/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/transport_util.py

  • Committer: Jelmer Vernooij
  • Date: 2011-02-20 13:34:07 UTC
  • mto: (5622.4.1 uninstall-hook)
  • mto: This revision was merged to the branch mainline in revision 5747.
  • Revision ID: jelmer@samba.org-20110220133407-zhgrvuhhc1e3j2fn
Add more lazily usable hook points.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
class TransportHooks(bzrlib.hooks.Hooks):
47
47
    """Dict-mapping hook name to a list of callables for transport hooks"""
48
48
 
49
 
    def __init__(self):
50
 
        super(TransportHooks, self).__init__()
 
49
    def __init__(self, module_name, member_name):
 
50
        super(TransportHooks, self).__init__(module_name, member_name)
51
51
        # Invoked when the transport has just created a new connection.
52
52
        # The api signature is (transport, connection, credentials)
53
53
        self['_set_connection'] = []
64
64
class InstrumentedTransport(_backing_transport_class):
65
65
    """Instrumented transport class to test commands behavior"""
66
66
 
67
 
    hooks = TransportHooks()
 
67
    hooks = TransportHooks("bzrlib.tests.transport_util", "InstrumentedTransport.hooks")
68
68
 
69
69
    def __init__(self, base, _from_transport=None):
70
70
        if not base.startswith(_hooked_scheme + '://'):
125
125
        return url
126
126
 
127
127
    def start_logging_connections(self):
128
 
        self.overrideAttr(InstrumentedTransport, 'hooks', TransportHooks())
 
128
        self.overrideAttr(InstrumentedTransport, 'hooks', TransportHooks(
 
129
            "bzrlib.tests.transport_util", "InstrumentedTransport.hooks"))
129
130
        # We preserved the hooks class attribute. Now we install our hook.
130
131
        ConnectionHookedTransport.hooks.install_named_hook(
131
132
            '_set_connection', self._collect_connection, None)