~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/memory.py

  • Committer: Robert Collins
  • Date: 2007-08-05 02:57:45 UTC
  • mto: (2592.3.77 repository)
  • mto: This revision was merged to the branch mainline in revision 2741.
  • Revision ID: robertc@robertcollins.net-20070805025745-eg2qmr8jzsky39y2
StartĀ open_file_streamĀ logic.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
    )
37
37
from bzrlib.trace import mutter
38
38
from bzrlib.transport import (
 
39
    _file_streams,
39
40
    LateReadError,
40
41
    register_transport,
41
42
    Server,
89
90
        result._locks = self._locks
90
91
        return result
91
92
 
 
93
    def close_file_stream(self, relpath):
 
94
        """See Transport.close_file_stream."""
 
95
        del _file_streams[self.abspath(relpath)]
 
96
 
92
97
    def abspath(self, relpath):
93
98
        """See Transport.abspath()."""
94
99
        # while a little slow, this is sufficiently fast to not matter in our
165
170
            raise FileExists(relpath)
166
171
        self._dirs[_abspath]=mode
167
172
 
 
173
    def open_file_stream(self, relpath):
 
174
        """See Transport.open_file_stream."""
 
175
        def append_data(bytes):
 
176
            self.append_bytes(relpath, bytes)
 
177
        self.put_bytes(relpath, "")
 
178
        _file_streams[self.abspath(relpath)] = append_data
 
179
        return append_data
 
180
 
168
181
    def listable(self):
169
182
        """See Transport.listable."""
170
183
        return True