mirror of
https://github.com/facebook/sapling.git
synced 2024-10-12 17:58:27 +03:00
a5e1820702
Summary: This splits out the logic in the `fsmonitor` extension that is responsible for publishing `hg.filemerge` and `hg.update` state changes to Watchman into its own extension, `hgevents`. This is because we want the behavior of `hgevents` when Hg is running in Eden, but we do not want the remaining behavior of `fsmonitor` when Hg is running in Eden, so splitting the logic into separate extensions is the most straightforward way to achieve that. To achieve the split, we move some more logic that is common to both `fsmonitor` and `hgevents` out of `hgext/fsmonitor/__init__.py` and into `hgext/extlib/watchmanclient/__init__.py`. Then we move these lines out of `extsetup()` in `fsmonitor` to create `extsetup()` in `hgevents`: ``` extensions.wrapfunction(merge, 'update', wrapupdate) extensions.wrapfunction(filemerge, '_xmerge', _xmerge) ``` We also have to pull all of the transitive dependencies for this logic into `hgevents`. Finally, we also have to define a `reposetup()` function in `hgevents` that does a subset of what `reposetup()` does in `fsmonitor`. Specifically, it ensures that a Watchman client is created for a `repo`, as appropriate, so that it can be used to dispatch state changes to Watchman in `state_filemerge` and `state_update`. Note that the utility functions `createclientforrepo()` and `getclientforrepo()` have been added to ensure that only one Watchman client is created (and shared) when both `fsmonitor` and `hgevents` are enabled. Today, when an Hg repo is created in Eden, we set `extensions.fsmonitor=!` in the `.hg/hgrc`: diffusion/FBS/browse/master/fbcode/eden/hooks/hg/post-clone.py$69 Therefore, to get existing repos (both Eden and non-Eden) to pick up the `hgevents` extension automatically, we add it to the list of `[extensions]` in `common.rc`: diffusion/FBS/browse/master/fbcode/scm/hg/fb/staticfiles/etc/mercurial/repo-specific/common.rc$53-60 as this is where `fsmonitor` is configured. We do not enable it in `scm/hg/fb/staticfiles/etc/mercurial/facebook.rc` because there is no reason to enable `hgevents` on Hg servers. Therefore, we also decline to add `hgevents` to the set of `DEFAULT_EXTENSIONS` in `scm/hg/mercurial/extensions.py`. Reviewed By: quark-zju Differential Revision: D8003628 fbshipit-source-id: 4f23881f8c25f4638f5475c292537b0352ae8d15 |
||
---|---|---|
.. | ||
__init__.py | ||
state.py |