~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: 2009-03-25 02:03:41 UTC
  • mfrom: (4187.3.6 remote-pack-hack)
  • Revision ID: pqm@pqm.ubuntu.com-20090325020341-dmq0yek061gtungf
(andrew) Buffer writes when pushing to a pack repository on a
        pre-1.12 smart server.

Show diffs side-by-side

added added

removed removed

Lines of Context:
532
532
    # XXX: Probably 'can be written to' could/should be separated from 'acts
533
533
    # like a knit index' -- mbp 20071024
534
534
 
535
 
    def __init__(self, reload_func=None):
 
535
    def __init__(self, reload_func=None, flush_func=None):
536
536
        """Create an AggregateIndex.
537
537
 
538
538
        :param reload_func: A function to call if we find we are missing an
543
543
        self.index_to_pack = {}
544
544
        self.combined_index = CombinedGraphIndex([], reload_func=reload_func)
545
545
        self.data_access = _DirectPackAccess(self.index_to_pack,
546
 
                                             reload_func=reload_func)
 
546
                                             reload_func=reload_func,
 
547
                                             flush_func=flush_func)
547
548
        self.add_callback = None
548
549
 
549
550
    def replace_indices(self, index_to_pack, indices):
1322
1323
        # when a pack is being created by this object, the state of that pack.
1323
1324
        self._new_pack = None
1324
1325
        # aggregated revision index data
1325
 
        self.revision_index = AggregateIndex(self.reload_pack_names)
1326
 
        self.inventory_index = AggregateIndex(self.reload_pack_names)
1327
 
        self.text_index = AggregateIndex(self.reload_pack_names)
1328
 
        self.signature_index = AggregateIndex(self.reload_pack_names)
 
1326
        flush = self._flush_new_pack
 
1327
        self.revision_index = AggregateIndex(self.reload_pack_names, flush)
 
1328
        self.inventory_index = AggregateIndex(self.reload_pack_names, flush)
 
1329
        self.text_index = AggregateIndex(self.reload_pack_names, flush)
 
1330
        self.signature_index = AggregateIndex(self.reload_pack_names, flush)
1329
1331
        # resumed packs
1330
1332
        self._resumed_packs = []
1331
1333
 
1452
1454
        for revision_count, packs in pack_operations:
1453
1455
            self._obsolete_packs(packs)
1454
1456
 
 
1457
    def _flush_new_pack(self):
 
1458
        if self._new_pack is not None:
 
1459
            self._new_pack.flush()
 
1460
 
1455
1461
    def lock_names(self):
1456
1462
        """Acquire the mutex around the pack-names index.
1457
1463