691
691
"""RemoteRepositories never create working trees by default."""
694
def revision_ids_to_search_result(self, result_set):
695
"""Convert a set of revision ids to a graph SearchResult."""
696
result_parents = set()
697
for parents in self.get_graph().get_parent_map(
698
result_set).itervalues():
699
result_parents.update(parents)
700
included_keys = result_set.intersection(result_parents)
701
start_keys = result_set.difference(included_keys)
702
exclude_keys = result_parents.difference(result_set)
703
result = graph.SearchResult(start_keys, exclude_keys,
704
len(result_set), result_set)
708
def search_missing_revision_ids(self, other, revision_id=None, find_ghosts=True):
709
"""Return the revision ids that other has that this does not.
711
These are returned in topological order.
713
revision_id: only return revision ids included by revision_id.
715
return repository.InterRepository.get(
716
other, self).search_missing_revision_ids(revision_id, find_ghosts)
694
718
def fetch(self, source, revision_id=None, pb=None):
695
719
if self.has_same_location(source):
696
720
# check that last_revision is in 'from' and then return a
941
965
self._ensure_real()
942
966
return self._real_repository.has_signature_for_revision_id(revision_id)
944
def get_data_stream(self, revision_ids):
968
def get_data_stream_for_search(self, search):
945
969
REQUEST_NAME = 'Repository.stream_revisions_chunked'
946
970
path = self.bzrdir._path_for_remote_call(self._client)
947
response, protocol = self._client.call_expecting_body(
948
REQUEST_NAME, path, *revision_ids)
971
recipe = search.get_recipe()
972
start_keys = ' '.join(recipe[0])
973
stop_keys = ' '.join(recipe[1])
974
count = str(recipe[2])
975
body = '\n'.join((start_keys, stop_keys, count))
976
response, protocol = self._client.call_with_body_bytes_expecting_body(
977
REQUEST_NAME, (path,), body)
950
979
if response == ('ok',):
951
980
return self._deserialise_stream(protocol)
981
if response == ('NoSuchRevision', ):
982
# We cannot easily identify the revision that is missing in this
983
# situation without doing much more network IO. For now, bail.
984
raise NoSuchRevision(self, "unknown")
952
985
elif (response == ('error', "Generic bzr smart protocol error: "
953
986
"bad request '%s'" % REQUEST_NAME) or
954
987
response == ('error', "Generic bzr smart protocol error: "
955
988
"bad request u'%s'" % REQUEST_NAME)):
956
989
protocol.cancel_read_body()
957
990
self._ensure_real()
958
return self._real_repository.get_data_stream(revision_ids)
991
return self._real_repository.get_data_stream_for_search(search)
960
993
raise errors.UnexpectedSmartServerResponse(response)