~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/check.py

Merged mailine

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
        self.missing_revision_cnt = 0
51
51
        # maps (file-id, version) -> sha1
52
52
        self.checked_texts = {}
 
53
        self.checked_weaves = {}
53
54
 
54
55
    def check(self):
55
56
        self.branch.lock_read()
65
66
                return
66
67
            self.plan_revisions()
67
68
            revno = 0
 
69
            self.check_weaves()
68
70
            while revno < len(self.planned_revisions):
69
71
                rev_id = self.planned_revisions[revno]
70
72
                self.progress.update('checking revision', revno,
101
103
        note('%6d revisions', self.checked_rev_cnt)
102
104
        note('%6d unique file texts', self.checked_text_cnt)
103
105
        note('%6d repeated file texts', self.repeated_text_cnt)
 
106
        note('%6d weaves', len(self.checked_weaves))
104
107
        if self.missing_inventory_sha_cnt:
105
108
            note('%6d revisions are missing inventory_sha1',
106
109
                 self.missing_inventory_sha_cnt)
188
191
        self._check_revision_tree(rev_id)
189
192
        self.checked_rev_cnt += 1
190
193
 
 
194
    def check_weaves(self):
 
195
        """Check all the weaves we can get our hands on.
 
196
        """
 
197
        n_weaves = 1
 
198
        weave_ids = []
 
199
        if self.branch.weave_store.listable():
 
200
            weave_ids = list(self.branch.weave_store)
 
201
            n_weaves = len(weave_ids)
 
202
        self.progress.update('checking weave', 0, n_weaves)
 
203
        self.inventory_weave.check(progress_bar=self.progress)
 
204
        for i, weave_id in enumerate(weave_ids):
 
205
            self.progress.update('checking weave', i, n_weaves)
 
206
            w = self.branch.weave_store.get_weave(weave_id,
 
207
                    self.branch.get_transaction())
 
208
            # No progress here, because it looks ugly.
 
209
            w.check()
 
210
            self.checked_weaves[weave_id] = True
 
211
 
191
212
    def _check_revision_tree(self, rev_id):
192
213
        tree = self.branch.revision_tree(rev_id)
193
214
        inv = tree.inventory