像"changegroup"一样起作用的Mercurial钩子,但仅在推动时才起作用? [英] Mercurial hook that operates like 'changegroup', but only on push?

查看:88
本文介绍了像"changegroup"一样起作用的Mercurial钩子,但仅在推动时才起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经建立了变更集传播机制,但是它依赖于捆绑和解绑新变更集.如果我们使用changegroup挂钩,则将导致循环行为,因为该挂钩已运行在拉,推或松开过程中.我们需要的是在提交后进行同步,而commit钩子非常适合在提交后进行,而在 push 之后也是如此.

We've built a changeset propagation mechanism, but it relies on bundling and unbundling the new changesets. If we were to use the changegroup hook, then it would cause cyclic behaviors, because the hook is run during a pull, push, or unbundle. What we need is for the sync to be done after a commit, which the commit hook works perfectly for, but also after a push.

请注意,post-push钩子不是答案,因为当您将推入另一个存储库时,它将运行.基本上,这种情况要求changegroup的特殊行为,仅当新的变更集是推送的结果时才运行.

Note, the post-push hook is not the answer, as it is run when you push from that repository to another. This scenario calls, basically, for a special behavior of changegroup, only running when the new changesets are a result of a push.

有没有这样的钩子?

推荐答案

检查

Check the source argument to the hook. It will be bundle when you're unbundling a changegroup, serve when the changeset comes in over HTTP(S) or SSH, and push when it comes in via a push done to a repository on the local file system.

您会发现此参数是作为作为外部进程运行的钩子的HG_SOURCE环境变量,以及作为进程内钩子的source关键字参数.

You find this argument as the HG_SOURCE environment variable for a hook run as an external process, and as the source keyword argument for an in-process hook.

这篇关于像"changegroup"一样起作用的Mercurial钩子,但仅在推动时才起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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