evolve: move _stabilizableunstable() with related functions stable
authorPatrick Mezard <patrick@mezard.eu>
Sat, 25 Aug 2012 08:17:59 +0200
branchstable
changeset 509 c072e559746d
parent 508 d1c658a6d0bc
child 510 f511d2aa742c
evolve: move _stabilizableunstable() with related functions
hgext/evolve.py
--- a/hgext/evolve.py	Sat Aug 25 07:59:51 2012 +0200
+++ b/hgext/evolve.py	Sat Aug 25 08:17:59 2012 +0200
@@ -1256,25 +1256,6 @@
         repo.dirstate.invalidate()
         raise
 
-def _stabilizableunstable(repo, pctx):
-    """Return a changectx for an unstable changeset which can be
-    stabilized on top of pctx or one of its descendants. None if none
-    can be found.
-    """
-    def selfanddescendants(repo, pctx):
-        yield pctx
-        for ctx in pctx.descendants():
-            yield ctx
-
-    # 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]
-    return None
-
 def _bookmarksupdater(repo, oldid):
     """Return a callable update(newid) updating the current bookmark
     and bookmarks bound to oldid to newid.
@@ -1375,6 +1356,24 @@
 
     return tr
 
+def _stabilizableunstable(repo, pctx):
+    """Return a changectx for an unstable changeset which can be
+    stabilized on top of pctx or one of its descendants. None if none
+    can be found.
+    """
+    def selfanddescendants(repo, pctx):
+        yield pctx
+        for ctx in pctx.descendants():
+            yield ctx
+
+    # 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]
+    return None
 
 def _solveunstable(ui, repo, orig, dryrun=False):
     """Stabilize a unstable changeset"""