Mercurial > hg
diff mercurial/streamclone.py @ 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 | bb0b955d050d |
children | 14f5ea7cc4c2 |
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