transplant: log source node when recovering too.
authorBrendan Cully <brendan@kublai.com>
Fri, 01 Dec 2006 15:00:33 -0800
changeset 3758 889f7e74a0d9
parent 3757 faed44bab17b
child 3759 e96f97ca0358
transplant: log source node when recovering too.
hgext/transplant.py
tests/test-transplant
tests/test-transplant.out
--- a/hgext/transplant.py	Fri Dec 01 14:30:17 2006 -0800
+++ b/hgext/transplant.py	Fri Dec 01 15:00:33 2006 -0800
@@ -238,6 +238,7 @@
                                                            revlog.short(n)))
         seriespath = os.path.join(self.path, 'series')
         if not os.path.exists(seriespath):
+            self.transplants.write()
             return
         nodes, merges = self.readseries()
         revmap = {}
@@ -255,6 +256,7 @@
         if not user or not date or not message or not parents[0]:
             raise util.Abort(_('transplant log file is corrupt'))
 
+        extra = {'transplant_source': node}
         wlock = repo.wlock()
         p1, p2 = repo.dirstate.parents()
         if p1 != parents[0]:
@@ -262,7 +264,7 @@
                              revlog.hex(parents[0]))
         if merge:
             repo.dirstate.setparents(p1, parents[1])
-        n = repo.commit(None, message, user, date, wlock=wlock)
+        n = repo.commit(None, message, user, date, wlock=wlock, extra=extra)
         if not n:
             raise util.Abort(_('commit failed'))
         if not merge:
--- a/tests/test-transplant	Fri Dec 01 14:30:17 2006 -0800
+++ b/tests/test-transplant	Fri Dec 01 15:00:33 2006 -0800
@@ -85,6 +85,9 @@
 echo foobar > foo
 hg ci -mfoobar -d '0 0'
 hg transplant 1:3
-echo merge > foo
+# transplant -c shouldn't use an old changeset
+hg up -C
+hg transplant 1
 hg transplant --continue
+hg transplant 1:3
 hg locate
--- a/tests/test-transplant.out	Fri Dec 01 14:30:17 2006 -0800
+++ b/tests/test-transplant.out	Fri Dec 01 15:00:33 2006 -0800
@@ -88,11 +88,19 @@
 1 out of 1 hunk FAILED -- saving rejects to file foo.rej
 patch command failed: exited with status 1
 abort: Fix up the merge and run hg transplant --continue
-a1e30dd1b8e7 transplanted as e6d0b5145568
+1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+applying a1e30dd1b8e7
+foo
+Hunk #1 FAILED at 1.
+1 out of 1 hunk FAILED -- saving rejects to file foo.rej
+patch command failed: exited with status 1
+abort: Fix up the merge and run hg transplant --continue
+a1e30dd1b8e7 transplanted as f1563cf27039
+skipping already applied revision 1:a1e30dd1b8e7
 applying 1739ac5f6139
-1739ac5f6139 transplanted to 48f780141a79
+1739ac5f6139 transplanted to d649c221319f
 applying 0282d5fbbe02
-0282d5fbbe02 transplanted to 821d17b1a3ed
+0282d5fbbe02 transplanted to 77418277ccb3
 added
 bar
 foo