56
56
self.branch.lock_read()
57
self.progress = bzrlib.ui.ui_factory.progress_bar()
59
self.progress.update('retrieving inventory', 0, 0)
60
# do not put in init, as it should be done with progess,
61
# and inside the lock.
62
self.inventory_weave = self.branch._get_inventory_weave()
58
63
self.history = self.branch.revision_history()
59
64
if not len(self.history):
60
65
# nothing to see here
62
self.planned_revisions = self.branch.get_ancestry(self.history[-1])
63
self.planned_revisions.remove(None)
66
self.progress = bzrlib.ui.ui_factory.progress_bar()
67
69
while revno < len(self.planned_revisions):
68
70
rev_id = self.planned_revisions[revno]
69
71
self.progress.update('checking revision', revno,
70
72
len(self.planned_revisions))
72
74
self.check_one_rev(rev_id)
75
77
self.branch.unlock()
79
def plan_revisions(self):
80
if not self.branch.revision_store.listable():
81
self.planned_revisions = self.branch.get_ancestry(self.history[-1])
82
self.planned_revisions.remove(None)
83
# FIXME progress bars should support this more nicely.
85
print ("Checking reachable history -"
86
" for a complete check use a local branch.")
89
self.planned_revisions = set(self.branch.revision_store)
90
inventoried = set(self.inventory_weave.names())
91
awol = self.planned_revisions - inventoried
93
raise BzrCheckError('Stored revisions missing from inventory'
94
'{%s}' % ','.join([f for f in awol]))
95
self.planned_revisions = list(self.planned_revisions)
77
97
def report_results(self, verbose):
78
98
note('checked branch %s format %d',
143
163
missing_links = self.missing_parent_links.get(parent, [])
144
164
missing_links.append(rev_id)
145
165
self.missing_parent_links[parent] = missing_links
146
# list based so slow, TODO have a planned_revisions list and set.
166
# list based so somewhat slow,
167
# TODO have a planned_revisions list and set.
147
168
if self.branch.has_revision(parent):
148
169
missing_ancestry = self.branch.get_ancestry(parent)
149
170
for missing in missing_ancestry: