34
34
from bzrlib.trace import mutter
35
35
from bzrlib.errors import BzrCheckError, NoSuchRevision
36
36
from bzrlib.inventory import ROOT_ID
37
from bzrlib.branch import gen_root_id
40
39
class Check(object):
56
56
self.branch.lock_read()
57
self.progress = bzrlib.ui.ui_factory.progress_bar()
58
59
self.history = self.branch.revision_history()
59
60
if not len(self.history):
60
61
# nothing to see here
62
self.planned_revisions = self.branch.get_ancestry(self.history[-1])
63
self.planned_revisions.remove(None)
63
if not self.branch.revision_store.listable():
64
raise BzrCheckError("Branch must be local")
65
self.planned_revisions = set(self.branch.revision_store)
66
inventoried = set(self.inventory_weave.names())
67
awol = self.planned_revisions - inventoried
69
raise BzrCheckError('Stored revisions missing from inventory'
70
'{%s}' % ','.join([f for f in awol]))
66
self.progress = bzrlib.ui.ui_factory.progress_bar()
67
while revno < len(self.planned_revisions):
68
rev_id = self.planned_revisions[revno]
69
self.progress.update('checking revision', revno,
72
for revno, rev_id in enumerate(self.planned_revisions):
73
self.progress.update('checking revision', revno+1,
70
74
len(self.planned_revisions))
72
75
self.check_one_rev(rev_id)
73
77
self.progress.clear()
75
78
self.branch.unlock()
77
80
def report_results(self, verbose):