Mercurial > hg
changeset 17760:1b8e820ef19d
histedit: simplify computation of edited set (issue3620)
This complex code can be replaced by two simple revset calls.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Wed, 10 Oct 2012 06:27:06 +0200 |
parents | 9c7497cd39fd |
children | c80a7a0c7d22 |
files | hgext/histedit.py |
diffstat | 1 files changed, 3 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/histedit.py Thu Sep 27 13:59:48 2012 +0200 +++ b/hgext/histedit.py Wed Oct 10 06:27:06 2012 +0200 @@ -587,22 +587,10 @@ """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: + revs = list(repo.set('%n::%n', old, new)) + if not keep and repo.revs('(%ld::) - %ld', revs, revs): raise util.Abort(_('cannot edit history that would orphan nodes')) - return revs + return [c.node() for c in revs] def writestate(repo, parentnode, rules, keep, topmost, replacements):