hgext3rd/evolve/rewind.py
changeset 3866 de42d00d6ee2
parent 3865 b945f2dae587
child 3868 1742254d1190
--- a/hgext3rd/evolve/rewind.py	Sun Jun 17 00:22:31 2018 +0200
+++ b/hgext3rd/evolve/rewind.py	Sun Jun 17 02:03:03 2018 +0200
@@ -73,9 +73,9 @@
 
         # Check that we can rewind these changesets
         with repo.transaction('rewind'):
-            for rev in rewinded:
+            for rev in sorted(rewinded):
                 ctx = unfi[rev]
-                rewindmap[ctx.node()] = _revive_revision(unfi, rev)
+                rewindmap[ctx.node()] = _revive_revision(unfi, rev, rewindmap)
 
             relationships = []
             cl = unfi.changelog
@@ -97,7 +97,7 @@
     if update_target is not None:
         ui.status(_('working directory is now at %s\n') % repo['.'])
 
-def _revive_revision(unfi, rev):
+def _revive_revision(unfi, rev, rewindmap):
     """rewind a single revision rev.
     """
     ctx = unfi[rev]
@@ -113,7 +113,9 @@
     extra['__rewind-hash__'] = hashlib.sha256(noise).hexdigest()
 
     p1 = ctx.p1().node()
+    p1 = rewindmap.get(p1, p1)
     p2 = ctx.p2().node()
+    p2 = rewindmap.get(p2, p2)
 
     extradict = {'extra': extra}