Mercurial > hg
changeset 17642:bea381c16809
histedit: move `between function` outside the action logic
Having this function in the middle of action and patching logic did not make
sense
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Fri, 21 Sep 2012 19:14:04 +0200 |
parents | 811a657fae48 |
children | 64e0f0cfb569 |
files | hgext/histedit.py |
diffstat | 1 files changed, 22 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/histedit.py Fri Sep 21 00:30:22 2012 +0200 +++ b/hgext/histedit.py Fri Sep 21 19:14:04 2012 +0200 @@ -195,28 +195,6 @@ os.unlink(patchfile) return files -def between(repo, old, new, keep): - """select and validate the set of revision to edit - - When keep is false, the specified set can't have children.""" - revs = [old] - current = old - while current != new: - ctx = repo[current] - if not keep and len(ctx.children()) > 1: - raise util.Abort(_('cannot edit history that would orphan nodes')) - if len(ctx.parents()) != 1 and ctx.parents()[1] != node.nullid: - raise util.Abort(_("can't edit history with merges")) - if not ctx.children(): - current = new - else: - current = ctx.children()[0].node() - revs.append(current) - if len(repo[current].children()) and not keep: - raise util.Abort(_('cannot edit history that would orphan nodes')) - return revs - - def pick(ui, repo, ctx, ha, opts): oldctx = repo[ha] if oldctx.parents()[0] == ctx: @@ -625,6 +603,28 @@ os.unlink(repo.sjoin('undo')) +def between(repo, old, new, keep): + """select and validate the set of revision to edit + + When keep is false, the specified set can't have children.""" + revs = [old] + current = old + while current != new: + ctx = repo[current] + if not keep and len(ctx.children()) > 1: + raise util.Abort(_('cannot edit history that would orphan nodes')) + if len(ctx.parents()) != 1 and ctx.parents()[1] != node.nullid: + raise util.Abort(_("can't edit history with merges")) + if not ctx.children(): + current = new + else: + current = ctx.children()[0].node() + revs.append(current) + if len(repo[current].children()) and not keep: + raise util.Abort(_('cannot edit history that would orphan nodes')) + return revs + + def writestate(repo, parentctxnode, created, replaced, tmpnodes, existing, rules, keep, oldtip, replacemap): fp = open(os.path.join(repo.path, 'histedit-state'), 'w')