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.
--- 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