sapling/tests/test-fsmonitor-warn-fresh.t
Jun Wu 8d4d0a66a2 context: wait for wlock for dirstate fixup if watchman reports fresh instance
Summary:
This is an attempt to solve issues that watchman state in dirstate stays stale
and users have pretty bad experience.

Normally, `hg status` is a "read-only" operation that works in a lock-free way,
and `status` still work if other hg commands are taking a lock. However,
`hg status` does need to update watchman state (clock, need-check file list) to
stay performant.

In case watchman reports "fresh instance" case, watchman also returns all file
paths in the working copy, which means the current `status` has very bad
performance, and the next `status` call can still be bad if the watchman state
in dirstate does not get updated.

This diff adds special handling of "fresh instance", waits for the lock, and
attempts to update the watchman state. It should reduce user frustration about
continuously slow `hg status` commands. In case it failed to update the
watchman state, also print warning messages so the user is aware of the issue.
For example, if there is an ongoing `hg histedit` that waits for the editor.

Reviewed By: wez

Differential Revision: D17468790

fbshipit-source-id: ad06bb1d5d13c6904db328c42a470112c3ee9940
2019-09-19 19:07:50 -07:00

13 lines
344 B
Perl

#require fsmonitor
$ setconfig fsmonitor.warn-fresh-instance=true
$ newrepo
A warning is printed for the first use
$ hg status --debug
warning: watchman has recently started (pid *) - operation will be slower than usual (glob)
poststatusfixup decides to wait for wlock since watchman reported fresh instance
$ hg status --debug