D5589: watchman: add the possibility to set the exact watchman binary location
lothiraldan (Boris Feld)
phabricator at mercurial-scm.org
Tue Jan 15 16:57:26 UTC 2019
lothiraldan created this revision.
Herald added subscribers: mercurial-devel, mjpieters.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
This is necessary to make rolling releases of new watchman versions across
users.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D5589
AFFECTED FILES
hgext/fsmonitor/__init__.py
hgext/fsmonitor/pywatchman/__init__.py
hgext/fsmonitor/watchmanclient.py
CHANGE DETAILS
diff --git a/hgext/fsmonitor/watchmanclient.py b/hgext/fsmonitor/watchmanclient.py
--- a/hgext/fsmonitor/watchmanclient.py
+++ b/hgext/fsmonitor/watchmanclient.py
@@ -82,9 +82,11 @@
try:
if self._watchmanclient is None:
self._firsttime = False
+ watchman_exe = self._ui.configpath('fsmonitor', 'watchman_exe')
self._watchmanclient = pywatchman.client(
timeout=self._timeout,
- useImmutableBser=True)
+ useImmutableBser=True,
+ watchman_exe=watchman_exe)
return self._watchmanclient.query(*watchmanargs)
except pywatchman.CommandError as ex:
if 'unable to resolve root' in ex.msg:
diff --git a/hgext/fsmonitor/pywatchman/__init__.py b/hgext/fsmonitor/pywatchman/__init__.py
--- a/hgext/fsmonitor/pywatchman/__init__.py
+++ b/hgext/fsmonitor/pywatchman/__init__.py
@@ -563,9 +563,12 @@
proc = None
closed = True
- def __init__(self, sockpath, timeout):
- self.sockpath = sockpath
- self.timeout = timeout
+ def __init__(self, watchman_exe):
+ def __init__(sockpath, timeout):
+ self.sockpath = sockpath
+ self.timeout = timeout
+ self.watchman_exe = watchman_exe
+ return __init__
def close(self):
if self.proc:
@@ -579,7 +582,7 @@
if self.proc:
return self.proc
args = [
- 'watchman',
+ self.watchman_exe,
'--sockname={0}'.format(self.sockpath),
'--logfile=/BOGUS',
'--statefile=/BOGUS',
@@ -756,17 +759,20 @@
unilateral = ['log', 'subscription']
tport = None
useImmutableBser = None
+ watchman_exe = None
def __init__(self,
sockpath=None,
timeout=1.0,
transport=None,
sendEncoding=None,
recvEncoding=None,
- useImmutableBser=False):
+ useImmutableBser=False,
+ watchman_exe=None):
self.sockpath = sockpath
self.timeout = timeout
self.useImmutableBser = useImmutableBser
+ self.watchman_exe = watchman_exe
if inspect.isclass(transport) and issubclass(transport, Transport):
self.transport = transport
@@ -777,7 +783,7 @@
elif transport == 'local':
self.transport = UnixSocketTransport
elif transport == 'cli':
- self.transport = CLIProcessTransport
+ self.transport = CLIProcessTransport(self.watchman_exe)
if sendEncoding is None:
sendEncoding = 'json'
if recvEncoding is None:
@@ -817,7 +823,7 @@
if path:
return path
- cmd = ['watchman', '--output-encoding=bser', 'get-sockname']
+ cmd = [self.watchman_exe, '--output-encoding=bser', 'get-sockname']
try:
args = dict(stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
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', 'watchman_exe',
+ default='watchman',
+)
configitem('hgwatchman', 'verbose',
default=False,
)
To: lothiraldan, #hg-reviewers
Cc: mjpieters, mercurial-devel
More information about the Mercurial-devel
mailing list