Show More
@@ -1,100 +1,100 | |||
|
1 | 1 | Enable obsolete markers |
|
2 | 2 | |
|
3 | 3 | $ cat >> $HGRCPATH << EOF |
|
4 | 4 | > [experimental] |
|
5 | 5 | > evolution=createmarkers |
|
6 | 6 | > [phases] |
|
7 | 7 | > publish=False |
|
8 | 8 | > EOF |
|
9 | 9 | |
|
10 | 10 | Build a repo with some cacheable bits: |
|
11 | 11 | |
|
12 | 12 | $ hg init a |
|
13 | 13 | $ cd a |
|
14 | 14 | |
|
15 | 15 | $ echo a > a |
|
16 | 16 | $ hg ci -qAm0 |
|
17 | 17 | $ hg tag t1 |
|
18 | 18 | $ hg book -i bk1 |
|
19 | 19 | |
|
20 | 20 | $ hg branch -q b2 |
|
21 | 21 | $ hg ci -Am1 |
|
22 | 22 | $ hg tag t2 |
|
23 | 23 | |
|
24 | 24 | $ echo dumb > dumb |
|
25 | 25 | $ hg ci -qAmdumb |
|
26 | 26 | $ hg debugobsolete b1174d11b69e63cb0c5726621a43c859f0858d7f |
|
27 | 27 | |
|
28 | 28 | $ hg phase -pr t1 |
|
29 | 29 | $ hg phase -fsr t2 |
|
30 | 30 | |
|
31 | 31 | Make a helper function to check cache damage invariants: |
|
32 | 32 | |
|
33 | 33 | - command output shouldn't change |
|
34 | 34 | - cache should be present after first use |
|
35 | 35 | - corruption/repair should be silent (no exceptions or warnings) |
|
36 | 36 | - cache should survive deletion, overwrite, and append |
|
37 | 37 | - unreadable / unwriteable caches should be ignored |
|
38 | 38 | - cache should be rebuilt after corruption |
|
39 | 39 | |
|
40 | 40 | $ damage() { |
|
41 | 41 | > CMD=$1 |
|
42 | 42 | > CACHE=.hg/cache/$2 |
|
43 | 43 | > CLEAN=$3 |
|
44 | 44 | > hg $CMD > before |
|
45 | 45 | > test -f $CACHE || echo "not present" |
|
46 | 46 | > echo bad > $CACHE |
|
47 | 47 | > test -z "$CLEAN" || $CLEAN |
|
48 | 48 | > hg $CMD > after |
|
49 | 49 | > diff -u before after || echo "*** overwrite corruption" |
|
50 | 50 | > echo corruption >> $CACHE |
|
51 | 51 | > test -z "$CLEAN" || $CLEAN |
|
52 | 52 | > hg $CMD > after |
|
53 | 53 | > diff -u before after || echo "*** append corruption" |
|
54 | 54 | > rm $CACHE |
|
55 | 55 | > mkdir $CACHE |
|
56 | 56 | > test -z "$CLEAN" || $CLEAN |
|
57 | 57 | > hg $CMD > after |
|
58 | 58 | > diff -u before after || echo "*** read-only corruption" |
|
59 | 59 | > test -d $CACHE || echo "*** directory clobbered" |
|
60 | 60 | > rmdir $CACHE |
|
61 | 61 | > test -z "$CLEAN" || $CLEAN |
|
62 | 62 | > hg $CMD > after |
|
63 | 63 | > diff -u before after || echo "*** missing corruption" |
|
64 | 64 | > test -f $CACHE || echo "not rebuilt" |
|
65 | 65 | > } |
|
66 | 66 | |
|
67 | 67 | Beat up tags caches: |
|
68 | 68 | |
|
69 | 69 | $ damage "tags --hidden" tags2 |
|
70 | 70 | $ damage tags tags2-visible |
|
71 | 71 | $ damage "tag -f t3" hgtagsfnodes1 |
|
72 | 72 | |
|
73 | 73 | Beat up hidden cache: |
|
74 | 74 | |
|
75 | 75 | $ damage log hidden |
|
76 | 76 | |
|
77 | 77 | Beat up branch caches: |
|
78 | 78 | |
|
79 | 79 | $ damage branches branch2-base "rm .hg/cache/branch2-[vs]*" |
|
80 | 80 | $ damage branches branch2-served "rm .hg/cache/branch2-[bv]*" |
|
81 | 81 | $ damage branches branch2-visible |
|
82 | 82 | $ damage "log -r branch(.)" rbc-names-v1 |
|
83 | 83 | $ damage "log -r branch(default)" rbc-names-v1 |
|
84 | 84 | $ damage "log -r branch(b2)" rbc-revs-v1 |
|
85 | 85 | |
|
86 | 86 | We currently can't detect an rbc cache with unknown names: |
|
87 | 87 | |
|
88 | 88 | $ damage "log -qr branch(b2)" rbc-names-v1 |
|
89 | 89 | --- before * (glob) |
|
90 | 90 | +++ after * (glob) |
|
91 |
@@ -1,8 + |
|
|
91 | @@ -1,8 +?,0 @@ (glob) | |
|
92 | 92 | -2:5fb7d38b9dc4 |
|
93 | 93 | -3:60b597ffdafa |
|
94 | 94 | -4:b1174d11b69e |
|
95 | 95 | -5:6354685872c0 |
|
96 | 96 | -6:5ebc725f1bef |
|
97 | 97 | -7:7b76eec2f273 |
|
98 | 98 | -8:ef3428d9d644 |
|
99 | 99 | -9:ba7a936bc03c |
|
100 | 100 | *** append corruption |
General Comments 0
You need to be logged in to leave comments.
Login now