# HG changeset patch # User Patrick Mezard # Date 1345875479 -7200 # Node ID c072e559746d08bc90ead5bfebd7830fe832289d # Parent d1c658a6d0bc792f5d56681539f2480a976180e3 evolve: move _stabilizableunstable() with related functions diff -r d1c658a6d0bc -r c072e559746d 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"""