Mercurial > public > mercurial-scm > hg-stable
diff hgext/histedit.py @ 20806:d66862b87ae6
histedit: select the lowest rev when looking for a root in a revset (bc)
When we specify a revision or a revset we just get the last element from the
list. For revsets this can lead to unintended effects where you specify a
revset like only() but instead histedit selects the highest revision in the
set as root. Therefore we should always use the lowest revision number as
root.
author | David Soria Parra <davidsp@fb.com> |
---|---|
date | Thu, 13 Mar 2014 16:05:06 -0700 |
parents | 49f2d5644f04 |
children | 76f68595ff8e |
line wrap: on
line diff
--- a/hgext/histedit.py Tue Mar 18 15:56:24 2014 -0700 +++ b/hgext/histedit.py Thu Mar 13 16:05:06 2014 -0700 @@ -158,7 +158,6 @@ 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 @@ -568,8 +567,11 @@ remote = None root = findoutgoing(ui, repo, remote, force, opts) else: - root = revs[0] - root = scmutil.revsingle(repo, root).node() + rootrevs = list(repo.set('roots(%lr)', revs)) + if len(rootrevs) != 1: + raise util.Abort(_('The specified revisions must have ' + + 'exactly one common root')) + root = rootrevs[0].node() keep = opts.get('keep', False) revs = between(repo, root, topmost, keep)