changeset 1253:5951969400ce stable

evolve: fix selection of changeset to evolve from the middle of a stack (issue4434) The evolve algorithm picked a bad changesets to evolve (unstable changeset with no obsolete parent (but unstable parent). And then get confused assuming that is the first parent was not obsolete, the second should be. This changeset fixed the issue by preventing selection of direct descendant of [.] when evolving.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 11 Nov 2014 12:38:49 +0000
parents 0f53c24096c6
children 0f6c97421cd9 e29a813f6af5
files hgext/evolve.py tests/test-evolve.t
diffstat 2 files changed, 19 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -1191,7 +1191,6 @@
                     displayer.show(ctx)
 
                 if dryrunopt:
-                    print 'hg update %s' % ctx.rev()
                     return 0
                 else:
                     res = hg.update(repo, ctx.rev())
@@ -1303,9 +1302,12 @@
 
     # Look for an unstable which can be stabilized as a child of
     # node. The unstable must be a child of one of node predecessors.
+    directdesc = set([pctx.rev()])
     for ctx in selfanddescendants(repo, pctx):
         for child in ctx.children():
-            if child.unstable():
+            if ctx.rev() in directdesc and not child.obsolete():
+                directdesc.add(child.rev())
+            elif child.unstable():
                 return child
     return None
 
@@ -1314,9 +1316,7 @@
     """Stabilize a unstable changeset"""
     obs = orig.parents()[0]
     if not obs.obsolete():
-        print obs.rev(), orig.parents()
-        print orig.rev()
-        obs = orig.parents()[1]
+        obs = orig.parents()[1] # second parent is obsolete ?
     assert obs.obsolete()
     newer = obsolete.successorssets(repo, obs.node())
     # search of a parent which is not killed
--- a/tests/test-evolve.t
+++ b/tests/test-evolve.t
@@ -846,3 +846,17 @@
   |
   o  0 [default] a0
   
+
+Evolve from the middle of a stack pick the right changesets.
+
+  $ hg up 7
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg ci --amend -m 'a1__'
+  2 new unstable changesets
+
+  $ hg up 8
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg evolve
+  nothing to evolve here
+  (2 troubled changesets, do you want --any ?)
+  [2]