Mercurial > public > mercurial-scm > hg
comparison mercurial/merge.py @ 52186:e6a44bc91bc2 stable
rust-update: make `update_from_null` respect `worker.numcpu` config option
This was overlooked in the original series.
This is important for tests (because we run many at once), and for the
occasional end user that wants to keep their CPU usage in check.
A future series should clean up this `worker` parameter tunelling business by
rewriting the config in Rust, but doing so on stable would be a very bad
idea.
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Tue, 05 Nov 2024 15:21:09 +0100 |
parents | 43e15277498e |
children | e627cc25b6f3 |
comparison
equal
deleted
inserted
replaced
52185:e698e3e75420 | 52186:e6a44bc91bc2 |
---|---|
2052 repo.narrowmatch() | 2052 repo.narrowmatch() |
2053 sparse.matcher(repo, [nullrev, p2.rev()]) | 2053 sparse.matcher(repo, [nullrev, p2.rev()]) |
2054 repo.hook(b'preupdate', throw=True, parent1=xp1, parent2=xp2) | 2054 repo.hook(b'preupdate', throw=True, parent1=xp1, parent2=xp2) |
2055 # note that we're in the middle of an update | 2055 # note that we're in the middle of an update |
2056 repo.vfs.write(b'updatestate', p2.hex()) | 2056 repo.vfs.write(b'updatestate', p2.hex()) |
2057 num_cpus = ( | |
2058 repo.ui.configint(b"worker", b"numcpus", None) | |
2059 if repo.ui.configbool(b"worker", b"enabled") | |
2060 else 1 | |
2061 ) | |
2057 try: | 2062 try: |
2058 updated_count = rust_update_mod.update_from_null( | 2063 updated_count = rust_update_mod.update_from_null( |
2059 repo.root, p2.rev() | 2064 repo.root, p2.rev(), num_cpus |
2060 ) | 2065 ) |
2061 except rust_update_mod.FallbackError: | 2066 except rust_update_mod.FallbackError: |
2062 update_from_null_fallback = True | 2067 update_from_null_fallback = True |
2063 else: | 2068 else: |
2064 # We've changed the dirstate from Rust, we need to tell Python | 2069 # We've changed the dirstate from Rust, we need to tell Python |