~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/inventory.py

  • Committer: Martin Pool
  • Date: 2006-03-20 22:32:41 UTC
  • mto: This revision was merged to the branch mainline in revision 1621.
  • Revision ID: mbp@sourcefrog.net-20060320223241-95ba66352fd77026
Cleanup and document some check code

Show diffs side-by-side

added added

removed removed

Lines of Context:
328
328
 
329
329
        This is a template method, override _check for kind specific
330
330
        tests.
 
331
 
 
332
        :param checker: Check object providing context for the checks; 
 
333
             can be used to find out what parts of the repository have already
 
334
             been checked.
 
335
        :param rev_id: Revision id from which this InventoryEntry was loaded.
 
336
             Not necessarily the last-changed revision for this file.
 
337
        :param inv: Inventory from which the entry was loaded.
 
338
        :param tree: RevisionTree for this entry.
331
339
        """
332
340
        if self.parent_id != None:
333
341
            if not inv.has_id(self.parent_id):
511
519
class InventoryFile(InventoryEntry):
512
520
    """A file in an inventory."""
513
521
 
514
 
    def _check(self, checker, rev_id, tree):
 
522
    def _check(self, checker, tree_revision_id, tree):
515
523
        """See InventoryEntry._check"""
516
 
        revision = self.revision
517
 
        t = (self.file_id, revision)
 
524
        t = (self.file_id, self.revision)
518
525
        if t in checker.checked_texts:
519
 
            prev_sha = checker.checked_texts[t] 
 
526
            prev_sha = checker.checked_texts[t]
520
527
            if prev_sha != self.text_sha1:
521
528
                raise BzrCheckError('mismatched sha1 on {%s} in {%s}' %
522
 
                                    (self.file_id, rev_id))
 
529
                                    (self.file_id, tree_revision_id))
523
530
            else:
524
531
                checker.repeated_text_cnt += 1
525
532
                return
535
542
        else:
536
543
            w = tree.get_weave(self.file_id)
537
544
 
538
 
        mutter('check version {%s} of {%s}', rev_id, self.file_id)
 
545
        mutter('check version {%s} of {%s}', tree_revision_id, self.file_id)
539
546
        checker.checked_text_cnt += 1 
540
547
        # We can't check the length, because Weave doesn't store that
541
548
        # information, and the whole point of looking at the weave's