~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/check.py

  • Committer: Martin Pool
  • Date: 2005-09-22 06:54:01 UTC
  • Revision ID: mbp@sourcefrog.net-20050922065401-6694b0f910701fca
- try to avoid redundant conversion of strings when retrieving from weaves

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 
29
29
import bzrlib.ui
30
30
from bzrlib.trace import note, warning
31
 
from bzrlib.osutils import rename, sha_string, fingerprint_file
 
31
from bzrlib.osutils import rename, sha_string, fingerprint_file, sha_strings
32
32
from bzrlib.trace import mutter
33
33
from bzrlib.errors import BzrCheckError, NoSuchRevision
34
34
from bzrlib.inventory import ROOT_ID
167
167
                    self.repeated_text_cnt += 1
168
168
                    return
169
169
            mutter('check version {%s} of {%s}', rev_id, file_id)
170
 
            text = tree.get_file_text(file_id)
 
170
            file_lines = tree.get_file_lines(file_id)
171
171
            self.checked_text_cnt += 1 
172
 
            if ie.text_size != len(text):
 
172
            if ie.text_size != sum(map(len, file_lines)):
173
173
                raise BzrCheckError('text {%s} wrong size' % ie.text_id)
174
 
            if ie.text_sha1 != sha_string(text):
 
174
            if ie.text_sha1 != sha_strings(file_lines):
175
175
                raise BzrCheckError('text {%s} wrong sha1' % ie.text_id)
176
176
            self.checked_texts[t] = ie.text_sha1
177
177
        elif ie.kind == 'directory':