~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Robert Collins
  • Date: 2009-05-12 04:21:17 UTC
  • mto: This revision was merged to the branch mainline in revision 4593.
  • Revision ID: robertc@robertcollins.net-20090512042117-nnqulvunpdh3ecd7
Keep an ancestors dict in check rather than recreating one multiple times.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2387
2387
                [parents_provider, other_repository._make_parents_provider()])
2388
2388
        return graph.Graph(parents_provider)
2389
2389
 
2390
 
    def _get_versioned_file_checker(self, text_key_references=None):
 
2390
    def _get_versioned_file_checker(self, text_key_references=None,
 
2391
        ancestors=None):
2391
2392
        """Return an object suitable for checking versioned files.
2392
2393
        
2393
2394
        :param text_key_references: if non-None, an already built
2395
2396
            to whether they were referred to by the inventory of the
2396
2397
            revision_id that they contain. If None, this will be
2397
2398
            calculated.
 
2399
        :param ancestors: Optional result from
 
2400
            self.get_graph().get_parent_map(self.all_revision_ids()) if already
 
2401
            available.
2398
2402
        """
2399
2403
        return _VersionedFileChecker(self,
2400
 
            text_key_references=text_key_references)
 
2404
            text_key_references=text_key_references, ancestors=ancestors)
2401
2405
 
2402
2406
    def revision_ids_to_search_result(self, result_set):
2403
2407
        """Convert a set of revision ids to a graph SearchResult."""
3889
3893
 
3890
3894
class _VersionedFileChecker(object):
3891
3895
 
3892
 
    def __init__(self, repository, text_key_references=None):
 
3896
    def __init__(self, repository, text_key_references=None, ancestors=None):
3893
3897
        self.repository = repository
3894
3898
        self.text_index = self.repository._generate_text_key_index(
3895
 
            text_key_references=text_key_references)
 
3899
            text_key_references=text_key_references, ancestors=ancestors)
3896
3900
 
3897
3901
    def calculate_file_version_parents(self, text_key):
3898
3902
        """Calculate the correct parents for a file version according to