1

What is Mercurial's equivalent to the prepare-commit-message hook in Git?

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.

Rick
  • 3,240
  • 2
  • 29
  • 53
  • possible duplicate of [Mercurial Hook - change a commit message pre commit](http://stackoverflow.com/questions/10377011/mercurial-hook-change-a-commit-message-pre-commit) – Mathiasdm Mar 19 '15 at 08:53

1 Answers1

2

From what I remember, there's no equivalent in Mercurial. There are a few other ways to do this:

  • if you use vim, you can fake a template here's the tip
  • using a patch to hgeditor or using scripts around it (more here)
  • if you use the Qct extension, it supports the use of a file called commit.template to seed your commit message

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.

smooth reggae
  • 2,189
  • 13
  • 14
  • Thanks! I guess the real answer is that there's no good way to do it. I tried your workarounds but none of them fit our workflow I'm afraid. – Rick Mar 19 '15 at 13:07
  • Have a look at my above 'possible duplicate' comment, there are some solutions there. – Mathiasdm Mar 20 '15 at 08:51