[MERGE][RFC] Enhanced hooks

Robert Collins robertc at robertcollins.net
Tue Feb 5 02:05:38 GMT 2008


On Tue, 2008-02-05 at 11:43 +1000, Ian Clatworthy wrote:
> 
> 
> I haven't removed any of the (implicitly global) self-registration -
> I've added selective registration so the active hooks can differ (for
> example) per branch.
> 
> Let's me know on IRC what API you want given the current branch is now
> needed to find the list of hooks.

Its not needed to find the list of hooks. Here are two ways of doing it
by branch.

* Add a hook instance at the end of branch.py for each hook, to a static
method on Branch.
e.g. Branch.set_rh_shell_hook

This hook does:

config = master.get_branch_config()
# look for shell hook
...
if not found:
    return


* Add a dynamically created hook when the branch config is first parsed,
and free it when unlock() drops the refcount all the way to zero.
it will say something like:
if master is not self:
    return

-Rob


-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080205/bf8e280e/attachment.pgp 


More information about the bazaar mailing list