D5588: watchman: disable fsmonitor when running non-interactively
lothiraldan (Boris Feld)
phabricator at mercurial-scm.org
Tue Jan 15 16:57:16 UTC 2019
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
One of the risks with activating fsmonitor globally is resource exhaustion
(like inotify watches on Linux).
When launching background-jobs, it's often better to not activate fsmonitor in
order to conserve resources for future interactive commands launched by users.
This can be overridden with the environment variable HGWATCHMAN_ENABLE
REPOSITORY
rHG Mercurial
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
@@ -777,6 +777,18 @@
'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':
+ return
+ else:
+ if not ui.interactive():
+ return
+
if repo.local():
# We don't work with subrepos either.
#
To: lothiraldan, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list