~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: mbp at sourcefrog
  • Date: 2005-03-29 00:35:00 UTC
  • Revision ID: mbp@sourcefrog.net-20050329003500-310b9786d05dd259
Use just one big read to fingerprint files

Show diffs side-by-side

added added

removed removed

Lines of Context:
120
120
def fingerprint_file(f):
121
121
    import sha
122
122
    s = sha.new()
123
 
    size = 0
124
 
    BUFSIZE = 64<<10
125
 
    while True:
126
 
        b = f.read(BUFSIZE)
127
 
        if b == '':
128
 
            break
129
 
        s.update(b)
130
 
        size += len(b)
 
123
    b = f.read()
 
124
    s.update(b)
 
125
    size = len(b)
 
126
    f.close()
131
127
    return {'size': size,
132
128
            'sha1': s.hexdigest()}
133
129