D5588: watchman: disable fsmonitor when running non-interactively

lothiraldan (Boris Feld) phabricator at mercurial-scm.org
Wed Feb 13 10:03:45 EST 2019


lothiraldan updated this revision to Diff 14069.

REPOSITORY
  rHG Mercurial

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

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('fsmonitor', 'verbose',
     default=True,
 )
@@ -760,6 +763,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