evolve: make evolve smarter stable
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Wed, 02 Jan 2013 12:15:56 +0100
branchstable
changeset 636 27c890b4f864
parent 635 0f5ff3b36144
child 637 fdbbc9b2fca2
evolve: make evolve smarter It is not more confused by killed changeset and can also choose to stabilise '.'
README
hgext/evolve.py
tests/test-tutorial.t
--- a/README	Wed Jan 02 11:52:22 2013 +0100
+++ b/README	Wed Jan 02 12:15:56 2013 +0100
@@ -46,6 +46,10 @@
 Changelog
 ==================
 
+2.2.0 --
+
+- make evolve smarter at picking next troubled to solved without --any
+
 2.1.0 -- 2012-12-03
 
 - qsync fixes
--- a/hgext/evolve.py	Wed Jan 02 11:52:22 2013 +0100
+++ b/hgext/evolve.py	Wed Jan 02 12:15:56 2013 +0100
@@ -1152,22 +1152,27 @@
     """
     def selfanddescendants(repo, pctx):
         yield pctx
+        for prec in repo.set('allprecursors(%d)', pctx):
+            yield prec
         for ctx in pctx.descendants():
             yield ctx
+            for prec in repo.set('allprecursors(%d)', ctx):
+                yield prec
 
     # Look for an unstable which can be stabilized as a child of
     # node. The unstable must be a child of one of node predecessors.
     for ctx in selfanddescendants(repo, pctx):
-        unstables = list(repo.set('unstable() and children(allprecursors(%d))',
-                                  ctx.rev()))
-        if unstables:
-            return unstables[0]
+        for child in ctx.children():
+            if child.unstable():
+                return child
     return None
 
 def _solveunstable(ui, repo, orig, dryrun=False):
     """Stabilize a unstable changeset"""
     obs = orig.parents()[0]
     if not obs.obsolete():
+        print obs.rev(), orig.parents()
+        print orig.rev()
         obs = orig.parents()[1]
     assert obs.obsolete()
     newer = successorssets(repo, obs.node())
--- a/tests/test-tutorial.t	Wed Jan 02 11:52:22 2013 +0100
+++ b/tests/test-tutorial.t	Wed Jan 02 12:15:56 2013 +0100
@@ -737,7 +737,7 @@
   $ hg log -r 'unstable()'
   ae45c0c3092a (draft): SPAM SPAM SPAM
 
-  $ hg evolve --any
+  $ hg evolve
   move:[17] SPAM SPAM SPAM
   atop:[14] bathroom stuff
   merging shopping