# HG changeset patch # User Yuya Nishihara # Date 2018-11-11 08:29:46 # Node ID 85372dc0cca34f5232c3d29161e1f09e797cd8ec # Parent 6d9a87fb8c89a394111906aa0e5c6a48b6a805b8 blackbox: extract function to test if log event is tracked This will be a required method of the logger interface. diff --git a/hgext/blackbox.py b/hgext/blackbox.py --- a/hgext/blackbox.py +++ b/hgext/blackbox.py @@ -131,7 +131,7 @@ class blackboxlogger(object): def __init__(self, ui): self._repo = None self._inlog = False - self.track = ui.configlist('blackbox', 'track') + self._trackedevents = set(ui.configlist('blackbox', 'track')) @property def _bbvfs(self): @@ -142,9 +142,12 @@ class blackboxlogger(object): vfs = None return vfs + def tracked(self, event): + return b'*' in self._trackedevents or event in self._trackedevents + def log(self, ui, event, msg, opts): global _lastlogger - if not '*' in self.track and not event in self.track: + if not self.tracked(event): return if self._bbvfs: