aboutsummaryrefslogtreecommitdiff
path: root/git-cvsimport.perl
diff options
context:
space:
mode:
authorMartin Langhoff <martin@catalyst.net.nz>2006-06-11 20:12:09 +1200
committerJunio C Hamano <junkio@cox.net>2006-06-16 22:45:11 -0700
commit71b08148366bbc4d02b3477e7ded35b049206f89 (patch)
treec53dc8fb7a8ee8dd311ec24c9f37d02fdb947f2c /git-cvsimport.perl
parentb19ee24b22b3c1d08f06e8f868f11d9e8639fd30 (diff)
downloadgit-71b08148366bbc4d02b3477e7ded35b049206f89.tar.gz
git-71b08148366bbc4d02b3477e7ded35b049206f89.tar.xz
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>
Diffstat (limited to 'git-cvsimport.perl')
-rwxr-xr-xgit-cvsimport.perl17
1 files changed, 16 insertions, 1 deletions
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 76f6246a3..d83c52fcb 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -595,7 +595,11 @@ sub write_tree () {
}
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 = ();
@@ -751,7 +755,16 @@ while(<CVS>) {
$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;
@@ -759,6 +772,7 @@ while(<CVS>) {
}
unless(open(H,"$git_dir/refs/heads/$ancestor")) {
print STDERR "Branch $ancestor does not exist!\n";
+ $ignorebranch{$branch} = 1;
$state=11;
next;
}
@@ -766,6 +780,7 @@ while(<CVS>) {
close(H);
unless(open(H,"> $git_dir/refs/heads/$branch")) {
print STDERR "Could not create branch $branch: $!\n";
+ $ignorebranch{$branch} = 1;
$state=11;
next;
}