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.
--- 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"""