diff mercurial/streamclone.py @ 28518:aa440c3d7c5d stable

streamclone: fix error when store files grow while stream cloning Effectively a backout of 9fea6b38a8da, but updated to using 'with'.
author Mads Kiilerich <madski@unity3d.com>
date Sun, 13 Mar 2016 02:29:11 +0100
parents 2fdbf22a1b63
children ed75909c4c67
line wrap: on
line diff
--- a/mercurial/streamclone.py	Sun Mar 13 02:28:46 2016 +0100
+++ b/mercurial/streamclone.py	Sun Mar 13 02:29:11 2016 +0100
@@ -206,7 +206,8 @@
                 # partially encode name over the wire for backwards compat
                 yield '%s\0%d\n' % (store.encodedir(name), size)
                 if size <= 65536:
-                    yield svfs.read(name)
+                    with svfs(name, 'rb') as fp:
+                        yield fp.read(size)
                 else:
                     for chunk in util.filechunkiter(svfs(name), limit=size):
                         yield chunk