将hgrc文件检入Mercurial [英] Checking hgrc file into Mercurial

查看:82
本文介绍了将hgrc文件检入Mercurial的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目,该项目使用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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆