streamclone: fix error when store files grow while stream cloning
Effectively a backout of
9fea6b38a8da, but updated to using 'with'.
--- 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