[Pkg-bazaar-commits] ./bzr/unstable r126: Use just one big read to fingerprint files

mbp at sourcefrog.net mbp at sourcefrog.net
Fri Apr 10 07:51:09 UTC 2009


------------------------------------------------------------
revno: 126
committer: mbp at sourcefrog.net
timestamp: Tue 2005-03-29 10:35:00 +1000
message:
  Use just one big read to fingerprint files
modified:
  bzrlib/osutils.py
-------------- next part --------------
=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py	2005-03-29 00:23:20 +0000
+++ b/bzrlib/osutils.py	2005-03-29 00:35:00 +0000
@@ -120,14 +120,10 @@
 def fingerprint_file(f):
     import sha
     s = sha.new()
-    size = 0
-    BUFSIZE = 64<<10
-    while True:
-        b = f.read(BUFSIZE)
-        if b == '':
-            break
-        s.update(b)
-        size += len(b)
+    b = f.read()
+    s.update(b)
+    size = len(b)
+    f.close()
     return {'size': size,
             'sha1': s.hexdigest()}
 



More information about the Pkg-bazaar-commits mailing list