~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/local.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:
33
33
    osutils,
34
34
    urlutils,
35
35
    symbol_versioning,
 
36
    transport,
36
37
    )
37
38
from bzrlib.trace import mutter
38
39
from bzrlib.transport import LateReadError
84
85
                abspath = self.base
85
86
            return LocalTransport(abspath)
86
87
 
 
88
    def close_file_stream(self, relpath):
 
89
        """See Transport.close_file_stream."""
 
90
        handle = transport._file_streams.pop(self.abspath(relpath))
 
91
        handle.close()
 
92
 
87
93
    def _abspath(self, relative_reference):
88
94
        """Return a path for use in os calls.
89
95
 
301
307
        """Create a directory at the given path."""
302
308
        self._mkdir(self._abspath(relpath), mode=mode)
303
309
 
 
310
    def open_file_stream(self, relpath):
 
311
        """See Transport.open_file_stream."""
 
312
        # initialise the file
 
313
        self.put_bytes_non_atomic(relpath, "")
 
314
        handle = open(self._abspath(relpath), 'wb')
 
315
        transport._file_streams[self.abspath(relpath)] = handle
 
316
        return handle.write
 
317
 
304
318
    def _get_append_file(self, relpath, mode=None):
305
319
        """Call os.open() for the given relpath"""
306
320
        file_abspath = self._abspath(relpath)