Mercurial > hg
changeset 33410:c784308305c6
streamclone: close large revlog files explicitly in generatev1()
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 07 Jul 2017 23:25:16 +0900 |
parents | 50243c975fc2 |
children | 50b49bb0fff3 |
files | mercurial/streamclone.py |
diffstat | 1 files changed, 5 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/streamclone.py Tue Jul 11 05:06:01 2017 +0200 +++ b/mercurial/streamclone.py Fri Jul 07 23:25:16 2017 +0900 @@ -221,13 +221,12 @@ repo.ui.debug('sending %s (%d bytes)\n' % (name, size)) # partially encode name over the wire for backwards compat yield '%s\0%d\n' % (store.encodedir(name), size) - if size <= 65536: - with svfs(name, 'rb', auditpath=False) as fp: + with svfs(name, 'rb', auditpath=False) as fp: + if size <= 65536: yield fp.read(size) - else: - data = svfs(name, auditpath=False) - for chunk in util.filechunkiter(data, limit=size): - yield chunk + else: + for chunk in util.filechunkiter(fp, limit=size): + yield chunk return len(entries), total_bytes, emitrevlogdata()