changeset 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 95163ababeb8
children ed75909c4c67 7dab4caf11bc
files mercurial/streamclone.py tests/test-clone-uncompressed.t
diffstat 2 files changed, 3 insertions(+), 7 deletions(-) [+]
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
--- a/tests/test-clone-uncompressed.t	Sun Mar 13 02:28:46 2016 +0100
+++ b/tests/test-clone-uncompressed.t	Sun Mar 13 02:29:11 2016 +0100
@@ -88,10 +88,5 @@
   $ echo >> repo/f2
   $ hg -R repo ci -m "1"
   $ wait
-  abort: unexpected response from remote server:
-  '*\n' (glob)
   $ hg -R clone id
-  abort: repository clone not found!
-  [255]
-
-the current clone error is a regression from 9fea6b38a8da.
+  000000000000