# HG changeset patch # User Yuya Nishihara # Date 1519525235 -32400 # Node ID f493829b74dd82d34fd0eba74a8b0761101115a5 # Parent 03eff66adb3b53f9776628f83b6433ee7b57ee52 histedit: use repo.revs() instead of repo.set() where revisions are needed Follows up 72da480db4a5. This is just a micro optimization, but looks slightly nicer. diff -r 03eff66adb3b -r f493829b74dd hgext/histedit.py --- a/hgext/histedit.py Sun Feb 25 11:13:01 2018 +0900 +++ b/hgext/histedit.py Sun Feb 25 11:20:35 2018 +0900 @@ -1354,20 +1354,19 @@ """select and validate the set of revision to edit When keep is false, the specified set can't have children.""" - ctxs = list(repo.set('%n::%n', old, new)) - if ctxs and not keep: - revs = [ctx.rev() for ctx in ctxs] + revs = repo.revs('%n::%n', old, new) + if revs and not keep: if (not obsolete.isenabled(repo, obsolete.allowunstableopt) and repo.revs('(%ld::) - (%ld)', revs, revs)): raise error.Abort(_('can only histedit a changeset together ' 'with all its descendants')) if repo.revs('(%ld) and merge()', revs): raise error.Abort(_('cannot edit history that contains merges')) - root = ctxs[0] # list is already sorted by repo.set + root = repo[revs.first()] # list is already sorted by repo.revs() if not root.mutable(): raise error.Abort(_('cannot edit public changeset: %s') % root, hint=_("see 'hg help phases' for details")) - return [c.node() for c in ctxs] + return pycompat.maplist(repo.changelog.node, revs) def ruleeditor(repo, ui, actions, editcomment=""): """open an editor to edit rules