Commits

Pierre-Yves David committed 27c890b

evolve: make evolve smarter

It is not more confused by killed changeset and can also choose to stabilise '.'

Comments (0)

Files changed (3)

 Changelog
 ==================
 
+2.2.0 --
+
+- make evolve smarter at picking next troubled to solved without --any
+
 2.1.0 -- 2012-12-03
 
 - qsync fixes
     """
     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())

tests/test-tutorial.t

   $ 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