Changing the Commit Message using Hooks
Benoît Allard
benoit at aeteurope.nl
Wed Mar 25 09:59:39 CDT 2009
Wendel wrote:
> Hi Greg,
>
> In my case, it's a small project and i have directly control of all
> repositories.
> I need a hook to add some information in the commit message everytime
> someone commit in his local repository. I tried using the precommit hook
> but, it seems i can see but not change the commit message.
>
>
Short answer:
It's not possible by design.
Short explanation:
Because the commit message is included in the calcul of the changesetID
(the hash identifying your changeset), like all other information in
your changeset, including the ID of the parents, which include their own
information, and so on ...
Short question:
What are you trying to achieve that (you think) would have been solved
by modifying the commit message ?
>
> Greg Ward-17 wrote:
>> On Tue, Mar 24, 2009 at 10:33 AM, Wendel <wendel12345 at yahoo.com.br> wrote:
>>> Its possible to change the commit message using hooks? Maybe using
>>> precommit
>>> hook?
>> In general, probably not: once somebody clones your repository, they
>> can install any hooks they like. You can only controls what goes into
>> repositories that you control directly. And by the time a changeset
>> is being pushed to another repository, it's immutable.
>>
>> I suspect the right answer is a commit wrapper script, training, and a
>> hook in your maste repository to make sure people get it right (i.e.
>> reject changesets with improper log messages).
>>
>> Greg
>>
>
More information about the Mercurial
mailing list