hgext/evolve.py
branchstable
changeset 636 27c890b4f864
parent 626 896463193675
child 644 8e41d5b78dff
--- 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())