2229
2231
self._ensure_real()
2230
2232
return self._real_repository.texts
2234
def _iter_revisions_rpc(self, revision_ids):
2235
body = "\n".join(revision_ids)
2236
path = self.bzrdir._path_for_remote_call(self._client)
2237
response_tuple, response_handler = (
2238
self._call_with_body_bytes_expecting_body(
2239
"Repository.iter_revisions", (path, ), body))
2240
if response_tuple[0] != "ok":
2241
raise errors.UnexpectedSmartServerResponse(response_tuple)
2242
serializer_format = response_tuple[1]
2243
serializer = serializer_format_registry.get(serializer_format)
2244
byte_stream = response_handler.read_streamed_body()
2245
decompressor = zlib.decompressobj()
2247
for bytes in byte_stream:
2248
chunks.append(decompressor.decompress(bytes))
2249
if decompressor.unused_data != "":
2250
chunks.append(decompressor.flush())
2251
yield serializer.read_revision_from_string("".join(chunks))
2252
unused = decompressor.unused_data
2253
decompressor = zlib.decompressobj()
2254
chunks = [decompressor.decompress(unused)]
2255
chunks.append(decompressor.flush())
2256
text = "".join(chunks)
2258
yield serializer.read_revision_from_string("".join(chunks))
2232
2260
@needs_read_lock
2233
2261
def get_revisions(self, revision_ids):
2235
return self._real_repository.get_revisions(revision_ids)
2262
if revision_ids is None:
2263
revision_ids = self.all_revision_ids()
2265
for rev_id in revision_ids:
2266
if not rev_id or not isinstance(rev_id, basestring):
2267
raise errors.InvalidRevisionId(
2268
revision_id=rev_id, branch=self)
2270
missing = set(revision_ids)
2272
for rev in self._iter_revisions_rpc(revision_ids):
2273
missing.remove(rev.revision_id)
2274
revs[rev.revision_id] = rev
2275
except errors.UnknownSmartMethod:
2277
return self._real_repository.get_revisions(revision_ids)
2278
for fallback in self._fallback_repositories:
2281
for revid in list(missing):
2282
# XXX JRV 2011-11-20: It would be nice if there was a
2283
# public method on Repository that could be used to query
2284
# for revision objects *without* failing completely if one
2285
# was missing. There is VersionedFileRepository._iter_revisions,
2286
# but unfortunately that's private and not provided by
2287
# all repository implementations.
2289
revs[revid] = fallback.get_revision(revid)
2290
except errors.NoSuchRevision:
2293
missing.remove(revid)
2295
raise errors.NoSuchRevision(self, list(missing)[0])
2296
return [revs[revid] for revid in revision_ids]
2237
2298
def supports_rich_root(self):
2238
2299
return self._format.rich_root_data