我在 Google 代码托管上的一些项目中使用了 Hg。对于我在 .hgrc 的 [auth] 部分中设置的每个项目,用户名/密码无需每次都要求输入密码即可推送。但它有很多重复,例如:
[auth]
proj1.prefix = ... 111
proj1.username = google code username
proj1.password = google code password
proj2.prefix = ... 222
proj2.username = google code username
proj2.password = google code password
这可以以某种方式减少重复吗?也许在 hgrc 中设置变量并从所有用户名/密码行引用它?
在此先感谢您的帮助
最佳答案
来自 auth hgrc 中的部分:
format:
<name>.<argument> = <value>
where<name>
is used to group arguments into authentication entries.
<name>.prefix
: The authentication entry with the longest matching prefix is used
因此,code.google.com 的单个条目就足够了。同样感兴趣的是
%include file
所以你可以将常见的东西存储在单独的文件中,并将它们包含在任何 hgrc 中。
关于mercurial:减少 hgrc 文件中的重复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2879642/