##// END OF EJS Templates
fsmonitor: add support for extra `hg debuginstall` data...
Augie Fackler -
r42876:3358dc6e default draft
parent child Browse files
Show More
@@ -112,6 +112,7 b' import hashlib'
112 import os
112 import os
113 import stat
113 import stat
114 import sys
114 import sys
115 import tempfile
115 import weakref
116 import weakref
116
117
117 from mercurial.i18n import _
118 from mercurial.i18n import _
@@ -175,6 +176,23 b" configitem('experimental', 'fsmonitor.tr"
175 # and will disable itself when encountering one of these:
176 # and will disable itself when encountering one of these:
176 _blacklist = ['largefiles', 'eol']
177 _blacklist = ['largefiles', 'eol']
177
178
179 def debuginstall(ui, fm):
180 fm.write("fsmonitor-watchman",
181 _("fsmonitor checking for watchman binary... (%s)\n"),
182 ui.configpath("fsmonitor", "watchman_exe"))
183 root = tempfile.mkdtemp()
184 c = watchmanclient.client(ui, root)
185 err = None
186 try:
187 v = c.command("version")
188 fm.write("fsmonitor-watchman-version",
189 _(" watchman binary version %s\n"), v["version"])
190 except watchmanclient.Unavailable as e:
191 err = str(e)
192 fm.condwrite(err, "fsmonitor-watchman-error",
193 _(" watchman binary missing or broken: %s\n"), err)
194 return 1 if err else 0
195
178 def _handleunavailable(ui, state, ex):
196 def _handleunavailable(ui, state, ex):
179 """Exception handler for Watchman interaction exceptions"""
197 """Exception handler for Watchman interaction exceptions"""
180 if isinstance(ex, watchmanclient.Unavailable):
198 if isinstance(ex, watchmanclient.Unavailable):
@@ -153,6 +153,16 b' not found (this is intentionally using b'
153 1 problems detected, please check your install!
153 1 problems detected, please check your install!
154 [1]
154 [1]
155
155
156 debuginstall extension support
157 $ hg debuginstall --config extensions.fsmonitor= --config fsmonitor.watchman_exe=false | grep atchman
158 fsmonitor checking for watchman binary... (false)
159 watchman binary missing or broken: warning: Watchman unavailable: watchman exited with code 1
160 Verify the json works too:
161 $ hg debuginstall --config extensions.fsmonitor= --config fsmonitor.watchman_exe=false -Tjson | grep atchman
162 "fsmonitor-watchman": "false",
163 "fsmonitor-watchman-error": "warning: Watchman unavailable: watchman exited with code 1",
164
165
156 #if test-repo
166 #if test-repo
157 $ . "$TESTDIR/helpers-testrepo.sh"
167 $ . "$TESTDIR/helpers-testrepo.sh"
158
168
General Comments 0
You need to be logged in to leave comments. Login now