hgext/largefiles/remotestore.py
changeset 19001 2a35296a6304
parent 18573 003730ca254d
child 19002 5083baa6cbf8
--- a/hgext/largefiles/remotestore.py	Mon Apr 15 23:35:43 2013 +0200
+++ b/hgext/largefiles/remotestore.py	Mon Apr 15 23:43:44 2013 +0200
@@ -74,7 +74,11 @@
         # Mercurial does not close its SSH connections after writing a stream
         if length is not None:
             infile = lfutil.limitreader(infile, length)
-        return lfutil.copyandhash(lfutil.blockstream(infile), tmpfile)
+        try:
+            return lfutil.copyandhash(util.filechunkiter(infile, 128 * 1024),
+                                      tmpfile)
+        finally:
+            infile.close()
 
     def _verifyfile(self, cctx, cset, contents, standin, verified):
         filename = lfutil.splitstandin(standin)