/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Robert Collins
  • Date: 2008-01-11 03:54:51 UTC
  • mto: (3172.5.3 remote.graph)
  • mto: This revision was merged to the branch mainline in revision 3176.
  • Revision ID: robertc@robertcollins.net-20080111035451-52at4031ohbmtoh2
Repository has a new method ``has_revisions`` which signals the presence
of many revisions by returning a set of the revisions listed which are
present. This can be done by index queries without reading data for parent
revision names etc. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1020
1020
    @needs_read_lock
1021
1021
    def has_revision(self, revision_id):
1022
1022
        """True if this repository has a copy of the revision."""
1023
 
        if 'evil' in debug.debug_flags:
1024
 
            mutter_callsite(3, "has_revision is a LBYL symptom.")
 
1023
        return revision_id in self.has_revisions((revision_id,))
 
1024
 
 
1025
    def has_revisions(self, revision_ids):
 
1026
        """Probe to find out the presence of multiple revisions.
 
1027
 
 
1028
        :param revision_ids: An iterable of revision_ids.
 
1029
        :return: A set of the revision_ids that were present.
 
1030
        """
 
1031
        raise NotImplementedError(self.has_revisions)
 
1032
 
1025
1033
        return self._revision_store.has_revision_id(revision_id,
1026
1034
                                                    self.get_transaction())
1027
1035
 
2650
2658
            graph = self.source.get_graph()
2651
2659
            missing_revs = set()
2652
2660
            searcher = graph._make_breadth_first_searcher([revision_id])
2653
 
            target_index = \
2654
 
                self.target._pack_collection.revision_index.combined_index
2655
2661
            null_set = frozenset([_mod_revision.NULL_REVISION])
2656
2662
            while True:
2657
2663
                try:
2659
2665
                except StopIteration:
2660
2666
                    break
2661
2667
                next_revs.difference_update(null_set)
2662
 
                target_keys = [(key,) for key in next_revs]
2663
 
                have_revs = frozenset(node[1][0] for node in
2664
 
                    target_index.iter_entries(target_keys))
 
2668
                have_revs = self.target.has_revisions(next_revs)
2665
2669
                missing_revs.update(next_revs - have_revs)
2666
2670
                searcher.stop_searching_any(have_revs)
2667
2671
            if next_revs - have_revs == set([revision_id]):