Fossil SCM

Added comments explaining the select statement checking revision/file/project/metadata integrity

aku 2007-12-08 02:59 trunk
Commit 808fbc474536c2f5bc5bf912b5212387ea7c2b4f
--- tools/cvs2fossil/lib/c2f_pcollrev.tcl
+++ tools/cvs2fossil/lib/c2f_pcollrev.tcl
@@ -377,10 +377,11 @@
377377
state discard author
378378
state discard cmessage
379379
return
380380
}
381381
382
+ # TODO: Move this code to the integrity module
382383
proc Paranoia {} {
383384
# This code performs a number of paranoid checks of the
384385
# database, searching for inconsistent cross-references.
385386
log write 4 collrev {Check database consistency}
386387
@@ -391,218 +392,218 @@
391392
# development about the project they are owned by.
392393
Check \
393394
{Revisions and their LODs have to be in the same project} \
394395
{disagrees with its LOD about owning project} {
395396
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
400401
;
401402
}
402403
# Find all revisions which disgree with their meta data about
403404
# the project they are owned by.
404405
Check \
405406
{Revisions and their meta data have to be in the same project} \
406407
{disagrees with its meta data about owning project} {
407408
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
412413
;
413414
}
414415
# Find all revisions which disgree with their meta data about
415416
# the branch/line of development they belong to.
416417
Check \
417418
{Revisions and their meta data have to be in the same LOD} \
418419
{disagrees with its meta data about owning LOD} {
419420
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
424425
;
425426
}
426427
# Find all revisions with a primary child which disagrees
427428
# about the file they belong to.
428429
Check \
429430
{Revisions and their primary children have to be in the same file} \
430431
{disagrees with its primary child about the owning file} {
431432
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
437438
;
438439
}
439440
440441
# Find all revisions with a branch parent symbol whose parent
441442
# disagrees about the file they belong to.
442443
Check \
443444
{Revisions and their branch children have to be in the same file} \
444445
{at the beginning of its branch and its parent disagree about the owning file} {
445446
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
451452
;
452453
}
453454
# Find all revisions with a non-NTDB child which disagrees
454455
# about the file they belong to.
455456
Check \
456457
{Revisions and their non-NTDB children have to be in the same file} \
457458
{disagrees with its non-NTDB child about the owning file} {
458459
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
464465
;
465466
}
466467
# Find all revisions which have a primary child, but the child
467468
# does not have them as parent.
468469
Check \
469470
{Revisions have to be parents of their primary children} \
470471
{is not the parent of its primary child} {
471472
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.
477478
;
478479
}
479480
# Find all revisions which have a primrary child, but the
480481
# child has a branch parent symbol making them brach starters.
481482
Check \
482483
{Primary children of revisions must not start branches} \
483484
{is parent of a primary child which is the beginning of a branch} {
484485
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
490491
;
491492
}
492493
# Find all revisions without branch parent symbol which have a
493494
# parent, but the parent does not have them as primary child.
494495
Check \
495496
{Revisions have to be primary children of their parents, if any} \
496497
{is not the child of its parent} {
497498
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
504505
;
505506
}
506507
# Find all revisions with a branch parent symbol which do not
507508
# have a parent.
508509
Check \
509510
{Branch starting revisions have to have a parent} \
510511
{at the beginning of its branch has no parent} {
511512
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
516517
;
517518
}
518519
# Find all revisions with a branch parent symbol whose parent
519520
# has them as primary child.
520521
Check \
521522
{Branch starting revisions must not be primary children of their parents} \
522523
{at the beginning of its branch is the primary child of its parent} {
523524
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
530531
;
531532
}
532533
# Find all revisions with a non-NTDB child which are not on
533534
# the NTDB.
534535
Check \
535536
{NTDB to trunk transition has to begin on NTDB} \
536537
{has a non-NTDB child, yet is not on the NTDB} {
537538
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
542543
;
543544
}
544545
# Find all revisions with a NTDB parent which are on the NTDB.
545546
Check \
546547
{NTDB to trunk transition has to end on non-NTDB} \
547548
{has a NTDB parent, yet is on the NTDB} {
548549
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
553554
;
554555
}
555556
# Find all revisions with a child which disagrees about the
556557
# line of development they belong to.
557558
Check \
558559
{Revisions and their primary children have to be in the same LOD} \
559560
{and its primary child disagree about their LOD} {
560561
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
566567
;
567568
}
568569
# Find all revisions with a non-NTDB child which agrees about
569570
# the line of development they belong to.
570571
Check \
571572
{NTDB and trunk revisions have to be in different LODs} \
572573
{on NTDB and its non-NTDB child wrongly agree about their LOD} {
573574
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
579580
;
580581
}
581582
# Find all revisions with a branch parent symbol which is not
582583
# their LOD.
583584
Check \
584585
{Branch starting revisions have to have their LOD as branch parent symbol} \
585586
{at the beginning of its branch does not have the branch symbol as its LOD} {
586587
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
591592
;
592593
}
593594
# Find all revisions with a branch parent symbol whose parent
594595
# is in the same line of development.
595596
Check \
596597
{Revisions and their branch children have to be in different LODs} \
597598
{at the beginning of its branch and its parent wrongly agree about their LOD} {
598599
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
604605
;
605606
}
606607
return
607608
}
608609
609610
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button