Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 35298: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 |
comparison
equal
deleted
inserted
replaced
35297:c9144396099b | 35298:921680c3e2ea |
---|---|
912 l = getargs(x, 0, 2, _("%s takes no arguments or a pattern " | 912 l = getargs(x, 0, 2, _("%s takes no arguments or a pattern " |
913 "and an optional revset") % name) | 913 "and an optional revset") % name) |
914 c = repo['.'] | 914 c = repo['.'] |
915 if l: | 915 if l: |
916 x = getstring(l[0], _("%s expected a pattern") % name) | 916 x = getstring(l[0], _("%s expected a pattern") % name) |
917 rev = None | 917 revs = [None] |
918 if len(l) >= 2: | 918 if len(l) >= 2: |
919 revs = getset(repo, fullreposet(repo), l[1]) | 919 revs = getset(repo, fullreposet(repo), l[1]) |
920 if len(revs) != 1: | 920 if not revs: |
921 raise error.RepoLookupError( | 921 raise error.RepoLookupError( |
922 _("%s expected one starting revision") % name) | 922 _("%s expected at least one starting revision") % name) |
923 rev = revs.last() | 923 fctxs = [] |
924 c = repo[rev] | 924 for r in revs: |
925 matcher = matchmod.match(repo.root, repo.getcwd(), [x], | 925 ctx = mctx = repo[r] |
926 ctx=repo[rev], default='path') | 926 if r is None: |
927 | 927 ctx = repo['.'] |
928 files = c.manifest().walk(matcher) | 928 m = matchmod.match(repo.root, repo.getcwd(), [x], |
929 | 929 ctx=mctx, default='path') |
930 fctxs = [c[f].introfilectx() for f in files] | 930 fctxs.extend(ctx[f].introfilectx() for f in ctx.manifest().walk(m)) |
931 s = dagop.filerevancestors(fctxs, followfirst) | 931 s = dagop.filerevancestors(fctxs, followfirst) |
932 else: | 932 else: |
933 s = dagop.revancestors(repo, baseset([c.rev()]), followfirst) | 933 s = dagop.revancestors(repo, baseset([c.rev()]), followfirst) |
934 | 934 |
935 return subset & s | 935 return subset & s |