changeset 4097:4ea2a813b82c stable

obscache: ignore permission and OS errors when writing In practice we always update this cache along side a new transaction, with lock taken so permission issues should not happens. However, staying on the safe side is better. Errors during Cache update should not block Mercurial operations.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 13 Sep 2018 18:21:07 +0200
parents 1630756a6a46
children c9fc82c4e66d
files hgext3rd/evolve/obscache.py
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/obscache.py	Thu Sep 13 02:49:58 2018 +0200
+++ b/hgext3rd/evolve/obscache.py	Thu Sep 13 18:21:07 2018 +0200
@@ -404,11 +404,14 @@
         if self._cachekey is None or self._cachekey == self._ondiskkey:
             return
 
-        cachefile = self._vfs(self._filepath, 'w', atomictemp=True)
-        headerdata = struct.pack(self._headerformat, *self._cachekey)
-        cachefile.write(headerdata)
-        cachefile.write(self._data)
-        cachefile.close()
+        try:
+            cachefile = self._vfs(self._filepath, 'w', atomictemp=True)
+            headerdata = struct.pack(self._headerformat, *self._cachekey)
+            cachefile.write(headerdata)
+            cachefile.write(self._data)
+            cachefile.close()
+        except (IOError, OSError) as exc:
+            repo.ui.debug('obscache: could not write update %s\n' % exc)
 
     def load(self, repo):
         """load data from disk"""