~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/pack_repo.py

CombinedGraphIndex can now reload when calling key_count().

Show diffs side-by-side

added added

removed removed

Lines of Context:
452
452
    # XXX: Probably 'can be written to' could/should be separated from 'acts
453
453
    # like a knit index' -- mbp 20071024
454
454
 
455
 
    def __init__(self):
456
 
        """Create an AggregateIndex."""
 
455
    def __init__(self, reload_func=None):
 
456
        """Create an AggregateIndex.
 
457
 
 
458
        :param reload_func: A function to call if we find we are missing an
 
459
            index. Should have the form reload_func() => True/False to indicate
 
460
            if reloading actually changed anything.
 
461
        """
 
462
        self._reload_func = reload_func
457
463
        self.index_to_pack = {}
458
 
        self.combined_index = CombinedGraphIndex([])
 
464
        self.combined_index = CombinedGraphIndex([], reload_func=reload_func)
459
465
        self.data_access = _DirectPackAccess(self.index_to_pack)
460
466
        self.add_callback = None
461
467