I'm writing some unit tests that call out to Mercurial, and I'd like to ensure the tests don't rely on any local state of the machine. I know I can override certain config values, e.g.:
hg --config ui.username='Test Account <not-a-real-address@example.com>' ...
However this still reads in the global and user .hgrc
files on the machine, which could affect Mercurial's behavior in an unintended or undesirable way.
Is there a robust way to invoke hg
without having it look at any config files except the .hg/hgrc
file in the repo? For instance with Bash I can accomplish this with bash --noprofile --norc
, but I don't see a similar flag for Mercurial.
NB: I'm aware of "heavyweight" options such as running the tests in an isolated virtual environment such as Docker. I'll certainly do something like that if necessary, but I'm wondering if there's a way to configure Mercurial itself.