changeset 40792:eb5948f29c60

blackbox: change the way of deactivating the logger on write error This prepares for the upcoming code move. The recursion guard will be ported to the core ui.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 17 Nov 2018 20:23:50 +0900
parents 2f14d1bbc9a7
children fdc6eb1d650d
files hgext/blackbox.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/blackbox.py	Wed Nov 28 10:12:50 2018 -0800
+++ b/hgext/blackbox.py	Sat Nov 17 20:23:50 2018 +0900
@@ -159,7 +159,7 @@
 
     def _log(self, ui, event, msg, opts):
         if self._inlog:
-            # recursion and failure guard
+            # recursion guard
             return
         self._inlog = True
         default = ui.configdate('devel', 'default-date')
@@ -185,10 +185,10 @@
             with _openlogfile(ui, self._bbvfs) as fp:
                 fp.write(fmt % args)
         except (IOError, OSError) as err:
+            # deactivate this to avoid failed logging again
+            self._repo = None
             ui.debug('warning: cannot write to blackbox.log: %s\n' %
                      encoding.strtolocal(err.strerror))
-            # do not restore _inlog intentionally to avoid failed
-            # logging again
         else:
             self._inlog = False