~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/trace.py

 * Hook up the new remote method ``RemoteBzrDir.find_repositoryV2`` so
   that it is now attempted first when lookup up repositories, leading to
   an extra round trip on older bzr smart servers but supporting the
   feature on newer servers. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
    Not all operations are logged at this point, if you need an unlogged
34
34
    operation please add a test to the tests of this transport, for the logging
35
35
    of the operation you want logged.
 
36
 
 
37
    Another future enhancement would be to log to bzrlib.trace.mutter when
 
38
    trace+ is used from the command line (or perhaps as well/instead use
 
39
    -Dtransport), to make tracing operations of the entire program easily.
36
40
    """
37
41
 
38
42
    def __init__(self, url, _decorated=None, _from_transport=None):
58
62
 
59
63
    def delete(self, relpath):
60
64
        """See Transport.delete()."""
61
 
        self._activity.append(('delete', relpath))
62
65
        return self._decorated.delete(relpath)
63
66
 
64
67
    def delete_tree(self, relpath):
72
75
 
73
76
    def get(self, relpath):
74
77
        """See Transport.get()."""
75
 
        self._trace(('get', relpath))
 
78
        self._activity.append(('get', relpath))
76
79
        return self._decorated.get(relpath)
77
80
 
78
81
    def get_smart_client(self):
88
91
 
89
92
    def mkdir(self, relpath, mode=None):
90
93
        """See Transport.mkdir()."""
91
 
        self._trace(('mkdir', relpath, mode))
92
94
        return self._decorated.mkdir(relpath, mode)
93
95
 
94
96
    def open_write_stream(self, relpath, mode=None):
101
103
    
102
104
    def put_bytes(self, relpath, bytes, mode=None):
103
105
        """See Transport.put_bytes()."""
104
 
        self._trace(('put_bytes', relpath, len(bytes), mode))
 
106
        self._activity.append(('put_bytes', relpath, len(bytes), mode))
105
107
        return self._decorated.put_bytes(relpath, bytes, mode)
106
108
 
107
109
    def listable(self):
119
121
    def readv(self, relpath, offsets, adjust_for_latency=False,
120
122
        upper_limit=None):
121
123
        """See Transport.readv."""
122
 
        self._trace(('readv', relpath, offsets, adjust_for_latency,
 
124
        self._activity.append(('readv', relpath, offsets, adjust_for_latency,
123
125
            upper_limit))
124
126
        return self._decorated.readv(relpath, offsets, adjust_for_latency,
125
127
            upper_limit)
129
131
        return self._decorated.recommended_page_size()
130
132
 
131
133
    def rename(self, rel_from, rel_to):
132
 
        self._activity.append(('rename', rel_from, rel_to))
133
134
        return self._decorated.rename(rel_from, rel_to)
134
135
    
135
136
    def rmdir(self, relpath):
148
149
        """See Transport.lock_write."""
149
150
        return self._decorated.lock_write(relpath)
150
151
 
151
 
    def _trace(self, operation_tuple):
152
 
        """Record that a transport operation occured.
153
 
 
154
 
        :param operation: Tuple of transport call name and arguments.
155
 
        """
156
 
        self._activity.append(operation_tuple)
157
 
 
158
152
 
159
153
class TraceServer(DecoratorServer):
160
154
    """Server for the TransportTraceDecorator for testing with."""