86
86
self._transport.clone('packs'),
87
87
_format.index_builder_class,
88
88
_format.index_class,
89
use_chk_index=self._format.supports_chks,
91
91
self.inventories = KnitVersionedFiles(
92
92
_KnitGraphIndex(self._pack_collection.inventory_index.combined_index,
854
854
self.new_pack.text_index, readv_group_iter, total_items))
855
855
self._log_copied_texts()
857
def _copy_chks(self, refs=None):
858
# XXX: Todo, recursive follow-pointers facility when fetching some
860
chk_index_map, chk_indices = self._pack_map_and_index_list(
862
chk_nodes = self._index_contents(chk_indices, refs)
864
# TODO: This isn't strictly tasteful as we are accessing some private
865
# variables (_serializer). Perhaps a better way would be to have
866
# Repository._deserialise_chk_node()
867
search_key_func = chk_map.search_key_registry.get(
868
self._pack_collection.repo._serializer.search_key_name)
869
def accumlate_refs(lines):
870
# XXX: move to a generic location
872
bytes = ''.join(lines)
873
node = chk_map._deserialise(bytes, ("unknown",), search_key_func)
874
new_refs.update(node.refs())
875
self._copy_nodes(chk_nodes, chk_index_map, self.new_pack._writer,
876
self.new_pack.chk_index, output_lines=accumlate_refs)
879
857
def _create_pack_from_packs(self):
880
858
self.pb.update("Opening pack", 0, 5)
881
859
self.new_pack = self.open_pack()
912
890
time.ctime(), self._pack_collection._upload_transport.base, new_pack.random_name,
913
891
new_pack.signature_index.key_count(),
914
892
time.time() - new_pack.start_time)
916
# NB XXX: how to check CHK references are present? perhaps by yielding
917
# the items? How should that interact with stacked repos?
918
if new_pack.chk_index is not None:
920
if 'pack' in debug.debug_flags:
921
trace.mutter('%s: create_pack: chk content copied: %s%s %d items t+%6.3fs',
922
time.ctime(), self._pack_collection._upload_transport.base,
923
new_pack.random_name,
924
new_pack.chk_index.key_count(),
925
time.time() - new_pack.start_time)
926
893
new_pack._check_references()
927
894
if not self._use_pack(new_pack):