Prepare commit message hook in Mercurial

185 Views Asked by At

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.

1

There are 1 best solutions below

2
smooth reggae On

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.