# HG changeset patch # User Yuya Nishihara # Date 1541924734 -32400 # Node ID 6d9a87fb8c89a394111906aa0e5c6a48b6a805b8 # Parent 179c02baaa8c3b4f4af329533ff8ffbab5b459a7 blackbox: initialize inlog flag properly And ditch the "bb" prefix as it's no longer a ui extension class. diff -r 179c02baaa8c -r 6d9a87fb8c89 hgext/blackbox.py --- 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