~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/check.py

[merge] make sure to get all text revisions during merge (aaron)

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
 
43
43
    def __init__(self, branch):
44
44
        self.branch = branch
 
45
        self.inventory_weave = branch._get_inventory_weave()
45
46
        self.checked_text_cnt = 0
46
47
        self.checked_rev_cnt = 0
47
48
        self.ghosts = []
54
55
 
55
56
    def check(self):
56
57
        self.branch.lock_read()
 
58
        self.progress = bzrlib.ui.ui_factory.progress_bar()
57
59
        try:
58
60
            self.history = self.branch.revision_history()
59
61
            if not len(self.history):
60
62
                # nothing to see here
61
63
                return
62
 
            self.planned_revisions = self.branch.get_ancestry(self.history[-1])
63
 
            self.planned_revisions.remove(None)
64
 
            revno = 0
 
64
            if not self.branch.revision_store.listable():
 
65
                raise BzrCheckError("Branch must be local")
 
66
            self.planned_revisions = set(self.branch.revision_store)
 
67
            inventoried = set(self.inventory_weave.names())
 
68
            awol = self.planned_revisions - inventoried
 
69
            if len(awol) > 0:
 
70
                raise BzrCheckError('Stored revisions missing from inventory'
 
71
                    '{%s}' % ','.join([f for f in awol]))
65
72
    
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,
 
73
            for revno, rev_id in enumerate(self.planned_revisions):
 
74
                self.progress.update('checking revision', revno+1,
70
75
                                     len(self.planned_revisions))
71
 
                revno += 1
72
76
                self.check_one_rev(rev_id)
 
77
        finally:
73
78
            self.progress.clear()
74
 
        finally:
75
79
            self.branch.unlock()
76
80
 
77
81
    def report_results(self, verbose):