问题标签 [mercurial-hook]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
mercurial - Using hooks vs. wrapping commands in mercurial
What are the relative pros and cons for using hooks vs. using an extension that wraps a command for a particular task?
In other words, what are the criteria for deciding whether to use hooks or wrap a command?
Please also list the cases where one approach is the only option. One case I can think of is to add new arguments for existing commands. You could also change/remove arguments, for example I default log
to log -g
but graphlog
aborts in the presence of some "incompatible" arguments (see graphlog.check_unsupported_flags
), so I added a log
wrapper to remove -g
in those cases, because forced abortion is a crime against humanity.
It feels like hooks are more clean-cut. Python hooks run in the hg process so there's no performance issue. And while it's easy to use extensions.wrapcommand
to create command wrappers, it's trivial to create/disable hooks, and to adjust the order in which they are applied (they should be self-contained in the first place).
And here's a quote from hgrc doc that recommends standard hooks over pre/post command hooks, but it also applies to hooks over wrapper:
... hooks like "commit" will be called in all contexts that generate a commit (e.g. tag) and not just the commit command.
Also I guess that hooks are not subjected to GPL (or are they?), whereas command wrappers in extensions are.
(I hope a 1.5k+ user can create a mercurialhooks
tag. Git fan boys have beaten us with githooks
.)
python - 我的 Mercurial 挂钩是否可以从另一个文件调用代码?
我有一个名为precommit_bad_branch
which imports的钩子函数hook_utils
。precommit_bad_branch
通过提交调用时,我收到以下错误消息:
看来我不允许从 拨打hook_utils
电话precommit_bad_branch
。如果我在不涉及 Mercurial 的情况下明确调用该代码,则该代码可以正常工作。
我的钩子是否可以从另一个文件调用代码?
我的 hgrc 钩子部分如下所示:
mercurial - Mercurial pre commit hook - 根据文件内容停止提交?
如何设置预提交挂钩,它将在提交的文件中搜索字符串,如果找到则停止提交?
mercurial - How to use a relative pathname to a Mercurial hook
I have a script that is in the top level of my working copy and would like to use it as a Mercurial hook. If I use an absolute pathname to the hook then everything is fine, but I want a relative pathname so the whole thing can be easily moved around, used in other working copies and other developers can copy the hgrc as is.
/space/project/.hg/hgrc contains
The genid script is at /space/project/genid
The hook is invoked just fine if I am in /space/project but if my current directory is /space/project/src/tools then 'hg update' will give an error as the hook cannot be found.
mercurial - 我怎样才能创建一个可以防止新头的反复无常的钩子?
我有几个从 SVN 转换而来的存储库,我们希望确保当人们推送到存储库时,他们不能创建额外的头。TipsAndTricks wiki页面中有几个钩子 可以防止在有多个头时推动,但是我如何构建一个防止推动新头的钩子?
看起来这样做的正确方法是比较修订版 0:parent 中的磁头数,然后比较 0:tip,但我似乎找不到这样做的方法。hg heads -r $HG_NODE
仅向我显示用户第一次提交被推送后的人头数。
mercurial - Mercurial 变更集钩子存在,状态为 -1
我在 LAN 上使用 Mercurial SCM,使用普通共享文件夹而不是 HTTP,但在运行自动更新挂钩时遇到问题。
我已按照常见问题解答中的详细说明输入了此钩子。这会安装钩子,但是当我将某些内容推送到远程存储库时,会出现错误:
还有另一个与此类似的stackoverflow问题,但它没有提供任何解决方案,只是它可能是某处的权限错误。
有没有其他人遇到过这个问题,其他人可以对此有更多的了解,或者告诉我从哪里开始解决这个问题?谢谢。
mercurial - Mercurial Changegroup 挂钩因分支而异
Mercurial 中是否有一个现有的钩子,就像 changegroup 一样,它允许在推送时执行操作,但允许我根据哪些分支受其中的变更集影响来执行多个操作(或改变它们)?
例如,我需要在进行推送时通知 url 上的侦听器,但理想情况下,它会根据受影响的分支通知不同的 url,而不仅仅是将它们全部覆盖。
mercurial - Mercurial 更改组挂钩传递错误 HG_URL
我为我的 Mercurial 存储库设置了一个简单的更改组挂钩,以通过电子邮件将更改集发送给感兴趣的用户。我想为我管理的每个存储库使用一个脚本,并且我还想识别变更组来自的存储库。根据 Mercurial Hooks文档,环境变量 HG_URL 可用于此目的。但是,我没有从这个变量中得到我所期望的:
预期的:
实际的:
为什么这是 URL,以及如何将我期望的内容放入 changegroup 钩子中?
mercurial - 传递给外部钩子程序/脚本的钩子参数是什么?
标题说:我正在寻找变量名 (HG_*),以便我可以在我的钩子脚本中使用它们。
mercurial - 如何与所有其他开发人员共享 mercurial 中的 commit-hook?
我们正在使用 mercurial,现在我们想引入 precommit 钩子以保持代码干净。我们希望每个人都能以某种方式获得钩子,但我们也希望能够以某种集中的方式更新它。Mercurial 没有版本控制钩子,那么我们的替代选择是什么?你们中有人找到解决方案吗?提前致谢!
内米