# HG changeset patch # User Gregory Szorc # Date 2016-01-02 23:14:55 # Node ID 9fea6b38a8da2ae32f18909ed390f949e4d77d4d # Parent c18292a6ff54a4d91290f2f357573af099798086 streamclone: use read() We have a convenience API for reading the full contents of a file. Use it. diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py --- a/mercurial/streamclone.py +++ b/mercurial/streamclone.py @@ -212,12 +212,7 @@ def generatev1(repo): # 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