~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/trace.py

  • Committer: Vincent Ladeuil
  • Date: 2010-02-10 15:46:03 UTC
  • mfrom: (4985.3.21 update)
  • mto: This revision was merged to the branch mainline in revision 5021.
  • Revision ID: v.ladeuil+lp@free.fr-20100210154603-k4no1gvfuqpzrw7p
Update performs two merges in a more logical order but stop on conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
"""Implementation of Transport that traces transport operations.
18
18
 
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
    See also TransportLogDecorator, that records a machine-readable log in 
 
38
    memory for eg testing.
36
39
    """
37
40
 
38
41
    def __init__(self, url, _decorated=None, _from_transport=None):
39
42
        """Set the 'base' path where files will be stored.
40
 
        
 
43
 
41
44
        _decorated is a private parameter for cloning.
42
45
        """
43
46
        TransportDecorator.__init__(self, url, _decorated)
98
101
    def put_file(self, relpath, f, mode=None):
99
102
        """See Transport.put_file()."""
100
103
        return self._decorated.put_file(relpath, f, mode)
101
 
    
 
104
 
102
105
    def put_bytes(self, relpath, bytes, mode=None):
103
106
        """See Transport.put_bytes()."""
104
107
        self._trace(('put_bytes', relpath, len(bytes), mode))
105
108
        return self._decorated.put_bytes(relpath, bytes, mode)
106
109
 
 
110
    def put_bytes_non_atomic(self, relpath, bytes, mode=None,
 
111
        create_parent_dir=False, dir_mode=None):
 
112
        """See Transport.put_bytes_non_atomic."""
 
113
        self._trace(('put_bytes_non_atomic', relpath, len(bytes), mode,
 
114
            create_parent_dir, dir_mode))
 
115
        return self._decorated.put_bytes_non_atomic(relpath, bytes, mode=mode,
 
116
            create_parent_dir=create_parent_dir, dir_mode=dir_mode)
 
117
 
107
118
    def listable(self):
108
119
        """See Transport.listable."""
109
120
        return self._decorated.listable()
111
122
    def iter_files_recursive(self):
112
123
        """See Transport.iter_files_recursive()."""
113
124
        return self._decorated.iter_files_recursive()
114
 
    
 
125
 
115
126
    def list_dir(self, relpath):
116
127
        """See Transport.list_dir()."""
117
128
        return self._decorated.list_dir(relpath)
118
129
 
119
130
    def readv(self, relpath, offsets, adjust_for_latency=False,
120
131
        upper_limit=None):
121
 
        """See Transport.readv."""
 
132
        # we override at the readv() level rather than _readv() so that any
 
133
        # latency adjustments will be done by the underlying transport
122
134
        self._trace(('readv', relpath, offsets, adjust_for_latency,
123
135
            upper_limit))
124
136
        return self._decorated.readv(relpath, offsets, adjust_for_latency,
131
143
    def rename(self, rel_from, rel_to):
132
144
        self._activity.append(('rename', rel_from, rel_to))
133
145
        return self._decorated.rename(rel_from, rel_to)
134
 
    
 
146
 
135
147
    def rmdir(self, relpath):
136
148
        """See Transport.rmdir."""
 
149
        self._trace(('rmdir', relpath))
137
150
        return self._decorated.rmdir(relpath)
138
151
 
139
152
    def stat(self, relpath):