问题描述
我有一个项目,该项目使用mercurial进行版本控制,使用SCons进行构建,并使用Google Test编写单元测试. hgrc文件挂钩预提交并运行SCons来构建项目并运行单元测试.是否有办法签入"一部分hgrc文件,以便新签出的副本以及与我的项目版本进行的任何合并都会自动获得一个hgrc文件,当他们尝试提交时会运行SCons?
I have a project using mercurial for version control, SCons to build, and google test to write unit tests. The hgrc file hooks pre-commit and runs SCons to build the project and and run unit tests. Is there a way to "check-in" a portion of the hgrc file so that newly checked out copies, and any merges with my version of the project automatically get an hgrc file that runs SCons when they try to commit?
推荐答案
克隆后,您将无法使人们自动在其.hg/hgrc
中包含条目-这样做将使某人可以放置rm -rf ~
放在提交钩子中,对于以前的克隆者来说,这不是一个可耻的事情.
You can't get people to automatically have entries in their .hg/hgrc
when they clone -- doing so would make it possible for someone to put rm -rf ~
in a commit hook, and wouldn't that be a bummer for the erstwhile cloners.
您可以做的是在'hg
目录之外包含一个名为mandatory.hgrc
之类的文件,然后告诉克隆程序将此行放入其.hg/hgrc
中:
What you can do is include a file named something like mandatory.hgrc
outside of the 'hg
directory and then tell cloners to put this line in their .hg/hgrc
:
%include ../mandatory.hgrc
尽管那仍然显示出对您的极大信任.
Though that's still showing an awful lot of trust in you.
如果要像在许多公司设置中一样控制机器,则可以让软件包/部署/更新工具(我们使用p)将所需的内容放入它们的/etc/mercurial/hgrc
文件中.
If you control the machines, as in many corporate settings, you can have your package/deployment/update tools (we use puppet) put whatever you want in their /etc/mercurial/hgrc
file.
这篇关于将hgrc文件检入Mercurial的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!