604
605
self._lock_token = None
605
606
self._lock_count = 0
606
607
self._leave_lock = False
608
# Cache of revision parents; misses are cached during read locks, and
609
# write locks when no _real_repository has been set.
607
610
self._unstacked_provider = graph.CachingParentsProvider(
608
611
get_parent_map=self._get_parent_map_rpc)
609
612
self._unstacked_provider.disable_cache()
685
688
invocation. If in doubt chat to the bzr network team.
687
690
if self._real_repository is None:
691
self._unstacked_provider.missing_keys.clear()
688
692
self.bzrdir._ensure_real()
689
693
self._set_real_repository(
690
694
self.bzrdir._real_bzrdir.open_repository())
750
754
"""Return a source for streaming from this repository."""
751
755
return RemoteStreamSource(self, to_format)
753
758
def has_revision(self, revision_id):
754
"""See Repository.has_revision()."""
755
if revision_id == NULL_REVISION:
756
# The null revision is always present.
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':
764
for fallback_repo in self._fallback_repositories:
765
if fallback_repo.has_revision(revision_id):
759
"""True if this repository has a copy of the revision."""
760
# Copy of bzrlib.repository.Repository.has_revision
761
return revision_id in self.has_revisions((revision_id,))
769
764
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
774
for revision_id in revision_ids:
775
if self.has_revision(revision_id):
776
result.add(revision_id)
765
"""Probe to find out the presence of multiple revisions.
767
:param revision_ids: An iterable of revision_ids.
768
:return: A set of the revision_ids that were present.
770
# Copy of bzrlib.repository.Repository.has_revisions
771
parent_map = self.get_parent_map(revision_ids)
772
result = set(parent_map)
773
if _mod_revision.NULL_REVISION in revision_ids:
774
result.add(_mod_revision.NULL_REVISION)
779
777
def has_same_location(self, other):
897
895
self._leave_lock = False
898
896
self._lock_mode = 'w'
899
897
self._lock_count = 1
900
self._unstacked_provider.enable_cache(cache_misses=False)
898
cache_misses = self._real_repository is None
899
self._unstacked_provider.enable_cache(cache_misses=cache_misses)
901
900
elif self._lock_mode == 'r':
902
901
raise errors.ReadOnlyError(self)
1611
1610
def insert_stream(self, stream, src_format, resume_tokens):
1612
1611
target = self.target_repo
1612
target._unstacked_provider.missing_keys.clear()
1613
1613
if target._lock_token:
1614
1614
verb = 'Repository.insert_stream_locked'
1615
1615
extra_args = (target._lock_token or '',)