795
790
self._ensure_real()
796
791
self._real_repository.create_bundle(target, base, fileobj, format)
799
def control_weaves(self):
801
return self._real_repository.control_weaves
804
794
def get_ancestry(self, revision_id, topo_sorted=True):
805
795
self._ensure_real()
806
796
return self._real_repository.get_ancestry(revision_id, topo_sorted)
809
def get_inventory_weave(self):
799
def inventories(self):
810
800
self._ensure_real()
811
return self._real_repository.get_inventory_weave()
801
return self._real_repository.inventories
813
803
def fileids_altered_by_revision_ids(self, revision_ids):
814
804
self._ensure_real()
1051
1051
self._ensure_real()
1052
1052
return self._real_repository.pack()
1055
def revisions(self):
1056
"""Decorate the real repository for now.
1058
In the short term this should become a real object to intercept graph
1061
In the long term a full blown network facility is needed.
1064
return self._real_repository.revisions
1054
1066
def set_make_working_trees(self, new_value):
1055
1067
self._ensure_real()
1056
1068
self._real_repository.set_make_working_trees(new_value)
1071
def signatures(self):
1072
"""Decorate the real repository for now.
1074
In the long term a full blown network facility is needed to avoid
1075
creating a real repository object locally.
1078
return self._real_repository.signatures
1058
1080
@needs_write_lock
1059
1081
def sign_revision(self, revision_id, gpg_strategy):
1060
1082
self._ensure_real()
1061
1083
return self._real_repository.sign_revision(revision_id, gpg_strategy)
1087
"""Decorate the real repository for now.
1089
In the long term a full blown network facility is needed to avoid
1090
creating a real repository object locally.
1093
return self._real_repository.texts
1063
1095
@needs_read_lock
1064
1096
def get_revisions(self, revision_ids):
1065
1097
self._ensure_real()
1091
1123
self._ensure_real()
1092
1124
return self._real_repository.has_signature_for_revision_id(revision_id)
1094
def get_data_stream_for_search(self, search):
1095
medium = self._client._medium
1096
if not medium._remote_is_at_least_1_2:
1098
return self._real_repository.get_data_stream_for_search(search)
1099
REQUEST_NAME = 'Repository.stream_revisions_chunked'
1100
path = self.bzrdir._path_for_remote_call(self._client)
1101
body = self._serialise_search_recipe(search.get_recipe())
1103
result = self._client.call_with_body_bytes_expecting_body(
1104
REQUEST_NAME, (path,), body)
1105
response, protocol = result
1106
except errors.UnknownSmartMethod:
1107
# Server does not support this method, so fall back to VFS.
1108
# Worse, we have to force a disconnection, because the server now
1109
# doesn't realise it has a body on the wire to consume, so the
1110
# only way to recover is to abandon the connection.
1112
'Server is too old for streaming pull, reconnecting. '
1113
'(Upgrade the server to Bazaar 1.2 to avoid this)')
1115
# To avoid having to disconnect repeatedly, we keep track of the
1116
# fact the server doesn't understand this remote method.
1117
medium._remote_is_at_least_1_2 = False
1119
return self._real_repository.get_data_stream_for_search(search)
1121
if response == ('ok',):
1122
return self._deserialise_stream(protocol)
1123
if response == ('NoSuchRevision', ):
1124
# We cannot easily identify the revision that is missing in this
1125
# situation without doing much more network IO. For now, bail.
1126
raise NoSuchRevision(self, "unknown")
1128
raise errors.UnexpectedSmartServerResponse(response)
1130
def _deserialise_stream(self, protocol):
1131
stream = protocol.read_streamed_body()
1132
container_parser = ContainerPushParser()
1133
for bytes in stream:
1134
container_parser.accept_bytes(bytes)
1135
records = container_parser.read_pending_records()
1136
for record_names, record_bytes in records:
1137
if len(record_names) != 1:
1138
# These records should have only one name, and that name
1139
# should be a one-element tuple.
1140
raise errors.SmartProtocolError(
1141
'Repository data stream had invalid record name %r'
1143
name_tuple = record_names[0]
1144
yield name_tuple, record_bytes
1146
def insert_data_stream(self, stream):
1148
self._real_repository.insert_data_stream(stream)
1150
1126
def item_keys_introduced_by(self, revision_ids, _files_pb=None):
1151
1127
self._ensure_real()
1152
1128
return self._real_repository.item_keys_introduced_by(revision_ids,