Mercurial > hg-stable
changeset 27769:40bd01be5c25
largefiles: use a context manager in _getfile
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Tue, 12 Jan 2016 14:27:42 -0800 |
parents | 5ef99738a562 |
children | 1b8c7d59be43 |
files | hgext/largefiles/localstore.py |
diffstat | 1 files changed, 1 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/largefiles/localstore.py Tue Jan 12 16:16:19 2016 -0800 +++ b/hgext/largefiles/localstore.py Tue Jan 12 14:27:42 2016 -0800 @@ -39,11 +39,8 @@ if not path: raise basestore.StoreError(filename, hash, self.url, _("can't get file locally")) - fd = open(path, 'rb') - try: + with open(path, 'rb') as fd: return lfutil.copyandhash(fd, tmpfile) - finally: - fd.close() def _verifyfile(self, cctx, cset, contents, standin, verified): filename = lfutil.splitstandin(standin)