changeset 40647:6d9a87fb8c89

blackbox: initialize inlog flag properly And ditch the "bb" prefix as it's no longer a ui extension class.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 11 Nov 2018 17:25:34 +0900
parents 179c02baaa8c
children 85372dc0cca3
files hgext/blackbox.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/blackbox.py	Sun Nov 11 17:24:28 2018 +0900
+++ b/hgext/blackbox.py	Sun Nov 11 17:25:34 2018 +0900
@@ -130,6 +130,7 @@
 class blackboxlogger(object):
     def __init__(self, ui):
         self._repo = None
+        self._inlog = False
         self.track = ui.configlist('blackbox', 'track')
 
     @property
@@ -158,10 +159,10 @@
         _lastlogger._log(ui, event, msg, opts)
 
     def _log(self, ui, event, msg, opts):
-        if getattr(self, '_bbinlog', False):
+        if self._inlog:
             # recursion and failure guard
             return
-        self._bbinlog = True
+        self._inlog = True
         default = ui.configdate('devel', 'default-date')
         date = dateutil.datestr(default, ui.config('blackbox', 'date-format'))
         user = procutil.getuser()
@@ -187,10 +188,10 @@
         except (IOError, OSError) as err:
             ui.debug('warning: cannot write to blackbox.log: %s\n' %
                      encoding.strtolocal(err.strerror))
-            # do not restore _bbinlog intentionally to avoid failed
+            # do not restore _inlog intentionally to avoid failed
             # logging again
         else:
-            self._bbinlog = False
+            self._inlog = False
 
     def setrepo(self, repo):
         self._repo = repo