Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revset.py @ 35307:921680c3e2ea
revset: make follow() accept multiple startrevs
The diff might look slightly complicated, but the initial "c = repo['.']" was
effective if rev = None.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 22 Sep 2016 19:11:26 +0900 |
parents | 2cb05e6043be |
children | 89b5c2ae1980 |
line wrap: on
line diff
--- a/mercurial/revset.py Thu Sep 22 18:41:51 2016 +0900 +++ b/mercurial/revset.py Thu Sep 22 19:11:26 2016 +0900 @@ -914,20 +914,20 @@ c = repo['.'] if l: x = getstring(l[0], _("%s expected a pattern") % name) - rev = None + revs = [None] if len(l) >= 2: revs = getset(repo, fullreposet(repo), l[1]) - if len(revs) != 1: + if not revs: raise error.RepoLookupError( - _("%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') - - files = c.manifest().walk(matcher) - - fctxs = [c[f].introfilectx() for f in files] + _("%s expected at least one starting revision") % name) + fctxs = [] + for r in revs: + ctx = mctx = repo[r] + if r is None: + ctx = repo['.'] + m = matchmod.match(repo.root, repo.getcwd(), [x], + ctx=mctx, default='path') + fctxs.extend(ctx[f].introfilectx() for f in ctx.manifest().walk(m)) s = dagop.filerevancestors(fctxs, followfirst) else: s = dagop.revancestors(repo, baseset([c.rev()]), followfirst)