Fossil SCM
Added comments explaining the select statement checking revision/file/project/metadata integrity
Commit
808fbc474536c2f5bc5bf912b5212387ea7c2b4f
Parent
97e0e9dda94ea0f…
1 file changed
+81
-80
+81
-80
| --- tools/cvs2fossil/lib/c2f_pcollrev.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_pcollrev.tcl | ||
| @@ -377,10 +377,11 @@ | ||
| 377 | 377 | state discard author |
| 378 | 378 | state discard cmessage |
| 379 | 379 | return |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | + # TODO: Move this code to the integrity module | |
| 382 | 383 | proc Paranoia {} { |
| 383 | 384 | # This code performs a number of paranoid checks of the |
| 384 | 385 | # database, searching for inconsistent cross-references. |
| 385 | 386 | log write 4 collrev {Check database consistency} |
| 386 | 387 | |
| @@ -391,218 +392,218 @@ | ||
| 391 | 392 | # development about the project they are owned by. |
| 392 | 393 | Check \ |
| 393 | 394 | {Revisions and their LODs have to be in the same project} \ |
| 394 | 395 | {disagrees with its LOD about owning project} { |
| 395 | 396 | SELECT F.name, R.rev |
| 396 | - FROM revision R, file F, symbol S | |
| 397 | - WHERE R.fid = F.fid | |
| 398 | - AND R.lod = S.sid | |
| 399 | - AND F.pid != S.pid | |
| 397 | + FROM revision R, file F, symbol S | |
| 398 | + WHERE R.fid = F.fid -- Get file of revision | |
| 399 | + AND R.lod = S.sid -- Get symbol for revision's LOD | |
| 400 | + AND F.pid != S.pid -- but symbol is for a different project | |
| 400 | 401 | ; |
| 401 | 402 | } |
| 402 | 403 | # Find all revisions which disgree with their meta data about |
| 403 | 404 | # the project they are owned by. |
| 404 | 405 | Check \ |
| 405 | 406 | {Revisions and their meta data have to be in the same project} \ |
| 406 | 407 | {disagrees with its meta data about owning project} { |
| 407 | 408 | SELECT F.name, R.rev |
| 408 | - FROM revision R, file F, meta M | |
| 409 | - WHERE R.fid = F.fid | |
| 410 | - AND R.mid = M.mid | |
| 411 | - AND F.pid != M.pid | |
| 409 | + FROM revision R, file F, meta M | |
| 410 | + WHERE R.fid = F.fid -- Get file of revision | |
| 411 | + AND R.mid = M.mid -- Get meta data of revision | |
| 412 | + AND F.pid != M.pid -- but is for a different project | |
| 412 | 413 | ; |
| 413 | 414 | } |
| 414 | 415 | # Find all revisions which disgree with their meta data about |
| 415 | 416 | # the branch/line of development they belong to. |
| 416 | 417 | Check \ |
| 417 | 418 | {Revisions and their meta data have to be in the same LOD} \ |
| 418 | 419 | {disagrees with its meta data about owning LOD} { |
| 419 | 420 | SELECT F.name, R.rev |
| 420 | - FROM revision R, meta M, file F | |
| 421 | - WHERE R.mid = M.mid | |
| 422 | - AND R.lod != M.bid | |
| 423 | - AND R.fid = F.fid | |
| 421 | + FROM revision R, meta M, file F | |
| 422 | + WHERE R.mid = M.mid -- Get meta data of revision | |
| 423 | + AND R.lod != M.bid -- but is for a different LOD | |
| 424 | + AND R.fid = F.fid -- Get file of revision | |
| 424 | 425 | ; |
| 425 | 426 | } |
| 426 | 427 | # Find all revisions with a primary child which disagrees |
| 427 | 428 | # about the file they belong to. |
| 428 | 429 | Check \ |
| 429 | 430 | {Revisions and their primary children have to be in the same file} \ |
| 430 | 431 | {disagrees with its primary child about the owning file} { |
| 431 | 432 | SELECT F.name, R.rev |
| 432 | - FROM revision R, revision C, file F | |
| 433 | - WHERE R.fid = F.fid | |
| 434 | - AND R.child IS NOT NULL | |
| 435 | - AND R.child = C.rid | |
| 436 | - AND C.fid != R.fid | |
| 433 | + FROM revision R, revision C, file F | |
| 434 | + WHERE R.fid = F.fid -- Get file of revision | |
| 435 | + AND R.child IS NOT NULL -- Restrict to non-leaf revisions | |
| 436 | + AND R.child = C.rid -- Get child (has to exist) | |
| 437 | + AND C.fid != R.fid -- Whic wrongly is in a different file | |
| 437 | 438 | ; |
| 438 | 439 | } |
| 439 | 440 | |
| 440 | 441 | # Find all revisions with a branch parent symbol whose parent |
| 441 | 442 | # disagrees about the file they belong to. |
| 442 | 443 | Check \ |
| 443 | 444 | {Revisions and their branch children have to be in the same file} \ |
| 444 | 445 | {at the beginning of its branch and its parent disagree about the owning file} { |
| 445 | 446 | SELECT F.name, R.rev |
| 446 | - FROM revision R, revision P, file F | |
| 447 | - WHERE R.fid = F.fid | |
| 448 | - AND R.bparent IS NOT NULL | |
| 449 | - AND R.parent = P.rid | |
| 450 | - AND R.fid != P.fid | |
| 447 | + FROM revision R, revision P, file F | |
| 448 | + WHERE R.fid = F.fid -- Get file of revision | |
| 449 | + AND R.bparent IS NOT NULL -- Restrict to first on branch | |
| 450 | + AND R.parent = P.rid -- Get out-of-branch parent | |
| 451 | + AND R.fid != P.fid -- Which wrongly is in a different file | |
| 451 | 452 | ; |
| 452 | 453 | } |
| 453 | 454 | # Find all revisions with a non-NTDB child which disagrees |
| 454 | 455 | # about the file they belong to. |
| 455 | 456 | Check \ |
| 456 | 457 | {Revisions and their non-NTDB children have to be in the same file} \ |
| 457 | 458 | {disagrees with its non-NTDB child about the owning file} { |
| 458 | 459 | SELECT F.name, R.rev |
| 459 | - FROM revision R, revision C, file F | |
| 460 | - WHERE R.fid = F.fid | |
| 461 | - AND R.dbchild IS NOT NULL | |
| 462 | - AND R.dbchild = C.rid | |
| 463 | - AND C.fid != R.fid | |
| 460 | + FROM revision R, revision C, file F | |
| 461 | + WHERE R.fid = F.fid -- Get file of revision | |
| 462 | + AND R.dbchild IS NOT NULL -- Restrict to semi-last NTDB revision | |
| 463 | + AND R.dbchild = C.rid -- Got to associated trunk revision | |
| 464 | + AND C.fid != R.fid -- Which wrongly is in a different file | |
| 464 | 465 | ; |
| 465 | 466 | } |
| 466 | 467 | # Find all revisions which have a primary child, but the child |
| 467 | 468 | # does not have them as parent. |
| 468 | 469 | Check \ |
| 469 | 470 | {Revisions have to be parents of their primary children} \ |
| 470 | 471 | {is not the parent of its primary child} { |
| 471 | 472 | SELECT F.name, R.rev |
| 472 | - FROM revision R, revision C, file F | |
| 473 | - WHERE R.fid = F.fid | |
| 474 | - AND R.child IS NOT NULL | |
| 475 | - AND R.child = C.rid | |
| 476 | - AND C.parent != R.rid | |
| 473 | + FROM revision R, revision C, file F | |
| 474 | + WHERE R.fid = F.fid -- Get file of revision | |
| 475 | + AND R.child IS NOT NULL -- Restrict to non-leaves | |
| 476 | + AND R.child = C.rid -- Get the child (has to exist) | |
| 477 | + AND C.parent != R.rid -- Which does not have us as its parent. | |
| 477 | 478 | ; |
| 478 | 479 | } |
| 479 | 480 | # Find all revisions which have a primrary child, but the |
| 480 | 481 | # child has a branch parent symbol making them brach starters. |
| 481 | 482 | Check \ |
| 482 | 483 | {Primary children of revisions must not start branches} \ |
| 483 | 484 | {is parent of a primary child which is the beginning of a branch} { |
| 484 | 485 | SELECT F.name, R.rev |
| 485 | - FROM revision R, revision C, file F | |
| 486 | - WHERE R.fid = F.fid | |
| 487 | - AND R.child IS NOT NULL | |
| 488 | - AND R.child = C.rid | |
| 489 | - AND C.bparent IS NOT NULL | |
| 486 | + FROM revision R, revision C, file F | |
| 487 | + WHERE R.fid = F.fid -- Get file of revision | |
| 488 | + AND R.child IS NOT NULL -- Restrict to non-leaves | |
| 489 | + AND R.child = C.rid -- Get the child (has to exist) | |
| 490 | + AND C.bparent IS NOT NULL -- wrongly claiming to be first on branch | |
| 490 | 491 | ; |
| 491 | 492 | } |
| 492 | 493 | # Find all revisions without branch parent symbol which have a |
| 493 | 494 | # parent, but the parent does not have them as primary child. |
| 494 | 495 | Check \ |
| 495 | 496 | {Revisions have to be primary children of their parents, if any} \ |
| 496 | 497 | {is not the child of its parent} { |
| 497 | 498 | SELECT F.name, R.rev |
| 498 | - FROM revision R, revision P, file F | |
| 499 | - WHERE R.fid = F.fid | |
| 500 | - AND R.bparent IS NULL | |
| 501 | - AND R.parent IS NOT NULL | |
| 502 | - AND R.parent = P.rid | |
| 503 | - AND P.child != R.rid | |
| 499 | + FROM revision R, revision P, file F | |
| 500 | + WHERE R.fid = F.fid | |
| 501 | + AND R.bparent IS NULL -- Get file of revision | |
| 502 | + AND R.parent IS NOT NULL -- Restrict to everything not first on a branch | |
| 503 | + AND R.parent = P.rid -- Get the parent (has to exist) | |
| 504 | + AND P.child != R.rid -- Which do not have us as their child | |
| 504 | 505 | ; |
| 505 | 506 | } |
| 506 | 507 | # Find all revisions with a branch parent symbol which do not |
| 507 | 508 | # have a parent. |
| 508 | 509 | Check \ |
| 509 | 510 | {Branch starting revisions have to have a parent} \ |
| 510 | 511 | {at the beginning of its branch has no parent} { |
| 511 | 512 | SELECT F.name, R.rev |
| 512 | - FROM revision R, file F | |
| 513 | - WHERE R.fid = F.fid | |
| 514 | - AND R.bparent IS NOT NULL | |
| 515 | - AND R.parent IS NULL | |
| 513 | + FROM revision R, file F | |
| 514 | + WHERE R.fid = F.fid -- Get file of revision | |
| 515 | + AND R.bparent IS NOT NULL -- Restrict to first on a branch | |
| 516 | + AND R.parent IS NULL -- But there is no out-of-branch parent | |
| 516 | 517 | ; |
| 517 | 518 | } |
| 518 | 519 | # Find all revisions with a branch parent symbol whose parent |
| 519 | 520 | # has them as primary child. |
| 520 | 521 | Check \ |
| 521 | 522 | {Branch starting revisions must not be primary children of their parents} \ |
| 522 | 523 | {at the beginning of its branch is the primary child of its parent} { |
| 523 | 524 | SELECT F.name, R.rev |
| 524 | - FROM revision R, revision P, file F | |
| 525 | - WHERE R.fid = F.fid | |
| 526 | - AND R.bparent IS NOT NULL | |
| 527 | - AND R.parent IS NOT NULL | |
| 528 | - AND R.parent = P.rid | |
| 529 | - AND P.child = R.rid | |
| 525 | + FROM revision R, revision P, file F | |
| 526 | + WHERE R.fid = F.fid -- Get file of revision | |
| 527 | + AND R.bparent IS NOT NULL -- Restrict to first on a branch | |
| 528 | + AND R.parent IS NOT NULL -- Which are not detached | |
| 529 | + AND R.parent = P.rid -- Get their non-branch parent | |
| 530 | + AND P.child = R.rid -- which improperly has them as primary child | |
| 530 | 531 | ; |
| 531 | 532 | } |
| 532 | 533 | # Find all revisions with a non-NTDB child which are not on |
| 533 | 534 | # the NTDB. |
| 534 | 535 | Check \ |
| 535 | 536 | {NTDB to trunk transition has to begin on NTDB} \ |
| 536 | 537 | {has a non-NTDB child, yet is not on the NTDB} { |
| 537 | 538 | SELECT F.name, R.rev |
| 538 | - FROM revision R, file F | |
| 539 | - WHERE R.fid = F.fid | |
| 540 | - AND R.dbchild IS NOT NULL | |
| 541 | - AND NOT R.isdefault | |
| 539 | + FROM revision R, file F | |
| 540 | + WHERE R.fid = F.fid -- Get file of revision | |
| 541 | + AND R.dbchild IS NOT NULL -- Restrict to semi-last NTDB revision | |
| 542 | + AND NOT R.isdefault -- Improperly claiming to not be on NTDB | |
| 542 | 543 | ; |
| 543 | 544 | } |
| 544 | 545 | # Find all revisions with a NTDB parent which are on the NTDB. |
| 545 | 546 | Check \ |
| 546 | 547 | {NTDB to trunk transition has to end on non-NTDB} \ |
| 547 | 548 | {has a NTDB parent, yet is on the NTDB} { |
| 548 | 549 | SELECT F.name, R.rev |
| 549 | - FROM revision R, file F | |
| 550 | - WHERE R.fid = F.fid | |
| 551 | - AND R.dbparent IS NOT NULL | |
| 552 | - AND R.isdefault | |
| 550 | + FROM revision R, file F | |
| 551 | + WHERE R.fid = F.fid -- Get file of revision | |
| 552 | + AND R.dbparent IS NOT NULL -- Restrict to trunk roots with NTDB around | |
| 553 | + AND R.isdefault -- But root improperly claims to be on NTDB | |
| 553 | 554 | ; |
| 554 | 555 | } |
| 555 | 556 | # Find all revisions with a child which disagrees about the |
| 556 | 557 | # line of development they belong to. |
| 557 | 558 | Check \ |
| 558 | 559 | {Revisions and their primary children have to be in the same LOD} \ |
| 559 | 560 | {and its primary child disagree about their LOD} { |
| 560 | 561 | SELECT F.name, R.rev |
| 561 | - FROM revision R, revision C, file F | |
| 562 | - WHERE R.fid = F.fid | |
| 563 | - AND R.child IS NOT NULL | |
| 564 | - AND R.child = C.rid | |
| 565 | - AND C.lod != R.lod | |
| 562 | + FROM revision R, revision C, file F | |
| 563 | + WHERE R.fid = F.fid -- Get file of revision | |
| 564 | + AND R.child IS NOT NULL -- Restrict to non-leaves | |
| 565 | + AND R.child = C.rid -- Get child (has to exist) | |
| 566 | + AND C.lod != R.lod -- which improperly uses a different LOD | |
| 566 | 567 | ; |
| 567 | 568 | } |
| 568 | 569 | # Find all revisions with a non-NTDB child which agrees about |
| 569 | 570 | # the line of development they belong to. |
| 570 | 571 | Check \ |
| 571 | 572 | {NTDB and trunk revisions have to be in different LODs} \ |
| 572 | 573 | {on NTDB and its non-NTDB child wrongly agree about their LOD} { |
| 573 | 574 | SELECT F.name, R.rev |
| 574 | - FROM revision R, revision C, file F | |
| 575 | - WHERE R.fid = F.fid | |
| 576 | - AND R.dbchild IS NOT NULL | |
| 577 | - AND R.dbchild = C.rid | |
| 578 | - AND C.lod = R.lod | |
| 575 | + FROM revision R, revision C, file F | |
| 576 | + WHERE R.fid = F.fid -- Get file of revision | |
| 577 | + AND R.dbchild IS NOT NULL -- Restrict to semi-last NTDB revision | |
| 578 | + AND R.dbchild = C.rid -- Get associated trunk root revision | |
| 579 | + AND C.lod = R.lod -- Improperly uses the same LOD | |
| 579 | 580 | ; |
| 580 | 581 | } |
| 581 | 582 | # Find all revisions with a branch parent symbol which is not |
| 582 | 583 | # their LOD. |
| 583 | 584 | Check \ |
| 584 | 585 | {Branch starting revisions have to have their LOD as branch parent symbol} \ |
| 585 | 586 | {at the beginning of its branch does not have the branch symbol as its LOD} { |
| 586 | 587 | SELECT F.name, R.rev |
| 587 | - FROM revision R, file F | |
| 588 | - WHERE R.fid = F.fid | |
| 589 | - AND R.bparent IS NOT NULL | |
| 590 | - AND R.lod != R.bparent | |
| 588 | + FROM revision R, file F | |
| 589 | + WHERE R.fid = F.fid -- Get file of revision | |
| 590 | + AND R.bparent IS NOT NULL -- Restrict to revisions first on a branch | |
| 591 | + AND R.lod != R.bparent -- and their branch is not their LOD | |
| 591 | 592 | ; |
| 592 | 593 | } |
| 593 | 594 | # Find all revisions with a branch parent symbol whose parent |
| 594 | 595 | # is in the same line of development. |
| 595 | 596 | Check \ |
| 596 | 597 | {Revisions and their branch children have to be in different LODs} \ |
| 597 | 598 | {at the beginning of its branch and its parent wrongly agree about their LOD} { |
| 598 | 599 | SELECT F.name, R.rev |
| 599 | - FROM revision R, revision P, file F | |
| 600 | - WHERE R.fid = F.fid | |
| 601 | - AND R.bparent IS NOT NULL | |
| 602 | - AND R.parent = P.rid | |
| 603 | - AND R.lod = P.lod | |
| 600 | + FROM revision R, revision P, file F | |
| 601 | + WHERE R.fid = F.fid -- Get file of revision | |
| 602 | + AND R.bparent IS NOT NULL -- Restrict to revisions first on a branch | |
| 603 | + AND R.parent = P.rid -- Get their non-branch parent | |
| 604 | + AND R.lod = P.lod -- Which improperly uses the same LOD | |
| 604 | 605 | ; |
| 605 | 606 | } |
| 606 | 607 | return |
| 607 | 608 | } |
| 608 | 609 | |
| 609 | 610 |
| --- tools/cvs2fossil/lib/c2f_pcollrev.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pcollrev.tcl | |
| @@ -377,10 +377,11 @@ | |
| 377 | state discard author |
| 378 | state discard cmessage |
| 379 | return |
| 380 | } |
| 381 | |
| 382 | proc Paranoia {} { |
| 383 | # This code performs a number of paranoid checks of the |
| 384 | # database, searching for inconsistent cross-references. |
| 385 | log write 4 collrev {Check database consistency} |
| 386 | |
| @@ -391,218 +392,218 @@ | |
| 391 | # development about the project they are owned by. |
| 392 | Check \ |
| 393 | {Revisions and their LODs have to be in the same project} \ |
| 394 | {disagrees with its LOD about owning project} { |
| 395 | SELECT F.name, R.rev |
| 396 | FROM revision R, file F, symbol S |
| 397 | WHERE R.fid = F.fid |
| 398 | AND R.lod = S.sid |
| 399 | AND F.pid != S.pid |
| 400 | ; |
| 401 | } |
| 402 | # Find all revisions which disgree with their meta data about |
| 403 | # the project they are owned by. |
| 404 | Check \ |
| 405 | {Revisions and their meta data have to be in the same project} \ |
| 406 | {disagrees with its meta data about owning project} { |
| 407 | SELECT F.name, R.rev |
| 408 | FROM revision R, file F, meta M |
| 409 | WHERE R.fid = F.fid |
| 410 | AND R.mid = M.mid |
| 411 | AND F.pid != M.pid |
| 412 | ; |
| 413 | } |
| 414 | # Find all revisions which disgree with their meta data about |
| 415 | # the branch/line of development they belong to. |
| 416 | Check \ |
| 417 | {Revisions and their meta data have to be in the same LOD} \ |
| 418 | {disagrees with its meta data about owning LOD} { |
| 419 | SELECT F.name, R.rev |
| 420 | FROM revision R, meta M, file F |
| 421 | WHERE R.mid = M.mid |
| 422 | AND R.lod != M.bid |
| 423 | AND R.fid = F.fid |
| 424 | ; |
| 425 | } |
| 426 | # Find all revisions with a primary child which disagrees |
| 427 | # about the file they belong to. |
| 428 | Check \ |
| 429 | {Revisions and their primary children have to be in the same file} \ |
| 430 | {disagrees with its primary child about the owning file} { |
| 431 | SELECT F.name, R.rev |
| 432 | FROM revision R, revision C, file F |
| 433 | WHERE R.fid = F.fid |
| 434 | AND R.child IS NOT NULL |
| 435 | AND R.child = C.rid |
| 436 | AND C.fid != R.fid |
| 437 | ; |
| 438 | } |
| 439 | |
| 440 | # Find all revisions with a branch parent symbol whose parent |
| 441 | # disagrees about the file they belong to. |
| 442 | Check \ |
| 443 | {Revisions and their branch children have to be in the same file} \ |
| 444 | {at the beginning of its branch and its parent disagree about the owning file} { |
| 445 | SELECT F.name, R.rev |
| 446 | FROM revision R, revision P, file F |
| 447 | WHERE R.fid = F.fid |
| 448 | AND R.bparent IS NOT NULL |
| 449 | AND R.parent = P.rid |
| 450 | AND R.fid != P.fid |
| 451 | ; |
| 452 | } |
| 453 | # Find all revisions with a non-NTDB child which disagrees |
| 454 | # about the file they belong to. |
| 455 | Check \ |
| 456 | {Revisions and their non-NTDB children have to be in the same file} \ |
| 457 | {disagrees with its non-NTDB child about the owning file} { |
| 458 | SELECT F.name, R.rev |
| 459 | FROM revision R, revision C, file F |
| 460 | WHERE R.fid = F.fid |
| 461 | AND R.dbchild IS NOT NULL |
| 462 | AND R.dbchild = C.rid |
| 463 | AND C.fid != R.fid |
| 464 | ; |
| 465 | } |
| 466 | # Find all revisions which have a primary child, but the child |
| 467 | # does not have them as parent. |
| 468 | Check \ |
| 469 | {Revisions have to be parents of their primary children} \ |
| 470 | {is not the parent of its primary child} { |
| 471 | SELECT F.name, R.rev |
| 472 | FROM revision R, revision C, file F |
| 473 | WHERE R.fid = F.fid |
| 474 | AND R.child IS NOT NULL |
| 475 | AND R.child = C.rid |
| 476 | AND C.parent != R.rid |
| 477 | ; |
| 478 | } |
| 479 | # Find all revisions which have a primrary child, but the |
| 480 | # child has a branch parent symbol making them brach starters. |
| 481 | Check \ |
| 482 | {Primary children of revisions must not start branches} \ |
| 483 | {is parent of a primary child which is the beginning of a branch} { |
| 484 | SELECT F.name, R.rev |
| 485 | FROM revision R, revision C, file F |
| 486 | WHERE R.fid = F.fid |
| 487 | AND R.child IS NOT NULL |
| 488 | AND R.child = C.rid |
| 489 | AND C.bparent IS NOT NULL |
| 490 | ; |
| 491 | } |
| 492 | # Find all revisions without branch parent symbol which have a |
| 493 | # parent, but the parent does not have them as primary child. |
| 494 | Check \ |
| 495 | {Revisions have to be primary children of their parents, if any} \ |
| 496 | {is not the child of its parent} { |
| 497 | SELECT F.name, R.rev |
| 498 | FROM revision R, revision P, file F |
| 499 | WHERE R.fid = F.fid |
| 500 | AND R.bparent IS NULL |
| 501 | AND R.parent IS NOT NULL |
| 502 | AND R.parent = P.rid |
| 503 | AND P.child != R.rid |
| 504 | ; |
| 505 | } |
| 506 | # Find all revisions with a branch parent symbol which do not |
| 507 | # have a parent. |
| 508 | Check \ |
| 509 | {Branch starting revisions have to have a parent} \ |
| 510 | {at the beginning of its branch has no parent} { |
| 511 | SELECT F.name, R.rev |
| 512 | FROM revision R, file F |
| 513 | WHERE R.fid = F.fid |
| 514 | AND R.bparent IS NOT NULL |
| 515 | AND R.parent IS NULL |
| 516 | ; |
| 517 | } |
| 518 | # Find all revisions with a branch parent symbol whose parent |
| 519 | # has them as primary child. |
| 520 | Check \ |
| 521 | {Branch starting revisions must not be primary children of their parents} \ |
| 522 | {at the beginning of its branch is the primary child of its parent} { |
| 523 | SELECT F.name, R.rev |
| 524 | FROM revision R, revision P, file F |
| 525 | WHERE R.fid = F.fid |
| 526 | AND R.bparent IS NOT NULL |
| 527 | AND R.parent IS NOT NULL |
| 528 | AND R.parent = P.rid |
| 529 | AND P.child = R.rid |
| 530 | ; |
| 531 | } |
| 532 | # Find all revisions with a non-NTDB child which are not on |
| 533 | # the NTDB. |
| 534 | Check \ |
| 535 | {NTDB to trunk transition has to begin on NTDB} \ |
| 536 | {has a non-NTDB child, yet is not on the NTDB} { |
| 537 | SELECT F.name, R.rev |
| 538 | FROM revision R, file F |
| 539 | WHERE R.fid = F.fid |
| 540 | AND R.dbchild IS NOT NULL |
| 541 | AND NOT R.isdefault |
| 542 | ; |
| 543 | } |
| 544 | # Find all revisions with a NTDB parent which are on the NTDB. |
| 545 | Check \ |
| 546 | {NTDB to trunk transition has to end on non-NTDB} \ |
| 547 | {has a NTDB parent, yet is on the NTDB} { |
| 548 | SELECT F.name, R.rev |
| 549 | FROM revision R, file F |
| 550 | WHERE R.fid = F.fid |
| 551 | AND R.dbparent IS NOT NULL |
| 552 | AND R.isdefault |
| 553 | ; |
| 554 | } |
| 555 | # Find all revisions with a child which disagrees about the |
| 556 | # line of development they belong to. |
| 557 | Check \ |
| 558 | {Revisions and their primary children have to be in the same LOD} \ |
| 559 | {and its primary child disagree about their LOD} { |
| 560 | SELECT F.name, R.rev |
| 561 | FROM revision R, revision C, file F |
| 562 | WHERE R.fid = F.fid |
| 563 | AND R.child IS NOT NULL |
| 564 | AND R.child = C.rid |
| 565 | AND C.lod != R.lod |
| 566 | ; |
| 567 | } |
| 568 | # Find all revisions with a non-NTDB child which agrees about |
| 569 | # the line of development they belong to. |
| 570 | Check \ |
| 571 | {NTDB and trunk revisions have to be in different LODs} \ |
| 572 | {on NTDB and its non-NTDB child wrongly agree about their LOD} { |
| 573 | SELECT F.name, R.rev |
| 574 | FROM revision R, revision C, file F |
| 575 | WHERE R.fid = F.fid |
| 576 | AND R.dbchild IS NOT NULL |
| 577 | AND R.dbchild = C.rid |
| 578 | AND C.lod = R.lod |
| 579 | ; |
| 580 | } |
| 581 | # Find all revisions with a branch parent symbol which is not |
| 582 | # their LOD. |
| 583 | Check \ |
| 584 | {Branch starting revisions have to have their LOD as branch parent symbol} \ |
| 585 | {at the beginning of its branch does not have the branch symbol as its LOD} { |
| 586 | SELECT F.name, R.rev |
| 587 | FROM revision R, file F |
| 588 | WHERE R.fid = F.fid |
| 589 | AND R.bparent IS NOT NULL |
| 590 | AND R.lod != R.bparent |
| 591 | ; |
| 592 | } |
| 593 | # Find all revisions with a branch parent symbol whose parent |
| 594 | # is in the same line of development. |
| 595 | Check \ |
| 596 | {Revisions and their branch children have to be in different LODs} \ |
| 597 | {at the beginning of its branch and its parent wrongly agree about their LOD} { |
| 598 | SELECT F.name, R.rev |
| 599 | FROM revision R, revision P, file F |
| 600 | WHERE R.fid = F.fid |
| 601 | AND R.bparent IS NOT NULL |
| 602 | AND R.parent = P.rid |
| 603 | AND R.lod = P.lod |
| 604 | ; |
| 605 | } |
| 606 | return |
| 607 | } |
| 608 | |
| 609 |
| --- tools/cvs2fossil/lib/c2f_pcollrev.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pcollrev.tcl | |
| @@ -377,10 +377,11 @@ | |
| 377 | state discard author |
| 378 | state discard cmessage |
| 379 | return |
| 380 | } |
| 381 | |
| 382 | # TODO: Move this code to the integrity module |
| 383 | proc Paranoia {} { |
| 384 | # This code performs a number of paranoid checks of the |
| 385 | # database, searching for inconsistent cross-references. |
| 386 | log write 4 collrev {Check database consistency} |
| 387 | |
| @@ -391,218 +392,218 @@ | |
| 392 | # development about the project they are owned by. |
| 393 | Check \ |
| 394 | {Revisions and their LODs have to be in the same project} \ |
| 395 | {disagrees with its LOD about owning project} { |
| 396 | SELECT F.name, R.rev |
| 397 | FROM revision R, file F, symbol S |
| 398 | WHERE R.fid = F.fid -- Get file of revision |
| 399 | AND R.lod = S.sid -- Get symbol for revision's LOD |
| 400 | AND F.pid != S.pid -- but symbol is for a different project |
| 401 | ; |
| 402 | } |
| 403 | # Find all revisions which disgree with their meta data about |
| 404 | # the project they are owned by. |
| 405 | Check \ |
| 406 | {Revisions and their meta data have to be in the same project} \ |
| 407 | {disagrees with its meta data about owning project} { |
| 408 | SELECT F.name, R.rev |
| 409 | FROM revision R, file F, meta M |
| 410 | WHERE R.fid = F.fid -- Get file of revision |
| 411 | AND R.mid = M.mid -- Get meta data of revision |
| 412 | AND F.pid != M.pid -- but is for a different project |
| 413 | ; |
| 414 | } |
| 415 | # Find all revisions which disgree with their meta data about |
| 416 | # the branch/line of development they belong to. |
| 417 | Check \ |
| 418 | {Revisions and their meta data have to be in the same LOD} \ |
| 419 | {disagrees with its meta data about owning LOD} { |
| 420 | SELECT F.name, R.rev |
| 421 | FROM revision R, meta M, file F |
| 422 | WHERE R.mid = M.mid -- Get meta data of revision |
| 423 | AND R.lod != M.bid -- but is for a different LOD |
| 424 | AND R.fid = F.fid -- Get file of revision |
| 425 | ; |
| 426 | } |
| 427 | # Find all revisions with a primary child which disagrees |
| 428 | # about the file they belong to. |
| 429 | Check \ |
| 430 | {Revisions and their primary children have to be in the same file} \ |
| 431 | {disagrees with its primary child about the owning file} { |
| 432 | SELECT F.name, R.rev |
| 433 | FROM revision R, revision C, file F |
| 434 | WHERE R.fid = F.fid -- Get file of revision |
| 435 | AND R.child IS NOT NULL -- Restrict to non-leaf revisions |
| 436 | AND R.child = C.rid -- Get child (has to exist) |
| 437 | AND C.fid != R.fid -- Whic wrongly is in a different file |
| 438 | ; |
| 439 | } |
| 440 | |
| 441 | # Find all revisions with a branch parent symbol whose parent |
| 442 | # disagrees about the file they belong to. |
| 443 | Check \ |
| 444 | {Revisions and their branch children have to be in the same file} \ |
| 445 | {at the beginning of its branch and its parent disagree about the owning file} { |
| 446 | SELECT F.name, R.rev |
| 447 | FROM revision R, revision P, file F |
| 448 | WHERE R.fid = F.fid -- Get file of revision |
| 449 | AND R.bparent IS NOT NULL -- Restrict to first on branch |
| 450 | AND R.parent = P.rid -- Get out-of-branch parent |
| 451 | AND R.fid != P.fid -- Which wrongly is in a different file |
| 452 | ; |
| 453 | } |
| 454 | # Find all revisions with a non-NTDB child which disagrees |
| 455 | # about the file they belong to. |
| 456 | Check \ |
| 457 | {Revisions and their non-NTDB children have to be in the same file} \ |
| 458 | {disagrees with its non-NTDB child about the owning file} { |
| 459 | SELECT F.name, R.rev |
| 460 | FROM revision R, revision C, file F |
| 461 | WHERE R.fid = F.fid -- Get file of revision |
| 462 | AND R.dbchild IS NOT NULL -- Restrict to semi-last NTDB revision |
| 463 | AND R.dbchild = C.rid -- Got to associated trunk revision |
| 464 | AND C.fid != R.fid -- Which wrongly is in a different file |
| 465 | ; |
| 466 | } |
| 467 | # Find all revisions which have a primary child, but the child |
| 468 | # does not have them as parent. |
| 469 | Check \ |
| 470 | {Revisions have to be parents of their primary children} \ |
| 471 | {is not the parent of its primary child} { |
| 472 | SELECT F.name, R.rev |
| 473 | FROM revision R, revision C, file F |
| 474 | WHERE R.fid = F.fid -- Get file of revision |
| 475 | AND R.child IS NOT NULL -- Restrict to non-leaves |
| 476 | AND R.child = C.rid -- Get the child (has to exist) |
| 477 | AND C.parent != R.rid -- Which does not have us as its parent. |
| 478 | ; |
| 479 | } |
| 480 | # Find all revisions which have a primrary child, but the |
| 481 | # child has a branch parent symbol making them brach starters. |
| 482 | Check \ |
| 483 | {Primary children of revisions must not start branches} \ |
| 484 | {is parent of a primary child which is the beginning of a branch} { |
| 485 | SELECT F.name, R.rev |
| 486 | FROM revision R, revision C, file F |
| 487 | WHERE R.fid = F.fid -- Get file of revision |
| 488 | AND R.child IS NOT NULL -- Restrict to non-leaves |
| 489 | AND R.child = C.rid -- Get the child (has to exist) |
| 490 | AND C.bparent IS NOT NULL -- wrongly claiming to be first on branch |
| 491 | ; |
| 492 | } |
| 493 | # Find all revisions without branch parent symbol which have a |
| 494 | # parent, but the parent does not have them as primary child. |
| 495 | Check \ |
| 496 | {Revisions have to be primary children of their parents, if any} \ |
| 497 | {is not the child of its parent} { |
| 498 | SELECT F.name, R.rev |
| 499 | FROM revision R, revision P, file F |
| 500 | WHERE R.fid = F.fid |
| 501 | AND R.bparent IS NULL -- Get file of revision |
| 502 | AND R.parent IS NOT NULL -- Restrict to everything not first on a branch |
| 503 | AND R.parent = P.rid -- Get the parent (has to exist) |
| 504 | AND P.child != R.rid -- Which do not have us as their child |
| 505 | ; |
| 506 | } |
| 507 | # Find all revisions with a branch parent symbol which do not |
| 508 | # have a parent. |
| 509 | Check \ |
| 510 | {Branch starting revisions have to have a parent} \ |
| 511 | {at the beginning of its branch has no parent} { |
| 512 | SELECT F.name, R.rev |
| 513 | FROM revision R, file F |
| 514 | WHERE R.fid = F.fid -- Get file of revision |
| 515 | AND R.bparent IS NOT NULL -- Restrict to first on a branch |
| 516 | AND R.parent IS NULL -- But there is no out-of-branch parent |
| 517 | ; |
| 518 | } |
| 519 | # Find all revisions with a branch parent symbol whose parent |
| 520 | # has them as primary child. |
| 521 | Check \ |
| 522 | {Branch starting revisions must not be primary children of their parents} \ |
| 523 | {at the beginning of its branch is the primary child of its parent} { |
| 524 | SELECT F.name, R.rev |
| 525 | FROM revision R, revision P, file F |
| 526 | WHERE R.fid = F.fid -- Get file of revision |
| 527 | AND R.bparent IS NOT NULL -- Restrict to first on a branch |
| 528 | AND R.parent IS NOT NULL -- Which are not detached |
| 529 | AND R.parent = P.rid -- Get their non-branch parent |
| 530 | AND P.child = R.rid -- which improperly has them as primary child |
| 531 | ; |
| 532 | } |
| 533 | # Find all revisions with a non-NTDB child which are not on |
| 534 | # the NTDB. |
| 535 | Check \ |
| 536 | {NTDB to trunk transition has to begin on NTDB} \ |
| 537 | {has a non-NTDB child, yet is not on the NTDB} { |
| 538 | SELECT F.name, R.rev |
| 539 | FROM revision R, file F |
| 540 | WHERE R.fid = F.fid -- Get file of revision |
| 541 | AND R.dbchild IS NOT NULL -- Restrict to semi-last NTDB revision |
| 542 | AND NOT R.isdefault -- Improperly claiming to not be on NTDB |
| 543 | ; |
| 544 | } |
| 545 | # Find all revisions with a NTDB parent which are on the NTDB. |
| 546 | Check \ |
| 547 | {NTDB to trunk transition has to end on non-NTDB} \ |
| 548 | {has a NTDB parent, yet is on the NTDB} { |
| 549 | SELECT F.name, R.rev |
| 550 | FROM revision R, file F |
| 551 | WHERE R.fid = F.fid -- Get file of revision |
| 552 | AND R.dbparent IS NOT NULL -- Restrict to trunk roots with NTDB around |
| 553 | AND R.isdefault -- But root improperly claims to be on NTDB |
| 554 | ; |
| 555 | } |
| 556 | # Find all revisions with a child which disagrees about the |
| 557 | # line of development they belong to. |
| 558 | Check \ |
| 559 | {Revisions and their primary children have to be in the same LOD} \ |
| 560 | {and its primary child disagree about their LOD} { |
| 561 | SELECT F.name, R.rev |
| 562 | FROM revision R, revision C, file F |
| 563 | WHERE R.fid = F.fid -- Get file of revision |
| 564 | AND R.child IS NOT NULL -- Restrict to non-leaves |
| 565 | AND R.child = C.rid -- Get child (has to exist) |
| 566 | AND C.lod != R.lod -- which improperly uses a different LOD |
| 567 | ; |
| 568 | } |
| 569 | # Find all revisions with a non-NTDB child which agrees about |
| 570 | # the line of development they belong to. |
| 571 | Check \ |
| 572 | {NTDB and trunk revisions have to be in different LODs} \ |
| 573 | {on NTDB and its non-NTDB child wrongly agree about their LOD} { |
| 574 | SELECT F.name, R.rev |
| 575 | FROM revision R, revision C, file F |
| 576 | WHERE R.fid = F.fid -- Get file of revision |
| 577 | AND R.dbchild IS NOT NULL -- Restrict to semi-last NTDB revision |
| 578 | AND R.dbchild = C.rid -- Get associated trunk root revision |
| 579 | AND C.lod = R.lod -- Improperly uses the same LOD |
| 580 | ; |
| 581 | } |
| 582 | # Find all revisions with a branch parent symbol which is not |
| 583 | # their LOD. |
| 584 | Check \ |
| 585 | {Branch starting revisions have to have their LOD as branch parent symbol} \ |
| 586 | {at the beginning of its branch does not have the branch symbol as its LOD} { |
| 587 | SELECT F.name, R.rev |
| 588 | FROM revision R, file F |
| 589 | WHERE R.fid = F.fid -- Get file of revision |
| 590 | AND R.bparent IS NOT NULL -- Restrict to revisions first on a branch |
| 591 | AND R.lod != R.bparent -- and their branch is not their LOD |
| 592 | ; |
| 593 | } |
| 594 | # Find all revisions with a branch parent symbol whose parent |
| 595 | # is in the same line of development. |
| 596 | Check \ |
| 597 | {Revisions and their branch children have to be in different LODs} \ |
| 598 | {at the beginning of its branch and its parent wrongly agree about their LOD} { |
| 599 | SELECT F.name, R.rev |
| 600 | FROM revision R, revision P, file F |
| 601 | WHERE R.fid = F.fid -- Get file of revision |
| 602 | AND R.bparent IS NOT NULL -- Restrict to revisions first on a branch |
| 603 | AND R.parent = P.rid -- Get their non-branch parent |
| 604 | AND R.lod = P.lod -- Which improperly uses the same LOD |
| 605 | ; |
| 606 | } |
| 607 | return |
| 608 | } |
| 609 | |
| 610 |