~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/check.py

  • Committer: mbp at sourcefrog
  • Date: 2005-03-29 00:23:20 UTC
  • Revision ID: mbp@sourcefrog.net-20050329002320-b494544b3ff546c9
- check file text for past revisions is correct
- new fingerprint_file function

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
import bzrlib
27
27
from trace import mutter
28
28
from errors import bailout
29
 
 
 
29
import osutils
30
30
 
31
31
def check(branch, progress=True):
32
32
    out = sys.stdout
95
95
        if ie.kind == 'file':
96
96
            if not ie.text_id in branch.text_store:
97
97
                bailout('text {%s} not in text_store' % ie.text_id)
 
98
 
 
99
            tf = branch.text_store[ie.text_id]
 
100
            fp = osutils.fingerprint_file(tf)
 
101
            if ie.text_size != fp['size']:
 
102
                bailout('text {%s} wrong size' % ie.text_id)
 
103
            if ie.text_sha1 != fp['sha1']:
 
104
                bailout('text {%s} wrong sha1' % ie.text_id)
98
105
        elif ie.kind == 'directory':
99
106
            if ie.text_sha1 != None or ie.text_size != None or ie.text_id != None:
100
107
                bailout('directory {%s} has text in revision {%s}'