comparison mercurial/revset.py @ 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 2def3d55b1b9
children cdef35b38026
comparison
equal deleted inserted replaced
30177:9626022feaa4 30178:d61c42c1a35c
1025 c = repo['.'] 1025 c = repo['.']
1026 if l: 1026 if l:
1027 x = getstring(l[0], _("%s expected a pattern") % name) 1027 x = getstring(l[0], _("%s expected a pattern") % name)
1028 rev = None 1028 rev = None
1029 if len(l) >= 2: 1029 if len(l) >= 2:
1030 rev = getset(repo, fullreposet(repo), l[1]).last() 1030 revs = getset(repo, fullreposet(repo), l[1])
1031 if rev is None: 1031 if len(revs) != 1:
1032 raise error.RepoLookupError( 1032 raise error.RepoLookupError(
1033 _("%s: starting revision set cannot be empty") % name) 1033 _("%s expected one starting revision") % name)
1034 rev = revs.last()
1034 c = repo[rev] 1035 c = repo[rev]
1035 matcher = matchmod.match(repo.root, repo.getcwd(), [x], 1036 matcher = matchmod.match(repo.root, repo.getcwd(), [x],
1036 ctx=repo[rev], default='path') 1037 ctx=repo[rev], default='path')
1037 1038
1038 files = c.manifest().walk(matcher) 1039 files = c.manifest().walk(matcher)