streamclone: use read()
We have a convenience API for reading the full contents of a file.
Use it.
--- a/mercurial/streamclone.py Wed Dec 30 16:21:57 2015 -0700
+++ b/mercurial/streamclone.py Sat Jan 02 15:14:55 2016 -0800
@@ -212,12 +212,7 @@
# partially encode name over the wire for backwards compat
yield '%s\0%d\n' % (store.encodedir(name), size)
if size <= 65536:
- fp = svfs(name)
- try:
- data = fp.read(size)
- finally:
- fp.close()
- yield data
+ yield svfs.read(name)
else:
for chunk in util.filechunkiter(svfs(name), limit=size):
yield chunk