streamclone: fix error when store files grow while stream cloning stable
authorMads Kiilerich <madski@unity3d.com>
Sun, 13 Mar 2016 02:29:11 +0100
branchstable
changeset 28518 aa440c3d7c5d
parent 28517 95163ababeb8
child 28532 ed75909c4c67
child 28618 7dab4caf11bc
streamclone: fix error when store files grow while stream cloning Effectively a backout of 9fea6b38a8da, but updated to using 'with'.
mercurial/streamclone.py
tests/test-clone-uncompressed.t
--- 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