hgext/largefiles/remotestore.py
changeset 19004 6614e5e24e66
parent 19003 ad993cb7bbb1
child 19008 9d33d6e0d442
--- a/hgext/largefiles/remotestore.py	Mon Apr 15 23:47:04 2013 +0200
+++ b/hgext/largefiles/remotestore.py	Tue Apr 16 01:46:39 2013 +0200
@@ -58,7 +58,7 @@
                                'statlfile (%r)' % stat)
 
         try:
-            length, infile = self._get(hash)
+            chunks = self._get(hash)
         except urllib2.HTTPError, e:
             # 401s get converted to util.Aborts; everything else is fine being
             # turned into a StoreError
@@ -71,14 +71,7 @@
         except IOError, e:
             raise basestore.StoreError(filename, hash, self.url, str(e))
 
-        # Mercurial does not close its SSH connections after writing a stream
-        if length is not None:
-            infile = lfutil.limitreader(infile, length)
-        try:
-            return lfutil.copyandhash(util.filechunkiter(infile, 128 * 1024),
-                                      tmpfile)
-        finally:
-            infile.close()
+        return lfutil.copyandhash(chunks, tmpfile)
 
     def _verifyfile(self, cctx, cset, contents, standin, verified):
         filename = lfutil.splitstandin(standin)