mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 00:14:35 +03:00
hg: fsmonitor: fix sockpath propagation from WATCHMAN_SOCK env
Summary: This unbreaks the watchman/hg integration tests in a more sustainable and holistic way than the workaround in D19415053. The issue is that the explicit fsmonitor sockpath configuration option didn't take into account that the environment needs to take precedence in order for the appropriate watchman instance to be used by the set of processes in a given process tree. It is not feasible to have them all pass `--config` options to mercurial because that would require teaching several layers about the fsmonitor extension, and then later to update them as we evolve how mercurial works. Reviewed By: quark-zju Differential Revision: D19415252 fbshipit-source-id: 5872d0462e466bfb5d70f809c3c433d92fb78567
This commit is contained in:
parent
fdaf9bffd8
commit
8d85b68d6b
@ -11,7 +11,7 @@ import ctypes
|
|||||||
import getpass
|
import getpass
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from edenscm.mercurial import blackbox, progress, pycompat, util
|
from edenscm.mercurial import blackbox, encoding, progress, pycompat, util
|
||||||
from edenscm.mercurial.node import hex
|
from edenscm.mercurial.node import hex
|
||||||
|
|
||||||
from .. import pywatchman
|
from .. import pywatchman
|
||||||
@ -74,12 +74,19 @@ class client(object):
|
|||||||
|
|
||||||
self._sockpath = None
|
self._sockpath = None
|
||||||
|
|
||||||
sockpath = repo.ui.config("fsmonitor", "sockpath")
|
# When spawned indirectly by watchman, or the watchman/eden integration
|
||||||
if sockpath and self._user:
|
# tests, the appropriate sockpath is passed down to us via the environment
|
||||||
sockpath = sockpath.replace("%i", self._user)
|
# and must take precedence over other configuration
|
||||||
|
sockpath = encoding.environ.get("WATCHMAN_SOCK", None)
|
||||||
|
if sockpath is None:
|
||||||
|
sockpath = repo.ui.config("fsmonitor", "sockpath")
|
||||||
|
if sockpath and self._user:
|
||||||
|
sockpath = sockpath.replace("%i", self._user)
|
||||||
|
repo.ui.debug("watchman sockpath is set as %s\n" % sockpath)
|
||||||
|
|
||||||
|
if sockpath:
|
||||||
if os.path.exists(sockpath):
|
if os.path.exists(sockpath):
|
||||||
self._sockpath = sockpath
|
self._sockpath = sockpath
|
||||||
repo.ui.debug("watchman sockpath is set as %s\n" % sockpath)
|
|
||||||
|
|
||||||
self._transport = None
|
self._transport = None
|
||||||
if repo.ui.configbool("fsmonitor", "tcp", False):
|
if repo.ui.configbool("fsmonitor", "tcp", False):
|
||||||
|
Loading…
Reference in New Issue
Block a user