0

Is there anyway i can change a commit message trough a hook when someone amends the commit message ?

I tried to use precommit hook but this hook isn't called when amending.

I also tried to call hg commit --amend from the changegroup hook, but this causes errors.

I managed to do it by calling an external python script but this requires python to be installed and certainly doesn't feel like the right way to go about it.

Willem D'Haeseleer
  • 19,661
  • 9
  • 66
  • 99
  • amending a commit seems so against the principals of version control ? why not just do a new commit with the new message? – Joran Beasley May 28 '13 at 18:06
  • I don't agree, i think amend is extremely useful. Not only for fixing typos but also for fixing your commit before you push it to the server. However in this case i want to use the amend function to allow a user to suffix the commit so that a hook can detect the suffix and upload the commit onto our code review server. – Willem D'Haeseleer May 28 '13 at 18:15
  • Mercurial already requires Python to be installed, so using an external Python script should not be a problem? – Reimer Behrends May 28 '13 at 19:14
  • @JoranBeasley Amend is a core Mercurial command (meaning: vetted as safe by Matt), and there are several core mechanisms in Mercurial to support history modification, e.g. phases and changeset evolution. I think it’s a great feature of DVCSs, you can correct little mistakes easily. And once changeset evolution development is complete, Mercurial will be the DVCS with the best support for it. Of course you can always choose not to use it. – Laurens Holst May 31 '13 at 13:16

0 Answers0