Skip to contentSkip to conversation

git-cvsimport-script: handling of tags

PATCH In review H. Peter Anvin 3 participants 10 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-cvsimport-script: handling of tags

This patch changes git-cvsimport-script so that it creates tag objects instead of refs to commits, and adds an option, -u, to convert underscores in branch and tag names to dots (since CVS doesn't allow dots in branches and tags.)

Pullable tree at master.kernel.org:/home/hpa/git/cvsimport.git/

-hpa

Documentation/git-cvsimport-script.txt +3 -0
@@ -44,6 +44,9 @@ OPTIONS
 	to avoid noisy changesets. Highly recommended, but off by default
 	to preserve compatibility with early imported trees. 
 
+-u::
+	Convert underscores in tag and branch names to dots.
+
 -o <branch-for-HEAD>::
 	The 'HEAD' branch from CVS is imported to the 'origin' branch within
 	the git repository, as 'HEAD' already has a special meaning for git.
git-cvsimport-script +36 -11

72 lines not on this page · raw message

#1 lore raw
Quoted 3 lines · H. Peter Anvin

This patch changes git-cvsimport-script so that it creates tag objects instead of refs to commits, and adds an option, -u, to convert underscores in branch and tag names to dots (since CVS doesn't allow dots in branches and tags.)

Pullable tree at master.kernel.org:/home/hpa/git/cvsimport.git/

I should probably point out that there are still bugs in git-cvsimport-script; for one thing, it seems to fail to register a tag associated with the head, and I have yet to get the "recognize merge" feature to actually work. It's also possible -- but I haven't verified it -- that two tags which are aliases may not be properly registered.

-hpa

#2 lore raw
Quoted 9 lines · H. Peter Anvin
Quoted 3 lines · H. Peter Anvin

This patch changes git-cvsimport-script so that it creates tag objects instead of refs to commits, and adds an option, -u, to convert underscores in branch and tag names to dots (since CVS doesn't allow dots in branches and tags.)

Pullable tree at master.kernel.org:/home/hpa/git/cvsimport.git/

I should probably point out that there are still bugs in git-cvsimport-script; for one thing, it seems to fail to register a tag associated with the head, and I have yet to get the "recognize merge" feature to actually work. It's also possible -- but I haven't verified it -- that two tags which are aliases may not be properly registered.

I just verified this; git-cvsimport-script will not handle more than one tag per commit.

-hpa

#3 lore raw
Quoted 7 lines · H. Peter Anvin
Quoted 5 lines

I should probably point out that there are still bugs in git-cvsimport-script; for one thing, it seems to fail to register a tag associated with the head, and I have yet to get the "recognize merge" feature to actually work. It's also possible -- but I haven't verified it -- that two tags which are aliases may not be properly registered.

I just verified this; git-cvsimport-script will not handle more than one tag per commit.

Tell me more about how you are trying the 'recognize merge'. It is a pretty unsophisticated thing, as it trusts the commit message in the first place. But when it works, it works.

I have a more refined merge detection already working in the Arch imports -- patch coming soon -- but with cvs it is pretty hard to do.

cheers,

martin

#4 lore raw
Quoted 5 lines · Martin Langhoff

Tell me more about how you are trying the 'recognize merge'. It is a pretty unsophisticated thing, as it trusts the commit message in the first place. But when it works, it works.

Perhaps it would be good to know what it expects in the commit message?

My style has always be to use tags for merges; tag the origin branch as well as before and after on the receiving branch.

-hpa

#5 lore raw
Quoted 10 lines · H. Peter Anvin
Quoted 5 lines · Martin Langhoff

Tell me more about how you are trying the 'recognize merge'. It is a pretty unsophisticated thing, as it trusts the commit message in the first place. But when it works, it works.

Perhaps it would be good to know what it expects in the commit message?

From the source, with line numbers:

80 our @mergerx = ();
81 if ($opt_m) {
82 @mergerx = ( qr/\W(?:from|of|merge|merging|merged) (\w+)/i );
83 }
84 if ($opt_M) {
85 push (@mergerx, qr/$opt_M/);
86 }

If your commit messages have a particular format, feed -M a regex that captures the branchname/tagname in $1.

Quoted 2 lines

My style has always be to use tags for merges; tag the origin branch as well as before and after on the receiving branch.

Do you move the tags with cvs tag -F? If that's the case, the data you need to merge is lost... otherwise, you could hack an alternative merge detection based on your tagnames.

cheers,

martin

#6 lore raw
Quoted 8 lines · Martin Langhoff
Quoted 3 lines

My style has always be to use tags for merges; tag the origin branch as well as before and after on the receiving branch.

Do you move the tags with cvs tag -F? If that's the case, the data you need to merge is lost... otherwise, you could hack an alternative merge detection based on your tagnames.

No, there are three tags:

            before-merge-foo
            |  after-merge-foo
            |  |
branch 1 ---*--*----
              /
             /
branch 2 ---*-------
            |
            merge-point-foo

That's why I was a bit confused. I thought most people did something similar.

-hpa

#7 lore raw
In reply to H. Peter Anvin
Quoted 4 lines · H. Peter Anvin

This patch changes git-cvsimport-script so that it creates tag objects instead of refs to commits, and adds an option, -u, to convert underscores in branch and tag names to dots (since CVS doesn't allow dots in branches and tags.)

looks good. Will it add proper tag objects for tags already imported and for tags added to the project post-initial-git-import?

cheers,

martin

#8 lore raw
Quoted 11 lines · Martin Langhoff
Quoted 4 lines · H. Peter Anvin

This patch changes git-cvsimport-script so that it creates tag objects instead of refs to commits, and adds an option, -u, to convert underscores in branch and tag names to dots (since CVS doesn't allow dots in branches and tags.)

looks good. Will it add proper tag objects for tags already imported and for tags added to the project post-initial-git-import?

No and yes, respectively.

I incorrectly stated it renamed both branches and tags. It currently only renames tags. I'm trying to get branch renaming to work, but it seems to be a lot more work to get right.

-hpa

#9 lore raw
In reply to H. Peter Anvin
Quoted 4 lines · H. Peter Anvin

This patch changes git-cvsimport-script so that it creates tag objects instead of refs to commits, and adds an option, -u, to convert underscores in branch and tag names to dots (since CVS doesn't allow dots in branches and tags.)

Looks good. Thanks.