##// END OF EJS Templates
tests: add tests for missing revlogs and revlog entries...
Martin von Zweigbergk -
r28110:2b41f865 default
parent child Browse files
Show More
@@ -1,117 +1,319 b''
1 1 prepare repo
2 2
3 3 $ hg init a
4 4 $ cd a
5 5 $ echo "some text" > FOO.txt
6 6 $ echo "another text" > bar.txt
7 7 $ echo "more text" > QUICK.txt
8 8 $ hg add
9 9 adding FOO.txt
10 10 adding QUICK.txt
11 11 adding bar.txt
12 12 $ hg ci -mtest1
13 13
14 14 verify
15 15
16 16 $ hg verify
17 17 checking changesets
18 18 checking manifests
19 19 crosschecking files in changesets and manifests
20 20 checking files
21 21 3 files, 1 changesets, 3 total revisions
22 22
23 23 verify with journal
24 24
25 25 $ touch .hg/store/journal
26 26 $ hg verify
27 27 abandoned transaction found - run hg recover
28 28 checking changesets
29 29 checking manifests
30 30 crosschecking files in changesets and manifests
31 31 checking files
32 32 3 files, 1 changesets, 3 total revisions
33 33 $ rm .hg/store/journal
34 34
35 35 introduce some bugs in repo
36 36
37 37 $ cd .hg/store/data
38 38 $ mv _f_o_o.txt.i X_f_o_o.txt.i
39 39 $ mv bar.txt.i xbar.txt.i
40 40 $ rm _q_u_i_c_k.txt.i
41 41
42 42 $ hg verify
43 43 checking changesets
44 44 checking manifests
45 45 crosschecking files in changesets and manifests
46 46 checking files
47 47 warning: revlog 'data/FOO.txt.i' not in fncache!
48 48 0: empty or missing FOO.txt
49 49 FOO.txt@0: f62022d3d590 in manifests not found
50 50 warning: revlog 'data/QUICK.txt.i' not in fncache!
51 51 0: empty or missing QUICK.txt
52 52 QUICK.txt@0: 88b857db8eba in manifests not found
53 53 warning: revlog 'data/bar.txt.i' not in fncache!
54 54 0: empty or missing bar.txt
55 55 bar.txt@0: 256559129457 in manifests not found
56 56 3 files, 1 changesets, 0 total revisions
57 57 3 warnings encountered!
58 58 hint: run "hg debugrebuildfncache" to recover from corrupt fncache
59 59 6 integrity errors encountered!
60 60 (first damaged changeset appears to be 0)
61 61 [1]
62 62
63 63 $ cd ../../..
64 64 $ cd ..
65 65
66 Set up a repo for testing missing revlog entries
67
68 $ hg init missing-entries
69 $ cd missing-entries
70 $ echo 0 > file
71 $ hg ci -Aqm0
72 $ cp -r .hg/store .hg/store-partial
73 $ echo 1 > file
74 $ hg ci -Aqm1
75 $ cp -r .hg/store .hg/store-full
76
77 Entire changelog missing
78
79 $ rm .hg/store/00changelog.*
80 $ hg verify -q
81 0: empty or missing changelog
82 manifest@0: d0b6632564d4 not in changesets
83 manifest@1: 941fc4534185 not in changesets
84 3 integrity errors encountered!
85 (first damaged changeset appears to be 0)
86 [1]
87 $ cp -r .hg/store-full/* .hg/store
88
89 Entire manifest log missing
90
91 $ rm .hg/store/00manifest.*
92 $ hg verify -q
93 0: empty or missing manifest
94 1 integrity errors encountered!
95 (first damaged changeset appears to be 0)
96 [1]
97 $ cp -r .hg/store-full/* .hg/store
98
99 Entire filelog missing
100
101 $ rm .hg/store/data/file.*
102 $ hg verify -q
103 warning: revlog 'data/file.i' not in fncache!
104 0: empty or missing file
105 file@0: 362fef284ce2 in manifests not found
106 file@1: c10f2164107d in manifests not found
107 1 warnings encountered!
108 hint: run "hg debugrebuildfncache" to recover from corrupt fncache
109 3 integrity errors encountered!
110 (first damaged changeset appears to be 0)
111 [1]
112 $ cp -r .hg/store-full/* .hg/store
113
114 Entire changelog and manifest log missing
115
116 $ rm .hg/store/00changelog.*
117 $ rm .hg/store/00manifest.*
118 $ hg verify -q
119 warning: orphan revlog 'data/file.i'
120 1 warnings encountered!
121 $ cp -r .hg/store-full/* .hg/store
122
123 Entire changelog and filelog missing
124
125 $ rm .hg/store/00changelog.*
126 $ rm .hg/store/data/file.*
127 $ hg verify -q
128 0: empty or missing changelog
129 manifest@0: d0b6632564d4 not in changesets
130 manifest@1: 941fc4534185 not in changesets
131 warning: revlog 'data/file.i' not in fncache!
132 ?: empty or missing file
133 file@0: 362fef284ce2 in manifests not found
134 file@1: c10f2164107d in manifests not found
135 1 warnings encountered!
136 hint: run "hg debugrebuildfncache" to recover from corrupt fncache
137 6 integrity errors encountered!
138 (first damaged changeset appears to be 0)
139 [1]
140 $ cp -r .hg/store-full/* .hg/store
141
142 Entire manifest log and filelog missing
143
144 $ rm .hg/store/00manifest.*
145 $ rm .hg/store/data/file.*
146 $ hg verify -q
147 0: empty or missing manifest
148 warning: revlog 'data/file.i' not in fncache!
149 0: empty or missing file
150 1 warnings encountered!
151 hint: run "hg debugrebuildfncache" to recover from corrupt fncache
152 2 integrity errors encountered!
153 (first damaged changeset appears to be 0)
154 [1]
155 $ cp -r .hg/store-full/* .hg/store
156
157 Changelog missing entry
158
159 $ cp -f .hg/store-partial/00changelog.* .hg/store
160 $ hg verify -q
161 manifest@?: rev 1 points to nonexistent changeset 1
162 manifest@?: 941fc4534185 not in changesets
163 file@?: rev 1 points to nonexistent changeset 1
164 (expected 0)
165 1 warnings encountered!
166 3 integrity errors encountered!
167 [1]
168 $ cp -r .hg/store-full/* .hg/store
169
170 Manifest log missing entry
171
172 $ cp -f .hg/store-partial/00manifest.* .hg/store
173 $ hg verify -q
174 1: changeset refers to unknown manifest 941fc4534185
175 file@1: c10f2164107d not in manifests
176 2 integrity errors encountered!
177 (first damaged changeset appears to be 1)
178 [1]
179 $ cp -r .hg/store-full/* .hg/store
180
181 Filelog missing entry
182
183 $ cp -f .hg/store-partial/data/file.* .hg/store/data
184 $ hg verify -q
185 file@1: c10f2164107d in manifests not found
186 1 integrity errors encountered!
187 (first damaged changeset appears to be 1)
188 [1]
189 $ cp -r .hg/store-full/* .hg/store
190
191 Changelog and manifest log missing entry
192
193 $ cp -f .hg/store-partial/00changelog.* .hg/store
194 $ cp -f .hg/store-partial/00manifest.* .hg/store
195 $ hg verify -q
196 file@?: rev 1 points to nonexistent changeset 1
197 (expected 0)
198 file@?: c10f2164107d not in manifests
199 1 warnings encountered!
200 2 integrity errors encountered!
201 [1]
202 $ cp -r .hg/store-full/* .hg/store
203
204 Changelog and filelog missing entry
205
206 $ cp -f .hg/store-partial/00changelog.* .hg/store
207 $ cp -f .hg/store-partial/data/file.* .hg/store/data
208 $ hg verify -q
209 manifest@?: rev 1 points to nonexistent changeset 1
210 manifest@?: 941fc4534185 not in changesets
211 file@?: c10f2164107d in manifests not found
212 3 integrity errors encountered!
213 [1]
214 $ cp -r .hg/store-full/* .hg/store
215
216 Manifest and filelog missing entry
217
218 $ cp -f .hg/store-partial/00manifest.* .hg/store
219 $ cp -f .hg/store-partial/data/file.* .hg/store/data
220 $ hg verify -q
221 1: changeset refers to unknown manifest 941fc4534185
222 1 integrity errors encountered!
223 (first damaged changeset appears to be 1)
224 [1]
225 $ cp -r .hg/store-full/* .hg/store
226
227 Corrupt changelog base node to cause failure to read revision
228
229 $ printf abcd | dd conv=notrunc of=.hg/store/00changelog.i bs=1 seek=16 \
230 > 2> /dev/null
231 $ hg verify -q
232 0: unpacking changeset 08b1860757c2: * (glob)
233 manifest@?: rev 0 points to unexpected changeset 0
234 manifest@?: d0b6632564d4 not in changesets
235 file@?: rev 0 points to unexpected changeset 0
236 (expected 1)
237 1 warnings encountered!
238 4 integrity errors encountered!
239 (first damaged changeset appears to be 0)
240 [1]
241 $ cp -r .hg/store-full/* .hg/store
242
243 Corrupt manifest log base node to cause failure to read revision
244
245 $ printf abcd | dd conv=notrunc of=.hg/store/00manifest.i bs=1 seek=16 \
246 > 2> /dev/null
247 $ hg verify -q
248 0: reading manifest delta d0b6632564d4: * (glob)
249 file@0: 362fef284ce2 not in manifests
250 2 integrity errors encountered!
251 (first damaged changeset appears to be 0)
252 [1]
253 $ cp -r .hg/store-full/* .hg/store
254
255 Corrupt filelog base node to cause failure to read revision
256
257 $ printf abcd | dd conv=notrunc of=.hg/store/data/file.i bs=1 seek=16 \
258 > 2> /dev/null
259 $ hg verify -q
260 file@0: unpacking 362fef284ce2: * (glob)
261 1 integrity errors encountered!
262 (first damaged changeset appears to be 0)
263 [1]
264 $ cp -r .hg/store-full/* .hg/store
265
266 $ cd ..
267
66 268 test changelog without a manifest
67 269
68 270 $ hg init b
69 271 $ cd b
70 272 $ hg branch foo
71 273 marked working directory as branch foo
72 274 (branches are permanent and global, did you want a bookmark?)
73 275 $ hg ci -m branchfoo
74 276 $ hg verify
75 277 checking changesets
76 278 checking manifests
77 279 crosschecking files in changesets and manifests
78 280 checking files
79 281 0 files, 1 changesets, 0 total revisions
80 282
81 283 test revlog corruption
82 284
83 285 $ touch a
84 286 $ hg add a
85 287 $ hg ci -m a
86 288
87 289 $ echo 'corrupted' > b
88 290 $ dd if=.hg/store/data/a.i of=start bs=1 count=20 2>/dev/null
89 291 $ cat start b > .hg/store/data/a.i
90 292
91 293 $ hg verify
92 294 checking changesets
93 295 checking manifests
94 296 crosschecking files in changesets and manifests
95 297 checking files
96 298 a@1: broken revlog! (index data/a.i is corrupted)
97 299 warning: orphan revlog 'data/a.i'
98 300 1 files, 2 changesets, 0 total revisions
99 301 1 warnings encountered!
100 302 1 integrity errors encountered!
101 303 (first damaged changeset appears to be 1)
102 304 [1]
103 305
104 306 $ cd ..
105 307
106 308 test revlog format 0
107 309
108 310 $ revlog-formatv0.py
109 311 $ cd formatv0
110 312 $ hg verify
111 313 repository uses revlog format 0
112 314 checking changesets
113 315 checking manifests
114 316 crosschecking files in changesets and manifests
115 317 checking files
116 318 1 files, 1 changesets, 1 total revisions
117 319 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now