[PATCH STABLE] inifinitepush: fix filebundlestore to close file

Yuya Nishihara yuya at tcha.org
Thu Apr 19 11:29:53 UTC 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1524136953 -32400
#      Thu Apr 19 20:22:33 2018 +0900
# Branch stable
# Node ID 3866a9af240cc01e5eab12ffeac668f61cfa2a13
# Parent  8ba1c6dab49f5665dc687000f149eb530a1079cf
inifinitepush: fix filebundlestore to close file

diff --git a/hgext/infinitepush/store.py b/hgext/infinitepush/store.py
--- a/hgext/infinitepush/store.py
+++ b/hgext/infinitepush/store.py
@@ -86,12 +86,11 @@ class filebundlestore(object):
 
     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):
         """


More information about the Mercurial-devel mailing list