/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/check.py

  • Committer: Martin Pool
  • Date: 2009-03-13 07:54:48 UTC
  • mfrom: (4144 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4189.
  • Revision ID: mbp@sourcefrog.net-20090313075448-jlz1t7baz7gzipqn
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
# TODO: Check for extra files in the control directory.
23
23
 
24
 
# TODO: Check revision, inventory and entry objects have all 
 
24
# TODO: Check revision, inventory and entry objects have all
25
25
# required fields.
26
26
 
27
27
# TODO: Get every revision in the revision-store even if they're not
166
166
        rev_id - the one to check
167
167
        """
168
168
        rev = self.repository.get_revision(rev_id)
169
 
                
 
169
 
170
170
        if rev.revision_id != rev_id:
171
171
            raise BzrCheckError('wrong internal revision id in revision {%s}'
172
172
                                % rev_id)
173
173
 
174
174
        for parent in rev.parent_ids:
175
175
            if not parent in self.planned_revisions:
 
176
                # rev has a parent we didn't know about.
176
177
                missing_links = self.missing_parent_links.get(parent, [])
177
178
                missing_links.append(rev_id)
178
179
                self.missing_parent_links[parent] = missing_links
181
182
                if self.repository.has_revision(parent):
182
183
                    missing_ancestry = self.repository.get_ancestry(parent)
183
184
                    for missing in missing_ancestry:
184
 
                        if (missing is not None 
 
185
                        if (missing is not None
185
186
                            and missing not in self.planned_revisions):
186
187
                            self.planned_revisions.append(missing)
187
188
                else:
188
189
                    self.ghosts.append(rev_id)
189
190
 
190
191
        if rev.inventory_sha1:
 
192
            # Loopback - this is currently circular logic as the
 
193
            # knit get_inventory_sha1 call returns rev.inventory_sha1.
 
194
            # Repository.py's get_inventory_sha1 should instead return
 
195
            # inventories.get_record_stream([(revid,)]).next().sha1 or
 
196
            # similar.
191
197
            inv_sha1 = self.repository.get_inventory_sha1(rev_id)
192
198
            if inv_sha1 != rev.inventory_sha1:
193
199
                raise BzrCheckError('Inventory sha1 hash doesn\'t match'
244
250
@deprecated_function(deprecated_in((1,6,0)))
245
251
def check(branch, verbose):
246
252
    """Run consistency checks on a branch.
247
 
    
 
253
 
248
254
    Results are reported through logging.
249
 
    
 
255
 
250
256
    Deprecated in 1.6.  Please use check_branch instead.
251
257
 
252
258
    :raise BzrCheckError: if there's a consistency error.
278
284
 
279
285
    if do_tree:
280
286
        if tree is not None:
281
 
            note("Checking working tree at '%s'." 
 
287
            note("Checking working tree at '%s'."
282
288
                 % (tree.bzrdir.root_transport.base,))
283
289
            tree._check()
284
290
        else: