~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-08-15 13:49:38 UTC
  • mfrom: (6060.3.1 fix-last-revno-args)
  • Revision ID: pqm@pqm.ubuntu.com-20110815134938-4fuo63g4v2hj8jdt
(jelmer) Cope with the localhost having the name 'localhost' when running
 the test suite. (Jelmer Vernooij)

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