I am working on projects for different clients using Mercurial as a VCS. I know how to set a default user, but is there a mean to set a different user for each project ?
If you specify a -u option to the hg commit command on the command line, followed by a username, this is always given the highest precedence. If you have set the HGUSER environment variable, this is checked next. If you have set the EMAIL environment variable, this will be used next.
Mercurial on Windows has a three-tier configuration system. A site-wide configuration file in C:\Program Files\TortoiseHg\Mercurial. ini This file is read first and thus has the lowest priority. A per-user configuration file in C:\Documents and Settings\username\Mercurial.
Just edit the file .hg/hgrc
inside each repository. It's the same syntax as your ~/.hgrc
but will only affect a specific repo.
In repo1/.hg/hgrc
:
[ui]
username = Foo Bar <[email protected]>
And in repo2/.hg/hgrc
:
[ui]
username = Something Else <[email protected]>
Alternatively to setting username for each repository you can use Mercurial Dynamic Username extension and set usernames for specific locations in your global ~/.hgrc
like this:
[extensions]
dynamic_username =
[dynamic_username]
work.location = ~/work
work.username = John Smith <[email protected]>
hobby.location = ~/hobby ~/blogging
hobby.username = Johny <[email protected]>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With