~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/knit.py

  • Committer: John Arbash Meinel
  • Date: 2006-09-05 19:58:39 UTC
  • mto: (1946.2.8 reduce-knit-churn)
  • mto: This revision was merged to the branch mainline in revision 1988.
  • Revision ID: john@arbash-meinel.com-20060905195839-307783fb130a341c
avoid some deprecation warnings in other parts of the code

Show diffs side-by-side

added added

removed removed

Lines of Context:
403
403
        """See VersionedFile.copy_to()."""
404
404
        # copy the current index to a temp index to avoid racing with local
405
405
        # writes
406
 
        transport.put(name + INDEX_SUFFIX + '.tmp', self.transport.get(self._index._filename),)
 
406
        transport.put_file(name + INDEX_SUFFIX + '.tmp',
 
407
                           self.transport.get(self._index._filename))
407
408
        # copy the data file
408
409
        f = self._data._open_file()
409
410
        try:
410
 
            transport.put(name + DATA_SUFFIX, f)
 
411
            transport.put_file(name + DATA_SUFFIX, f)
411
412
        finally:
412
413
            f.close()
413
414
        # move the copied index into place
414
415
        transport.move(name + INDEX_SUFFIX + '.tmp', name + INDEX_SUFFIX)
415
416
 
416
417
    def create_empty(self, name, transport, mode=None):
417
 
        return KnitVersionedFile(name, transport, factory=self.factory, delta=self.delta, create=True)
 
418
        return KnitVersionedFile(name, transport, factory=self.factory,
 
419
                                 delta=self.delta, create=True)
418
420
    
419
421
    def _fix_parents(self, version, new_parents):
420
422
        """Fix the parents list for version.
1308
1310
        self._cache = {}
1309
1311
        self._do_cache = False
1310
1312
        if create:
1311
 
            self._transport.put(self._filename, StringIO(''), mode=file_mode)
 
1313
            self._transport.put_bytes(self._filename, '', mode=file_mode)
1312
1314
 
1313
1315
    def enable_cache(self):
1314
1316
        """Enable caching of reads."""