Skip to content

Commit

Permalink
cvsimport: ignore CVSPS_NO_BRANCH and impossible branches
Browse files Browse the repository at this point in the history
cvsps output often contains references to CVSPS_NO_BRANCH, commits
that it could not trace to a branch. Ignore that branch.

Additionally, cvsps will sometimes draw circular relationships
between branches -- where two branches are recorded as opening
from the other.  In those cases, and where the ancestor branch
hasn't been seen, ignore it.

Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Martin Langhoff authored and Junio C Hamano committed Jun 17, 2006
1 parent b19ee24 commit 71b0814
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion git-cvsimport.perl
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,11 @@ ()
}

my($patchset,$date,$author_name,$author_email,$branch,$ancestor,$tag,$logmsg);
my(@old,@new,@skipped);
my(@old,@new,@skipped,%ignorebranch);

# commits that cvsps cannot place anywhere...
$ignorebranch{'#CVSPS_NO_BRANCH'} = 1;

sub commit {
update_index(@old, @new);
@old = @new = ();
Expand Down Expand Up @@ -751,21 +755,32 @@ sub commit {
$state = 11;
next;
}
if (exists $ignorebranch{$branch}) {
print STDERR "Skipping $branch\n";
$state = 11;
next;
}
if($ancestor) {
if($ancestor eq $branch) {
print STDERR "Branch $branch erroneously stems from itself -- changed ancestor to $opt_o\n";
$ancestor = $opt_o;
}
if(-f "$git_dir/refs/heads/$branch") {
print STDERR "Branch $branch already exists!\n";
$state=11;
next;
}
unless(open(H,"$git_dir/refs/heads/$ancestor")) {
print STDERR "Branch $ancestor does not exist!\n";
$ignorebranch{$branch} = 1;
$state=11;
next;
}
chomp(my $id = <H>);
close(H);
unless(open(H,"> $git_dir/refs/heads/$branch")) {
print STDERR "Could not create branch $branch: $!\n";
$ignorebranch{$branch} = 1;
$state=11;
next;
}
Expand Down

0 comments on commit 71b0814

Please sign in to comment.