605
605
def __init__(self, *args, **kwargs):
606
606
super(GCCHKCanonicalizingPacker, self).__init__(*args, **kwargs)
607
607
self._data_changed = False
609
609
def _exhaust_stream(self, source_vf, keys, message, vf_to_stream, pb_offset):
610
610
"""Create and exhaust a stream, but don't insert it.
612
612
This is useful to get the side-effects of generating a stream.
614
614
self.pb.update('scanning %s' % (message,), pb_offset)
1147
1147
return GroupCHKStreamSource(self, to_format)
1148
1148
return super(CHKInventoryRepository, self)._get_source(to_format)
1150
def _find_inconsistent_revision_parents(self, revisions_iterator=None):
1151
"""Find revisions with different parent lists in the revision object
1152
and in the index graph.
1154
:param revisions_iterator: None, or an iterator of (revid,
1155
Revision-or-None). This iterator controls the revisions checked.
1156
:returns: an iterator yielding tuples of (revison-id, parents-in-index,
1157
parents-in-revision).
1159
if not self.is_locked():
1160
raise AssertionError()
1162
if revisions_iterator is None:
1163
revisions_iterator = self._iter_revisions(None)
1164
for revid, revision in revisions_iterator:
1165
if revision is None:
1167
parent_map = vf.get_parent_map([(revid,)])
1168
parents_according_to_index = tuple(parent[-1] for parent in
1169
parent_map[(revid,)])
1170
parents_according_to_revision = tuple(revision.parent_ids)
1171
if parents_according_to_index != parents_according_to_revision:
1172
yield (revid, parents_according_to_index,
1173
parents_according_to_revision)
1175
def _check_for_inconsistent_revision_parents(self):
1176
inconsistencies = list(self._find_inconsistent_revision_parents())
1178
raise errors.BzrCheckError(
1179
"Revision index has inconsistent parents.")
1181
def revision_graph_can_have_wrong_parents(self):
1151
1185
class GroupCHKStreamSource(StreamSource):
1152
1186
"""Used when both the source and target repo are GroupCHK repos."""