You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
status: prevent accidentally overwriting dirstate during native status
Summary:
There was a bug where hg status would take the lock, then write the
treestate and dirstate without checking to see if another process had written
the dirstate/treestate since the current process had read it. This would cause
files to show up as dirty when they weren't, and potentially result in invalid
store id errors.
For example:
```
Process 1: Starts an hg checkout and takes the wlock.
Process 2: Starts hg status and begins updating the in-memory treestate
Process 1: Completes the checkout and writes a new dirstate/treestate showing
all the newly clean files. It releases the wlock.
Process 2: Takes the wlock and writes the watchman file updates it saw during
status. This overwrites process 1's written state.
Future hg status runs now see a bunch of empty files because it's using the
pre-checkout treestate to compare against the post-checkout working copy.
```
The new code prevents the status process from writing the update (since it's
mostly just an optimization anyway) if the dirstate changed out from under it.
Reviewed By: quark-zju
Differential Revision: D41052635
fbshipit-source-id: aa5459eab5b4fe5e86e037e7ffa364149cb686a8
0 commit comments