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