changeset 27632: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
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	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