changeset 37796:968ac00c4017 stable

inifinitepush: fix filebundlestore to close file
author Yuya Nishihara <yuya@tcha.org>
date Thu, 19 Apr 2018 20:22:33 +0900
parents 68748c2c761b
children 43221a57e22f
files hgext/infinitepush/store.py
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/infinitepush/store.py	Wed Apr 18 15:07:06 2018 +0200
+++ b/hgext/infinitepush/store.py	Thu Apr 19 20:22:33 2018 +0900
@@ -86,12 +86,11 @@
 
     def read(self, key):
         try:
-            f = open(self._filepath(key), 'rb')
+            with open(self._filepath(key), 'rb') as f:
+                return f.read()
         except IOError:
             return None
 
-        return f.read()
-
 class externalbundlestore(abstractbundlestore):
     def __init__(self, put_binary, put_args, get_binary, get_args):
         """