Running hg config --debug | fgrep 'read config'
on (Arch) Linux gives:
read config from: resource:mercurial.defaultrc.mergetools.rc
read config from: /usr/local/etc/mercurial/hgrc
read config from: /etc/mercurial/hgrc
read config from: /home/anthon/.hgrc
read config from: /home/anthon/.config/hg/hgrc
whereas on macOS it gives:
read config from: resource:mercurial.defaultrc.mergetools.rc
read config from: /opt/homebrew/etc/mercurial/hgrc
read config from: /etc/mercurial/hgrc
read config from: /Users/anthon/.hgrc
If you don't want to clobber your home directory with another hidden file ~/.hgrc
, you can do:
sudo mkdir /etc/mercurial # wasn't there on my system
echo '%include ~/.config/hg/hgrc' | sudo tee -a /etc/mercurial/hgrc
After which your ~/.config/hg/hgrc
should be read on mercurial startup.
Unfortunately using hg config --edit
not only tries to edit ~/.hgrc
, but it also creates it even if you quit your editor without making changes. After that your username will be unset (as ~/.hgrc
is read after /etc/mercurial/hgrc