Show More
@@ -1,611 +1,611 b'' | |||
|
1 | 1 | =============================================================== |
|
2 | 2 | Test non-regression on the corruption associated with issue6528 |
|
3 | 3 | =============================================================== |
|
4 | 4 | |
|
5 | 5 | Setup |
|
6 | 6 | ===== |
|
7 | 7 | |
|
8 | 8 | $ hg init base-repo |
|
9 | 9 | $ cd base-repo |
|
10 | 10 | |
|
11 | 11 | $ cat <<EOF > a.txt |
|
12 | 12 | > 1 |
|
13 | 13 | > 2 |
|
14 | 14 | > 3 |
|
15 | 15 | > 4 |
|
16 | 16 | > 5 |
|
17 | 17 | > 6 |
|
18 | 18 | > EOF |
|
19 | 19 | |
|
20 | 20 | $ hg add a.txt |
|
21 | 21 | $ hg commit -m 'c_base_c - create a.txt' |
|
22 | 22 | |
|
23 | 23 | Modify a.txt |
|
24 | 24 | |
|
25 | 25 | $ sed -e 's/1/foo/' a.txt > a.tmp; mv a.tmp a.txt |
|
26 | 26 | $ hg commit -m 'c_modify_c - modify a.txt' |
|
27 | 27 | |
|
28 | 28 | Modify and rename a.txt to b.txt |
|
29 | 29 | |
|
30 | 30 | $ hg up -r "desc('c_base_c')" |
|
31 | 31 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
32 | 32 | $ sed -e 's/6/bar/' a.txt > a.tmp; mv a.tmp a.txt |
|
33 | 33 | $ hg mv a.txt b.txt |
|
34 | 34 | $ hg commit -m 'c_rename_c - rename and modify a.txt to b.txt' |
|
35 | 35 | created new head |
|
36 | 36 | |
|
37 | 37 | Merge each branch |
|
38 | 38 | |
|
39 | 39 | $ hg merge -r "desc('c_modify_c')" |
|
40 | 40 | merging b.txt and a.txt to b.txt |
|
41 | 41 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
42 | 42 | (branch merge, don't forget to commit) |
|
43 | 43 | $ hg commit -m 'c_merge_c: commit merge' |
|
44 | 44 | |
|
45 | 45 | $ hg debugrevlogindex b.txt |
|
46 | 46 | rev linkrev nodeid p1 p2 |
|
47 | 47 | 0 2 05b806ebe5ea 000000000000 000000000000 |
|
48 | 48 | 1 3 a58b36ad6b65 000000000000 05b806ebe5ea |
|
49 | 49 | |
|
50 | 50 | Check commit Graph |
|
51 | 51 | |
|
52 | 52 | $ hg log -G |
|
53 | 53 | @ changeset: 3:a1cc2bdca0aa |
|
54 | 54 | |\ tag: tip |
|
55 | 55 | | | parent: 2:615c6ccefd15 |
|
56 | 56 | | | parent: 1:373d507f4667 |
|
57 | 57 | | | user: test |
|
58 | 58 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
59 | 59 | | | summary: c_merge_c: commit merge |
|
60 | 60 | | | |
|
61 | 61 | | o changeset: 2:615c6ccefd15 |
|
62 | 62 | | | parent: 0:f5a5a568022f |
|
63 | 63 | | | user: test |
|
64 | 64 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
65 | 65 | | | summary: c_rename_c - rename and modify a.txt to b.txt |
|
66 | 66 | | | |
|
67 | 67 | o | changeset: 1:373d507f4667 |
|
68 | 68 | |/ user: test |
|
69 | 69 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
70 | 70 | | summary: c_modify_c - modify a.txt |
|
71 | 71 | | |
|
72 | 72 | o changeset: 0:f5a5a568022f |
|
73 | 73 | user: test |
|
74 | 74 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
75 | 75 | summary: c_base_c - create a.txt |
|
76 | 76 | |
|
77 | 77 | |
|
78 | 78 | $ hg cat -r . b.txt |
|
79 | 79 | foo |
|
80 | 80 | 2 |
|
81 | 81 | 3 |
|
82 | 82 | 4 |
|
83 | 83 | 5 |
|
84 | 84 | bar |
|
85 | 85 | $ cat b.txt |
|
86 | 86 | foo |
|
87 | 87 | 2 |
|
88 | 88 | 3 |
|
89 | 89 | 4 |
|
90 | 90 | 5 |
|
91 | 91 | bar |
|
92 | 92 | $ cd .. |
|
93 | 93 | |
|
94 | 94 | |
|
95 | 95 | Check the lack of corruption |
|
96 | 96 | ============================ |
|
97 | 97 | |
|
98 | 98 | $ hg clone --pull base-repo cloned |
|
99 | 99 | requesting all changes |
|
100 | 100 | adding changesets |
|
101 | 101 | adding manifests |
|
102 | 102 | adding file changes |
|
103 | 103 | added 4 changesets with 4 changes to 2 files |
|
104 | 104 | new changesets f5a5a568022f:a1cc2bdca0aa |
|
105 | 105 | updating to branch default |
|
106 | 106 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
107 | 107 | $ cd cloned |
|
108 | 108 | $ hg up -r "desc('c_merge_c')" |
|
109 | 109 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
110 | 110 | |
|
111 | 111 | |
|
112 | 112 | Status is buggy, even with debugrebuilddirstate |
|
113 | 113 | |
|
114 | 114 | $ hg cat -r . b.txt |
|
115 | 115 | foo |
|
116 | 116 | 2 |
|
117 | 117 | 3 |
|
118 | 118 | 4 |
|
119 | 119 | 5 |
|
120 | 120 | bar |
|
121 | 121 | $ cat b.txt |
|
122 | 122 | foo |
|
123 | 123 | 2 |
|
124 | 124 | 3 |
|
125 | 125 | 4 |
|
126 | 126 | 5 |
|
127 | 127 | bar |
|
128 | 128 | $ hg status |
|
129 | 129 | $ hg debugrebuilddirstate |
|
130 | 130 | $ hg status |
|
131 | 131 | |
|
132 | 132 | the history was altered |
|
133 | 133 | |
|
134 | 134 | in theory p1/p2 order does not matter but in practice p1 == nullid is used as a |
|
135 | 135 | marker that some metadata are present and should be fetched. |
|
136 | 136 | |
|
137 | 137 | $ hg debugrevlogindex b.txt |
|
138 | 138 | rev linkrev nodeid p1 p2 |
|
139 | 139 | 0 2 05b806ebe5ea 000000000000 000000000000 |
|
140 | 140 | 1 3 a58b36ad6b65 000000000000 05b806ebe5ea |
|
141 | 141 | |
|
142 | 142 | Check commit Graph |
|
143 | 143 | |
|
144 | 144 | $ hg log -G |
|
145 | 145 | @ changeset: 3:a1cc2bdca0aa |
|
146 | 146 | |\ tag: tip |
|
147 | 147 | | | parent: 2:615c6ccefd15 |
|
148 | 148 | | | parent: 1:373d507f4667 |
|
149 | 149 | | | user: test |
|
150 | 150 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
151 | 151 | | | summary: c_merge_c: commit merge |
|
152 | 152 | | | |
|
153 | 153 | | o changeset: 2:615c6ccefd15 |
|
154 | 154 | | | parent: 0:f5a5a568022f |
|
155 | 155 | | | user: test |
|
156 | 156 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
157 | 157 | | | summary: c_rename_c - rename and modify a.txt to b.txt |
|
158 | 158 | | | |
|
159 | 159 | o | changeset: 1:373d507f4667 |
|
160 | 160 | |/ user: test |
|
161 | 161 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
162 | 162 | | summary: c_modify_c - modify a.txt |
|
163 | 163 | | |
|
164 | 164 | o changeset: 0:f5a5a568022f |
|
165 | 165 | user: test |
|
166 | 166 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
167 | 167 | summary: c_base_c - create a.txt |
|
168 | 168 | |
|
169 | 169 | |
|
170 | 170 | Test the command that fixes the issue |
|
171 | 171 | ===================================== |
|
172 | 172 | |
|
173 | 173 | Restore a broken repository with multiple broken revisions and a filename that |
|
174 | 174 | would get encoded to test the `report` options. |
|
175 | 175 | It's a tarball because unbundle might magically fix the issue later. |
|
176 | 176 | |
|
177 | 177 | $ cd .. |
|
178 | 178 | $ mkdir repo-to-fix |
|
179 | 179 | $ cd repo-to-fix |
|
180 | $ tar -x < $TESTDIR/bundles/issue6528.tar | |
|
180 | $ tar -xf - < "$TESTDIR"/bundles/issue6528.tar | |
|
181 | 181 | |
|
182 | 182 | Check that the issue is present |
|
183 | 183 | (It is currently not present with rhg but will be when optimizations are added |
|
184 | 184 | to resolve ambiguous files at the end of status without reading their content |
|
185 | 185 | if the size differs, and reading the expected size without resolving filelog |
|
186 | 186 | deltas where possible.) |
|
187 | 187 | |
|
188 | 188 | $ hg st |
|
189 | 189 | M D.txt |
|
190 | 190 | M b.txt |
|
191 | 191 | $ hg debugrevlogindex b.txt |
|
192 | 192 | rev linkrev nodeid p1 p2 |
|
193 | 193 | 0 2 05b806ebe5ea 000000000000 000000000000 |
|
194 | 194 | 1 3 a58b36ad6b65 05b806ebe5ea 000000000000 |
|
195 | 195 | 2 6 216a5fe8b8ed 000000000000 000000000000 |
|
196 | 196 | 3 7 ea4f2f2463cc 216a5fe8b8ed 000000000000 |
|
197 | 197 | $ hg debugrevlogindex D.txt |
|
198 | 198 | rev linkrev nodeid p1 p2 |
|
199 | 199 | 0 6 2a8d3833f2fb 000000000000 000000000000 |
|
200 | 200 | 1 7 2a80419dfc31 2a8d3833f2fb 000000000000 |
|
201 | 201 | |
|
202 | 202 | Dry-run the fix |
|
203 | 203 | $ hg debug-repair-issue6528 --dry-run |
|
204 | 204 | found affected revision 1 for filelog 'data/D.txt.i' |
|
205 | 205 | found affected revision 1 for filelog 'data/b.txt.i' |
|
206 | 206 | found affected revision 3 for filelog 'data/b.txt.i' |
|
207 | 207 | $ hg st |
|
208 | 208 | M D.txt |
|
209 | 209 | M b.txt |
|
210 | 210 | $ hg debugrevlogindex b.txt |
|
211 | 211 | rev linkrev nodeid p1 p2 |
|
212 | 212 | 0 2 05b806ebe5ea 000000000000 000000000000 |
|
213 | 213 | 1 3 a58b36ad6b65 05b806ebe5ea 000000000000 |
|
214 | 214 | 2 6 216a5fe8b8ed 000000000000 000000000000 |
|
215 | 215 | 3 7 ea4f2f2463cc 216a5fe8b8ed 000000000000 |
|
216 | 216 | $ hg debugrevlogindex D.txt |
|
217 | 217 | rev linkrev nodeid p1 p2 |
|
218 | 218 | 0 6 2a8d3833f2fb 000000000000 000000000000 |
|
219 | 219 | 1 7 2a80419dfc31 2a8d3833f2fb 000000000000 |
|
220 | 220 | |
|
221 | 221 | Test the --paranoid option |
|
222 | 222 | $ hg debug-repair-issue6528 --dry-run --paranoid |
|
223 | 223 | found affected revision 1 for filelog 'data/D.txt.i' |
|
224 | 224 | found affected revision 1 for filelog 'data/b.txt.i' |
|
225 | 225 | found affected revision 3 for filelog 'data/b.txt.i' |
|
226 | 226 | $ hg st |
|
227 | 227 | M D.txt |
|
228 | 228 | M b.txt |
|
229 | 229 | $ hg debugrevlogindex b.txt |
|
230 | 230 | rev linkrev nodeid p1 p2 |
|
231 | 231 | 0 2 05b806ebe5ea 000000000000 000000000000 |
|
232 | 232 | 1 3 a58b36ad6b65 05b806ebe5ea 000000000000 |
|
233 | 233 | 2 6 216a5fe8b8ed 000000000000 000000000000 |
|
234 | 234 | 3 7 ea4f2f2463cc 216a5fe8b8ed 000000000000 |
|
235 | 235 | $ hg debugrevlogindex D.txt |
|
236 | 236 | rev linkrev nodeid p1 p2 |
|
237 | 237 | 0 6 2a8d3833f2fb 000000000000 000000000000 |
|
238 | 238 | 1 7 2a80419dfc31 2a8d3833f2fb 000000000000 |
|
239 | 239 | |
|
240 | 240 | Run the fix |
|
241 | 241 | $ hg debug-repair-issue6528 |
|
242 | 242 | found affected revision 1 for filelog 'data/D.txt.i' |
|
243 | 243 | repaired revision 1 of 'filelog data/D.txt.i' |
|
244 | 244 | found affected revision 1 for filelog 'data/b.txt.i' |
|
245 | 245 | found affected revision 3 for filelog 'data/b.txt.i' |
|
246 | 246 | repaired revision 1 of 'filelog data/b.txt.i' |
|
247 | 247 | repaired revision 3 of 'filelog data/b.txt.i' |
|
248 | 248 | |
|
249 | 249 | Check that the fix worked and that running it twice does nothing |
|
250 | 250 | $ hg st |
|
251 | 251 | $ hg debugrevlogindex b.txt |
|
252 | 252 | rev linkrev nodeid p1 p2 |
|
253 | 253 | 0 2 05b806ebe5ea 000000000000 000000000000 |
|
254 | 254 | 1 3 a58b36ad6b65 000000000000 05b806ebe5ea |
|
255 | 255 | 2 6 216a5fe8b8ed 000000000000 000000000000 |
|
256 | 256 | 3 7 ea4f2f2463cc 000000000000 216a5fe8b8ed |
|
257 | 257 | $ hg debugrevlogindex D.txt |
|
258 | 258 | rev linkrev nodeid p1 p2 |
|
259 | 259 | 0 6 2a8d3833f2fb 000000000000 000000000000 |
|
260 | 260 | 1 7 2a80419dfc31 000000000000 2a8d3833f2fb |
|
261 | 261 | $ hg debug-repair-issue6528 |
|
262 | 262 | no affected revisions were found |
|
263 | 263 | $ hg st |
|
264 | 264 | $ hg debugrevlogindex b.txt |
|
265 | 265 | rev linkrev nodeid p1 p2 |
|
266 | 266 | 0 2 05b806ebe5ea 000000000000 000000000000 |
|
267 | 267 | 1 3 a58b36ad6b65 000000000000 05b806ebe5ea |
|
268 | 268 | 2 6 216a5fe8b8ed 000000000000 000000000000 |
|
269 | 269 | 3 7 ea4f2f2463cc 000000000000 216a5fe8b8ed |
|
270 | 270 | $ hg debugrevlogindex D.txt |
|
271 | 271 | rev linkrev nodeid p1 p2 |
|
272 | 272 | 0 6 2a8d3833f2fb 000000000000 000000000000 |
|
273 | 273 | 1 7 2a80419dfc31 000000000000 2a8d3833f2fb |
|
274 | 274 | |
|
275 | 275 | Try the using the report options |
|
276 | 276 | -------------------------------- |
|
277 | 277 | |
|
278 | 278 | $ cd .. |
|
279 | 279 | $ mkdir repo-to-fix-report |
|
280 | 280 | $ cd repo-to-fix |
|
281 | $ tar -x < "$TESTDIR"/bundles/issue6528.tar | |
|
281 | $ tar -xf - < "$TESTDIR"/bundles/issue6528.tar | |
|
282 | 282 | |
|
283 | 283 | $ hg debug-repair-issue6528 --to-report $TESTTMP/report.txt |
|
284 | 284 | found affected revision 1 for filelog 'data/D.txt.i' |
|
285 | 285 | found affected revision 1 for filelog 'data/b.txt.i' |
|
286 | 286 | found affected revision 3 for filelog 'data/b.txt.i' |
|
287 | 287 | $ cat $TESTTMP/report.txt |
|
288 | 288 | 2a80419dfc31d7dfb308ac40f3f138282de7d73b D.txt |
|
289 | 289 | a58b36ad6b6545195952793099613c2116f3563b,ea4f2f2463cca5b29ddf3461012b8ce5c6dac175 b.txt |
|
290 | 290 | |
|
291 | 291 | $ hg debug-repair-issue6528 --from-report $TESTTMP/report.txt --dry-run |
|
292 | 292 | loading report file '$TESTTMP/report.txt' |
|
293 | 293 | found affected revision 1 for filelog 'D.txt' |
|
294 | 294 | found affected revision 1 for filelog 'b.txt' |
|
295 | 295 | found affected revision 3 for filelog 'b.txt' |
|
296 | 296 | $ hg st |
|
297 | 297 | M D.txt |
|
298 | 298 | M b.txt |
|
299 | 299 | $ hg debugrevlogindex b.txt |
|
300 | 300 | rev linkrev nodeid p1 p2 |
|
301 | 301 | 0 2 05b806ebe5ea 000000000000 000000000000 |
|
302 | 302 | 1 3 a58b36ad6b65 05b806ebe5ea 000000000000 |
|
303 | 303 | 2 6 216a5fe8b8ed 000000000000 000000000000 |
|
304 | 304 | 3 7 ea4f2f2463cc 216a5fe8b8ed 000000000000 |
|
305 | 305 | $ hg debugrevlogindex D.txt |
|
306 | 306 | rev linkrev nodeid p1 p2 |
|
307 | 307 | 0 6 2a8d3833f2fb 000000000000 000000000000 |
|
308 | 308 | 1 7 2a80419dfc31 2a8d3833f2fb 000000000000 |
|
309 | 309 | |
|
310 | 310 | $ hg debug-repair-issue6528 --from-report $TESTTMP/report.txt |
|
311 | 311 | loading report file '$TESTTMP/report.txt' |
|
312 | 312 | found affected revision 1 for filelog 'D.txt' |
|
313 | 313 | repaired revision 1 of 'filelog data/D.txt.i' |
|
314 | 314 | found affected revision 1 for filelog 'b.txt' |
|
315 | 315 | found affected revision 3 for filelog 'b.txt' |
|
316 | 316 | repaired revision 1 of 'filelog data/b.txt.i' |
|
317 | 317 | repaired revision 3 of 'filelog data/b.txt.i' |
|
318 | 318 | $ hg st |
|
319 | 319 | $ hg debugrevlogindex b.txt |
|
320 | 320 | rev linkrev nodeid p1 p2 |
|
321 | 321 | 0 2 05b806ebe5ea 000000000000 000000000000 |
|
322 | 322 | 1 3 a58b36ad6b65 000000000000 05b806ebe5ea |
|
323 | 323 | 2 6 216a5fe8b8ed 000000000000 000000000000 |
|
324 | 324 | 3 7 ea4f2f2463cc 000000000000 216a5fe8b8ed |
|
325 | 325 | $ hg debugrevlogindex D.txt |
|
326 | 326 | rev linkrev nodeid p1 p2 |
|
327 | 327 | 0 6 2a8d3833f2fb 000000000000 000000000000 |
|
328 | 328 | 1 7 2a80419dfc31 000000000000 2a8d3833f2fb |
|
329 | 329 | |
|
330 | 330 | Check that the revision is not "fixed" again |
|
331 | 331 | |
|
332 | 332 | $ hg debug-repair-issue6528 --from-report $TESTTMP/report.txt |
|
333 | 333 | loading report file '$TESTTMP/report.txt' |
|
334 | 334 | revision 2a80419dfc31d7dfb308ac40f3f138282de7d73b of file 'D.txt' is not affected |
|
335 | 335 | no affected revisions were found for 'D.txt' |
|
336 | 336 | revision a58b36ad6b6545195952793099613c2116f3563b of file 'b.txt' is not affected |
|
337 | 337 | revision ea4f2f2463cca5b29ddf3461012b8ce5c6dac175 of file 'b.txt' is not affected |
|
338 | 338 | no affected revisions were found for 'b.txt' |
|
339 | 339 | $ hg st |
|
340 | 340 | $ hg debugrevlogindex b.txt |
|
341 | 341 | rev linkrev nodeid p1 p2 |
|
342 | 342 | 0 2 05b806ebe5ea 000000000000 000000000000 |
|
343 | 343 | 1 3 a58b36ad6b65 000000000000 05b806ebe5ea |
|
344 | 344 | 2 6 216a5fe8b8ed 000000000000 000000000000 |
|
345 | 345 | 3 7 ea4f2f2463cc 000000000000 216a5fe8b8ed |
|
346 | 346 | $ hg debugrevlogindex D.txt |
|
347 | 347 | rev linkrev nodeid p1 p2 |
|
348 | 348 | 0 6 2a8d3833f2fb 000000000000 000000000000 |
|
349 | 349 | 1 7 2a80419dfc31 000000000000 2a8d3833f2fb |
|
350 | 350 | |
|
351 | 351 | Try it with a non-inline revlog |
|
352 | 352 | ------------------------------- |
|
353 | 353 | |
|
354 | 354 | $ cd .. |
|
355 | 355 | $ mkdir $TESTTMP/ext |
|
356 | 356 | $ cat << EOF > $TESTTMP/ext/small_inline.py |
|
357 | 357 | > from mercurial import revlog |
|
358 | 358 | > revlog._maxinline = 8 |
|
359 | 359 | > EOF |
|
360 | 360 | |
|
361 | 361 | $ cat << EOF >> $HGRCPATH |
|
362 | 362 | > [extensions] |
|
363 | 363 | > small_inline=$TESTTMP/ext/small_inline.py |
|
364 | 364 | > EOF |
|
365 | 365 | |
|
366 | 366 | $ mkdir repo-to-fix-not-inline |
|
367 | 367 | $ cd repo-to-fix-not-inline |
|
368 | $ tar -x < "$TESTDIR"/bundles/issue6528.tar | |
|
368 | $ tar -xf - < "$TESTDIR"/bundles/issue6528.tar | |
|
369 | 369 | $ echo b >> b.txt |
|
370 | 370 | $ hg commit -qm "inline -> separate" |
|
371 | 371 | $ find .hg -name *b.txt.d |
|
372 | 372 | .hg/store/data/b.txt.d |
|
373 | 373 | |
|
374 | 374 | Status is correct, but the problem is still there, in the earlier revision |
|
375 | 375 | $ hg st |
|
376 | 376 | $ hg up 3 |
|
377 | 377 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
378 | 378 | $ hg st |
|
379 | 379 | M b.txt |
|
380 | 380 | $ hg debugrevlogindex b.txt |
|
381 | 381 | rev linkrev nodeid p1 p2 |
|
382 | 382 | 0 2 05b806ebe5ea 000000000000 000000000000 |
|
383 | 383 | 1 3 a58b36ad6b65 05b806ebe5ea 000000000000 |
|
384 | 384 | 2 6 216a5fe8b8ed 000000000000 000000000000 |
|
385 | 385 | 3 7 ea4f2f2463cc 216a5fe8b8ed 000000000000 |
|
386 | 386 | 4 8 db234885e2fe ea4f2f2463cc 000000000000 |
|
387 | 387 | $ hg debugrevlogindex D.txt |
|
388 | 388 | rev linkrev nodeid p1 p2 |
|
389 | 389 | 0 6 2a8d3833f2fb 000000000000 000000000000 |
|
390 | 390 | 1 7 2a80419dfc31 2a8d3833f2fb 000000000000 |
|
391 | 391 | 2 8 65aecc89bb5d 2a80419dfc31 000000000000 |
|
392 | 392 | |
|
393 | 393 | Run the fix on the non-inline revlog |
|
394 | 394 | $ hg debug-repair-issue6528 |
|
395 | 395 | found affected revision 1 for filelog 'data/D.txt.i' |
|
396 | 396 | repaired revision 1 of 'filelog data/D.txt.i' |
|
397 | 397 | found affected revision 1 for filelog 'data/b.txt.i' |
|
398 | 398 | found affected revision 3 for filelog 'data/b.txt.i' |
|
399 | 399 | repaired revision 1 of 'filelog data/b.txt.i' |
|
400 | 400 | repaired revision 3 of 'filelog data/b.txt.i' |
|
401 | 401 | |
|
402 | 402 | Check that it worked |
|
403 | 403 | $ hg debugrevlogindex b.txt |
|
404 | 404 | rev linkrev nodeid p1 p2 |
|
405 | 405 | 0 2 05b806ebe5ea 000000000000 000000000000 |
|
406 | 406 | 1 3 a58b36ad6b65 000000000000 05b806ebe5ea |
|
407 | 407 | 2 6 216a5fe8b8ed 000000000000 000000000000 |
|
408 | 408 | 3 7 ea4f2f2463cc 000000000000 216a5fe8b8ed |
|
409 | 409 | 4 8 db234885e2fe ea4f2f2463cc 000000000000 |
|
410 | 410 | $ hg debugrevlogindex D.txt |
|
411 | 411 | rev linkrev nodeid p1 p2 |
|
412 | 412 | 0 6 2a8d3833f2fb 000000000000 000000000000 |
|
413 | 413 | 1 7 2a80419dfc31 000000000000 2a8d3833f2fb |
|
414 | 414 | 2 8 65aecc89bb5d 2a80419dfc31 000000000000 |
|
415 | 415 | $ hg debug-repair-issue6528 |
|
416 | 416 | no affected revisions were found |
|
417 | 417 | $ hg st |
|
418 | 418 | |
|
419 | 419 | $ cd .. |
|
420 | 420 | |
|
421 | 421 | Applying a bad bundle should fix it on the fly |
|
422 | 422 | ---------------------------------------------- |
|
423 | 423 | |
|
424 | 424 | from a v1 bundle |
|
425 | 425 | ~~~~~~~~~~~~~~~~ |
|
426 | 426 | |
|
427 | 427 | $ hg debugbundle --spec "$TESTDIR"/bundles/issue6528.hg-v1 |
|
428 | 428 | bzip2-v1 |
|
429 | 429 | |
|
430 | 430 | $ hg init unbundle-v1 |
|
431 | 431 | $ cd unbundle-v1 |
|
432 | 432 | |
|
433 | 433 | $ hg unbundle "$TESTDIR"/bundles/issue6528.hg-v1 |
|
434 | 434 | adding changesets |
|
435 | 435 | adding manifests |
|
436 | 436 | adding file changes |
|
437 | 437 | added 8 changesets with 12 changes to 4 files |
|
438 | 438 | new changesets f5a5a568022f:3beabb508514 (8 drafts) |
|
439 | 439 | (run 'hg update' to get a working copy) |
|
440 | 440 | |
|
441 | 441 | Check that revision were fixed on the fly |
|
442 | 442 | |
|
443 | 443 | $ hg debugrevlogindex b.txt |
|
444 | 444 | rev linkrev nodeid p1 p2 |
|
445 | 445 | 0 2 05b806ebe5ea 000000000000 000000000000 |
|
446 | 446 | 1 3 a58b36ad6b65 000000000000 05b806ebe5ea |
|
447 | 447 | 2 6 216a5fe8b8ed 000000000000 000000000000 |
|
448 | 448 | 3 7 ea4f2f2463cc 000000000000 216a5fe8b8ed |
|
449 | 449 | |
|
450 | 450 | $ hg debugrevlogindex D.txt |
|
451 | 451 | rev linkrev nodeid p1 p2 |
|
452 | 452 | 0 6 2a8d3833f2fb 000000000000 000000000000 |
|
453 | 453 | 1 7 2a80419dfc31 000000000000 2a8d3833f2fb |
|
454 | 454 | |
|
455 | 455 | That we don't see the symptoms of the bug |
|
456 | 456 | |
|
457 | 457 | $ hg up -- -1 |
|
458 | 458 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
459 | 459 | $ hg status |
|
460 | 460 | |
|
461 | 461 | And that the repair command does not find anything to fix |
|
462 | 462 | |
|
463 | 463 | $ hg debug-repair-issue6528 |
|
464 | 464 | no affected revisions were found |
|
465 | 465 | |
|
466 | 466 | $ cd .. |
|
467 | 467 | |
|
468 | 468 | from a v2 bundle |
|
469 | 469 | ~~~~~~~~~~~~~~~~ |
|
470 | 470 | |
|
471 | 471 | $ hg debugbundle --spec "$TESTDIR"/bundles/issue6528.hg-v2 |
|
472 | 472 | bzip2-v2 |
|
473 | 473 | |
|
474 | 474 | $ hg init unbundle-v2 |
|
475 | 475 | $ cd unbundle-v2 |
|
476 | 476 | |
|
477 | 477 | $ hg unbundle "$TESTDIR"/bundles/issue6528.hg-v2 |
|
478 | 478 | adding changesets |
|
479 | 479 | adding manifests |
|
480 | 480 | adding file changes |
|
481 | 481 | added 8 changesets with 12 changes to 4 files |
|
482 | 482 | new changesets f5a5a568022f:3beabb508514 (8 drafts) |
|
483 | 483 | (run 'hg update' to get a working copy) |
|
484 | 484 | |
|
485 | 485 | Check that revision were fixed on the fly |
|
486 | 486 | |
|
487 | 487 | $ hg debugrevlogindex b.txt |
|
488 | 488 | rev linkrev nodeid p1 p2 |
|
489 | 489 | 0 2 05b806ebe5ea 000000000000 000000000000 |
|
490 | 490 | 1 3 a58b36ad6b65 000000000000 05b806ebe5ea |
|
491 | 491 | 2 6 216a5fe8b8ed 000000000000 000000000000 |
|
492 | 492 | 3 7 ea4f2f2463cc 000000000000 216a5fe8b8ed |
|
493 | 493 | |
|
494 | 494 | $ hg debugrevlogindex D.txt |
|
495 | 495 | rev linkrev nodeid p1 p2 |
|
496 | 496 | 0 6 2a8d3833f2fb 000000000000 000000000000 |
|
497 | 497 | 1 7 2a80419dfc31 000000000000 2a8d3833f2fb |
|
498 | 498 | |
|
499 | 499 | That we don't see the symptoms of the bug |
|
500 | 500 | |
|
501 | 501 | $ hg up -- -1 |
|
502 | 502 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
503 | 503 | $ hg status |
|
504 | 504 | |
|
505 | 505 | And that the repair command does not find anything to fix |
|
506 | 506 | |
|
507 | 507 | $ hg debug-repair-issue6528 |
|
508 | 508 | no affected revisions were found |
|
509 | 509 | |
|
510 | 510 | $ cd .. |
|
511 | 511 | |
|
512 | 512 | A config option can disable the fixing of the bad bundle on the fly |
|
513 | 513 | ------------------------------------------------------------------- |
|
514 | 514 | |
|
515 | 515 | |
|
516 | 516 | |
|
517 | 517 | from a v1 bundle |
|
518 | 518 | ~~~~~~~~~~~~~~~~ |
|
519 | 519 | |
|
520 | 520 | $ hg debugbundle --spec "$TESTDIR"/bundles/issue6528.hg-v1 |
|
521 | 521 | bzip2-v1 |
|
522 | 522 | |
|
523 | 523 | $ hg init unbundle-v1-no-fix |
|
524 | 524 | $ cd unbundle-v1-no-fix |
|
525 | 525 | |
|
526 | 526 | $ hg unbundle "$TESTDIR"/bundles/issue6528.hg-v1 --config storage.revlog.issue6528.fix-incoming=no |
|
527 | 527 | adding changesets |
|
528 | 528 | adding manifests |
|
529 | 529 | adding file changes |
|
530 | 530 | added 8 changesets with 12 changes to 4 files |
|
531 | 531 | new changesets f5a5a568022f:3beabb508514 (8 drafts) |
|
532 | 532 | (run 'hg update' to get a working copy) |
|
533 | 533 | |
|
534 | 534 | Check that revision were not fixed on the fly |
|
535 | 535 | |
|
536 | 536 | $ hg debugrevlogindex b.txt |
|
537 | 537 | rev linkrev nodeid p1 p2 |
|
538 | 538 | 0 2 05b806ebe5ea 000000000000 000000000000 |
|
539 | 539 | 1 3 a58b36ad6b65 05b806ebe5ea 000000000000 |
|
540 | 540 | 2 6 216a5fe8b8ed 000000000000 000000000000 |
|
541 | 541 | 3 7 ea4f2f2463cc 216a5fe8b8ed 000000000000 |
|
542 | 542 | |
|
543 | 543 | $ hg debugrevlogindex D.txt |
|
544 | 544 | rev linkrev nodeid p1 p2 |
|
545 | 545 | 0 6 2a8d3833f2fb 000000000000 000000000000 |
|
546 | 546 | 1 7 2a80419dfc31 2a8d3833f2fb 000000000000 |
|
547 | 547 | |
|
548 | 548 | That we do see the symptoms of the bug |
|
549 | 549 | |
|
550 | 550 | $ hg up -- -1 |
|
551 | 551 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
552 | 552 | $ hg status |
|
553 | 553 | M D.txt (?) |
|
554 | 554 | M b.txt (?) |
|
555 | 555 | |
|
556 | 556 | And that the repair command find issue to fix. |
|
557 | 557 | |
|
558 | 558 | $ hg debug-repair-issue6528 --dry-run |
|
559 | 559 | found affected revision 1 for filelog 'data/D.txt.i' |
|
560 | 560 | found affected revision 1 for filelog 'data/b.txt.i' |
|
561 | 561 | found affected revision 3 for filelog 'data/b.txt.i' |
|
562 | 562 | |
|
563 | 563 | $ cd .. |
|
564 | 564 | |
|
565 | 565 | from a v2 bundle |
|
566 | 566 | ~~~~~~~~~~~~~~~~ |
|
567 | 567 | |
|
568 | 568 | $ hg debugbundle --spec "$TESTDIR"/bundles/issue6528.hg-v2 |
|
569 | 569 | bzip2-v2 |
|
570 | 570 | |
|
571 | 571 | $ hg init unbundle-v2-no-fix |
|
572 | 572 | $ cd unbundle-v2-no-fix |
|
573 | 573 | |
|
574 | 574 | $ hg unbundle "$TESTDIR"/bundles/issue6528.hg-v2 --config storage.revlog.issue6528.fix-incoming=no |
|
575 | 575 | adding changesets |
|
576 | 576 | adding manifests |
|
577 | 577 | adding file changes |
|
578 | 578 | added 8 changesets with 12 changes to 4 files |
|
579 | 579 | new changesets f5a5a568022f:3beabb508514 (8 drafts) |
|
580 | 580 | (run 'hg update' to get a working copy) |
|
581 | 581 | |
|
582 | 582 | Check that revision were not fixed on the fly |
|
583 | 583 | |
|
584 | 584 | $ hg debugrevlogindex b.txt |
|
585 | 585 | rev linkrev nodeid p1 p2 |
|
586 | 586 | 0 2 05b806ebe5ea 000000000000 000000000000 |
|
587 | 587 | 1 3 a58b36ad6b65 05b806ebe5ea 000000000000 |
|
588 | 588 | 2 6 216a5fe8b8ed 000000000000 000000000000 |
|
589 | 589 | 3 7 ea4f2f2463cc 216a5fe8b8ed 000000000000 |
|
590 | 590 | |
|
591 | 591 | $ hg debugrevlogindex D.txt |
|
592 | 592 | rev linkrev nodeid p1 p2 |
|
593 | 593 | 0 6 2a8d3833f2fb 000000000000 000000000000 |
|
594 | 594 | 1 7 2a80419dfc31 2a8d3833f2fb 000000000000 |
|
595 | 595 | |
|
596 | 596 | That we do see the symptoms of the bug |
|
597 | 597 | |
|
598 | 598 | $ hg up -- -1 |
|
599 | 599 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
600 | 600 | $ hg status |
|
601 | 601 | M D.txt (?) |
|
602 | 602 | M b.txt (?) |
|
603 | 603 | |
|
604 | 604 | And that the repair command find issue to fix. |
|
605 | 605 | |
|
606 | 606 | $ hg debug-repair-issue6528 --dry-run |
|
607 | 607 | found affected revision 1 for filelog 'data/D.txt.i' |
|
608 | 608 | found affected revision 1 for filelog 'data/b.txt.i' |
|
609 | 609 | found affected revision 3 for filelog 'data/b.txt.i' |
|
610 | 610 | |
|
611 | 611 | $ cd .. |
@@ -1,89 +1,89 b'' | |||
|
1 | 1 | $ hg init empty-repo |
|
2 | 2 | $ cd empty-repo |
|
3 | 3 | |
|
4 | 4 | Flags on revlog version 0 are rejected |
|
5 | 5 | |
|
6 | 6 | >>> with open('.hg/store/00changelog.i', 'wb') as fh: |
|
7 | 7 | ... fh.write(b'\x00\x01\x00\x00') and None |
|
8 | 8 | |
|
9 | 9 | $ hg log |
|
10 | 10 | abort: unknown flags (0x01) in version 0 revlog 00changelog |
|
11 | 11 | [50] |
|
12 | 12 | |
|
13 | 13 | Unknown flags on revlog version 1 are rejected |
|
14 | 14 | |
|
15 | 15 | >>> with open('.hg/store/00changelog.i', 'wb') as fh: |
|
16 | 16 | ... fh.write(b'\x00\x04\x00\x01') and None |
|
17 | 17 | |
|
18 | 18 | $ hg log |
|
19 | 19 | abort: unknown flags (0x04) in version 1 revlog 00changelog |
|
20 | 20 | [50] |
|
21 | 21 | |
|
22 | 22 | Unknown version is rejected |
|
23 | 23 | |
|
24 | 24 | >>> with open('.hg/store/00changelog.i', 'wb') as fh: |
|
25 | 25 | ... fh.write(b'\x00\x00\xbe\xef') and None |
|
26 | 26 | |
|
27 | 27 | $ hg log |
|
28 | 28 | abort: unknown version (48879) in revlog 00changelog |
|
29 | 29 | [50] |
|
30 | 30 | |
|
31 | 31 | $ cd .. |
|
32 | 32 | |
|
33 | 33 | Test for CVE-2016-3630 |
|
34 | 34 | |
|
35 | 35 | $ mkdir test2; cd test2 |
|
36 | 36 | $ hg init |
|
37 | 37 | |
|
38 | 38 | >>> import codecs |
|
39 | 39 | >>> open("a.i", "wb").write(codecs.decode(codecs.decode( |
|
40 | 40 | ... b"""eJxjYGZgZIAAYQYGxhgom+k/FMx8YKx9ZUaKSOyqo4cnuKb8mbqHV5cBCVTMWb1Cwqkhe4Gsg9AD |
|
41 | 41 | ... Joa3dYtcYYYBAQ8Qr4OqZAYRICPTSr5WKd/42rV36d+8/VmrNpv7NP1jQAXrQE4BqQUARngwVA==""", |
|
42 | 42 | ... "base64"), "zlib")) and None |
|
43 | 43 | |
|
44 | 44 | $ hg debugrevlogindex a.i |
|
45 | 45 | rev linkrev nodeid p1 p2 |
|
46 | 46 | 0 2 99e0332bd498 000000000000 000000000000 |
|
47 | 47 | 1 3 6674f57a23d8 99e0332bd498 000000000000 |
|
48 | 48 | |
|
49 | 49 | >>> from mercurial.revlogutils.constants import KIND_OTHER |
|
50 | 50 | >>> from mercurial import revlog, vfs |
|
51 | 51 | >>> tvfs = vfs.vfs(b'.') |
|
52 | 52 | >>> tvfs.options = {b'revlogv1': True} |
|
53 | 53 | >>> rl = revlog.revlog(tvfs, target=(KIND_OTHER, b'test'), radix=b'a') |
|
54 | 54 | >>> rl.revision(1) |
|
55 | 55 | mpatchError(*'patch cannot be decoded'*) (glob) |
|
56 | 56 | |
|
57 | 57 | $ cd .. |
|
58 | 58 | |
|
59 | 59 | |
|
60 | 60 | Regression test for support for the old repos with strange diff encoding. |
|
61 | 61 | Apparently it used to be possible (maybe it's still possible, but we don't know how) |
|
62 | 62 | to create commits whose diffs are encoded relative to a nullrev. |
|
63 | 63 | This test checks that a repo with that encoding can still be read. |
|
64 | 64 | |
|
65 | 65 | This is what we did to produce the repo in test-revlog-diff-relative-to-nullrev.tar: |
|
66 | 66 | |
|
67 | 67 | - tweak the code in mercurial/revlogutils/deltas.py to produce such "trivial" deltas: |
|
68 | 68 | > if deltainfo is None: |
|
69 | 69 | > - deltainfo = self._fullsnapshotinfo(fh, revinfo, target_rev) |
|
70 | 70 | > + deltainfo = self._builddeltainfo(revinfo, nullrev, fh) |
|
71 | 71 | - hg init |
|
72 | 72 | - echo hi > a |
|
73 | 73 | - hg commit -Am_ |
|
74 | 74 | - remove some cache files |
|
75 | 75 | |
|
76 | $ tar -x < "$TESTDIR"/bundles/test-revlog-diff-relative-to-nullrev.tar | |
|
76 | $ tar -xf - < "$TESTDIR"/bundles/test-revlog-diff-relative-to-nullrev.tar | |
|
77 | 77 | $ cd nullrev-diff |
|
78 | 78 | $ hg debugdeltachain a |
|
79 | 79 | rev p1 p2 chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks |
|
80 | 80 | 0 -1 -1 1 2 -1 p1 15 3 15 5.00000 15 0 0.00000 15 15 1.00000 1 |
|
81 | 81 | 1 0 -1 1 2 -1 p2 15 3 15 5.00000 30 15 1.00000 30 30 0.50000 1 |
|
82 | 82 | 2 -1 -1 1 2 -1 p1 15 3 15 5.00000 45 30 2.00000 45 45 0.33333 1 |
|
83 | 83 | $ hg cat --config rhg.cat=true -r 0 a |
|
84 | 84 | hi |
|
85 | 85 | $ hg cat --config rhg.cat=true -r 1 a |
|
86 | 86 | ho |
|
87 | 87 | $ hg cat --config rhg.cat=true -r 2 a |
|
88 | 88 | ha |
|
89 | 89 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now