changeset 40648:85372dc0cca3

blackbox: extract function to test if log event is tracked This will be a required method of the logger interface.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 11 Nov 2018 17:29:46 +0900
parents 6d9a87fb8c89
children f83cea7f54d7
files hgext/blackbox.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/blackbox.py	Sun Nov 11 17:25:34 2018 +0900
+++ b/hgext/blackbox.py	Sun Nov 11 17:29:46 2018 +0900
@@ -131,7 +131,7 @@
     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 @@
                 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: