* [PATCH] cvsimport: ignore CVSPS_NO_BRANCH and impossible branches
@ 2006-06-11 8:12 Martin Langhoff
2006-06-17 21:00 ` Junio C Hamano
0 siblings, 1 reply; 4+ messages in thread
From: Martin Langhoff @ 2006-06-11 8:12 UTC (permalink / raw)
To: junkio, git; +Cc: Martin Langhoff
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>
---
git-cvsimport.perl | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 76f6246..07b3203 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;
}
--
1.4.0.gcda2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] cvsimport: ignore CVSPS_NO_BRANCH and impossible branches
2006-06-11 8:12 [PATCH] cvsimport: ignore CVSPS_NO_BRANCH and impossible branches Martin Langhoff
@ 2006-06-17 21:00 ` Junio C Hamano
2006-06-17 21:27 ` Yann Dirson
2006-06-19 16:20 ` Salikh Zakirov
0 siblings, 2 replies; 4+ messages in thread
From: Junio C Hamano @ 2006-06-17 21:00 UTC (permalink / raw)
To: Martin Langhoff; +Cc: git, Yann Dirson
Martin Langhoff <martin@catalyst.net.nz> writes:
> 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.
This sounds more like an workaround than a real fix to me,
although I'd apply it for now. I see Yann is collecting cvsps
patches but maybe there will be a real fix soonish?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cvsimport: ignore CVSPS_NO_BRANCH and impossible branches
2006-06-17 21:00 ` Junio C Hamano
@ 2006-06-17 21:27 ` Yann Dirson
2006-06-19 16:20 ` Salikh Zakirov
1 sibling, 0 replies; 4+ messages in thread
From: Yann Dirson @ 2006-06-17 21:27 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Martin Langhoff, git
On Sat, Jun 17, 2006 at 02:00:10PM -0700, Junio C Hamano wrote:
> Martin Langhoff <martin@catalyst.net.nz> writes:
>
> > 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.
>
> This sounds more like an workaround than a real fix to me,
> although I'd apply it for now. I see Yann is collecting cvsps
> patches but maybe there will be a real fix soonish?
I have not dig yet into the cases that trigger CVSPS_NO_BRANCH so
can't make any promise, unless someone comes in with a patch already
written :)
Since the patch seems to ensure the user gets warned when a branch
gets ignored this way, allowing it in could probably allow at least
some people to have cvsimport does a partial job, rather than failing
midway. Maybe a final warning when all patchsets could not be
imported could be issued, so the existing ones do not get simply lost
in the verbose output.
Best regards,
--
Yann Dirson <ydirson@altern.org> |
Debian-related: <dirson@debian.org> | Support Debian GNU/Linux:
| Freedom, Power, Stability, Gratis
http://ydirson.free.fr/ | Check <http://www.debian.org/>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cvsimport: ignore CVSPS_NO_BRANCH and impossible branches
2006-06-17 21:00 ` Junio C Hamano
2006-06-17 21:27 ` Yann Dirson
@ 2006-06-19 16:20 ` Salikh Zakirov
1 sibling, 0 replies; 4+ messages in thread
From: Salikh Zakirov @ 2006-06-19 16:20 UTC (permalink / raw)
Cc: git
Junio C Hamano wrote:
> Martin Langhoff <martin@catalyst.net.nz> writes:
>
>> 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.
>
> This sounds more like an workaround than a real fix to me,
> although I'd apply it for now. I see Yann is collecting cvsps
> patches but maybe there will be a real fix soonish?
#CVSPS_NO_BRANCH is the identifier that CVSPS gives to the unnamed branches.
Unnamed branches appear when the branch tag is removed or moved forcefully.
The following short script reproduces the CVS repository with unnamed branches.
In my opinion, ignoring #CVSPS_NO_BRANCH in git-cvsimport is the most sensible
thing to do, because the branch was abandoned in the CVS in the first place.
I had to preprocess cvsps output to cut out CVSPS_NO_BRANCH commits anyway.
I vote for including the Martin's patch.
Creating CVS repository with unnamed branch
--8<--
export CVSROOT=$PWD/cvsroot
cvs init
cvs checkout .
mkdir a
cvs add a
cd a
vim a.txt
cvs add a.txt
cvs commit -m "added a.txt" a.txt
cvs tag -b br1
cvs update -r br1
echo "br1 update" >> a.txt
cvs commit -m "br1 update" a.txt
cvs update -A
echo "HEAD update" >> a.txt
cvs commit -m "HEAD update" a.txt
cvs tag -d br1
cvs tag -b br1
cvs tag -d -B br1
cvs tag -b br1
cvs update -r br1
echo "branch update, once more" >> a.txt
cvs commit -m "2nd branch update" a.txt
------
and corresponding CVSPS output is
--8<--
$ cvsps -A
WARNING: revision 1.1.2.1 of file a.txt on unnamed branch
---------------------
PatchSet 1
Date: 2006/06/19 20:10:09
Author: sszakiro
Branch: HEAD
Tag: (none)
Log:
added a.txt
Members:
a.txt:INITIAL->1.1
---------------------
PatchSet 2
Date: 2006/06/19 20:10:45
Author: sszakiro
Branch: #CVSPS_NO_BRANCH
Ancestor branch: HEAD
Tag: (none)
Log:
br1 update
Members:
a.txt:1.1->1.1.2.1
---------------------
PatchSet 3
Date: 2006/06/19 20:11:18
Author: sszakiro
Branch: HEAD
Tag: (none)
Log:
HEAD update
Members:
a.txt:1.1->1.2
---------------------
PatchSet 4
Date: 2006/06/19 20:12:07
Author: sszakiro
Branch: br1
Ancestor branch: HEAD
Tag: (none)
Log:
2nd branch update
Members:
a.txt:1.2->1.2.2.1
------
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-06-19 17:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-11 8:12 [PATCH] cvsimport: ignore CVSPS_NO_BRANCH and impossible branches Martin Langhoff
2006-06-17 21:00 ` Junio C Hamano
2006-06-17 21:27 ` Yann Dirson
2006-06-19 16:20 ` Salikh Zakirov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).