Debian Codegraph @

tests/test-fastannotate-corrupt.t

raw
1 $ cat >> $HGRCPATH << EOF
2 > [extensions]
3 > fastannotate=
4 > EOF
5
6 $ hg init repo
7 $ cd repo
8 $ for i in 0 1 2 3 4; do
9 > echo $i >> a
10 > echo $i >> b
11 > hg commit -A -m $i a b
12 > done
13
14 use the "debugbuildannotatecache" command to build annotate cache at rev 0
15
16 $ hg debugbuildannotatecache --debug --config fastannotate.mainbranch=0
17 fastannotate: a: 1 new changesets in the main branch
18 fastannotate: b: 1 new changesets in the main branch
19
20 "debugbuildannotatecache" should work with broken cache (and other files would
21 be built without being affected). note: linelog being broken is only noticed
22 when we try to append to it.
23
24 $ echo 'CORRUPT!' >> .hg/fastannotate/default/a.m
25 $ hg debugbuildannotatecache --debug --config fastannotate.mainbranch=1
26 fastannotate: a: rebuilding broken cache
27 fastannotate: a: 2 new changesets in the main branch
28 fastannotate: b: 1 new changesets in the main branch
29
30 $ echo 'CANNOT REUSE!' > .hg/fastannotate/default/a.l
31 $ hg debugbuildannotatecache --debug --config fastannotate.mainbranch=2
32 fastannotate: a: rebuilding broken cache
33 fastannotate: a: 3 new changesets in the main branch
34 fastannotate: b: 1 new changesets in the main branch
35
36 $ rm .hg/fastannotate/default/a.m
37 $ hg debugbuildannotatecache --debug --config fastannotate.mainbranch=3
38 fastannotate: a: rebuilding broken cache
39 fastannotate: a: 4 new changesets in the main branch
40 fastannotate: b: 1 new changesets in the main branch
41
42 $ rm .hg/fastannotate/default/a.l
43 $ hg debugbuildannotatecache --debug --config fastannotate.mainbranch=3
44 $ hg debugbuildannotatecache --debug --config fastannotate.mainbranch=4
45 fastannotate: a: rebuilding broken cache
46 fastannotate: a: 5 new changesets in the main branch
47 fastannotate: b: 1 new changesets in the main branch
48
49 "fastannotate" should deal with file corruption as well
50
51 $ rm -rf .hg/fastannotate
52 $ hg fastannotate --debug -r 0 a
53 fastannotate: a: 1 new changesets in the main branch
54 0: 0
55
56 $ echo 'CORRUPT!' >> .hg/fastannotate/default/a.m
57 $ hg fastannotate --debug -r 0 a
58 fastannotate: a: cache broken and deleted
59 fastannotate: a: 1 new changesets in the main branch
60 0: 0
61
62 $ echo 'CORRUPT!' > .hg/fastannotate/default/a.l
63 $ hg fastannotate --debug -r 1 a
64 fastannotate: a: cache broken and deleted
65 fastannotate: a: 2 new changesets in the main branch
66 0: 0
67 1: 1
68
69 $ rm .hg/fastannotate/default/a.l
70 $ hg fastannotate --debug -r 1 a
71 fastannotate: a: using fast path (resolved fctx: True)
72 fastannotate: a: cache broken and deleted
73 fastannotate: a: 2 new changesets in the main branch
74 0: 0
75 1: 1
76
77 $ rm .hg/fastannotate/default/a.m
78 $ hg fastannotate --debug -r 2 a
79 fastannotate: a: cache broken and deleted
80 fastannotate: a: 3 new changesets in the main branch
81 0: 0
82 1: 1
83 2: 2