Mercurial > hg
diff tests/test-dirstate-version-fallback.t @ 50660:bf16ef96defe stable
rust-dirstate: fall back to v1 if reading v2 failed
This will help us not fail when a v1 dirstate is present on disk while a v2
was expected (which could happen with a racy/interrupted upgrade).
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Mon, 05 Jun 2023 16:43:27 +0200 |
parents | 9e08cfbe77b1 |
children | e7a3611181aa |
line wrap: on
line diff
--- a/tests/test-dirstate-version-fallback.t Mon Jun 05 17:29:52 2023 +0200 +++ b/tests/test-dirstate-version-fallback.t Mon Jun 05 16:43:27 2023 +0200 @@ -20,7 +20,7 @@ Upgrade it to v2 - $ hg debugupgraderepo -q --config format.use-dirstate-v2=1 --run | grep added + $ hg debugupgraderepo -q --config format.use-dirstate-v2=1 --run | egrep 'added:|removed:' added: dirstate-v2 $ hg debugrequires | grep dirstate dirstate-v2 @@ -35,9 +35,15 @@ There should be no errors, but a v2 dirstate should be written back to disk $ hg st - abort: dirstate-v2 parse error: when reading docket, Expected at least * bytes, got * (glob) (known-bad-output !) - [255] $ ls -1 .hg/dirstate* .hg/dirstate - .hg/dirstate.* (glob) (missing-correct-output !) + .hg/dirstate.* (glob) + +Corrupt the dirstate to see how the errors show up to the user + $ echo "I ate your data" > .hg/dirstate + $ hg st + abort: working directory state appears damaged! (no-rhg !) + (falling back to dirstate-v1 from v2 also failed) (no-rhg !) + abort: Too little data for dirstate. (rhg !) + [255]