changeset 45356:2c96fd8e05f6

merge: pass mergeresult obj in merge._prefetchfiles() Differential Revision: https://phab.mercurial-scm.org/D8877
author Pulkit Goyal <7895pulkit@gmail.com>
date Mon, 03 Aug 2020 14:19:06 +0530
parents b9b055f15035
children 27c6518b7287
files mercurial/merge.py
diffstat 1 files changed, 10 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Mon Aug 03 14:12:13 2020 +0530
+++ b/mercurial/merge.py	Mon Aug 03 14:19:06 2020 +0530
@@ -1256,34 +1256,28 @@
     yield True, filedata
 
 
-def _prefetchfiles(repo, ctx, actions):
+def _prefetchfiles(repo, ctx, mresult):
     """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
     # 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 (
+    files = []
+    for f, args, msg in mresult.getactions(
+        [
             mergestatemod.ACTION_GET,
             mergestatemod.ACTION_DELETED_CHANGED,
             mergestatemod.ACTION_LOCAL_DIR_RENAME_GET,
             mergestatemod.ACTION_MERGE,
-        )
-    ]
+        ]
+    ):
+        files.append(f)
+
     prefetch = scmutil.prefetchfiles
     matchfiles = scmutil.matchfiles
     prefetch(
-        repo,
-        [
-            (
-                ctx.rev(),
-                matchfiles(
-                    repo, [f for sublist in oplist for f, args, msg in sublist]
-                ),
-            )
-        ],
+        repo, [(ctx.rev(), matchfiles(repo, files),)],
     )
 
 
@@ -1351,7 +1345,7 @@
     """
 
     actions = mresult.actionsdict
-    _prefetchfiles(repo, mctx, actions)
+    _prefetchfiles(repo, mctx, mresult)
 
     updated, merged, removed = 0, 0, 0
     ms = mergestatemod.mergestate.clean(