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

Edouard Gomez ed.gomez at free.fr
Sun Dec 17 15:31:52 UTC 2006


# HG changeset patch
# User Edouard Gomez <ed.gomez at free.fr>
# Date 1166365118 -3600
# Node ID 3d3b602596f8f1904a54f8f1cad88a600644b55e
# Parent  6381ed11ed68270bff3c0a0eb85cc9df33327aca
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 6381ed11ed68 -r 3d3b602596f8 hg-cvs-import
--- a/hg-cvs-import	Sun Dec 17 15:18:38 2006 +0100
+++ b/hg-cvs-import	Sun Dec 17 15:18:38 2006 +0100
@@ -224,7 +224,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:
@@ -266,6 +269,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