changeset 41488:18adb747a332

watchman: add verbose config knob This new config knob allows to silent watchman log and warning messages when watchman is unavailable. Differential Revision: https://phab.mercurial-scm.org/D5586
author Boris Feld <boris.feld@octobus.net>
date Fri, 21 Dec 2018 17:12:31 +0100
parents fa471151d269
children 5125f0a9728b
files hgext/fsmonitor/__init__.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/fsmonitor/__init__.py	Tue Jan 29 22:59:15 2019 -0800
+++ b/hgext/fsmonitor/__init__.py	Fri Dec 21 17:12:31 2018 +0100
@@ -161,6 +161,9 @@
 configitem('fsmonitor', 'blacklistusers',
     default=list,
 )
+configitem('hgwatchman', 'verbose',
+    default=True,
+)
 configitem('experimental', 'fsmonitor.transaction_notify',
     default=False,
 )
@@ -172,11 +175,14 @@
 def _handleunavailable(ui, state, ex):
     """Exception handler for Watchman interaction exceptions"""
     if isinstance(ex, watchmanclient.Unavailable):
-        if ex.warn:
+        # experimental config: hgwatchman.verbose
+        if ex.warn and ui.configbool('hgwatchman', 'verbose'):
             ui.warn(str(ex) + '\n')
         if ex.invalidate:
             state.invalidate()
-        ui.log('fsmonitor', 'Watchman unavailable: %s\n', ex.msg)
+        # experimental config: hgwatchman.verbose
+        if ui.configbool('hgwatchman','verbose'):
+            ui.log('fsmonitor', 'Watchman unavailable: %s\n', ex.msg)
     else:
         ui.log('fsmonitor', 'Watchman exception: %s\n', ex)