768
763
self._ensure_real()
769
764
self._real_repository.create_bundle(target, base, fileobj, format)
772
def control_weaves(self):
774
return self._real_repository.control_weaves
777
767
def get_ancestry(self, revision_id, topo_sorted=True):
778
768
self._ensure_real()
779
769
return self._real_repository.get_ancestry(revision_id, topo_sorted)
782
def get_inventory_weave(self):
772
def inventories(self):
783
773
self._ensure_real()
784
return self._real_repository.get_inventory_weave()
774
return self._real_repository.inventories
786
776
def fileids_altered_by_revision_ids(self, revision_ids):
787
777
self._ensure_real()
1020
1020
self._ensure_real()
1021
1021
return self._real_repository.pack()
1024
def revisions(self):
1025
"""Decorate the real repository for now.
1027
In the short term this should become a real object to intercept graph
1030
In the long term a full blown network facility is needed.
1033
return self._real_repository.revisions
1023
1035
def set_make_working_trees(self, new_value):
1024
1036
self._ensure_real()
1025
1037
self._real_repository.set_make_working_trees(new_value)
1040
def signatures(self):
1041
"""Decorate the real repository for now.
1043
In the long term a full blown network facility is needed to avoid
1044
creating a real repository object locally.
1047
return self._real_repository.signatures
1027
1049
@needs_write_lock
1028
1050
def sign_revision(self, revision_id, gpg_strategy):
1029
1051
self._ensure_real()
1030
1052
return self._real_repository.sign_revision(revision_id, gpg_strategy)
1056
"""Decorate the real repository for now.
1058
In the long term a full blown network facility is needed to avoid
1059
creating a real repository object locally.
1062
return self._real_repository.texts
1032
1064
@needs_read_lock
1033
1065
def get_revisions(self, revision_ids):
1034
1066
self._ensure_real()
1060
1092
self._ensure_real()
1061
1093
return self._real_repository.has_signature_for_revision_id(revision_id)
1063
def get_data_stream_for_search(self, search):
1064
medium = self._client._medium
1065
if not medium._remote_is_at_least_1_2:
1067
return self._real_repository.get_data_stream_for_search(search)
1068
REQUEST_NAME = 'Repository.stream_revisions_chunked'
1069
path = self.bzrdir._path_for_remote_call(self._client)
1070
body = self._serialise_search_recipe(search.get_recipe())
1072
result = self._client.call_with_body_bytes_expecting_body(
1073
REQUEST_NAME, (path,), body)
1074
response, protocol = result
1075
except errors.UnknownSmartMethod:
1076
# Server does not support this method, so fall back to VFS.
1077
# Worse, we have to force a disconnection, because the server now
1078
# doesn't realise it has a body on the wire to consume, so the
1079
# only way to recover is to abandon the connection.
1081
'Server is too old for streaming pull, reconnecting. '
1082
'(Upgrade the server to Bazaar 1.2 to avoid this)')
1084
# To avoid having to disconnect repeatedly, we keep track of the
1085
# fact the server doesn't understand this remote method.
1086
medium._remote_is_at_least_1_2 = False
1088
return self._real_repository.get_data_stream_for_search(search)
1090
if response == ('ok',):
1091
return self._deserialise_stream(protocol)
1092
if response == ('NoSuchRevision', ):
1093
# We cannot easily identify the revision that is missing in this
1094
# situation without doing much more network IO. For now, bail.
1095
raise NoSuchRevision(self, "unknown")
1097
raise errors.UnexpectedSmartServerResponse(response)
1099
def _deserialise_stream(self, protocol):
1100
stream = protocol.read_streamed_body()
1101
container_parser = ContainerPushParser()
1102
for bytes in stream:
1103
container_parser.accept_bytes(bytes)
1104
records = container_parser.read_pending_records()
1105
for record_names, record_bytes in records:
1106
if len(record_names) != 1:
1107
# These records should have only one name, and that name
1108
# should be a one-element tuple.
1109
raise errors.SmartProtocolError(
1110
'Repository data stream had invalid record name %r'
1112
name_tuple = record_names[0]
1113
yield name_tuple, record_bytes
1115
def insert_data_stream(self, stream):
1117
self._real_repository.insert_data_stream(stream)
1119
1095
def item_keys_introduced_by(self, revision_ids, _files_pb=None):
1120
1096
self._ensure_real()
1121
1097
return self._real_repository.item_keys_introduced_by(revision_ids,