compat: drop the context manager used to write the cache file stable
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Wed, 03 May 2017 13:27:26 +0200
branchstable
changeset 2316 35a548465647
parent 2315 e16f6bef5848
child 2317 7263463ae79a
child 2321 8ba42b1576d0
compat: drop the context manager used to write the cache file Mercurial 3.8 does not supports context manager on atomic temporary file.
hgext3rd/evolve/obscache.py
--- a/hgext3rd/evolve/obscache.py	Wed May 03 12:54:11 2017 +0200
+++ b/hgext3rd/evolve/obscache.py	Wed May 03 13:27:26 2017 +0200
@@ -307,10 +307,11 @@
         if self._cachekey is None or self._cachekey == self._ondiskkey:
             return
 
-        with repo.vfs(self._filepath, 'w', atomictemp=True) as cachefile:
-            headerdata = struct.pack(self._headerformat, *self._cachekey)
-            cachefile.write(headerdata)
-            cachefile.write(self._data)
+        cachefile = repo.vfs(self._filepath, 'w', atomictemp=True)
+        headerdata = struct.pack(self._headerformat, *self._cachekey)
+        cachefile.write(headerdata)
+        cachefile.write(self._data)
+        cachefile.close()
 
     def load(self, repo):
         """load data from disk"""