[MERGE][RFC] Enhanced hooks

Jelmer Vernooij jelmer at vernstok.nl
Mon Feb 4 16:23:54 GMT 2008


Hi Ian,

Thanks for this, I think this is really something that belongs in the
bzr core :-)

On Mon, Feb 04, 2008 at 11:57:13PM +1000, Ian Clatworthy wrote:
> This is part 3 of the enhanced hooks changes - the interesting bit. To
> be fully functional, it require the previous 2 parts though this can be
> reviewed separately and all tests should pass. (The obvious link points
> to the 2 routines provided by the other patches are marked with comments.)

> Here are the major points:

> 1. Scripts to run when hooks are triggered can now be defined in
>    configuration files. Multiple scripts can be given for each
>    hook and each hook is named.

> 2. By reusing our (nice) configuration architecture, we provide
>    a lot of flexibility. Some hooks may only be triggered for
>    a given branch, or for all users of a branch, or for all
>    branches. (Right now, that flexibility only applies to
>    shell hooks, though supporting triggering of Python hooks
>    is almost complete as well - see below.)

> 3. Arguments passed to a Python hook can be mapped to the most
>    appropriate "form" for a command line script - parameter,
>    stdin or an env variable. Likewise, outputs from the
>    command line script can be mapped back to Python results
>    as required. The way that mapping is done defines the
>    "shell script signature" for a given hook type.

> As that signature is a "public interface", I'm marking this
> patch as RFC. For the branch hooks, I've gone with what Jelmer did in
> his shell-hook plugin (as I said I would). If anyone thinks we should do
> something different, now's the time to speak up. :-)

> In summary, this feature brings us up to (and arguably beyond) the hook
> functionality delivered by Subversion, Git and Hg. Once merged, it will
> make it much easier for non Python developers to integrate Bazaar into
> their environments.
I think the syntax in the configuration file is a bit complex. Git and
mercurial simply allow::

	[hooks]
	pre-commit = foo.sh
	post-commit = bar.sh

Using a separate section per hook seems overkill to me.

Also, there are now two word separator characters used, '_' and ' '.
It would be nice if the character used could be consistent, e.g.::

	[pre-commit-hooks]
	foo=foo.sh

Cheers,

Jelmer

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080204/04cd40d2/attachment.pgp 


More information about the bazaar mailing list