merge: disable Rust workers if in-memory merge is in progress

Summary: We don't really need the Rust workers for this, as we do not expect thousands of files to be changed during an in-memory merge.

Reviewed By: DurhamG

Differential Revision: D20495141

fbshipit-source-id: e72f8c4b01deee46ee72364dcd6716692c4103ab
This commit is contained in:
Xavier Deguillard 2020-03-17 15:52:55 -07:00 committed by Facebook GitHub Bot
parent 499a67a417
commit 20029d1bdc
2 changed files with 17 additions and 3 deletions

View File

@ -1651,6 +1651,8 @@ def applyupdates(repo, actions, wctx, mctx, overwrite, labels=None, ancestors=No
numupdates = sum(len(l) for m, l in actions.items() if m != "k")
z = 0
rustworkers = repo.ui.configbool("worker", "rustworkers") and not wctx.isinmemory()
# record path conflicts
with progress.bar(
repo.ui, _("updating"), _("files"), numupdates
@ -1684,7 +1686,7 @@ def applyupdates(repo, actions, wctx, mctx, overwrite, labels=None, ancestors=No
# remove in parallel (must come before resolving path conflicts and
# getting)
if repo.ui.configbool("worker", "rustworkers"):
if rustworkers:
numworkers = worker._numworkers(repo.ui)
remover = rustworker.removerworker(repo.wvfs.base, numworkers)
for f, args, msg in actions["r"]:
@ -1718,7 +1720,7 @@ def applyupdates(repo, actions, wctx, mctx, overwrite, labels=None, ancestors=No
# get in parallel
writesize = 0
if repo.ui.configbool("worker", "rustworkers"):
if rustworkers:
numworkers = worker._numworkers(repo.ui)
writer = rustworker.writerworker(
repo.fileslog.contentstore, repo.wvfs.base, numworkers

View File

@ -22,7 +22,7 @@ Shallow clone
$ clone master shallow --noupdate
$ cd shallow
$ setconfig remotefilelog.useruststore=True worker.rustworkers=True
$ setconfig remotefilelog.useruststore=True worker.rustworkers=True extensions.amend= rebase.experimental.inmemory=True
$ hg up master
fetching tree '' 6b8f81b9651010925578ea56a4129930688cbf98, found via baeb6587a441
1 trees fetched over 0.00s
@ -44,3 +44,15 @@ Shallow clone
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ test -f dir
[1]
$ echo x > x
$ hg commit -qAm x
$ echo y > y
$ hg commit -qAm y
$ hg prev
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
[02b5b1] x
$ hg amend
rebasing 02663ae2e9f7 "y"
hint[amend-autorebase]: descendants have been auto-rebased because no merge conflict could have happened - use --no-rebase or set commands.amend.autorebase=False to disable auto rebase
hint[hint-ack]: use 'hg hint --ack amend-autorebase' to silence these hints