views:

35

answers:

2

As described in: http://hgbook.red-bean.com/read/handling-repository-events-with-hooks.html I thought I could write a small hook which rejects checkins with malformed commit messages. Thats no problem, the issue I encounter is the following work flow:

If a developer makes let's say 10 local commits, some of them are malformed, and then pushes them to the central repository all will be rejected, but he is unable to edit the old commit messages since rollback will work only once..

How do you solve this?

+2  A: 

Using the HistEdit extension, you can change the commit message locally, then push back the whole changes in the main repository.

gizmo
A: 

I suppose you can't mandate developers to use the same precommit hook to check commit messages, because it's not a centrally-managed project?

An alternative to @gizmo's answer is to let developers use MQ and mandate code review before pushing (or better, someone pulling from them). Then if reviewers (or some review scripts) spot the malformed messages, the developer can use qrefresh to change the message.

You need to be careful about a couple of things in that workflow, though:

  1. NEVER EVER push/pull unfinished patch, even though qfinish does not change the hash. It's just too easy to screw up.
  2. Make sure developer qcommit every time before sending things out for review, otherwise you won't know if s/he slips in other changes in the next iteration (not that s/he would, but s/he could).
Geoffrey Zheng