D5588: watchman: disable fsmonitor when running non-interactively

lothiraldan (Boris Feld) phabricator at mercurial-scm.org
Thu Jan 24 12:40:51 EST 2019


lothiraldan updated this revision to Diff 13413.
Herald added a subscriber: mjpieters.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5588?vs=13224&id=13413

REVISION DETAIL
  https://phab.mercurial-scm.org/D5588

AFFECTED FILES
  hgext/fsmonitor/__init__.py

CHANGE DETAILS

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', 'blacklistusers',
     default=list,
 )
+configitem('fsmonitor', 'enable_on_non_interactive',
+    default=True,
+)
 configitem('hgwatchman', 'verbose',
     default=True,
 )
@@ -778,6 +781,24 @@
                       'extension and has been disabled.\n') % ext)
             return
 
+    enabled = None
+    if 'HGWATCHMAN_ENABLE' in encoding.environ:
+        enabled = encoding.environ['HGWATCHMAN_ENABLE'].lower()
+
+    if enabled == 'true' or enabled == '':
+        pass
+    elif enabled == 'false':
+        ui.debug('fsmonitor: disabled through HGWATCHMAN_ENABLE env variable')
+        return
+    else:
+        interactive = ui.interactive()
+        enable_on_non_interactive = ui.configbool(
+            'fsmonitor', 'enable_on_non_interactive'
+        )
+        if not interactive and not enable_on_non_interactive:
+            ui.debug('fsmonitor: disabled for non-interactive commands')
+            return
+
     if repo.local():
         # We don't work with subrepos either.
         #



To: lothiraldan, #hg-reviewers, indygreg
Cc: mjpieters, indygreg, mercurial-devel


More information about the Mercurial-devel mailing list