Mercurial > evolve
changeset 509:c072e559746d stable
evolve: move _stabilizableunstable() with related functions
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Sat, 25 Aug 2012 08:17:59 +0200 |
parents | d1c658a6d0bc |
children | f511d2aa742c |
files | hgext/evolve.py |
diffstat | 1 files changed, 18 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- 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"""