diff -r eaf146e811a4 -r 2a35296a6304 hgext/largefiles/remotestore.py --- 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)