cvs synthetic branchpoint commits (was Re: cvsps wrapper script on mercurial@)

John Hein jhein at timing.com
Wed Sep 30 18:48:24 CDT 2009


Frank A. Kingswood wrote at 20:20 +0100 on Sep 30, 2009:
 > Well this is a start. A patch for this is attached to give an idea.
 > 
 > But it sadly leads to new problems.
 > I created a cvs repository with several branches:
 > 
 > echo % create file1 on the trunk
 > cd src
 > echo f0 >f0
 > cvscall -Q add f0
 > cvsci -m"add f0 on trunk" f0
 > 
 > echo % create two branches
 > cvscall -q tag -b b0
 > cvscall -q tag -b b1
 > 
 > echo % create f1 on branch b0
 > cvscall -Q up -rb0
 > echo f1 >f1
 > cvscall -Q add f1
 > cvsci -m"add f1" f1
 > 
 > echo % create f2 on branch b0
 > echo f2 >f2
 > cvscall -Q add f2
 > cvsci -m"add f2" f2
 > 
 > echo % create another branch
 > cvscall -q tag -b b2 f0
 > cvscall -q tag -b b2 f1
 > 
 > echo % create f3 on branch b0
 > echo f3 >f3
 > cvscall -Q add f3
 > cvsci -m"add f3" f3
 > 
 > echo % modify f1 on branch b0
 > echo f1a >f1
 > cvsci -m"modify f1" f1
 > 
 > echo % create f4 on branch b1
 > cvscall -Q up -rb1
 > echo f4 >f4
 > cvscall -Q add f4
 > cvsci -m"add f4" f4
 > 
 > echo % create f5 on branch b1
 > echo f5 >f5
 > cvscall -Q add f5
 > cvsci -m"add f5" f5
 > 
 > echo % create f6 on branch b1
 > echo f6 >f6
 > cvscall -Q add f6
 > cvsci -m"add f6" f6
 > 
 > echo % modify f4 on branch b1
 > echo f4a >f4
 > cvsci -m"modify f4" f4
 > 
 > 
 > This gives this incorrect glog:
 > 
 > 
 > o  9[tip]:0   0056697a62d5   2009-09-30 20:06 +0100   frank
 > |    convert-repo: CVS branchpoint b2
 > |
 > | o  8   22a76c959ab4   2009-09-30 20:06 +0100   frank
 > | |    modify f1
 > | |
 > | o  7   9bae17743cb1   2009-09-30 20:06 +0100   frank
 > | |    add f3
 > | |
 > | o  6   63b2ef861a90   2009-09-30 20:06 +0100   frank
 > | |    add f2
 > | |
 > | o  5:0   aceb0fb57a15   2009-09-30 20:06 +0100   frank
 > |/     add f1
 > |
 > | o  4   c983529840c8   2009-09-30 20:06 +0100   frank
 > | |    modify f4
 > | |
 > | o  3   4988cbf8941b   2009-09-30 20:06 +0100   frank
 > | |    add f6
 > | |
 > | o  2   e5330a1eaa8f   2009-09-30 20:06 +0100   frank
 > | |    add f5
 > | |
 > | o  1   b283b6221e1d   2009-09-30 20:06 +0100   frank
 > |/     add f4
 > |
 > o  0   fbbab430f796   2009-09-30 20:06 +0100   frank
 >       add f0 on trunk
 > 
 > 
 > You see that the parent of revision 9 is revision 0, not revision 6 as 
 > expected. The reason for that is that the branch changesets created are 
 > placed as early as possible in the list of changesets, instead of as 
 > late as possible.

I would have thought rev 5, not 6, since f2 should not be on b2.
Also when you do hg up -r b2, you don't get f1, but maybe that's saying
the same thing.


 > This requires some thought. There must be a sane way to do this, and I 
 > guess that it might at the same time make it possible to avoid inserting 
 > artificial branchpoint changesets if they are only going to be deleted 
 > anyway.
 > 
 > Any thoughts on this?

After my reparenting false start, my thought was that this is really
just a sorting issue.  Except for some missing branch changesets, the
changesets are all there and right.  But having them sorted properly
so they are committed to hg in the right order before adding a branch
commit (which I still think will be necessary) is important.  What
about overriding the sorting done in convert to be specific to CVS?

It seems to me that somehow the synthetic branch commit for branch
'foo' in hg needs to be done just after all changesets marked with
'Branchpoint: foo' (in cvsps output) have been committed.

If we can have this happen by sorting changesets properly, I
think that would be ideal and fast.  I just don't know
the best way to customize the toposort for cvs.

The only question I have is what happens with real CVS repos
that have twisty complicated branching.  That can be a complicated
sorting issue, but it may not be that bad if we get a good
solution for the simpler cases.


More information about the Mercurial-devel mailing list