【问题标题】:Mercurial: how to add a hook on pullMercurial:如何在拉动时添加钩子
【发布时间】:2013-04-11 15:55:36
【问题描述】:

我已经搜索了一段时间,但没有看到任何东西。这可能意味着,它不应该完成,或者根本无法完成。

我查看了 mercurial 的钩子列表,但在您发出 hg pull 命令后,我似乎找不到(或让一个工作)执行脚本。

谢谢

【问题讨论】:

    标签: mercurial mercurial-hook


    【解决方案1】:

    来自hgrc docs section on "hooks"-

    "incoming"
      Run after a changeset has been pulled, pushed, or unbundled into the
      local repository. The ID of the newly arrived changeset is in
      "$HG_NODE". URL that was source of changes came is in "$HG_URL".
    

    或者...

    "post-<command>"
      Run after successful invocations of the associated command. The contents
      of the command line are passed as "$HG_ARGS" and the result code in
      "$HG_RESULT". Parsed command line arguments are passed as "$HG_PATS" and
      "$HG_OPTS". These contain string representations of the python data
      internally passed to <command>. "$HG_OPTS" is a dictionary of options
      (with unspecified options set to their defaults). "$HG_PATS" is a list
      of arguments. Hook failure is ignored.
    

    (文档还详细介绍了配置的实际外观以及如何调用挂钩脚本。)

    【讨论】:

    • 还有pretxnchangegroup 在拉取变更集之后运行,但在它们在本地存储库中永久化之前运行。如果您需要在传入变更集被接受之前对其进行验证,这将非常有用。
    • 我确实有机会读到这个,但是只有在找到新的变更集时才会拉取。如果我希望每次执行 hg pull 时都运行一个钩子怎么办?即使在没有发现任何变化的情况下发生
    • post- 做了我想要的,但我并没有立即意识到。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-01
    • 2019-09-23
    • 1970-01-01
    相关资源
    最近更新 更多