Is there any way for me to refer to an external configuration in Mercurial? Our repository is on a shared drive so at the moment the last user to use it is the username it keeps since by default hgrc is under the .hg
folder local to the repository.

- 1,271
- 9
- 23

- 3,454
- 8
- 42
- 59
2 Answers
I agree completely with Daniel — each user should configure the username in his personal config file. The .hg/hgrc
file should not contain a username.
However, let me answer your question about include files: you can include one configuration file in another with:
%include some/file
See the hgrc(5) man page.

- 1,271
- 9
- 23
You could place one in the root of your home directory.
According to the man page, the following locations are checked for per-user configuration files.
(Unix) $HOME/.hgrc (Windows) %USERPROFILE%\.hgrc (Windows) %USERPROFILE%\Mercurial.ini (Windows) %HOME%\.hgrc (Windows) %HOME%\Mercurial.ini
In your per user .hgrc you can have a section like this:
[ui]
username =Your Name<example@example.com>
When you commit and push, the push destinations in .hg/hgrc will be used and your username from the per user file will be used for the commit.
Also, you should consider sharing your repository in a way other then a shared drive. hg lets you pull and push from each computer with a repository and if you need the notion of a 'central repo' you could put it behind hgweb.cgi and push via https or ssh

- 2,335
- 2
- 19
- 28