[MERGE] Added support for a hook before sending the commit message to the editor.

Ian Clatworthy ian.clatworthy at internode.on.net
Wed Jan 30 07:05:08 GMT 2008


Ian Clatworthy wrote:

> How about passing the current text and information into the hook and
> passing the new values back out? That way, the hook could alter either
> as it sees fit.

On second thoughts with an eye towards supporting command line hooks
more easily, maybe it makes more sense to have 2 separate hooks, one for
the message (pre-commit-message) and one for the information
(pre-commit-info). We can still pass the current text in and get the new
text returned. In Python, the hooks would look something like:

    start_msg = ""
    for hook in Branch.hooks['pre_commit_message']:
        start_msg = hook(tree, selected_list, start_msg)

For command line hooks, stdin and stdout could be used for existing and
new texts respectively.

Ian C.



More information about the bazaar mailing list