~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/check.py

Merge from integration, mode-changes are broken.

Show diffs side-by-side

added added

removed removed

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