edomaur
edomaur

Reputation: 1407

How to set different username by repository in Mercurial?

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 ?

Upvotes: 11

Views: 1104

Answers (2)

Piotr Dobrogost
Piotr Dobrogost

Reputation: 42405

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]>

Upvotes: 6

tonfa
tonfa

Reputation: 24491

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]>

Upvotes: 16

Related Questions