Mercurial > public > mercurial-scm > hg-stable
diff mercurial/merge.py @ 37762:7269b87f817c
scmutil: teach the file prefetch hook to handle multiple commits
The remainder of the commands that need prefetch deal with multiple revisions.
I initially coded this as a separate hook, but then it needed a list of files
to handle `diff` and `grep`, so it didn't seem worth keeping them separate.
Not every matcher will emit bad file messages (some are built from a list of
files that are known to exist). But it seems better to filter this in one place
than to push this on either each caller or each hook implementation.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sat, 14 Apr 2018 18:50:45 -0400 |
parents | daef13da66fe |
children | 1322ae04d3d7 000039f6ca2d |
line wrap: on
line diff
--- a/mercurial/merge.py Mon Apr 16 23:39:30 2018 -0400 +++ b/mercurial/merge.py Sat Apr 14 18:50:45 2018 -0400 @@ -1465,7 +1465,7 @@ yield i, f def _prefetchfiles(repo, ctx, actions): - """Invoke ``scmutil.fileprefetchhooks()`` for the files relevant to the dict + """Invoke ``scmutil.prefetchfiles()`` for the files relevant to the dict of merge actions. ``ctx`` is the context being merged in.""" # Skipping 'a', 'am', 'f', 'r', 'dm', 'e', 'k', 'p' and 'pr', because they @@ -1473,8 +1473,11 @@ # changed/deleted never resolves to something from the remote side. oplist = [actions[a] for a in (ACTION_GET, ACTION_DELETED_CHANGED, ACTION_LOCAL_DIR_RENAME_GET, ACTION_MERGE)] - prefetch = scmutil.fileprefetchhooks - prefetch(repo, ctx, [f for sublist in oplist for f, args, msg in sublist]) + prefetch = scmutil.prefetchfiles + matchfiles = scmutil.matchfiles + prefetch(repo, [ctx.rev()], + matchfiles(repo, + [f for sublist in oplist for f, args, msg in sublist])) @attr.s(frozen=True) class updateresult(object):