Richard
Richard

Reputation: 3296

Prepare commit message hook in Mercurial

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.

Upvotes: 1

Views: 189

Answers (1)

smooth reggae
smooth reggae

Reputation: 2219

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.

Upvotes: 2

Related Questions