如何防止有人推多个头?
我的一些同事使用 --force
开关推动多个头,因为它们没有正确合并。
有什么方法可以防止这种情况吗?
I have colleagues who push multiple heads by using the --force
switch because they haven't merged properly.
Are there any ways to prevent this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可以使用服务器端的
pretxnchangegroup
挂钩来完成此操作。以下是一些示例: http:// /www.softwareprojects.com/resources/programming/t-mercurial-hook-forbid-2-heads-1910.html
所有这些钩子正在做的是确保在应用了changegroup,仍然只有一个头(或者如果你想变得更奇特的话,每个分支只有一个头)。
You can do this with a
pretxnchangegroup
hook on the server side.Here are a few examples: http://www.softwareprojects.com/resources/programming/t-mercurial-hook-forbid-2-heads-1910.html
All those hooks are doing is making sure that after the changegroup is applied that there's still only one head (or only one per branch if you want to get fancy).
告诉他们不应该这样做,并通过您控制的存储库上的挂钩强制执行工作流程。
在工作中,我们将其限制为一个头/分支。本质上用以下内容替换 forbid_2head.sh :
Tell them they shouldn't do it, and enforce the workflow with hooks on a repository you control.
At work, we restrict it to one head / branch. Essentially replace forbid_2head.sh with this:
这是来自顶尖熟练开发人员的最佳:http:// /hg.python.org/hooks/file/default/checkheads.py
访问http://hg.python.org/hooks/file/default/ 查看另一个有用的钩子列表。
This is the best from top proficient developers: http://hg.python.org/hooks/file/default/checkheads.py
Visit http://hg.python.org/hooks/file/default/ for list of another useful hooks.
您可以撤销他们对他们正在
--force
ing的存储库的推送权限,并让他们推送到不同的服务器,或者通过补丁提交更改。You could revoke their push rights to the repository that they are
--force
ing to, and make them push to a different server, or submit changes via patch.首先,我会告诉开发人员,不允许使用 --force 推送。
我还会使用上面规定的服务器端挂钩解决方案,并在挂钩中向每个人添加一封电子邮件,说明谁试图将多个头推入中央存储库[然后格式化他的硬盘;)]
First off, I'd tell developers that a --force push is not allowed.
I'd also use the server side hook solution as prescribed above, and in the hook add an email to everyone stating WHO tried to push multiple heads into the central repo [and then format his hard drive ;)]