test-dirstate-version-fallback.t
51 lines
| 1.2 KiB
| text/troff
|
Tads3Lexer
/ tests / test-dirstate-version-fallback.t
Raphaël Gomès
|
r51552 | $ cat >> $HGRCPATH << EOF | ||
> [storage] | ||||
> dirstate-v2.slow-path=allow | ||||
Raphaël Gomès
|
r51560 | > [format] | ||
> use-dirstate-v2=no | ||||
Raphaël Gomès
|
r51552 | > EOF | ||
Set up a v1 repo | ||||
$ hg init repo | ||||
$ cd repo | ||||
$ echo a > a | ||||
Arseniy Alekseyev
|
r51616 | $ touch file-with-somewhat-long-name-to-make-dirstate-v1-bigger-than-v2 | ||
$ hg commit -Aqm a | ||||
Raphaël Gomès
|
r51552 | $ hg debugrequires | grep dirstate | ||
[1] | ||||
$ ls -1 .hg/dirstate* | ||||
.hg/dirstate | ||||
Copy v1 dirstate | ||||
$ cp .hg/dirstate $TESTTMP/dirstate-v1-backup | ||||
Upgrade it to v2 | ||||
Mads Kiilerich
|
r51618 | $ hg debugupgraderepo -q --config format.use-dirstate-v2=1 --run | grep -E 'added:|removed:' | ||
Raphaël Gomès
|
r51552 | added: dirstate-v2 | ||
$ hg debugrequires | grep dirstate | ||||
dirstate-v2 | ||||
$ ls -1 .hg/dirstate* | ||||
.hg/dirstate | ||||
.hg/dirstate.* (glob) | ||||
Manually reset to dirstate v1 to simulate an incomplete dirstate-v2 upgrade | ||||
$ rm .hg/dirstate* | ||||
$ cp $TESTTMP/dirstate-v1-backup .hg/dirstate | ||||
There should be no errors, but a v2 dirstate should be written back to disk | ||||
$ hg st | ||||
$ ls -1 .hg/dirstate* | ||||
.hg/dirstate | ||||
Raphaël Gomès
|
r51553 | .hg/dirstate.* (glob) | ||
Corrupt the dirstate to see how the errors show up to the user | ||||
$ echo "I ate your data" > .hg/dirstate | ||||
Raphaël Gomès
|
r51552 | |||
Raphaël Gomès
|
r51553 | $ hg st | ||
abort: working directory state appears damaged! (no-rhg !) | ||||
(falling back to dirstate-v1 from v2 also failed) (no-rhg !) | ||||
r51579 | abort: Too little data for dirstate: 16 bytes. (rhg !) | |||
Raphaël Gomès
|
r51553 | [255] | ||