changeset 30178:d61c42c1a35c

revset: make follow() reject more than one start revisions Taking only the last revision is inconsistent because ancestors(set) follows all revisions given, and theoretically follow(startrev=set) == ancestors(set). I'm planning to add a support for multiple start revisions, but that won't fit to the 4.0 time frame. So reject multiple revisions now to avoid future BC. len(revs) might be slow if revs were large, but we don't care since a valid revs should have only one element.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 10 Oct 2016 22:30:09 +0200
parents 9626022feaa4
children cdef35b38026
files mercurial/revset.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Sat Oct 15 17:10:53 2016 -0700
+++ b/mercurial/revset.py	Mon Oct 10 22:30:09 2016 +0200
@@ -1027,10 +1027,11 @@
         x = getstring(l[0], _("%s expected a pattern") % name)
         rev = None
         if len(l) >= 2:
-            rev = getset(repo, fullreposet(repo), l[1]).last()
-            if rev is None:
+            revs = getset(repo, fullreposet(repo), l[1])
+            if len(revs) != 1:
                 raise error.RepoLookupError(
-                        _("%s: starting revision set cannot be empty") % name)
+                        _("%s expected one starting revision") % name)
+            rev = revs.last()
             c = repo[rev]
         matcher = matchmod.match(repo.root, repo.getcwd(), [x],
                                  ctx=repo[rev], default='path')