603
557
return new_pack.data_inserted() and self._data_changed
606
class GCCHKCanonicalizingPacker(GCCHKPacker):
607
"""A packer that ensures inventories have canonical-form CHK maps.
609
Ideally this would be part of reconcile, but it's very slow and rarely
610
needed. (It repairs repositories affected by
611
https://bugs.launchpad.net/bzr/+bug/522637).
614
def __init__(self, *args, **kwargs):
615
super(GCCHKCanonicalizingPacker, self).__init__(*args, **kwargs)
616
self._data_changed = False
618
def _exhaust_stream(self, source_vf, keys, message, vf_to_stream, pb_offset):
619
"""Create and exhaust a stream, but don't insert it.
621
This is useful to get the side-effects of generating a stream.
623
self.pb.update('scanning %s' % (message,), pb_offset)
624
with ui.ui_factory.nested_progress_bar() as child_pb:
625
list(vf_to_stream(source_vf, keys, message, child_pb))
627
def _copy_inventory_texts(self):
628
source_vf, target_vf = self._build_vfs('inventory', True, True)
629
source_chk_vf, target_chk_vf = self._get_chk_vfs_for_copy()
630
inventory_keys = source_vf.keys()
631
# First, copy the existing CHKs on the assumption that most of them
632
# will be correct. This will save us from having to reinsert (and
633
# recompress) these records later at the cost of perhaps preserving a
635
# (Iterate but don't insert _get_filtered_inv_stream to populate the
636
# variables needed by GCCHKPacker._copy_chk_texts.)
637
self._exhaust_stream(source_vf, inventory_keys, 'inventories',
638
self._get_filtered_inv_stream, 2)
639
GCCHKPacker._copy_chk_texts(self)
640
# Now copy and fix the inventories, and any regenerated CHKs.
642
def chk_canonicalizing_inv_stream(source_vf, keys, message, pb=None):
643
return self._get_filtered_canonicalizing_inv_stream(
644
source_vf, keys, message, pb, source_chk_vf, target_chk_vf)
645
self._copy_stream(source_vf, target_vf, inventory_keys,
646
'inventories', chk_canonicalizing_inv_stream, 4)
648
def _copy_chk_texts(self):
649
# No-op; in this class this happens during _copy_inventory_texts.
652
def _get_filtered_canonicalizing_inv_stream(self, source_vf, keys, message,
653
pb=None, source_chk_vf=None, target_chk_vf=None):
654
"""Filter the texts of inventories, regenerating CHKs to make sure they
657
total_keys = len(keys)
658
target_chk_vf = versionedfile.NoDupeAddLinesDecorator(target_chk_vf)
660
def _filtered_inv_stream():
661
stream = source_vf.get_record_stream(keys, 'groupcompress', True)
662
search_key_name = None
663
for idx, record in enumerate(stream):
664
# Inventories should always be with revisions; assume success.
665
lines = record.get_bytes_as('lines')
666
chk_inv = inventory.CHKInventory.deserialise(
667
source_chk_vf, lines, record.key)
669
pb.update('inv', idx, total_keys)
670
chk_inv.id_to_entry._ensure_root()
671
if search_key_name is None:
672
# Find the name corresponding to the search_key_func
673
search_key_reg = chk_map.search_key_registry
674
for search_key_name, func in viewitems(search_key_reg):
675
if func == chk_inv.id_to_entry._search_key_func:
677
canonical_inv = inventory.CHKInventory.from_inventory(
678
target_chk_vf, chk_inv,
679
maximum_size=chk_inv.id_to_entry._root_node._maximum_size,
680
search_key_name=search_key_name)
681
if chk_inv.id_to_entry.key() != canonical_inv.id_to_entry.key():
683
'Non-canonical CHK map for id_to_entry of inv: %s '
684
'(root is %s, should be %s)' % (chk_inv.revision_id,
685
chk_inv.id_to_entry.key()[
687
canonical_inv.id_to_entry.key()[0]))
688
self._data_changed = True
689
p_id_map = chk_inv.parent_id_basename_to_file_id
690
p_id_map._ensure_root()
691
canon_p_id_map = canonical_inv.parent_id_basename_to_file_id
692
if p_id_map.key() != canon_p_id_map.key():
694
'Non-canonical CHK map for parent_id_to_basename of '
695
'inv: %s (root is %s, should be %s)'
696
% (chk_inv.revision_id, p_id_map.key()[0],
697
canon_p_id_map.key()[0]))
698
self._data_changed = True
699
yield versionedfile.ChunkedContentFactory(
700
record.key, record.parents, record.sha1, canonical_inv.to_lines(),
701
chunks_are_lines=True)
702
# We have finished processing all of the inventory records, we
703
# don't need these sets anymore
704
return _filtered_inv_stream()
706
def _use_pack(self, new_pack):
707
"""Override _use_pack to check for reconcile having changed content."""
708
return new_pack.data_inserted() and self._data_changed
711
560
class GCRepositoryPackCollection(RepositoryPackCollection):
713
562
pack_factory = GCPack
714
563
resumed_pack_factory = ResumedGCPack
715
normal_packer_class = GCCHKPacker
716
optimising_packer_class = GCCHKPacker
718
def _check_new_inventories(self):
719
"""Detect missing inventories or chk root entries for the new revisions
722
:returns: list of strs, summarising any problems found. If the list is
723
empty no problems were found.
565
def _execute_pack_operations(self, pack_operations,
566
_packer_class=GCCHKPacker,
568
"""Execute a series of pack operations.
570
:param pack_operations: A list of [revision_count, packs_to_combine].
571
:param _packer_class: The class of packer to use (default: Packer).
725
# Ensure that all revisions added in this write group have:
726
# - corresponding inventories,
727
# - chk root entries for those inventories,
728
# - and any present parent inventories have their chk root
730
# And all this should be independent of any fallback repository.
732
key_deps = self.repo.revisions._index._key_dependencies
733
new_revisions_keys = key_deps.get_new_keys()
734
no_fallback_inv_index = self.repo.inventories._index
735
no_fallback_chk_bytes_index = self.repo.chk_bytes._index
736
no_fallback_texts_index = self.repo.texts._index
737
inv_parent_map = no_fallback_inv_index.get_parent_map(
739
# Are any inventories for corresponding to the new revisions missing?
740
corresponding_invs = set(inv_parent_map)
741
missing_corresponding = set(new_revisions_keys)
742
missing_corresponding.difference_update(corresponding_invs)
743
if missing_corresponding:
744
problems.append("inventories missing for revisions %s" %
745
(sorted(missing_corresponding),))
747
# Are any chk root entries missing for any inventories? This includes
748
# any present parent inventories, which may be used when calculating
749
# deltas for streaming.
750
all_inv_keys = set(corresponding_invs)
751
for parent_inv_keys in viewvalues(inv_parent_map):
752
all_inv_keys.update(parent_inv_keys)
753
# Filter out ghost parents.
754
all_inv_keys.intersection_update(
755
no_fallback_inv_index.get_parent_map(all_inv_keys))
756
parent_invs_only_keys = all_inv_keys.symmetric_difference(
759
inv_ids = [key[-1] for key in all_inv_keys]
760
parent_invs_only_ids = [key[-1] for key in parent_invs_only_keys]
761
root_key_info = _build_interesting_key_sets(
762
self.repo, inv_ids, parent_invs_only_ids)
763
expected_chk_roots = root_key_info.all_keys()
764
present_chk_roots = no_fallback_chk_bytes_index.get_parent_map(
766
missing_chk_roots = expected_chk_roots.difference(present_chk_roots)
767
if missing_chk_roots:
769
"missing referenced chk root keys: %s."
770
"Run 'brz reconcile --canonicalize-chks' on the affected "
772
% (sorted(missing_chk_roots),))
773
# Don't bother checking any further.
775
# Find all interesting chk_bytes records, and make sure they are
776
# present, as well as the text keys they reference.
777
chk_bytes_no_fallbacks = self.repo.chk_bytes.without_fallbacks()
778
chk_bytes_no_fallbacks._search_key_func = \
779
self.repo.chk_bytes._search_key_func
780
chk_diff = chk_map.iter_interesting_nodes(
781
chk_bytes_no_fallbacks, root_key_info.interesting_root_keys,
782
root_key_info.uninteresting_root_keys)
785
for record in _filter_text_keys(chk_diff, text_keys,
786
chk_map._bytes_to_text_key):
788
except errors.NoSuchRevision as e:
789
# XXX: It would be nice if we could give a more precise error here.
790
problems.append("missing chk node(s) for id_to_entry maps")
791
chk_diff = chk_map.iter_interesting_nodes(
792
chk_bytes_no_fallbacks, root_key_info.interesting_pid_root_keys,
793
root_key_info.uninteresting_pid_root_keys)
795
for interesting_rec, interesting_map in chk_diff:
797
except errors.NoSuchRevision as e:
799
"missing chk node(s) for parent_id_basename_to_file_id maps")
800
present_text_keys = no_fallback_texts_index.get_parent_map(text_keys)
801
missing_text_keys = text_keys.difference(present_text_keys)
802
if missing_text_keys:
803
problems.append("missing text keys: %r"
804
% (sorted(missing_text_keys),))
808
class CHKInventoryRepository(PackRepository):
809
"""subclass of PackRepository that uses CHK based inventories."""
811
def __init__(self, _format, a_controldir, control_files, _commit_builder_class,
574
# XXX: Copied across from RepositoryPackCollection simply because we
575
# want to override the _packer_class ... :(
576
for revision_count, packs in pack_operations:
577
# we may have no-ops from the setup logic
580
packer = GCCHKPacker(self, packs, '.autopack',
581
reload_func=reload_func)
584
except errors.RetryWithNewPacks:
585
# An exception is propagating out of this context, make sure
586
# this packer has cleaned up. Packer() doesn't set its new_pack
587
# state into the RepositoryPackCollection object, so we only
588
# have access to it directly here.
589
if packer.new_pack is not None:
590
packer.new_pack.abort()
593
self._remove_pack_from_memory(pack)
594
# record the newly available packs and stop advertising the old
596
self._save_pack_names(clear_obsolete_packs=True)
597
# Move the old packs out of the way now they are no longer referenced.
598
for revision_count, packs in pack_operations:
599
self._obsolete_packs(packs)
602
class CHKInventoryRepository(KnitPackRepository):
603
"""subclass of KnitPackRepository that uses CHK based inventories."""
605
def __init__(self, _format, a_bzrdir, control_files, _commit_builder_class,
813
607
"""Overridden to change pack collection class."""
814
super(CHKInventoryRepository, self).__init__(_format, a_controldir,
815
control_files, _commit_builder_class, _serializer)
608
KnitPackRepository.__init__(self, _format, a_bzrdir, control_files,
609
_commit_builder_class, _serializer)
610
# and now replace everything it did :)
816
611
index_transport = self._transport.clone('indices')
817
612
self._pack_collection = GCRepositoryPackCollection(self,
818
self._transport, index_transport,
819
self._transport.clone(
821
self._transport.clone(
823
_format.index_builder_class,
825
use_chk_index=self._format.supports_chks,
613
self._transport, index_transport,
614
self._transport.clone('upload'),
615
self._transport.clone('packs'),
616
_format.index_builder_class,
618
use_chk_index=self._format.supports_chks,
827
620
self.inventories = GroupCompressVersionedFiles(
828
621
_GCGraphIndex(self._pack_collection.inventory_index.combined_index,
829
add_callback=self._pack_collection.inventory_index.add_callback,
830
parents=True, is_locked=self.is_locked,
831
inconsistency_fatal=False),
622
add_callback=self._pack_collection.inventory_index.add_callback,
623
parents=True, is_locked=self.is_locked,
624
inconsistency_fatal=False),
832
625
access=self._pack_collection.inventory_index.data_access)
833
626
self.revisions = GroupCompressVersionedFiles(
834
627
_GCGraphIndex(self._pack_collection.revision_index.combined_index,
835
add_callback=self._pack_collection.revision_index.add_callback,
836
parents=True, is_locked=self.is_locked,
837
track_external_parent_refs=True, track_new_keys=True),
628
add_callback=self._pack_collection.revision_index.add_callback,
629
parents=True, is_locked=self.is_locked,
630
track_external_parent_refs=True),
838
631
access=self._pack_collection.revision_index.data_access,
840
633
self.signatures = GroupCompressVersionedFiles(
841
634
_GCGraphIndex(self._pack_collection.signature_index.combined_index,
842
add_callback=self._pack_collection.signature_index.add_callback,
843
parents=False, is_locked=self.is_locked,
844
inconsistency_fatal=False),
635
add_callback=self._pack_collection.signature_index.add_callback,
636
parents=False, is_locked=self.is_locked,
637
inconsistency_fatal=False),
845
638
access=self._pack_collection.signature_index.data_access,
847
640
self.texts = GroupCompressVersionedFiles(
848
641
_GCGraphIndex(self._pack_collection.text_index.combined_index,
849
add_callback=self._pack_collection.text_index.add_callback,
850
parents=True, is_locked=self.is_locked,
851
inconsistency_fatal=False),
642
add_callback=self._pack_collection.text_index.add_callback,
643
parents=True, is_locked=self.is_locked,
644
inconsistency_fatal=False),
852
645
access=self._pack_collection.text_index.data_access)
853
646
# No parents, individual CHK pages don't have specific ancestry
854
647
self.chk_bytes = GroupCompressVersionedFiles(
855
648
_GCGraphIndex(self._pack_collection.chk_index.combined_index,
856
add_callback=self._pack_collection.chk_index.add_callback,
857
parents=False, is_locked=self.is_locked,
858
inconsistency_fatal=False),
649
add_callback=self._pack_collection.chk_index.add_callback,
650
parents=False, is_locked=self.is_locked,
651
inconsistency_fatal=False),
859
652
access=self._pack_collection.chk_index.data_access)
860
653
search_key_name = self._format._serializer.search_key_name
861
654
search_key_func = chk_map.search_key_registry.get(search_key_name)
955
746
raise AssertionError("%r not in write group" % (self,))
956
747
_mod_revision.check_not_reserved_id(new_revision_id)
957
748
basis_tree = None
958
if basis_inv is None or not isinstance(basis_inv, inventory.CHKInventory):
749
if basis_inv is None:
959
750
if basis_revision_id == _mod_revision.NULL_REVISION:
960
751
new_inv = self._create_inv_from_null(delta, new_revision_id)
961
if new_inv.root_id is None:
962
raise errors.RootMissing()
963
752
inv_lines = new_inv.to_lines()
964
753
return self._inventory_add_lines(new_revision_id, parents,
965
inv_lines, check_content=False), new_inv
754
inv_lines, check_content=False), new_inv
967
756
basis_tree = self.revision_tree(basis_revision_id)
968
757
basis_tree.lock_read()
969
basis_inv = basis_tree.root_inventory
758
basis_inv = basis_tree.inventory
971
760
result = basis_inv.create_by_apply_delta(delta, new_revision_id,
972
propagate_caches=propagate_caches)
761
propagate_caches=propagate_caches)
973
762
inv_lines = result.to_lines()
974
763
return self._inventory_add_lines(new_revision_id, parents,
975
inv_lines, check_content=False), result
764
inv_lines, check_content=False), result
977
766
if basis_tree is not None:
978
767
basis_tree.unlock()
980
def _deserialise_inventory(self, revision_id, lines):
981
return inventory.CHKInventory.deserialise(self.chk_bytes, lines,
984
def _iter_inventories(self, revision_ids, ordering):
769
def _iter_inventories(self, revision_ids):
985
770
"""Iterate over many inventory objects."""
987
ordering = 'unordered'
988
771
keys = [(revision_id,) for revision_id in revision_ids]
989
stream = self.inventories.get_record_stream(keys, ordering, True)
772
stream = self.inventories.get_record_stream(keys, 'unordered', True)
991
774
for record in stream:
992
775
if record.storage_kind != 'absent':
993
texts[record.key] = record.get_bytes_as('lines')
776
texts[record.key] = record.get_bytes_as('fulltext')
995
texts[record.key] = None
778
raise errors.NoSuchRevision(self, record.key)
999
yield (None, key[-1])
1001
yield (inventory.CHKInventory.deserialise(
1002
self.chk_bytes, lines, key), key[-1])
780
yield inventory.CHKInventory.deserialise(self.chk_bytes, texts[key], key)
1004
def _get_inventory_xml(self, revision_id):
1005
"""Get serialized inventory as a string."""
1006
# Without a native 'xml' inventory, this method doesn't make sense.
1007
# However older working trees, and older bundles want it - so we supply
1008
# it allowing _get_inventory_xml to work. Bundles currently use the
1009
# serializer directly; this also isn't ideal, but there isn't an xml
1010
# iteration interface offered at all for repositories.
1011
return self._serializer.write_inventory_to_lines(
1012
self.get_inventory(revision_id))
782
def _iter_inventory_xmls(self, revision_ids):
783
# Without a native 'xml' inventory, this method doesn't make sense, so
784
# make it raise to trap naughty direct users.
785
raise NotImplementedError(self._iter_inventory_xmls)
1014
787
def _find_present_inventory_keys(self, revision_keys):
1015
788
parent_map = self.inventories.get_parent_map(revision_keys)
1091
870
if entry.revision == inv.revision_id:
1092
871
result[key] = True
1095
def reconcile_canonicalize_chks(self):
1096
"""Reconcile this repository to make sure all CHKs are in canonical
1099
from .reconcile import PackReconciler
1100
with self.lock_write():
1101
reconciler = PackReconciler(
1102
self, thorough=True, canonicalize_chks=True)
1103
return reconciler.reconcile()
1105
876
def _reconcile_pack(self, collection, packs, extension, revs, pb):
1106
877
packer = GCCHKReconcilePacker(collection, packs, extension)
1107
878
return packer.pack(pb)
1109
def _canonicalize_chks_pack(self, collection, packs, extension, revs, pb):
1110
packer = GCCHKCanonicalizingPacker(collection, packs, extension, revs)
1111
return packer.pack(pb)
1113
880
def _get_source(self, to_format):
1114
881
"""Return a source for streaming from this repository."""
1115
if self._format._serializer == to_format._serializer:
882
if isinstance(to_format, remote.RemoteRepositoryFormat):
883
# Can't just check attributes on to_format with the current code,
885
to_format._ensure_real()
886
to_format = to_format._custom_format
887
if to_format.__class__ is self._format.__class__:
1116
888
# We must be exactly the same format, otherwise stuff like the chk
1117
# page layout might be different.
1118
# Actually, this test is just slightly looser than exact so that
1119
# CHK2 <-> 2a transfers will work.
889
# page layout might be different
1120
890
return GroupCHKStreamSource(self, to_format)
1121
891
return super(CHKInventoryRepository, self)._get_source(to_format)
1123
def _find_inconsistent_revision_parents(self, revisions_iterator=None):
1124
"""Find revisions with different parent lists in the revision object
1125
and in the index graph.
1127
:param revisions_iterator: None, or an iterator of (revid,
1128
Revision-or-None). This iterator controls the revisions checked.
1129
:returns: an iterator yielding tuples of (revison-id, parents-in-index,
1130
parents-in-revision).
1132
if not self.is_locked():
1133
raise AssertionError()
1135
if revisions_iterator is None:
1136
revisions_iterator = self.iter_revisions(self.all_revision_ids())
1137
for revid, revision in revisions_iterator:
1138
if revision is None:
1140
parent_map = vf.get_parent_map([(revid,)])
1141
parents_according_to_index = tuple(parent[-1] for parent in
1142
parent_map[(revid,)])
1143
parents_according_to_revision = tuple(revision.parent_ids)
1144
if parents_according_to_index != parents_according_to_revision:
1145
yield (revid, parents_according_to_index,
1146
parents_according_to_revision)
1148
def _check_for_inconsistent_revision_parents(self):
1149
inconsistencies = list(self._find_inconsistent_revision_parents())
1151
raise errors.BzrCheckError(
1152
"Revision index has inconsistent parents.")
1155
class GroupCHKStreamSource(StreamSource):
894
class GroupCHKStreamSource(KnitPackStreamSource):
1156
895
"""Used when both the source and target repo are GroupCHK repos."""
1158
897
def __init__(self, from_repository, to_format):
1226
964
uninteresting_root_keys.add(inv.id_to_entry.key())
1227
965
uninteresting_pid_root_keys.add(
1228
966
inv.parent_id_basename_to_file_id.key())
967
bytes_to_info = inventory.CHKInventory._bytes_to_utf8name_key
1229
968
chk_bytes = self.from_repository.chk_bytes
1231
969
def _filter_id_to_entry():
1232
interesting_nodes = chk_map.iter_interesting_nodes(chk_bytes,
1233
self._chk_id_roots, uninteresting_root_keys)
1234
for record in _filter_text_keys(interesting_nodes, self._text_keys,
1235
chk_map._bytes_to_text_key):
970
for record, items in chk_map.iter_interesting_nodes(chk_bytes,
971
self._chk_id_roots, uninteresting_root_keys):
972
for name, bytes in items:
973
# Note: we don't care about name_utf8, because we are always
975
_, file_id, revision_id = bytes_to_info(bytes)
976
self._text_keys.add((file_id, revision_id))
1236
977
if record is not None:
1239
980
self._chk_id_roots = None
1240
981
yield 'chk_bytes', _filter_id_to_entry()
1242
982
def _get_parent_id_basename_to_file_id_pages():
1243
983
for record, items in chk_map.iter_interesting_nodes(chk_bytes,
1244
self._chk_p_id_roots, uninteresting_pid_root_keys):
984
self._chk_p_id_roots, uninteresting_pid_root_keys):
1245
985
if record is not None:
1248
988
self._chk_p_id_roots = None
1249
989
yield 'chk_bytes', _get_parent_id_basename_to_file_id_pages()
1251
def _get_text_stream(self):
1252
# Note: We know we don't have to handle adding root keys, because both
1253
# the source and target are the identical network name.
1254
text_stream = self.from_repository.texts.get_record_stream(
1255
self._text_keys, self._text_fetch_order, False)
1256
return ('texts', text_stream)
1258
991
def get_stream(self, search):
1259
def wrap_and_count(pb, rc, stream):
1260
"""Yield records from stream while showing progress."""
1262
for record in stream:
1263
if count == rc.STEP:
1265
pb.update('Estimate', rc.current, rc.max)
1270
992
revision_ids = search.get_keys()
1271
with ui.ui_factory.nested_progress_bar() as pb:
1272
rc = self._record_counter
1273
self._record_counter.setup(len(revision_ids))
1274
for stream_info in self._fetch_revision_texts(revision_ids):
1275
yield (stream_info[0],
1276
wrap_and_count(pb, rc, stream_info[1]))
1277
self._revision_keys = [(rev_id,) for rev_id in revision_ids]
1278
# TODO: The keys to exclude might be part of the search recipe
1279
# For now, exclude all parents that are at the edge of ancestry, for
1280
# which we have inventories
1281
from_repo = self.from_repository
1282
parent_keys = from_repo._find_parent_keys_of_revisions(
1283
self._revision_keys)
1284
self.from_repository.revisions.clear_cache()
1285
self.from_repository.signatures.clear_cache()
1286
# Clear the repo's get_parent_map cache too.
1287
self.from_repository._unstacked_provider.disable_cache()
1288
self.from_repository._unstacked_provider.enable_cache()
1289
s = self._get_inventory_stream(self._revision_keys)
1290
yield (s[0], wrap_and_count(pb, rc, s[1]))
1291
self.from_repository.inventories.clear_cache()
1292
for stream_info in self._get_filtered_chk_streams(parent_keys):
1293
yield (stream_info[0], wrap_and_count(pb, rc, stream_info[1]))
1294
self.from_repository.chk_bytes.clear_cache()
1295
s = self._get_text_stream()
1296
yield (s[0], wrap_and_count(pb, rc, s[1]))
1297
self.from_repository.texts.clear_cache()
1298
pb.update('Done', rc.max, rc.max)
993
for stream_info in self._fetch_revision_texts(revision_ids):
995
self._revision_keys = [(rev_id,) for rev_id in revision_ids]
996
yield self._get_inventory_stream(self._revision_keys)
997
# TODO: The keys to exclude might be part of the search recipe
998
# For now, exclude all parents that are at the edge of ancestry, for
999
# which we have inventories
1000
from_repo = self.from_repository
1001
parent_keys = from_repo._find_parent_keys_of_revisions(
1002
self._revision_keys)
1003
for stream_info in self._get_filtered_chk_streams(parent_keys):
1005
yield self._get_text_stream()
1300
1007
def get_stream_for_missing_keys(self, missing_keys):
1301
1008
# missing keys can only occur when we are byte copying and not
1385
1052
# multiple in-a-row (and sharing strings). Topological is better
1386
1053
# for remote, because we access less data.
1387
1054
_fetch_order = 'unordered'
1388
# essentially ignored by the groupcompress code.
1389
_fetch_uses_deltas = False
1055
_fetch_uses_deltas = False # essentially ignored by the groupcompress code.
1390
1056
fast_deltas = True
1391
1057
pack_compresses = True
1392
supports_tree_reference = True
1394
1059
def _get_matching_bzrdir(self):
1395
return controldir.format_registry.make_controldir('2a')
1060
return bzrdir.format_registry.make_bzrdir('development6-rich-root')
1397
1062
def _ignore_setting_bzrdir(self, format):
1400
_matchingcontroldir = property(
1401
_get_matching_bzrdir, _ignore_setting_bzrdir)
1065
_matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
1404
def get_format_string(cls):
1405
return b'Bazaar repository format 2a (needs bzr 1.16 or later)\n'
1067
def get_format_string(self):
1068
"""See RepositoryFormat.get_format_string()."""
1069
return ('Bazaar development format - group compression and chk inventory'
1070
' (needs bzr.dev from 1.14)\n')
1407
1072
def get_format_description(self):
1408
1073
"""See RepositoryFormat.get_format_description()."""
1409
return ("Repository format 2a - rich roots, group compression"
1410
" and chk inventories")
1413
class RepositoryFormat2aSubtree(RepositoryFormat2a):
1414
"""A 2a repository format that supports nested trees.
1074
return ("Development repository format - rich roots, group compression"
1075
" and chk inventories")
1077
def check_conversion_target(self, target_format):
1078
if not target_format.rich_root_data:
1079
raise errors.BadConversionTarget(
1080
'Does not support rich root data.', target_format)
1081
if (self.supports_tree_reference and
1082
not getattr(target_format, 'supports_tree_reference', False)):
1083
raise errors.BadConversionTarget(
1084
'Does not support nested trees', target_format)
1088
class RepositoryFormatCHK2(RepositoryFormatCHK1):
1089
"""A CHK repository that uses the bencode revision serializer."""
1091
_serializer = chk_serializer.chk_bencode_serializer
1093
def _get_matching_bzrdir(self):
1094
return bzrdir.format_registry.make_bzrdir('development7-rich-root')
1096
def _ignore_setting_bzrdir(self, format):
1099
_matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
1101
def get_format_string(self):
1102
"""See RepositoryFormat.get_format_string()."""
1103
return ('Bazaar development format - chk repository with bencode '
1104
'revision serialization (needs bzr.dev from 1.16)\n')
1107
class RepositoryFormat2a(RepositoryFormatCHK2):
1108
"""A CHK repository that uses the bencode revision serializer.
1110
This is the same as RepositoryFormatCHK2 but with a public name.
1113
_serializer = chk_serializer.chk_bencode_serializer
1418
1115
def _get_matching_bzrdir(self):
1419
return controldir.format_registry.make_controldir('development-subtree')
1116
return bzrdir.format_registry.make_bzrdir('2a')
1421
1118
def _ignore_setting_bzrdir(self, format):
1424
_matchingcontroldir = property(
1425
_get_matching_bzrdir, _ignore_setting_bzrdir)
1428
def get_format_string(cls):
1429
return b'Bazaar development format 8\n'
1431
def get_format_description(self):
1432
"""See RepositoryFormat.get_format_description()."""
1433
return ("Development repository format 8 - nested trees, "
1434
"group compression and chk inventories")
1437
supports_tree_reference = True
1121
_matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
1123
def get_format_string(self):
1124
return ('Bazaar repository format 2a (needs bzr 1.16 or later)\n')