56
56
# maps (file-id, version) -> sha1; used by InventoryFile._check
57
57
self.checked_texts = {}
58
58
self.checked_weaves = {}
59
self.unreferenced_versions = set()
59
self.revision_versions = _mod_repository._RevisionTextVersionCache(
61
self.unreferenced_ancestors = set()
60
62
self.inconsistent_parents = []
110
112
note('%6d file-ids', len(self.checked_weaves))
111
113
note('%6d unique file texts', self.checked_text_cnt)
112
114
note('%6d repeated file texts', self.repeated_text_cnt)
113
note('%6d unreferenced text versions',
114
len(self.unreferenced_versions))
115
note('%6d unreferenced text ancestors',
116
len(self.unreferenced_ancestors))
115
117
if self.missing_inventory_sha_cnt:
116
118
note('%6d revisions are missing inventory_sha1',
117
119
self.missing_inventory_sha_cnt)
132
134
for linker in linkers:
133
135
note(' * %s', linker)
135
for file_id, revision_id in self.unreferenced_versions:
136
log_error('unreferenced version: {%s} in %s', revision_id,
137
for file_id, revision_id in self.unreferenced_ancestors:
138
log_error('unreferenced ancestor: {%s} in %s', revision_id,
138
140
if len(self.inconsistent_parents):
139
141
note('%6d inconsistent parents', len(self.inconsistent_parents))
202
204
self.inventory_weave.check(progress_bar=self.progress)
203
205
files_in_revisions = {}
204
206
revisions_of_files = {}
205
weave_checker = self.repository._get_versioned_file_checker()
206
207
for i, weave_id in enumerate(weave_ids):
207
208
self.progress.update('checking versionedfile', i, n_weaves)
208
209
w = self.repository.weave_store.get_weave(weave_id,
209
210
self.repository.get_transaction())
210
211
# No progress here, because it looks ugly.
214
weave_checker = self.repository.get_versioned_file_checker(
215
self.planned_revisions, self.revision_versions)
212
216
result = weave_checker.check_file_version_parents(w, weave_id)
213
bad_parents, unused_versions = result
214
bad_parents = bad_parents.items()
215
for revision_id, (weave_parents, correct_parents) in bad_parents:
218
for revision_id, (weave_parents,correct_parents) in result.items():
216
219
self.inconsistent_parents.append(
217
220
(revision_id, weave_id, weave_parents, correct_parents))
218
for revision_id in unused_versions:
219
self.unreferenced_versions.add((weave_id, revision_id))
221
unreferenced_parents = set(weave_parents)-set(correct_parents)
222
for unreferenced_parent in unreferenced_parents:
223
self.unreferenced_ancestors.add(
224
(weave_id, unreferenced_parent))
220
225
self.checked_weaves[weave_id] = True
222
227
def _check_revision_tree(self, rev_id):
223
228
tree = self.repository.revision_tree(rev_id)
229
self.revision_versions.add_revision_text_versions(tree)
224
230
inv = tree.inventory
226
232
for file_id in inv: