有没有办法通过 hg 或 hgtk 命令行选项设置所有者(联系人字段)?我可以通过以下方式调出存储库配置:
>> hgtk repoconfig
我想要做的是类似的事情:
[does not work] >> hgtk repoconfig set contact "Name of Contact"
有没有办法通过 hg 或 hgtk 命令行选项设置所有者(联系人字段)?我可以通过以下方式调出存储库配置:
>> hgtk repoconfig
我想要做的是类似的事情:
[does not work] >> hgtk repoconfig set contact "Name of Contact"
This can only be done by editing ha hgrc file. You can do it globally, for just your user account, or on a per-repo basis depending on which hgrc file you want to edit.
Here's the primary author of Mercurial's comment on a similar request: http://twitter.com/#!/mpmselenic/status/8392230762
More seriously the reason being that's there is no provably safe way to have a program read and write a configuration file that's also human readable in a safe way. It really feels like there is but there's always a case that can catch you (duplicate entries? %include rules? illegally formatted to begin with). It's all hassle and no gain.
If you know it's a brand new repo you can do that easily from the command line:
echo -e "[web]\ncontact = $CONTACT" >> $(hg root)/.hg/hgrc
It only starts getting unsafe if the hgrc already had a [web]
section (or two, or one and two %include
directives that may have them).