# HG changeset patch # User Pierre-Yves David # Date 2023-02-24 00:09:11 # Node ID 72104dd91f2bc67e99aad21e52072761e066d869 # Parent ee75dd844ab64f1b303fee23ca013a7ff58b342f dirstate: test a `hg status` raced by another `hg status` This shows that `rhg` is misbehaving here. diff --git a/tests/test-dirstate-status-write-race.t b/tests/test-dirstate-status-write-race.t --- a/tests/test-dirstate-status-write-race.t +++ b/tests/test-dirstate-status-write-race.t @@ -359,3 +359,52 @@ final cleanup $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting $ cd .. + +Race with another status +------------------------ + + $ cp -a reference-repo race-with-status + $ cd race-with-status + +spin a `hg status` with some caches to update + + $ touch -t 200001010030 dir/nested/h + $ hg st >$TESTTMP/status-race-lock.out 2>$TESTTMP/status-race-lock.log \ + > --config rhg.on-unsupported=abort \ + > --config devel.sync.status.pre-dirstate-write-file=$TESTTMP/status-race-lock \ + > & + $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/status-race-lock.waiting + +touch g + + $ touch -t 200001010025 g + $ hg status + A dir/o + R dir/nested/m + ? dir/n + ? p + ? q + $ touch $TESTTMP/status-race-lock + $ wait + +the first update should be on disk + + $ hg debugstate --all | grep "g" + n 644 0 2000-01-01 00:25:00 g (no-rhg !) + n 644 0 2000-01-01 00:25:00 g (missing-correct-output rhg !) + n 644 0 2000-01-01 00:10:00 g (known-bad-output rhg !) + +The status process should return a consistent result and not crash. + + $ cat $TESTTMP/status-race-lock.out + A dir/o + R dir/nested/m + ? dir/n + ? p + ? q + $ cat $TESTTMP/status-race-lock.log + +final cleanup + + $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting + $ cd ..