2245
2247
self._ensure_real()
2246
2248
return self._real_repository.texts
2250
def _iter_revisions_rpc(self, revision_ids):
2251
body = "\n".join(revision_ids)
2252
path = self.bzrdir._path_for_remote_call(self._client)
2253
response_tuple, response_handler = (
2254
self._call_with_body_bytes_expecting_body(
2255
"Repository.iter_revisions", (path, ), body))
2256
if response_tuple[0] != "ok":
2257
raise errors.UnexpectedSmartServerResponse(response_tuple)
2258
serializer_format = response_tuple[1]
2259
serializer = serializer_format_registry.get(serializer_format)
2260
byte_stream = response_handler.read_streamed_body()
2261
decompressor = zlib.decompressobj()
2263
for bytes in byte_stream:
2264
chunks.append(decompressor.decompress(bytes))
2265
if decompressor.unused_data != "":
2266
chunks.append(decompressor.flush())
2267
yield serializer.read_revision_from_string("".join(chunks))
2268
unused = decompressor.unused_data
2269
decompressor = zlib.decompressobj()
2270
chunks = [decompressor.decompress(unused)]
2271
chunks.append(decompressor.flush())
2272
text = "".join(chunks)
2274
yield serializer.read_revision_from_string("".join(chunks))
2248
2276
@needs_read_lock
2249
2277
def get_revisions(self, revision_ids):
2251
return self._real_repository.get_revisions(revision_ids)
2278
if revision_ids is None:
2279
revision_ids = self.all_revision_ids()
2281
for rev_id in revision_ids:
2282
if not rev_id or not isinstance(rev_id, basestring):
2283
raise errors.InvalidRevisionId(
2284
revision_id=rev_id, branch=self)
2286
missing = set(revision_ids)
2288
for rev in self._iter_revisions_rpc(revision_ids):
2289
missing.remove(rev.revision_id)
2290
revs[rev.revision_id] = rev
2291
except errors.UnknownSmartMethod:
2293
return self._real_repository.get_revisions(revision_ids)
2294
for fallback in self._fallback_repositories:
2297
for revid in list(missing):
2298
# XXX JRV 2011-11-20: It would be nice if there was a
2299
# public method on Repository that could be used to query
2300
# for revision objects *without* failing completely if one
2301
# was missing. There is VersionedFileRepository._iter_revisions,
2302
# but unfortunately that's private and not provided by
2303
# all repository implementations.
2305
revs[revid] = fallback.get_revision(revid)
2306
except errors.NoSuchRevision:
2309
missing.remove(revid)
2311
raise errors.NoSuchRevision(self, list(missing)[0])
2312
return [revs[revid] for revid in revision_ids]
2253
2314
def supports_rich_root(self):
2254
2315
return self._format.rich_root_data