/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/remote.py

  • Committer: Robert Collins
  • Date: 2009-04-28 05:29:04 UTC
  • mto: This revision was merged to the branch mainline in revision 4319.
  • Revision ID: robertc@robertcollins.net-20090428052904-sttkmasfldpxlq2m
Change RemoteRepository.has_revision to use get_parent_map to leverage the caching.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
    pack,
31
31
    repository,
32
32
    revision,
 
33
    revision as _mod_revision,
33
34
    symbol_versioning,
34
35
    urlutils,
35
36
)
750
751
        """Return a source for streaming from this repository."""
751
752
        return RemoteStreamSource(self, to_format)
752
753
 
 
754
    @needs_read_lock
753
755
    def has_revision(self, revision_id):
754
 
        """See Repository.has_revision()."""
755
 
        if revision_id == NULL_REVISION:
756
 
            # The null revision is always present.
757
 
            return True
758
 
        path = self.bzrdir._path_for_remote_call(self._client)
759
 
        response = self._call('Repository.has_revision', path, revision_id)
760
 
        if response[0] not in ('yes', 'no'):
761
 
            raise errors.UnexpectedSmartServerResponse(response)
762
 
        if response[0] == 'yes':
763
 
            return True
764
 
        for fallback_repo in self._fallback_repositories:
765
 
            if fallback_repo.has_revision(revision_id):
766
 
                return True
767
 
        return False
 
756
        """True if this repository has a copy of the revision."""
 
757
        # Copy of bzrlib.repository.Repository.has_revision
 
758
        return revision_id in self.has_revisions((revision_id,))
768
759
 
 
760
    @needs_read_lock
769
761
    def has_revisions(self, revision_ids):
770
 
        """See Repository.has_revisions()."""
771
 
        # FIXME: This does many roundtrips, particularly when there are
772
 
        # fallback repositories.  -- mbp 20080905
773
 
        result = set()
774
 
        for revision_id in revision_ids:
775
 
            if self.has_revision(revision_id):
776
 
                result.add(revision_id)
 
762
        """Probe to find out the presence of multiple revisions.
 
763
 
 
764
        :param revision_ids: An iterable of revision_ids.
 
765
        :return: A set of the revision_ids that were present.
 
766
        """
 
767
        # Copy of bzrlib.repository.Repository.has_revisions
 
768
        parent_map = self.get_parent_map(revision_ids)
 
769
        result = set(parent_map)
 
770
        if _mod_revision.NULL_REVISION in revision_ids:
 
771
            result.add(_mod_revision.NULL_REVISION)
777
772
        return result
778
773
 
779
774
    def has_same_location(self, other):