gpt4 book ai didi

mercurial - 有用的 Mercurial 钩子(Hook)

转载 作者:行者123 更新时间:2023-12-03 11:23:35 25 4
gpt4 key购买 nike

关闭。这个问题是opinion-based .它目前不接受答案。












想改进这个问题?更新问题,以便 editing this post 可以用事实和引用来回答它.

1年前关闭。




Improve this question




你遇到过哪些有用的 Mercurial 钩子(Hook)?

一些示例 Hook 位于 Mercurial book :

  • acl
  • bugzilla
  • notify
  • check for whitespace

  • 我个人不觉得这些很有用。我想看看:
  • 拒绝多头
  • 通过 merge 拒绝变更组(如果您希望用户始终 rebase ,则很有用)
  • 通过 merge 拒绝变更组,除非提交消息具有特殊字符串
  • 自动链接到 Fogbugz 或 TFS(类似于 bugzilla Hook )
  • 黑名单,将拒绝具有某些变更集 ID 的推送。 (如果您使用 MQ 从其他克隆中提取更改,则很有用)

  • 请坚持使用具有 bat 和 bash 或 Python 的钩子(Hook)。这样,*nix 和 Windows 用户都可以使用它们。

    最佳答案

    对于正式存储库,我最喜欢的钩子(Hook)是拒绝多头的钩子(Hook)。如果您有一个需要 merge 后提示来自动构建的持续集成系统,那就太好了。

    这里有几个例子:MercurialWiki: TipsAndTricks - prevent a push that would create multiple heads

    我使用 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

    关于mercurial - 有用的 Mercurial 钩子(Hook),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1705921/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com