Mercurial > hg
view tests/test-update-issue1456.t @ 28443:49d65663d7e4
fsmonitor: hook up state-enter, state-leave signals
Keeping the codebase in sync with upstream:
Watchman 4.4 introduced an advanced settling feature that allows publishing
tools to notify subscribing tools of the boundaries for important filesystem
operations.
https://facebook.github.io/watchman/docs/cmd/subscribe.html#advanced-settling
has more information about how this feature works.
This diff connects a signal that we're calling `hg.update` to the mercurial
update function so that mercurial can indirectly notify tools (such as IDEs or
build machinery) when it is changing the working copy. This will allow those
tools to pause their normal actions as the files are changing and defer them
until the end of the operation.
In addition to sending the enter/leave signals for the state, we are able to
publish useful metadata along the same channel. In this case we are passing
the following pieces of information:
1. destination revision hash
2. An estimate of the distance between the current state and the target state
3. A success indicator.
4. Whether it is a partial update
The distance is estimate may be useful to tools that wish to change their
strategy after the update has complete. For example, a large update may be
efficient to deal with by walking some internal state in the subscriber rather
than feeding every individual file notification through its normal (small)
delta mechanism.
We estimate the distance by comparing the repository revision number. In some
cases we cannot come up with a number so we report 0. This is ok; we're
offering this for informational purposes only and don't guarantee its accuracy.
The success indicator is only really meaningful when we generate the
state-leave notification; it indicates the overall success of the update.
author | Martijn Pieters <mjpieters@fb.com> |
---|---|
date | Thu, 10 Mar 2016 16:04:09 +0000 |
parents | 7a9cbb315d84 |
children | 527ce85c2e60 |
line wrap: on
line source
#require execbit $ rm -rf a $ hg init a $ cd a $ echo foo > foo $ hg ci -qAm0 $ echo toremove > toremove $ echo todelete > todelete $ chmod +x foo toremove todelete $ hg ci -qAm1 Test that local removed/deleted, remote removed works with flags $ hg rm toremove $ rm todelete $ hg co -q 0 $ echo dirty > foo $ hg up -c abort: uncommitted changes [255] $ hg up -q $ cat foo dirty $ hg st -A M foo C todelete C toremove Validate update of standalone execute bit change: $ hg up -C 0 1 files updated, 0 files merged, 2 files removed, 0 files unresolved $ chmod -x foo $ hg ci -m removeexec nothing changed [1] $ hg up -C 0 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg up 3 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg st $ cd ..