# HG changeset patch # User Boris Feld # Date 2018-12-21 16:12:31 # Node ID 18adb747a33219717851d5f1887002d42f9a71b8 # Parent fa471151d26981a3ff978369e29630637c9a23af 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 diff --git a/hgext/fsmonitor/__init__.py b/hgext/fsmonitor/__init__.py --- a/hgext/fsmonitor/__init__.py +++ b/hgext/fsmonitor/__init__.py @@ -161,6 +161,9 @@ configitem('fsmonitor', 'timeout', configitem('fsmonitor', 'blacklistusers', default=list, ) +configitem('hgwatchman', 'verbose', + default=True, +) configitem('experimental', 'fsmonitor.transaction_notify', default=False, ) @@ -172,11 +175,14 @@ configitem('experimental', 'fsmonitor.tr 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)