Mercurial > public > mercurial-scm > hg
comparison mercurial/merge.py @ 33081:6582dc01aca3
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.
author | Phil Cohen <phillco@fb.com> |
---|---|
date | Sun, 25 Jun 2017 16:56:49 -0700 |
parents | 9e3733d93f64 |
children | f9e50ee4c52b |
comparison
equal
deleted
inserted
replaced
33080:a53bfc2845f2 | 33081:6582dc01aca3 |
---|---|
1076 fractions = _forgetremoved(wctx, mctx, branchmerge) | 1076 fractions = _forgetremoved(wctx, mctx, branchmerge) |
1077 actions.update(fractions) | 1077 actions.update(fractions) |
1078 | 1078 |
1079 return actions, diverge, renamedelete | 1079 return actions, diverge, renamedelete |
1080 | 1080 |
1081 def batchremove(repo, actions): | 1081 def batchremove(repo, wctx, actions): |
1082 """apply removes to the working directory | 1082 """apply removes to the working directory |
1083 | 1083 |
1084 yields tuples for progress updates | 1084 yields tuples for progress updates |
1085 """ | 1085 """ |
1086 verbose = repo.ui.verbose | 1086 verbose = repo.ui.verbose |
1120 # Print a warning if cwd was deleted | 1120 # Print a warning if cwd was deleted |
1121 repo.ui.warn(_("current directory was removed\n" | 1121 repo.ui.warn(_("current directory was removed\n" |
1122 "(consider changing to repo root: %s)\n") % | 1122 "(consider changing to repo root: %s)\n") % |
1123 repo.root) | 1123 repo.root) |
1124 | 1124 |
1125 def batchget(repo, mctx, actions): | 1125 def batchget(repo, mctx, wctx, actions): |
1126 """apply gets to the working directory | 1126 """apply gets to the working directory |
1127 | 1127 |
1128 mctx is the context to get from | 1128 mctx is the context to get from |
1129 | 1129 |
1130 yields tuples for progress updates | 1130 yields tuples for progress updates |
1220 if [a for a in actions['r'] if a[0] == '.hgsubstate']: | 1220 if [a for a in actions['r'] if a[0] == '.hgsubstate']: |
1221 subrepo.submerge(repo, wctx, mctx, wctx, overwrite, labels) | 1221 subrepo.submerge(repo, wctx, mctx, wctx, overwrite, labels) |
1222 | 1222 |
1223 # remove in parallel (must come first) | 1223 # remove in parallel (must come first) |
1224 z = 0 | 1224 z = 0 |
1225 prog = worker.worker(repo.ui, 0.001, batchremove, (repo,), actions['r']) | 1225 prog = worker.worker(repo.ui, 0.001, batchremove, (repo, wctx), |
1226 actions['r']) | |
1226 for i, item in prog: | 1227 for i, item in prog: |
1227 z += i | 1228 z += i |
1228 progress(_updating, z, item=item, total=numupdates, unit=_files) | 1229 progress(_updating, z, item=item, total=numupdates, unit=_files) |
1229 removed = len(actions['r']) | 1230 removed = len(actions['r']) |
1230 | 1231 |
1231 # get in parallel | 1232 # get in parallel |
1232 prog = worker.worker(repo.ui, 0.001, batchget, (repo, mctx), actions['g']) | 1233 prog = worker.worker(repo.ui, 0.001, batchget, (repo, mctx, wctx), |
1234 actions['g']) | |
1233 for i, item in prog: | 1235 for i, item in prog: |
1234 z += i | 1236 z += i |
1235 progress(_updating, z, item=item, total=numupdates, unit=_files) | 1237 progress(_updating, z, item=item, total=numupdates, unit=_files) |
1236 updated = len(actions['g']) | 1238 updated = len(actions['g']) |
1237 | 1239 |