[MERGE][BUG #99983] hooks for commit message editor

Monty Taylor monty at inaugust.com
Mon Feb 4 04:51:28 GMT 2008


Ian Clatworthy wrote:
> Monty Taylor wrote:
>> And added the post_commit_message filter hook.
>>
> 
> I haven't reviewed all of this but two things stand out ...
> 
> bb: resubmit
> 
> You need to add some sanity tests.

DOH. Yup, you're right. I'll get some tests coded up. :)

>> +
>> +                for hook in Branch.hooks['post_commit_message']:
>> +                    try: 
>> +                        my_message = hook(my_message)
>> +                    except error.CommitMessageInvalid, err:
>> +                        raise error.BzrCommandError(str(err))
> 
> We don't have a module called "error" - s/error/errors/. That's a good
> example of why we ask for tests. :-)
> 
>> +post_commit_message
>> +-------------------
>> +
>> +Run after commit message is edited but before ``commit`` is completed. 
>> +
>> +The hook signature is (my_message) where my_message is the commit message. 
>> +The hook should return a string containing the commit message.
>> +
> 
> You need to explain how a hook can abort the commit if the message
> doesn't meet local standards, i.e. mention the CommitMessageInvalid
> exception.
> 
> Ian C.
> 




More information about the bazaar mailing list