mercurial/streamclone.py
changeset 33410 c784308305c6
parent 33258 761ccfeff8b1
child 33411 50b49bb0fff3
--- a/mercurial/streamclone.py	Tue Jul 11 05:06:01 2017 +0200
+++ b/mercurial/streamclone.py	Fri Jul 07 23:25:16 2017 +0900
@@ -221,13 +221,12 @@
                 repo.ui.debug('sending %s (%d bytes)\n' % (name, size))
             # partially encode name over the wire for backwards compat
             yield '%s\0%d\n' % (store.encodedir(name), size)
-            if size <= 65536:
-                with svfs(name, 'rb', auditpath=False) as fp:
+            with svfs(name, 'rb', auditpath=False) as fp:
+                if size <= 65536:
                     yield fp.read(size)
-            else:
-                data = svfs(name, auditpath=False)
-                for chunk in util.filechunkiter(data, limit=size):
-                    yield chunk
+                else:
+                    for chunk in util.filechunkiter(fp, limit=size):
+                        yield chunk
 
     return len(entries), total_bytes, emitrevlogdata()