diff -r 62719115875d -r 60dd840a7fdb mercurial/merge.py --- a/mercurial/merge.py Sun Feb 11 00:40:27 2018 -0500 +++ b/mercurial/merge.py Sun Feb 11 13:25:56 2018 -0500 @@ -1385,6 +1385,16 @@ if i > 0: yield i, f +def _prefetchfiles(repo, ctx, actions): + """Invoke ``scmutil.fileprefetchhooks()`` 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 + # don't touch the context to be merged in. 'cd' is skipped, because + # changed/deleted never resolves to something from the remote side. + oplist = [actions[a] for a in 'g dc dg m'.split()] + prefetch = scmutil.fileprefetchhooks + prefetch(repo, ctx, [f for sublist in oplist for f, args, msg in sublist]) def applyupdates(repo, actions, wctx, mctx, overwrite, labels=None): """apply the merge action list to the working directory @@ -1396,6 +1406,8 @@ describes how many files were affected by the update. """ + _prefetchfiles(repo, mctx, actions) + updated, merged, removed = 0, 0, 0 ms = mergestate.clean(repo, wctx.p1().node(), mctx.node(), labels) moves = []