如何在Mercurial中通过存储库设置不同的用户名?
问题描述:
我正在处理使用Mercurial作为VCS的不同客户端的项目。我知道如何设置一个默认用户,但是有没有一种方法可以为每个项目设置一个不同的用户?如何在Mercurial中通过存储库设置不同的用户名?
答
只需在每个存储库中编辑文件.hg/hgrc
即可。它与~/.hgrc
的语法相同,但只会影响特定的回购。
在repo1/.hg/hgrc
:
[ui]
username = Foo Bar <[email protected]>
而且在repo2/.hg/hgrc
:
[ui]
username = Something Else <[email protected]>
答
或者为每个存储库设置的用户名可以使用Mercurial Dynamic Username扩展,在全局~/.hgrc
这样设置特定地点的用户名:
[extensions]
dynamic_username =
[dynamic_username]
work.location = ~/work
work.username = John Smith <[email protected]>
hobby.location = ~/hobby ~/blogging
hobby.username = Johny <[email protected]>
nift你好!非常感谢你 ! – edomaur 2009-09-19 12:02:34