~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/check.py

  • Committer: Aaron Bentley
  • Date: 2005-12-25 00:38:48 UTC
  • mto: (1185.67.11 bzr.revision-storage)
  • mto: This revision was merged to the branch mainline in revision 1550.
  • Revision ID: aaron.bentley@utoronto.ca-20051225003848-111ac71170cb2605
Renamed Branch.storage to Branch.repository

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
 
42
42
    def __init__(self, branch):
43
43
        self.branch = branch
44
 
        self.storage = branch.storage
 
44
        self.repository = branch.repository
45
45
        self.checked_text_cnt = 0
46
46
        self.checked_rev_cnt = 0
47
47
        self.ghosts = []
59
59
            self.progress.update('retrieving inventory', 0, 0)
60
60
            # do not put in init, as it should be done with progess,
61
61
            # and inside the lock.
62
 
            self.inventory_weave = self.branch.storage.get_inventory_weave()
 
62
            self.inventory_weave = self.branch.repository.get_inventory_weave()
63
63
            self.history = self.branch.revision_history()
64
64
            if not len(self.history):
65
65
                # nothing to see here
77
77
            self.branch.unlock()
78
78
 
79
79
    def plan_revisions(self):
80
 
        if not self.branch.storage.revision_store.listable():
81
 
            self.planned_revisions = self.branch.storage.get_ancestry(self.history[-1])
 
80
        repository = self.branch.repository
 
81
        if not repository.revision_store.listable():
 
82
            self.planned_revisions = repository.get_ancestry(self.history[-1])
82
83
            self.planned_revisions.remove(None)
83
84
            # FIXME progress bars should support this more nicely.
84
85
            self.progress.clear()
86
87
                   " for a complete check use a local branch.")
87
88
            return
88
89
        
89
 
        self.planned_revisions = set(self.branch.storage.revision_store)
 
90
        self.planned_revisions = set(repository.revision_store)
90
91
        inventoried = set(self.inventory_weave.names())
91
92
        awol = self.planned_revisions - inventoried
92
93
        if len(awol) > 0:
138
139
            rev_history_position = None
139
140
        last_rev_id = None
140
141
        if rev_history_position:
141
 
            rev = branch.storage.get_revision(rev_id)
 
142
            rev = branch.repository.get_revision(rev_id)
142
143
            if rev_history_position > 0:
143
144
                last_rev_id = self.history[rev_history_position - 1]
144
145
        else:
145
 
            rev = branch.storage.get_revision(rev_id)
 
146
            rev = branch.repository.get_revision(rev_id)
146
147
                
147
148
        if rev.revision_id != rev_id:
148
149
            raise BzrCheckError('wrong internal revision id in revision {%s}'
166
167
                    # list based so somewhat slow,
167
168
                    # TODO have a planned_revisions list and set.
168
169
                    if self.branch.has_revision(parent):
169
 
                        missing_ancestry = self.storage.get_ancestry(parent)
 
170
                        missing_ancestry = self.repository.get_ancestry(parent)
170
171
                        for missing in missing_ancestry:
171
172
                            if (missing is not None 
172
173
                                and missing not in self.planned_revisions):
179
180
                                % (rev_id, last_rev_id))
180
181
 
181
182
        if rev.inventory_sha1:
182
 
            inv_sha1 = branch.storage.get_inventory_sha1(rev_id)
 
183
            inv_sha1 = branch.repository.get_inventory_sha1(rev_id)
183
184
            if inv_sha1 != rev.inventory_sha1:
184
185
                raise BzrCheckError('Inventory sha1 hash doesn\'t match'
185
186
                    ' value in revision {%s}' % rev_id)
190
191
        self.checked_rev_cnt += 1
191
192
 
192
193
    def _check_revision_tree(self, rev_id):
193
 
        tree = self.branch.storage.revision_tree(rev_id)
 
194
        tree = self.branch.repository.revision_tree(rev_id)
194
195
        inv = tree.inventory
195
196
        seen_ids = {}
196
197
        for file_id in inv: