Mercurial > hg
diff hgext/fsmonitor/__init__.py @ 42652:684b56ade431
fsmonitor: add support for extra `hg debuginstall` data
This might make some things easier to debug, and for default bug
report templates it'll help collect more data from users all at
once. I don't actually need fsmonitor in our bug reports (we don't use
it), but this demonstrates the utility of the preceding patches
without having to add new things to core.
Differential Revision: https://phab.mercurial-scm.org/D6682
author | Augie Fackler <augie@google.com> |
---|---|
date | Tue, 23 Jul 2019 15:01:28 -0400 |
parents | ab1900323b1d |
children | 9f2189b6bf2a |
line wrap: on
line diff
--- a/hgext/fsmonitor/__init__.py Tue Jul 23 14:37:51 2019 -0400 +++ b/hgext/fsmonitor/__init__.py Tue Jul 23 15:01:28 2019 -0400 @@ -112,6 +112,7 @@ import os import stat import sys +import tempfile import weakref from mercurial.i18n import _ @@ -175,6 +176,23 @@ # and will disable itself when encountering one of these: _blacklist = ['largefiles', 'eol'] +def debuginstall(ui, fm): + fm.write("fsmonitor-watchman", + _("fsmonitor checking for watchman binary... (%s)\n"), + ui.configpath("fsmonitor", "watchman_exe")) + root = tempfile.mkdtemp() + c = watchmanclient.client(ui, root) + err = None + try: + v = c.command("version") + fm.write("fsmonitor-watchman-version", + _(" watchman binary version %s\n"), v["version"]) + except watchmanclient.Unavailable as e: + err = str(e) + fm.condwrite(err, "fsmonitor-watchman-error", + _(" watchman binary missing or broken: %s\n"), err) + return 1 if err else 0 + def _handleunavailable(ui, state, ex): """Exception handler for Watchman interaction exceptions""" if isinstance(ex, watchmanclient.Unavailable):