add TCP support to fsmonitor

Summary:
This is part of proof-of-concept to test Watchman over TCP, a means
to accelerate hg workflows for the ASIC teams within Facebook.

For more context, refer to master task T55191832

Reviewed By: xavierd

Differential Revision: D18482107

fbshipit-source-id: 08ba3641854d81fe2a1cd8739bb4e9abcbc700ed
This commit is contained in:
Joseph Friesen 2020-01-15 13:41:47 -08:00 committed by Facebook Github Bot
parent aebbe4937f
commit 1b504b8c93
3 changed files with 13 additions and 0 deletions

View File

@ -81,6 +81,11 @@ class client(object):
self._sockpath = sockpath
repo.ui.debug("watchman sockpath is set as %s\n" % sockpath)
self._transport = None
if repo.ui.configbool("fsmonitor", "tcp", False):
self._transport = "tcp"
self._tcp_host = repo.ui.config("fsmonitor", "tcp-host", "::1")
self._tcp_port = repo.ui.configint("fsmonitor", "tcp-port", 12300)
self._timeout = timeout
self._watchmanclient = None
self._root = repo.root
@ -123,6 +128,8 @@ class client(object):
self._firsttime = False
self._watchmanclient = pywatchman.client(
sockpath=self._sockpath,
transport=self._transport,
tcpAddress=(self._tcp_host, self._tcp_port),
timeout=self._timeout,
recvEncoding="bser-v1",
sendEncoding="bser-v1",

View File

@ -215,6 +215,9 @@ configitem("fsmonitor", "walk_on_invalidate", default=False)
configitem("fsmonitor", "watchman-changed-file-threshold", default=200)
configitem("fsmonitor", "warn-fresh-instance", default=False)
configitem("fsmonitor", "fallback-on-watchman-exception", default=True)
configitem("fsmonitor", "tcp", default=False)
configitem("fsmonitor", "tcp-host", default="::1")
configitem("fsmonitor", "tcp-port", default=12300)
# This extension is incompatible with the following blacklisted extensions
# and will disable itself when encountering one of these:

View File

@ -60,6 +60,9 @@ New errors are not allowed. Warnings are strongly discouraged.
undocumented: fbscmquery.gitcallsigns (list)
undocumented: fbscmquery.reponame (str)
undocumented: format.usehgsql (bool)
undocumented: fsmonitor.tcp (bool)
undocumented: fsmonitor.tcp-host (str) ["::1"]
undocumented: fsmonitor.tcp-port (int) [12300]
undocumented: git.public (list)
undocumented: grep.biggrepcorpus (str)
undocumented: grep.biggreptier (str) ["biggrep.master"]