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.
This commit is contained in:
Phil Cohen 2017-06-25 16:56:49 -07:00
parent 44aa43c0dc
commit c6b8b5e8d4

View File

@ -1078,7 +1078,7 @@ def calculateupdates(repo, wctx, mctx, ancestors, branchmerge, force,
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 @@ def batchremove(repo, actions):
"(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 @@ def applyupdates(repo, actions, wctx, mctx, overwrite, labels=None):
# 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)