172
172
class ResumedGCPack(ResumedPack):
174
def _check_references(self):
175
"""Make sure our external compression parents are present."""
176
# See GCPack._check_references for why this is empty
174
178
def _get_external_refs(self, index):
175
179
# GC repositories don't have compression parents external to a given
928
933
self._text_keys.add((file_id, revision_id))
929
934
if record is not None:
937
self._chk_id_roots = None
931
938
yield 'chk_bytes', _filter_id_to_entry()
932
939
def _get_parent_id_basename_to_file_id_pages():
933
940
for record, items in chk_map.iter_interesting_nodes(chk_bytes,
934
941
self._chk_p_id_roots, uninteresting_pid_root_keys):
935
942
if record is not None:
945
self._chk_p_id_roots = None
937
946
yield 'chk_bytes', _get_parent_id_basename_to_file_id_pages()
939
948
def _get_text_stream(self):
960
969
# missing keys can only occur when we are byte copying and not
961
970
# translating (because translation means we don't send
962
971
# unreconstructable deltas ever).
964
keys['texts'] = set()
965
keys['revisions'] = set()
966
keys['inventories'] = set()
967
keys['chk_bytes'] = set()
968
keys['signatures'] = set()
972
missing_inventory_keys = set()
969
973
for key in missing_keys:
970
keys[key[0]].add(key[1:])
971
if len(keys['revisions']):
972
# If we allowed copying revisions at this point, we could end up
973
# copying a revision without copying its required texts: a
974
# violation of the requirements for repository integrity.
975
raise AssertionError(
976
'cannot copy revisions to fill in missing deltas %s' % (
978
for substream_kind in ['texts', 'chk_bytes', 'signatures']:
979
if len(keys[substream_kind]) > 0:
974
if key[0] != 'inventories':
980
975
raise AssertionError('The only missing keys we should'
981
976
' be filling in are inventory keys, not %s'
978
missing_inventory_keys.add(key[1:])
979
if self._chk_id_roots or self._chk_p_id_roots:
980
raise AssertionError('Cannot call get_stream_for_missing_keys'
981
' untill all of get_stream() has been consumed.')
983
982
# Yield the inventory stream, so we can find the chk stream
984
yield self._get_inventory_stream(keys['inventories'])
983
yield self._get_inventory_stream(missing_inventory_keys)
985
984
# We use the empty set for excluded_keys, to make it clear that we want
986
985
# to transmit all referenced chk pages.
987
986
for stream_info in self._get_filtered_chk_streams(set()):