简体   繁体   English

在Mercurial中准备提交消息挂钩

[英]Prepare commit message hook in Mercurial

What is Mercurial's equivalent to the prepare-commit-message hook in Git? Mercurial与Git中的prepare-commit-message钩子等效吗?

Basically what I'm looking for is any hook that runs as part of a commit but before the commit message has been edited by the user. 基本上,我正在寻找的是作为提交的一部分但在用户编辑提交消息之前运行的任何挂钩。 The hook will edit the commit message and the generated message will be shown to the user so it can be validated. 该挂钩将编辑提交消息,并且所生成的消息将显示给用户,以便可以对其进行验证。

From what I remember, there's no equivalent in Mercurial. 据我所知,Mercurial没有任何类似的东西。 There are a few other ways to do this: 还有其他几种方法可以执行此操作:

  • if you use vim, you can fake a template here's the tip 如果您使用vim,则可以伪造模板, 这是提示
  • using a patch to hgeditor or using scripts around it ( more here ) 使用hgeditor补丁或围绕它的脚本( 更多信息请 hgeditor 此处
  • if you use the Qct extension , it supports the use of a file called commit.template to seed your commit message 如果使用Qct扩展名 ,则它支持使用名为commit.template的文件来commit.template提交消息

I have not tried any of these, so I cannot offer anything more than pointers. 我没有尝试过任何一种方法,因此除了提供指针之外,我无法提供其他任何功能。 My experience with writing hooks has usually been to validate changesets about to be committed or to validate incoming changesets for master repositories. 我在编写钩子方面的经验通常是验证即将提交的变更集或验证主存储库的传入变更集。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM