[RFC] Better hooks for Bazaar

John Arbash Meinel john at arbash-meinel.com
Mon Dec 17 13:47:54 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ian Clatworthy wrote:
> We're had a few complaints that hooks in Bazaar are too hard to get
> going compared to other systems. While I'm looking into fixing that, I
> thought I'd ask for advice/recommendations on how hooks in general ought
> to be improved in Bazaar.
> 
> In case anyone is interested, I've put together some notes covering what
> hooks are supported by bzr, svn, git and hg, together with how to
> configure them in the various systems: http://bazaar-vcs.org/BzrHooks.
> There's more variation than I expected FWIW.
> 

To start with, a few of our hook apis are:

def some_hook(rich_object):

while others are:

def some_hook(source, target, master, rev_id, other, yet_another,
              oops_missed_one):

I think the "rich_object" is a lot better for hooks.

> Some questions:
> 
> * If you're using hooks in Bazaar, how would you like to have configured
>   them compared to how you had to?
> 
> * Did you prefer hooks in other systems and why? Was it the available
>   hooks, how they were configured or both?
> 
> * Any other ideas/thoughts?
> 
> If anyone has hooks they would like to share with others, let me know
> and we can either make them standard ones or more obvious on the Wiki.
> 
> Thanks,
> Ian C.
> 
> 

I think you are aware, but some people feel that writing simple shell scripts
is better than writing a python plugin.

My recommendation is to actually just write a plugin that grabs all of the
known hooks, and then checks for executable files that match a given pattern.
Like possibly:

.bzr/hooks/post_push

or maybe

~/.bazaar/hooks/post_push
(this is riskier because of problems with knowing which branches should
activate what hooks)

But then again putting it inside .bzr/* violates a bit of our "don't encourage
users to manually edit anything underneath .bzr/".

It seems like we also need Tree level hooks. At least in discussing with
Robert, people would like to do WT checks at commit time. Robert felt that
adding a Tree object to the branch hook was a layering violation. (Though I
counter that you can't commit without a tree, as commit is a tree action, and
we are just looking at policy based on the branch.)

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHZn4KJdeBCYSNAAMRAlirAJ41kkhlVe9MYRsPc8QncT7/Kq6GpgCdFySa
aBz5xuCcrfVZOD5tC8hmrkw=
=xlSG
-----END PGP SIGNATURE-----



More information about the bazaar mailing list