~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/local.py

  • Committer: Robert Collins
  • Date: 2009-06-23 01:59:20 UTC
  • mto: This revision was merged to the branch mainline in revision 4476.
  • Revision ID: robertc@robertcollins.net-20090623015920-vaouua88qdeqtflw
Tweaked version of Jam's fix for bug 162930, writing 0 length files to local transports.

Show diffs side-by-side

added added

removed removed

Lines of Context:
204
204
        except (IOError, OSError),e:
205
205
            self._translate_error(e, path)
206
206
        try:
207
 
            fp.write(bytes)
 
207
            if bytes:
 
208
                fp.write(bytes)
208
209
            fp.commit()
209
210
        finally:
210
211
            fp.close()
285
286
    def put_bytes_non_atomic(self, relpath, bytes, mode=None,
286
287
                             create_parent_dir=False, dir_mode=None):
287
288
        def writer(fd):
288
 
            os.write(fd, bytes)
 
289
            if bytes:
 
290
                os.write(fd, bytes)
289
291
        self._put_non_atomic_helper(relpath, writer, mode=mode,
290
292
                                    create_parent_dir=create_parent_dir,
291
293
                                    dir_mode=dir_mode)
370
372
        file_abspath, fd = self._get_append_file(relpath, mode=mode)
371
373
        try:
372
374
            result = self._check_mode_and_size(file_abspath, fd, mode=mode)
373
 
            os.write(fd, bytes)
 
375
            if bytes:
 
376
                os.write(fd, bytes)
374
377
        finally:
375
378
            os.close(fd)
376
379
        return result