merge: pass wctx to batchremove and batchget
authorPhil Cohen <phillco@fb.com>
Sun, 25 Jun 2017 16:56:49 -0700
changeset 33081 6582dc01aca3
parent 33080 a53bfc2845f2
child 33082 f9e50ee4c52b
merge: pass wctx to batchremove and batchget We would like to migrate direct calls of repo.wvfs/wwrite/wread/etc to a call on the relevant workingfilectx, both as a cleanup (to reduce the number of working copy functions on `repo`), and also to facilitate an in-memory merge that doesn't write to the working copy. In order to do that, the first step is to ensure we pass the target wctx around and perform our writes and reads on it. Later, this object might become a memctx.
mercurial/merge.py
--- a/mercurial/merge.py	Sat Jun 24 23:05:57 2017 +0900
+++ b/mercurial/merge.py	Sun Jun 25 16:56:49 2017 -0700
@@ -1078,7 +1078,7 @@
 
     return actions, diverge, renamedelete
 
-def batchremove(repo, actions):
+def batchremove(repo, wctx, actions):
     """apply removes to the working directory
 
     yields tuples for progress updates
@@ -1122,7 +1122,7 @@
                            "(consider changing to repo root: %s)\n") %
                          repo.root)
 
-def batchget(repo, mctx, actions):
+def batchget(repo, mctx, wctx, actions):
     """apply gets to the working directory
 
     mctx is the context to get from
@@ -1222,14 +1222,16 @@
 
     # remove in parallel (must come first)
     z = 0
-    prog = worker.worker(repo.ui, 0.001, batchremove, (repo,), actions['r'])
+    prog = worker.worker(repo.ui, 0.001, batchremove, (repo, wctx),
+                         actions['r'])
     for i, item in prog:
         z += i
         progress(_updating, z, item=item, total=numupdates, unit=_files)
     removed = len(actions['r'])
 
     # get in parallel
-    prog = worker.worker(repo.ui, 0.001, batchget, (repo, mctx), actions['g'])
+    prog = worker.worker(repo.ui, 0.001, batchget, (repo, mctx, wctx),
+                         actions['g'])
     for i, item in prog:
         z += i
         progress(_updating, z, item=item, total=numupdates, unit=_files)