Mercurial > public > mercurial-scm > hg-stable
diff mercurial/cmdutil.py @ 45073: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 | 0c40d2d151cb |
children | 8cce9f77ca73 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Sat Jul 11 00:31:21 2020 +0530 +++ b/mercurial/cmdutil.py Thu Jul 09 18:48:55 2020 -0700 @@ -2138,7 +2138,9 @@ for file in repo[rev].files(): if not match or match(file): allfiles.add(file) - scmutil.prefetchfiles(repo, revs, scmutil.matchfiles(repo, allfiles)) + match = scmutil.matchfiles(repo, allfiles) + revmatches = [(rev, match) for rev in revs] + scmutil.prefetchfiles(repo, revmatches) def export( @@ -2997,14 +2999,14 @@ try: if mfnode and mfl[mfnode].find(file)[0]: if _catfmtneedsdata(basefm): - scmutil.prefetchfiles(repo, [ctx.rev()], matcher) + scmutil.prefetchfiles(repo, [(ctx.rev(), matcher)]) write(file) return 0 except KeyError: pass if _catfmtneedsdata(basefm): - scmutil.prefetchfiles(repo, [ctx.rev()], matcher) + scmutil.prefetchfiles(repo, [(ctx.rev(), matcher)]) for abs in ctx.walk(matcher): write(abs) @@ -3769,11 +3771,11 @@ needdata = (b'revert', b'add', b'undelete') oplist = [actions[name][0] for name in needdata] prefetch = scmutil.prefetchfiles - matchfiles = scmutil.matchfiles + matchfiles = scmutil.matchfiles( + repo, [f for sublist in oplist for f in sublist] + ) prefetch( - repo, - [ctx.rev()], - matchfiles(repo, [f for sublist in oplist for f in sublist]), + repo, [(ctx.rev(), matchfiles)], ) match = scmutil.match(repo[None], pats) _performrevert(