changeset 42615:56132ebd14c6

blackbox: disable extremely verbose logging (issue6110) This is maybe not the best way to go about fixing this, but anything is better than the status quo. Differential Revision: https://phab.mercurial-scm.org/D6611
author Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
date Sun, 07 Jul 2019 10:54:41 -0400
parents 117437f3f541
children 5162753c4c14
files hgext/blackbox.py tests/test-blackbox.t
diffstat 2 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/blackbox.py	Wed Jul 17 22:24:17 2019 +0530
+++ b/hgext/blackbox.py	Sun Jul 07 10:54:41 2019 -0400
@@ -9,12 +9,14 @@
 """log repository events to a blackbox for debugging
 
 Logs event information to .hg/blackbox.log to help debug and diagnose problems.
-The events that get logged can be configured via the blackbox.track config key.
+The events that get logged can be configured via the blackbox.track and
+blackbox.ignore config keys.
 
 Examples::
 
   [blackbox]
   track = *
+  ignore = pythonhook
   # dirty is *EXPENSIVE* (slow);
   # each log entry indicates `+` if the repository is dirty, like :hg:`id`.
   dirty = True
@@ -84,6 +86,9 @@
 configitem('blackbox', 'track',
     default=lambda: ['*'],
 )
+configitem('blackbox', 'ignore',
+    default=lambda: ['chgserver', 'cmdserver', 'extension'],
+)
 configitem('blackbox', 'date-format',
     default='%Y/%m/%d %H:%M:%S',
 )
@@ -94,12 +99,15 @@
     def __init__(self, ui, repo):
         self._repo = repo
         self._trackedevents = set(ui.configlist('blackbox', 'track'))
+        self._ignoredevents = set(ui.configlist('blackbox', 'ignore'))
         self._maxfiles = ui.configint('blackbox', 'maxfiles')
         self._maxsize = ui.configbytes('blackbox', 'maxsize')
         self._inlog = False
 
     def tracked(self, event):
-        return b'*' in self._trackedevents or event in self._trackedevents
+        return ((b'*' in self._trackedevents
+                 and event not in self._ignoredevents)
+                or event in self._trackedevents)
 
     def log(self, ui, event, msg, opts):
         # self._log() -> ctx.dirty() may create new subrepo instance, which
--- a/tests/test-blackbox.t	Wed Jul 17 22:24:17 2019 +0530
+++ b/tests/test-blackbox.t	Sun Jul 07 10:54:41 2019 -0400
@@ -22,9 +22,6 @@
   > [alias]
   > confuse = log --limit 3
   > so-confusing = confuse --style compact
-  > [blackbox]
-  > track = backupbundle, branchcache, command, commandalias, commandexception,
-  >         commandfinish, debug, exthook, incoming, pythonhook, tagscache
   > EOF
 
   $ hg init blackboxtest