##// END OF EJS Templates
watchman: add the possibility to set the exact watchman binary location...
Boris Feld -
r42134:57264906 default
parent child Browse files
Show More
@@ -161,6 +161,9 b" configitem('fsmonitor', 'timeout',"
161 configitem('fsmonitor', 'blacklistusers',
161 configitem('fsmonitor', 'blacklistusers',
162 default=list,
162 default=list,
163 )
163 )
164 configitem('fsmonitor', 'watchman_exe',
165 default='watchman',
166 )
164 configitem('fsmonitor', 'verbose',
167 configitem('fsmonitor', 'verbose',
165 default=True,
168 default=True,
166 )
169 )
@@ -317,7 +317,7 b' class UnixSocketTransport(Transport):'
317 """ local unix domain socket transport """
317 """ local unix domain socket transport """
318 sock = None
318 sock = None
319
319
320 def __init__(self, sockpath, timeout):
320 def __init__(self, sockpath, timeout, watchman_exe):
321 self.sockpath = sockpath
321 self.sockpath = sockpath
322 self.timeout = timeout
322 self.timeout = timeout
323
323
@@ -397,7 +397,7 b' def _get_overlapped_result_ex_impl(pipe,'
397 class WindowsNamedPipeTransport(Transport):
397 class WindowsNamedPipeTransport(Transport):
398 """ connect to a named pipe """
398 """ connect to a named pipe """
399
399
400 def __init__(self, sockpath, timeout):
400 def __init__(self, sockpath, timeout, watchman_exe):
401 self.sockpath = sockpath
401 self.sockpath = sockpath
402 self.timeout = int(math.ceil(timeout * 1000))
402 self.timeout = int(math.ceil(timeout * 1000))
403 self._iobuf = None
403 self._iobuf = None
@@ -563,9 +563,10 b' class CLIProcessTransport(Transport):'
563 proc = None
563 proc = None
564 closed = True
564 closed = True
565
565
566 def __init__(self, sockpath, timeout):
566 def __init__(self, sockpath, timeout, watchman_exe):
567 self.sockpath = sockpath
567 self.sockpath = sockpath
568 self.timeout = timeout
568 self.timeout = timeout
569 self.watchman_exe = watchman_exe
569
570
570 def close(self):
571 def close(self):
571 if self.proc:
572 if self.proc:
@@ -579,7 +580,7 b' class CLIProcessTransport(Transport):'
579 if self.proc:
580 if self.proc:
580 return self.proc
581 return self.proc
581 args = [
582 args = [
582 'watchman',
583 self.watchman_exe,
583 '--sockname={0}'.format(self.sockpath),
584 '--sockname={0}'.format(self.sockpath),
584 '--logfile=/BOGUS',
585 '--logfile=/BOGUS',
585 '--statefile=/BOGUS',
586 '--statefile=/BOGUS',
@@ -756,6 +757,7 b' class client(object):'
756 unilateral = ['log', 'subscription']
757 unilateral = ['log', 'subscription']
757 tport = None
758 tport = None
758 useImmutableBser = None
759 useImmutableBser = None
760 watchman_exe = None
759
761
760 def __init__(self,
762 def __init__(self,
761 sockpath=None,
763 sockpath=None,
@@ -763,10 +765,12 b' class client(object):'
763 transport=None,
765 transport=None,
764 sendEncoding=None,
766 sendEncoding=None,
765 recvEncoding=None,
767 recvEncoding=None,
766 useImmutableBser=False):
768 useImmutableBser=False,
769 watchman_exe=None):
767 self.sockpath = sockpath
770 self.sockpath = sockpath
768 self.timeout = timeout
771 self.timeout = timeout
769 self.useImmutableBser = useImmutableBser
772 self.useImmutableBser = useImmutableBser
773 self.watchman_exe = watchman_exe
770
774
771 if inspect.isclass(transport) and issubclass(transport, Transport):
775 if inspect.isclass(transport) and issubclass(transport, Transport):
772 self.transport = transport
776 self.transport = transport
@@ -817,7 +821,7 b' class client(object):'
817 if path:
821 if path:
818 return path
822 return path
819
823
820 cmd = ['watchman', '--output-encoding=bser', 'get-sockname']
824 cmd = [self.watchman_exe, '--output-encoding=bser', 'get-sockname']
821 try:
825 try:
822 args = dict(stdout=subprocess.PIPE,
826 args = dict(stdout=subprocess.PIPE,
823 stderr=subprocess.PIPE,
827 stderr=subprocess.PIPE,
@@ -858,7 +862,7 b' class client(object):'
858 if self.sockpath is None:
862 if self.sockpath is None:
859 self.sockpath = self._resolvesockname()
863 self.sockpath = self._resolvesockname()
860
864
861 self.tport = self.transport(self.sockpath, self.timeout)
865 self.tport = self.transport(self.sockpath, self.timeout, self.watchman_exe)
862 self.sendConn = self.sendCodec(self.tport)
866 self.sendConn = self.sendCodec(self.tport)
863 self.recvConn = self.recvCodec(self.tport)
867 self.recvConn = self.recvCodec(self.tport)
864
868
@@ -82,9 +82,11 b' class client(object):'
82 try:
82 try:
83 if self._watchmanclient is None:
83 if self._watchmanclient is None:
84 self._firsttime = False
84 self._firsttime = False
85 watchman_exe = self._ui.configpath('fsmonitor', 'watchman_exe')
85 self._watchmanclient = pywatchman.client(
86 self._watchmanclient = pywatchman.client(
86 timeout=self._timeout,
87 timeout=self._timeout,
87 useImmutableBser=True)
88 useImmutableBser=True,
89 watchman_exe=watchman_exe)
88 return self._watchmanclient.query(*watchmanargs)
90 return self._watchmanclient.query(*watchmanargs)
89 except pywatchman.CommandError as ex:
91 except pywatchman.CommandError as ex:
90 if 'unable to resolve root' in ex.msg:
92 if 'unable to resolve root' in ex.msg:
General Comments 0
You need to be logged in to leave comments. Login now