# HG changeset patch # User Pierre-Yves David # Date 1536851298 -7200 # Node ID 88000f1d24069bef890f152f3c265a6dc614d5cd # Parent f21187478dcc34eccc4e33d3e2d5dda4bc5d25f4 firstmergecache: ignore permission and OS errors when writing This cache is related to the obshashrange one and we update it lazily by default. This can be an issue when pulling locally from a read only repository that was not configured for a more aggressive cache warming. The raised permission error was uncaught and could crash the whole process. Errors during cache update should not block Mercurial operations. diff -r f21187478dcc -r 88000f1d2406 hgext3rd/evolve/firstmergecache.py --- a/hgext3rd/evolve/firstmergecache.py Thu Sep 13 18:56:04 2018 +0200 +++ b/hgext3rd/evolve/firstmergecache.py Thu Sep 13 17:08:18 2018 +0200 @@ -135,9 +135,12 @@ if self._cachekey is None or self._cachekey == self._ondiskkey: return - cachevfs = compat.getcachevfs(repo) - cachefile = cachevfs(self._filepath, 'w', atomictemp=True) - headerdata = self._serializecachekey() - cachefile.write(headerdata) - cachefile.write(self._data.tostring()) - cachefile.close() + try: + cachevfs = compat.getcachevfs(repo) + cachefile = cachevfs(self._filepath, 'w', atomictemp=True) + headerdata = self._serializecachekey() + cachefile.write(headerdata) + cachefile.write(self._data.tostring()) + cachefile.close() + except (IOError, OSError) as exc: + repo.ui.debug('firstmergecache: could not write update %s\n' % exc)