inifinitepush: fix filebundlestore to close file stable
authorYuya Nishihara <yuya@tcha.org>
Thu, 19 Apr 2018 20:22:33 +0900
branchstable
changeset 37796 968ac00c4017
parent 37795 68748c2c761b
child 37797 43221a57e22f
inifinitepush: fix filebundlestore to close file
hgext/infinitepush/store.py
--- 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):
         """