有用的水银钩 [英] Useful Mercurial Hooks
本文介绍了有用的水银钩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您遇到了一些有用的Mercurial钩子?
What are some useful Mercurial hooks that you have come across?
- acl
- bugzilla
- notify
- check for whitespace
我个人认为这些功能不是非常有用.我想看看:
I personally don't find these very useful. I would like to see:
- 拒绝多个头
- 通过合并拒绝变更组(如果您希望用户始终进行基准调整,则很有用)
- 拒绝带有合并的变更组,除非提交消息具有特殊字符串
- Reject Multiple Heads
- Reject Changegroups with merges (useful if you want users to always rebase)
- Reject Changegroups with merges, unless commit message has special string
请坚持使用具有bat和bash或Python的钩子.这样,* nix和Windows用户都可以使用它们.
Please stick to hooks that have either bat and bash, or Python. That way they can be used by both *nix and Windows users.
推荐答案
我最喜欢的正式存储库钩子是拒绝多个头的钩子.当您拥有一个需要集成后提示自动构建的连续集成系统时,这非常好.
My favorite hook for formal repositories is the one that refuses multiple heads. It's great when you've got a continuous integration system that needs a post-merge tip to build automatically.
此处有一些示例: MercurialWiki:TipsAndTricks-防止会创建多个推送头
我从Netbeans使用此版本:
I use this version from Netbeans:
# This software may be used and distributed according to the terms # of the GNU General Public License, incorporated herein by reference. # # To forbid pushes which creates two or more headss # # [hooks] # pretxnchangegroup.forbid_2heads = python:forbid2_head.forbid_2heads from mercurial import ui from mercurial.i18n import gettext as _ def forbid_2heads(ui, repo, hooktype, node, **kwargs): if len(repo.heads()) > 1: ui.warn(_('Trying to push more than one head, try run "hg merge" before it.\n')) return True
这篇关于有用的水银钩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文