~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/pack_repo.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-07-15 10:34:59 UTC
  • mfrom: (6026.1.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20110715103459-a8mns59n9cqptdn5
(vila) Merge 2.4 into trunk (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
from bzrlib import (
26
26
    chk_map,
27
27
    cleanup,
28
 
    config,
29
28
    debug,
30
29
    graph,
31
30
    osutils,
479
478
        # visible is smaller.  On the other hand none will be seen until
480
479
        # they're in the names list.
481
480
        self.index_sizes = [None, None, None, None]
482
 
        self._write_index('revision', self.revision_index, 'revision',
483
 
            suspend)
 
481
        self._write_index('revision', self.revision_index, 'revision', suspend)
484
482
        self._write_index('inventory', self.inventory_index, 'inventory',
485
483
            suspend)
486
484
        self._write_index('text', self.text_index, 'file texts', suspend)
490
488
            self.index_sizes.append(None)
491
489
            self._write_index('chk', self.chk_index,
492
490
                'content hash bytes', suspend)
493
 
        self.write_stream.close(
494
 
            want_fdatasync=self._pack_collection.config_stack.get('repository.fdatasync'))
 
491
        self.write_stream.close()
495
492
        # Note that this will clobber an existing pack with the same name,
496
493
        # without checking for hash collisions. While this is undesirable this
497
494
        # is something that can be rectified in a subsequent release. One way
540
537
            transport = self.upload_transport
541
538
        else:
542
539
            transport = self.index_transport
543
 
        index_tempfile = index.finish()
544
 
        index_bytes = index_tempfile.read()
545
 
        write_stream = transport.open_write_stream(index_name,
546
 
            mode=self._file_mode)
547
 
        write_stream.write(index_bytes)
548
 
        write_stream.close(
549
 
            want_fdatasync=self._pack_collection.config_stack.get('repository.fdatasync'))
550
 
        self.index_sizes[self.index_offset(index_type)] = len(index_bytes)
 
540
        self.index_sizes[self.index_offset(index_type)] = transport.put_file(
 
541
            index_name, index.finish(), mode=self._file_mode)
551
542
        if 'pack' in debug.debug_flags:
552
543
            # XXX: size might be interesting?
553
544
            mutter('%s: create_pack: wrote %s index: %s%s t+%6.3fs',
831
822
                set(all_combined).difference([combined_idx]))
832
823
        # resumed packs
833
824
        self._resumed_packs = []
834
 
        self.config_stack = config.LocationStack(self.transport.base)
835
825
 
836
826
    def __repr__(self):
837
827
        return '%s(%r)' % (self.__class__.__name__, self.repo)