diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -1116,6 +1116,17 @@ use_rust = False if use_rust: + # Force Rayon (Rust parallelism library) to respect the number of + # workers. This is a temporary workaround until Rust code knows + # how to read the config file. + numcpus = self._ui.configint("worker", "numcpus") + if numcpus is not None: + os.environ.setdefault('RAYON_NUM_THREADS', str(numcpus)) + + workers_enabled = self._ui.configbool("worker", "enabled", True) + if not workers_enabled: + os.environ["RAYON_NUM_THREADS"] = "1" + ( lookup, modified,