66
66
self.progress.update('retrieving inventory', 0, 2)
67
67
# do not put in init, as it should be done with progess,
68
68
# and inside the lock.
69
self.inventory_weave = self.repository.get_inventory_weave()
69
self.inventory_weave = self.repository.inventories
70
70
self.progress.update('checking revision graph', 1)
71
71
self.check_revision_graph()
72
72
self.plan_revisions()
193
193
def check_weaves(self):
194
194
"""Check all the weaves we can get our hands on.
198
if self.repository.weave_store.listable():
199
weave_ids = list(self.repository.weave_store)
200
n_weaves = len(weave_ids) + 1
201
self.progress.update('checking versionedfile', 0, n_weaves)
197
self.progress.update('checking inventory', 0, 2)
202
198
self.inventory_weave.check(progress_bar=self.progress)
203
files_in_revisions = {}
204
revisions_of_files = {}
199
self.progress.update('checking text storage', 1, 2)
200
self.repository.texts.check(progress_bar=self.progress)
205
201
weave_checker = self.repository._get_versioned_file_checker()
206
for i, weave_id in enumerate(weave_ids):
207
self.progress.update('checking versionedfile', i, n_weaves)
208
w = self.repository.weave_store.get_weave(weave_id,
209
self.repository.get_transaction())
210
# No progress here, because it looks ugly.
212
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:
216
self.inconsistent_parents.append(
217
(revision_id, weave_id, weave_parents, correct_parents))
218
for revision_id in unused_versions:
219
self.unreferenced_versions.add((weave_id, revision_id))
220
self.checked_weaves[weave_id] = True
202
result = weave_checker.check_file_version_parents(
203
self.repository.texts, progress_bar=self.progress)
204
self.checked_weaves = weave_checker.file_ids
205
bad_parents, unused_versions = result
206
bad_parents = bad_parents.items()
207
for text_key, (stored_parents, correct_parents) in bad_parents:
208
# XXX not ready for id join/split operations.
209
weave_id = text_key[0]
210
revision_id = text_key[-1]
211
weave_parents = tuple([parent[-1] for parent in stored_parents])
212
correct_parents = tuple([parent[-1] for parent in correct_parents])
213
self.inconsistent_parents.append(
214
(revision_id, weave_id, weave_parents, correct_parents))
215
self.unreferenced_versions.update(unused_versions)
222
217
def _check_revision_tree(self, rev_id):
223
218
tree = self.repository.revision_tree(rev_id)