remote* objects and hooks.

Robert Collins robertc at robertcollins.net
Mon Apr 7 04:57:16 BST 2008


I was looking at fixing 'bzr push' for loom today; and I ran into an API
bug - the public interface for Branch.push differs from that used by
RemoteBranch.

The difference is a _override_source_branch parameter, used to change
what object is reported in hooks.

I chatted with Martin, who last touched this area, and I think we agree
that this is a problematic approach, because it doesn't scale well. 

Some options that might be better: 
 - make operations like 'push' always be convenience methods, with two
expected components:
  - a '_do_push' that does the push
  - a '_do_push_hooks' that invokes hooks.
   The idea here is that RemoteBranch would call
   self._real_branch._do_push and then self._do_push_hooks, thus
   triggering hooks with itself as the source object.
 - just allow the actual object that does the work to be the one
   reported in hooks. They will have the same URL.
 - disable all hooks temporarily, then invoke the relevant hooks from
   RemoteBranch.METHOD().

I think that just allowing the branch that did an action to trigger its
hook is the simplest approach, and one that should work well in
practice.

-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/20080407/eb3de4ca/attachment.pgp 


More information about the bazaar mailing list