756
758
expected_chk_roots)
757
759
missing_chk_roots = expected_chk_roots.difference(present_chk_roots)
758
760
if missing_chk_roots:
759
problems.append("missing referenced chk root keys: %s"
762
"missing referenced chk root keys: %s."
763
"Run 'bzr reconcile --canonicalize-chks' on the affected "
760
765
% (sorted(missing_chk_roots),))
761
766
# Don't bother checking any further.
953
958
basis_tree = self.revision_tree(basis_revision_id)
954
959
basis_tree.lock_read()
955
basis_inv = basis_tree.inventory
960
basis_inv = basis_tree.root_inventory
957
962
result = basis_inv.create_by_apply_delta(delta, new_revision_id,
958
963
propagate_caches=propagate_caches)
978
983
if record.storage_kind != 'absent':
979
984
texts[record.key] = record.get_bytes_as('fulltext')
981
raise errors.NoSuchRevision(self, record.key)
986
texts[record.key] = None
983
yield inventory.CHKInventory.deserialise(self.chk_bytes, texts[key], key)
990
yield (None, key[-1])
992
yield (inventory.CHKInventory.deserialise(
993
self.chk_bytes, bytes, key), key[-1])
985
def _iter_inventory_xmls(self, revision_ids, ordering):
995
def _get_inventory_xml(self, revision_id):
996
"""Get serialized inventory as a string."""
986
997
# Without a native 'xml' inventory, this method doesn't make sense.
987
998
# However older working trees, and older bundles want it - so we supply
988
999
# it allowing _get_inventory_xml to work. Bundles currently use the
989
1000
# serializer directly; this also isn't ideal, but there isn't an xml
990
# iteration interface offered at all for repositories. We could make
991
# _iter_inventory_xmls be part of the contract, even if kept private.
992
inv_to_str = self._serializer.write_inventory_to_string
993
for inv in self.iter_inventories(revision_ids, ordering=ordering):
994
yield inv_to_str(inv), inv.revision_id
1001
# iteration interface offered at all for repositories.
1002
return self._serializer.write_inventory_to_string(
1003
self.get_inventory(revision_id))
996
1005
def _find_present_inventory_keys(self, revision_keys):
997
1006
parent_map = self.inventories.get_parent_map(revision_keys)
1261
1270
yield (stream_info[0],
1262
1271
wrap_and_count(pb, rc, stream_info[1]))
1263
1272
self._revision_keys = [(rev_id,) for rev_id in revision_ids]
1264
self.from_repository.revisions.clear_cache()
1265
self.from_repository.signatures.clear_cache()
1266
s = self._get_inventory_stream(self._revision_keys)
1267
yield (s[0], wrap_and_count(pb, rc, s[1]))
1268
self.from_repository.inventories.clear_cache()
1269
1273
# TODO: The keys to exclude might be part of the search recipe
1270
1274
# For now, exclude all parents that are at the edge of ancestry, for
1271
1275
# which we have inventories
1272
1276
from_repo = self.from_repository
1273
1277
parent_keys = from_repo._find_parent_keys_of_revisions(
1274
1278
self._revision_keys)
1279
self.from_repository.revisions.clear_cache()
1280
self.from_repository.signatures.clear_cache()
1281
# Clear the repo's get_parent_map cache too.
1282
self.from_repository._unstacked_provider.disable_cache()
1283
self.from_repository._unstacked_provider.enable_cache()
1284
s = self._get_inventory_stream(self._revision_keys)
1285
yield (s[0], wrap_and_count(pb, rc, s[1]))
1286
self.from_repository.inventories.clear_cache()
1275
1287
for stream_info in self._get_filtered_chk_streams(parent_keys):
1276
1288
yield (stream_info[0], wrap_and_count(pb, rc, stream_info[1]))
1277
1289
self.from_repository.chk_bytes.clear_cache()
1374
1386
pack_compresses = True
1376
1388
def _get_matching_bzrdir(self):
1377
return bzrdir.format_registry.make_bzrdir('2a')
1389
return controldir.format_registry.make_bzrdir('2a')
1379
1391
def _ignore_setting_bzrdir(self, format):
1382
1394
_matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
1384
def get_format_string(self):
1397
def get_format_string(cls):
1385
1398
return ('Bazaar repository format 2a (needs bzr 1.16 or later)\n')
1387
1400
def get_format_description(self):
1398
1411
def _get_matching_bzrdir(self):
1399
return bzrdir.format_registry.make_bzrdir('development-subtree')
1412
return controldir.format_registry.make_bzrdir('development-subtree')
1401
1414
def _ignore_setting_bzrdir(self, format):
1404
1417
_matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
1406
def get_format_string(self):
1420
def get_format_string(cls):
1407
1421
return ('Bazaar development format 8\n')
1409
1423
def get_format_description(self):