[PATCH 06 of 12] Eventually enables hand surgery with "Ancestor patchset" cvsps keyword

Edouard Gomez ed.gomez at free.fr
Tue Dec 19 00:05:47 CST 2006


# HG changeset patch
# User Edouard Gomez <ed.gomez at free.fr>
# Date 1166511815 -3600
# Node ID 634c6cf8bd1aceb50deb929b88aba7307d262bca
# Parent  bd6c8e93a7ab4a3a4abcecccef3b4f68218d8856
Eventually enables hand surgery with "Ancestor patchset" cvsps keyword

The cvsps parser reads "Ancestor patchset". I don't know if it's intended
or not, but this proves to be quite good at hand surgery when cvsps doesn't
order the patchsets in the right order.

eg:
 - hack on head
 - tag a release: R
 - hack a lot of bugfixes
 - tag a branch B from R because new functionnal stuff will happen on head
 - report all work from head to the bugfix branch

In this case the B branch will be linked to the last commit on head and not
linked to R as it should be.

So "Ancestor patchset" can help in these cases

diff -r bd6c8e93a7ab -r 634c6cf8bd1a hg-cvs-import
--- a/hg-cvs-import	Tue Dec 19 08:03:35 2006 +0100
+++ b/hg-cvs-import	Tue Dec 19 08:03:35 2006 +0100
@@ -225,7 +225,10 @@ def addrev(branch, tag, r, user, date, l
     # tag file
     if branch != lastbranch:
         savebranch[lastbranch] = hg.hex(repo.changelog.tip())
-        type, v = branchlookup(branch)
+        if r in ancestorpatches:
+            type, v = 'rev', map[int(ancestorpatches[r])]
+        else:
+            type, v = branchlookup(branch)
         if type == "branch":
             node = branchhead(v)
         else:
@@ -267,6 +270,7 @@ def addrev(branch, tag, r, user, date, l
         repo.rawcommit(filelist, llog, user, dateconv, hg.bin(node),
                        wlock=wlock)
         n = repo.changelog.tip()
+        map[int(r)] = hg.hex(n)
         mapf.write("%d %s\n" % (r, hg.hex(n)))
         print "added patch %d %s" % (r, hg.hex(n))
     lastbranch = branch


More information about the Mercurial-devel mailing list