diff hgext/infinitepush/store.py @ 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 33d26f7bd6ca
children cc9aa88792fe
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):
         """