fsmonitor: send state about filemerge
Summary:
The merge process could be interactive, and tools like Hack wants to
scan changed files when the user is resolving conflicts. There is a
"hg.update" watchman state and "state-enter", "state-exit" events that help
detect the "update" process. However, the interactive "ui.merge" process is
inside the "update" process and cannot be easily decoupled confidently (i.e.
hard to end "update" state before doing the merge).
It's also hard to have a general "merge" state due to the current watchman
design. Because a merge might be across multiple hg processes (ex.
non-interactive ui.merge, hg exits, returns to the shell, and the user invokes
`hg resolve --mark` to end the merge state), and the current watchman
implementation will force end all states associated with a watchman socket
connection. If a hg process exits, it will disconnect from the watchman socket
and the merge state will be forced terminated, although there is still
unresolved conflicts. Previous attempt on this is D7286181.
This patch adds a "hg.filemerge" watchman state that could make watchman
users aware of ongoing interactive merge resolutions. The event fires when an
external merge tool is called, per conflicted file. It is strictly a sub
interval of an "update" state, which is within a single process. So it does not
have the problem that a "merge" state has.
Differential Revision: D7648929
fbshipit-source-id: 858beba1bff261e8da5bd4d8b08a388dcbc8a9ef
2018-04-19 22:38:59 +03:00
|
|
|
#require fsmonitor
|
|
|
|
|
|
|
|
(Run this test using HGFSMONITOR_TESTS=1)
|
|
|
|
|
|
|
|
$ newrepo
|
|
|
|
|
|
|
|
$ hg debugdrawdag << EOS
|
|
|
|
> C # C/A=0\n1\n
|
|
|
|
> | # B/A=1\n2\n
|
|
|
|
> | B # C/2=1\n
|
|
|
|
> |/ # B/2=2\n
|
|
|
|
> A # A/A=1\n
|
|
|
|
> EOS
|
|
|
|
|
2019-06-26 20:59:13 +03:00
|
|
|
$ enable fsmonitor rebase hgevents
|
2019-04-23 12:45:38 +03:00
|
|
|
$ setconfig blackbox.track=merge_resolve,watchman blackbox.logsource=true
|
fsmonitor: send state about filemerge
Summary:
The merge process could be interactive, and tools like Hack wants to
scan changed files when the user is resolving conflicts. There is a
"hg.update" watchman state and "state-enter", "state-exit" events that help
detect the "update" process. However, the interactive "ui.merge" process is
inside the "update" process and cannot be easily decoupled confidently (i.e.
hard to end "update" state before doing the merge).
It's also hard to have a general "merge" state due to the current watchman
design. Because a merge might be across multiple hg processes (ex.
non-interactive ui.merge, hg exits, returns to the shell, and the user invokes
`hg resolve --mark` to end the merge state), and the current watchman
implementation will force end all states associated with a watchman socket
connection. If a hg process exits, it will disconnect from the watchman socket
and the merge state will be forced terminated, although there is still
unresolved conflicts. Previous attempt on this is D7286181.
This patch adds a "hg.filemerge" watchman state that could make watchman
users aware of ongoing interactive merge resolutions. The event fires when an
external merge tool is called, per conflicted file. It is strictly a sub
interval of an "update" state, which is within a single process. So it does not
have the problem that a "merge" state has.
Differential Revision: D7648929
fbshipit-source-id: 858beba1bff261e8da5bd4d8b08a388dcbc8a9ef
2018-04-19 22:38:59 +03:00
|
|
|
|
|
|
|
$ hg rebase -s B -d C --tool=false
|
2019-10-16 02:28:01 +03:00
|
|
|
rebasing 65f3e88a53bc "B" (B)
|
fsmonitor: send state about filemerge
Summary:
The merge process could be interactive, and tools like Hack wants to
scan changed files when the user is resolving conflicts. There is a
"hg.update" watchman state and "state-enter", "state-exit" events that help
detect the "update" process. However, the interactive "ui.merge" process is
inside the "update" process and cannot be easily decoupled confidently (i.e.
hard to end "update" state before doing the merge).
It's also hard to have a general "merge" state due to the current watchman
design. Because a merge might be across multiple hg processes (ex.
non-interactive ui.merge, hg exits, returns to the shell, and the user invokes
`hg resolve --mark` to end the merge state), and the current watchman
implementation will force end all states associated with a watchman socket
connection. If a hg process exits, it will disconnect from the watchman socket
and the merge state will be forced terminated, although there is still
unresolved conflicts. Previous attempt on this is D7286181.
This patch adds a "hg.filemerge" watchman state that could make watchman
users aware of ongoing interactive merge resolutions. The event fires when an
external merge tool is called, per conflicted file. It is strictly a sub
interval of an "update" state, which is within a single process. So it does not
have the problem that a "merge" state has.
Differential Revision: D7648929
fbshipit-source-id: 858beba1bff261e8da5bd4d8b08a388dcbc8a9ef
2018-04-19 22:38:59 +03:00
|
|
|
merging 2
|
|
|
|
merging A
|
|
|
|
merging 2 failed!
|
|
|
|
unresolved conflicts (see hg resolve, then hg rebase --continue)
|
|
|
|
[1]
|
|
|
|
|
2019-07-06 12:41:45 +03:00
|
|
|
$ hg blackbox --no-timestamp --no-sid --pattern '{"watchman":"_"}' | egrep '(watchman.*state.*)'
|
|
|
|
[watchman] command ["state-enter",{"metadata":{"distance":3,"merge":false,"partial":false,"rev":"0000000000000000000000000000000000000000","status":"ok"},"name":"hg.update"}] finished in 0 ms
|
|
|
|
[watchman] command ["state-leave",{"metadata":{"distance":3,"merge":false,"partial":false,"rev":"2e2f27616b65209eecd4710c454df0f678f271d9","status":"ok"},"name":"hg.update"}] finished in 0 ms
|
|
|
|
[watchman] command ["state-enter",{"metadata":{"distance":3,"merge":true,"partial":false,"rev":"2e2f27616b65209eecd4710c454df0f678f271d9","status":"ok"},"name":"hg.update"}] finished in 0 ms
|
|
|
|
[watchman] command ["state-enter",{"metadata":{"path":"2"},"name":"hg.filemerge"}] finished in 0 ms
|
|
|
|
[watchman] command ["state-leave",{"metadata":{"path":"2"},"name":"hg.filemerge"}] finished in 0 ms
|
|
|
|
[watchman] command ["state-leave",{"metadata":{"distance":3,"merge":true,"partial":false,"rev":"65f3e88a53bc0f5183deea0cdbc46738777ec005","status":"ok"},"name":"hg.update"}] finished in 0 ms
|