~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/trace.py

  • Committer: Ian Clatworthy
  • Date: 2009-09-09 15:30:59 UTC
  • mto: (4634.37.2 prepare-2.0)
  • mto: This revision was merged to the branch mainline in revision 4689.
  • Revision ID: ian.clatworthy@canonical.com-20090909153059-sb038agvd38ci2q8
more link fixes in the User Guide

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
and then delegates it.
21
21
"""
22
22
 
23
 
from __future__ import absolute_import
24
 
 
25
 
from bzrlib.transport import decorator
26
 
 
27
 
 
28
 
class TransportTraceDecorator(decorator.TransportDecorator):
 
23
from bzrlib.transport.decorator import TransportDecorator, DecoratorServer
 
24
 
 
25
 
 
26
class TransportTraceDecorator(TransportDecorator):
29
27
    """A tracing decorator for Transports.
30
28
 
31
29
    Calls that potentially perform IO are logged to self._activity. The
45
43
 
46
44
        _decorated is a private parameter for cloning.
47
45
        """
48
 
        super(TransportTraceDecorator, self).__init__(url, _decorated)
 
46
        TransportDecorator.__init__(self, url, _decorated)
49
47
        if _from_transport is None:
50
48
            # newly created
51
49
            self._activity = []
171
169
        self._activity.append(operation_tuple)
172
170
 
173
171
 
 
172
class TraceServer(DecoratorServer):
 
173
    """Server for the TransportTraceDecorator for testing with."""
 
174
 
 
175
    def get_decorator_class(self):
 
176
        return TransportTraceDecorator
 
177
 
 
178
 
174
179
def get_test_permutations():
175
180
    """Return the permutations to be used in testing."""
176
 
    from bzrlib.tests import test_server
177
 
    return [(TransportTraceDecorator, test_server.TraceServer)]
 
181
    return [(TransportTraceDecorator, TraceServer)]