如何创建防止新头的水银钩? [英] How can I create a mercurial hook that prevents new heads?

查看:50
本文介绍了如何创建防止新头的水银钩?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个从SVN转换而来的存储库,并且向前迈进,我们希望确保当人们推送到存储库时,他们不能创建其他负责人.在 TipsAndTricks Wiki页面中有多个挂钩如果有多个头部,则可以防止推动,但是如何构建一个钩子来防止推动头部?

I have several repositories that have been converted from SVN and moving forward we want make sure when people push to the repository they can't create additional heads. there are several hooks in the TipsAndTricks wiki page that prevent pushing if there are multiple heads, but how I can build a hook that prevents pushing new heads?

执行此操作的正确方法似乎是比较版本0:parent中的heads数量,然后比较0:tip中的heads数量,但是我似乎找不到找到这种方法的方法. hg heads -r $HG_NODE仅显示我在用户的第一次提交被推动之后的磁头数.

It seems like the right way to do this would be to compare the number of heads from revision 0:parent and then compare 0:tip, but I can't seem to find a way to do that. hg heads -r $HG_NODE only shows me the number of heads after the user's first commit being pushed.

推荐答案

使用hg ci -m 'Closed branch feature-x' --close-branch关闭除一个头之外的所有头,然后应用普通的单头钩子.

Use hg ci -m 'Closed branch feature-x' --close-branch to close all but one head and then apply a normal single-head hook.

这篇关于如何创建防止新头的水银钩?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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