Show More
@@ -289,18 +289,11 b' def writestandin(repo, standin, hash, ex' | |||
|
289 | 289 | |
|
290 | 290 | def copyandhash(instream, outfile): |
|
291 | 291 | '''Read bytes from instream (iterable) and write them to outfile, |
|
292 |
computing the SHA-1 hash of the data along the way. |
|
|
293 | when done and return the hash.''' | |
|
292 | computing the SHA-1 hash of the data along the way. Return the hash.''' | |
|
294 | 293 | hasher = util.sha1('') |
|
295 | 294 | for data in instream: |
|
296 | 295 | hasher.update(data) |
|
297 | 296 | outfile.write(data) |
|
298 | ||
|
299 | # Blecch: closing a file that somebody else opened is rude and | |
|
300 | # wrong. But it's so darn convenient and practical! After all, | |
|
301 | # outfile was opened just to copy and hash. | |
|
302 | outfile.close() | |
|
303 | ||
|
304 | 297 | return hasher.hexdigest() |
|
305 | 298 | |
|
306 | 299 | def hashrepofile(repo, file): |
General Comments 0
You need to be logged in to leave comments.
Login now