Mercurial > hg
annotate tests/test-dirstate-version-fallback.t @ 50659:9e08cfbe77b1 stable
dirstate: add test showing dirstate version mismatch causes an error
We should fall back to trying dirstate v1 when v2 fails to read.
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Mon, 05 Jun 2023 17:29:52 +0200 |
parents | |
children | bf16ef96defe |
rev | line source |
---|---|
50659
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
1 $ cat >> $HGRCPATH << EOF |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
2 > [storage] |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
3 > dirstate-v2.slow-path=allow |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
4 > EOF |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
5 |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
6 Set up a v1 repo |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
7 |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
8 $ hg init repo |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
9 $ cd repo |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
10 $ echo a > a |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
11 $ hg add a |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
12 $ hg commit -m a |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
13 $ hg debugrequires | grep dirstate |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
14 [1] |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
15 $ ls -1 .hg/dirstate* |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
16 .hg/dirstate |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
17 |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
18 Copy v1 dirstate |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
19 $ cp .hg/dirstate $TESTTMP/dirstate-v1-backup |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
20 |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
21 Upgrade it to v2 |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
22 |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
23 $ hg debugupgraderepo -q --config format.use-dirstate-v2=1 --run | grep added |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
24 added: dirstate-v2 |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
25 $ hg debugrequires | grep dirstate |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
26 dirstate-v2 |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
27 $ ls -1 .hg/dirstate* |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
28 .hg/dirstate |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
29 .hg/dirstate.* (glob) |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
30 |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
31 Manually reset to dirstate v1 to simulate an incomplete dirstate-v2 upgrade |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
32 |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
33 $ rm .hg/dirstate* |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
34 $ cp $TESTTMP/dirstate-v1-backup .hg/dirstate |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
35 |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
36 There should be no errors, but a v2 dirstate should be written back to disk |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
37 $ hg st |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
38 abort: dirstate-v2 parse error: when reading docket, Expected at least * bytes, got * (glob) (known-bad-output !) |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
39 [255] |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
40 $ ls -1 .hg/dirstate* |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
41 .hg/dirstate |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
42 .hg/dirstate.* (glob) (missing-correct-output !) |
9e08cfbe77b1
dirstate: add test showing dirstate version mismatch causes an error
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
43 |