histedit: respect revsetalias entries (
issue4311)
We now expand user-provided revsets before using repo.revs() to locate
the root(s) of the user-specified set.
--- a/hgext/histedit.py Mon Jul 28 10:05:17 2014 +0200
+++ b/hgext/histedit.py Mon Jul 28 19:20:13 2014 -0400
@@ -158,6 +158,7 @@
from mercurial import hg
from mercurial import node
from mercurial import repair
+from mercurial import scmutil
from mercurial import util
from mercurial import obsolete
from mercurial import merge as mergemod
@@ -567,11 +568,11 @@
remote = None
root = findoutgoing(ui, repo, remote, force, opts)
else:
- rootrevs = list(repo.set('roots(%lr)', revs))
- if len(rootrevs) != 1:
+ rr = list(repo.set('roots(%ld)', scmutil.revrange(repo, revs)))
+ if len(rr) != 1:
raise util.Abort(_('The specified revisions must have '
'exactly one common root'))
- root = rootrevs[0].node()
+ root = rr[0].node()
keep = opts.get('keep', False)
revs = between(repo, root, topmost, keep)
--- a/tests/test-histedit-commute.t Mon Jul 28 10:05:17 2014 +0200
+++ b/tests/test-histedit-commute.t Mon Jul 28 19:20:13 2014 -0400
@@ -324,6 +324,30 @@
date: Thu Jan 01 00:00:00 1970 +0000
summary: a
+Verify that revsetalias entries work with histedit:
+ $ cat >> $HGRCPATH <<EOF
+ > [revsetalias]
+ > grandparent(ARG) = p1(p1(ARG))
+ > EOF
+ $ echo extra commit >> c
+ $ hg ci -m 'extra commit to c'
+ $ HGEDITOR=cat hg histedit 'grandparent(.)'
+ pick ece0b8d93dda 6 c
+ pick 803ef1c6fcfd 7 e
+ pick 9c863c565126 8 extra commit to c
+
+ # Edit history between ece0b8d93dda and 9c863c565126
+ #
+ # Commits are listed from least to most recent
+ #
+ # Commands:
+ # p, pick = use commit
+ # e, edit = use commit, but stop for amending
+ # f, fold = use commit, but combine it with the one above
+ # d, drop = remove commit from history
+ # m, mess = edit message without changing commit content
+ #
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
should also work if a commit message is missing
$ BUNDLE="$TESTDIR/missing-comment.hg"