~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: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:
117
117
 
118
118
 
119
119
 
 
120
def fingerprint_file(f):
 
121
    import sha
 
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)
 
131
    return {'size': size,
 
132
            'sha1': s.hexdigest()}
 
133
 
 
134
 
 
135
 
120
136
def username():
121
137
    """Return email-style username.
122
138