Skip to content

dispatch: change cwd when loading local config

Previously, the _getlocal function would not correctly load the repo config when given a relative rpath and an alternate cwd via the wd parameter.

Normally when --cwd is specified, hg changes to the given directory before attempting to load the local config (and therefore does not specify a wd). The only time the function is called with wd set is when hg is running as a command server (e.g., with chg), in which case each forked worker process will attempt to configure itself via _getlocal before responding to the client. When given a relative repo path, the worker fails to load the repo config, detects a config mismatch with the client, and enters a redirect/respawn loop.

To fix this, we can simply change to the desired working directory during config loading. (Note that simply concatenating wd and rpath won't work in all cases. The repo path could be something more complicated than a simple relative path, such as a union: repo.)

Edited by Arun Kulshreshtha

Merge request reports