Mercurial > hg
comparison hgext/remotefilelog/__init__.py @ 45072:a56ba57c837d
scmutil: allowing different files to be prefetched per revision
The old API takes a list of revision separate from the file matcher, and thus
provides no way to fetch different sets of files from each revision. In
preparation for adding one such usage, I'm changing the API to take a list of
(revision, file matcher) tuples instead.
Differential Revision: https://phab.mercurial-scm.org/D8721
author | Rodrigo Damazio Bovendorp <rdamazio@google.com> |
---|---|
date | Thu, 09 Jul 2020 18:48:55 -0700 |
parents | 9d2b2df2c2ba |
children | a03c177a4679 |
comparison
equal
deleted
inserted
replaced
45071:196ba4d4eb86 | 45072:a56ba57c837d |
---|---|
146 error, | 146 error, |
147 exchange, | 147 exchange, |
148 extensions, | 148 extensions, |
149 hg, | 149 hg, |
150 localrepo, | 150 localrepo, |
151 match, | 151 match as matchmod, |
152 merge, | 152 merge, |
153 node as nodemod, | 153 node as nodemod, |
154 patch, | 154 patch, |
155 pycompat, | 155 pycompat, |
156 registrar, | 156 registrar, |
822 if not isenabled(repo): | 822 if not isenabled(repo): |
823 return orig(repo, subset, x) | 823 return orig(repo, subset, x) |
824 | 824 |
825 # i18n: "filelog" is a keyword | 825 # i18n: "filelog" is a keyword |
826 pat = revset.getstring(x, _(b"filelog requires a pattern")) | 826 pat = revset.getstring(x, _(b"filelog requires a pattern")) |
827 m = match.match( | 827 m = matchmod.match( |
828 repo.root, repo.getcwd(), [pat], default=b'relpath', ctx=repo[None] | 828 repo.root, repo.getcwd(), [pat], default=b'relpath', ctx=repo[None] |
829 ) | 829 ) |
830 s = set() | 830 s = set() |
831 | 831 |
832 if not match.patkind(pat): | 832 if not matchmod.patkind(pat): |
833 # slow | 833 # slow |
834 for r in subset: | 834 for r in subset: |
835 ctx = repo[r] | 835 ctx = repo[r] |
836 cfiles = ctx.files() | 836 cfiles = ctx.files() |
837 for f in m.files(): | 837 for f in m.files(): |
1116 extensions.wrapfunction(remote, b'getbundle', localgetbundle) | 1116 extensions.wrapfunction(remote, b'getbundle', localgetbundle) |
1117 | 1117 |
1118 return orig(repo, remote, *args, **kwargs) | 1118 return orig(repo, remote, *args, **kwargs) |
1119 | 1119 |
1120 | 1120 |
1121 def _fileprefetchhook(repo, revs, match): | 1121 def _fileprefetchhook(repo, revmatches): |
1122 if isenabled(repo): | 1122 if isenabled(repo): |
1123 allfiles = [] | 1123 allfiles = [] |
1124 for rev in revs: | 1124 for rev, match in revmatches: |
1125 if rev == nodemod.wdirrev or rev is None: | 1125 if rev == nodemod.wdirrev or rev is None: |
1126 continue | 1126 continue |
1127 ctx = repo[rev] | 1127 ctx = repo[rev] |
1128 mf = ctx.manifest() | 1128 mf = ctx.manifest() |
1129 sparsematch = repo.maybesparsematch(ctx.rev()) | 1129 sparsematch = repo.maybesparsematch(ctx.rev()) |