changeset 28287:9fea6b38a8da

streamclone: use read() We have a convenience API for reading the full contents of a file. Use it.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 02 Jan 2016 15:14:55 -0800 (2016-01-02)
parents c18292a6ff54
children 37d7cf569cf3
files mercurial/streamclone.py
diffstat 1 files changed, 1 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/streamclone.py
+++ b/mercurial/streamclone.py
@@ -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