cvsimport: ignore CVSPS_NO_BRANCH and impossible branches
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>
Martin Langhoff committed
Jun 11, 2006 at 20:12 UTC
71b08148366bbc4d02b3477e7ded35b049206f89
1 file changed
+16
-1
git-cvsimport.perl
+16
-1
@@ -595,7 +595,11 @@ sub write_tree () {
595
}
596
597
my($patchset,$date,$author_name,$author_email,$branch,$ancestor,$tag,$logmsg);
598
-my(@old,@new,@skipped);
598
+my(@old,@new,@skipped,%ignorebranch);
599
+
600
+# commits that cvsps cannot place anywhere...
601
+$ignorebranch{'#CVSPS_NO_BRANCH'} = 1;
602
+
603
sub commit {
604
update_index(@old, @new);
605
@old = @new = ();
@@ -751,7 +755,16 @@ while(<CVS>) {
755
$state = 11;
756
next;
757
}
758
+ if (exists $ignorebranch{$branch}) {
759
+ print STDERR "Skipping $branch\n";
760
+ $state = 11;
761
+ next;
762
+ }
763
if($ancestor) {
764
+ if($ancestor eq $branch) {
765
+ print STDERR "Branch $branch erroneously stems from itself -- changed ancestor to $opt_o\n";
766
+ $ancestor = $opt_o;
767
+ }
768
if(-f "$git_dir/refs/heads/$branch") {
769
print STDERR "Branch $branch already exists!\n";
770
$state=11;
@@ -759,6 +772,7 @@ while(<CVS>) {
772
}
773
unless(open(H,"$git_dir/refs/heads/$ancestor")) {
774
print STDERR "Branch $ancestor does not exist!\n";
775
+ $ignorebranch{$branch} = 1;
776
$state=11;
777
next;
778
}
@@ -766,6 +780,7 @@ while(<CVS>) {
780
close(H);
781
unless(open(H,"> $git_dir/refs/heads/$branch")) {
782
print STDERR "Could not create branch $branch: $!\n";
783
+ $ignorebranch{$branch} = 1;
784
$state=11;
785
next;
786
}