Fossil SCM
Shuffled and updated the existing checks of revision changesets.
Commit
de10b2301e874f9edb4cb1b9249b540a157a10b9
Parent
7c28fe131228621…
1 file changed
+55
-59
+55
-59
| --- tools/cvs2fossil/lib/c2f_integrity.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_integrity.tcl | ||
| @@ -300,44 +300,46 @@ | ||
| 300 | 300 | ; |
| 301 | 301 | } |
| 302 | 302 | return |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | - proc AllChangesets {} { | |
| 305 | + proc RevisionChangesets {} { | |
| 306 | 306 | # This code performs a number of paranoid checks of the |
| 307 | 307 | # database, searching for inconsistent changeset/revision |
| 308 | 308 | # information. |
| 309 | 309 | |
| 310 | 310 | upvar 1 n n ; # Counter for the checks (we print an id before |
| 311 | 311 | # the main label). |
| 312 | 312 | |
| 313 | 313 | # Find all revisions which are not used by at least one |
| 314 | - # revision changeset. | |
| 314 | + # changeset. | |
| 315 | 315 | CheckRev \ |
| 316 | - {All revisions have to be used by least one revision changeset} \ | |
| 317 | - {is not used by a revision changeset} { | |
| 316 | + {All revisions have to be used by least one changeset} \ | |
| 317 | + {is not used by a changeset} { | |
| 318 | 318 | -- Unused revisions = All revisions |
| 319 | 319 | -- - revisions used by revision changesets. |
| 320 | 320 | -- |
| 321 | 321 | -- Both sets can be computed easily, and subtracted |
| 322 | 322 | -- from each other. Then we can get the associated |
| 323 | 323 | -- file (name) for display. |
| 324 | 324 | |
| 325 | 325 | SELECT F.name, R.rev |
| 326 | 326 | FROM revision R, file F |
| 327 | - WHERE R.rid IN (SELECT rid FROM revision -- All revisions | |
| 328 | - EXCEPT -- subtract | |
| 329 | - SELECT CR.rid FROM csrevision CR, changeset C -- revisions used | |
| 330 | - WHERE C.cid = CR.cid -- by any revision | |
| 331 | - AND C.type = 0) -- changeset | |
| 327 | + WHERE R.rid IN (SELECT rid | |
| 328 | + FROM revision -- All revisions | |
| 329 | + EXCEPT -- subtract | |
| 330 | + SELECT CR.rid | |
| 331 | + FROM csrevision CR, changeset C -- revisions used | |
| 332 | + WHERE C.cid = CR.cid -- by any revision | |
| 333 | + AND C.type = 0) -- changeset | |
| 332 | 334 | AND R.fid = F.fid -- get file of unused revision |
| 333 | 335 | } |
| 334 | - # Find all revisions which are used by more than one revision | |
| 336 | + # Find all revisions which are used by more than one | |
| 335 | 337 | # changeset. |
| 336 | 338 | CheckRev \ |
| 337 | - {All revisions have to be used by at most one revision changeset} \ | |
| 338 | - {is used by multiple revision changesets} { | |
| 339 | + {All revisions have to be used by at most one changeset} \ | |
| 340 | + {is used by multiple changesets} { | |
| 339 | 341 | -- Principle of operation: Get all revision/changeset |
| 340 | 342 | -- pairs for all revision changesets, group by |
| 341 | 343 | -- revision to aggregate the changeset, counting |
| 342 | 344 | -- them. From the resulting revision/count table |
| 343 | 345 | -- select those with more than one user, and get their |
| @@ -347,18 +349,32 @@ | ||
| 347 | 349 | FROM revision R, file F, |
| 348 | 350 | (SELECT CR.rid AS rid, count(CR.cid) AS count |
| 349 | 351 | FROM csrevision CR, changeset C |
| 350 | 352 | WHERE C.type = 0 |
| 351 | 353 | AND C.cid = CR.cid |
| 352 | - GROUP BY CR.rid ) AS U | |
| 354 | + GROUP BY CR.rid) AS U | |
| 353 | 355 | WHERE U.count > 1 |
| 354 | 356 | AND R.rid = U.rid |
| 355 | 357 | AND R.fid = F.fid |
| 356 | 358 | } |
| 357 | - # All revisions in all changesets have to agree on the LOD | |
| 358 | - # their changeset belongs to. In other words, all revisions in | |
| 359 | - # a changeset have to refer to the same line of development. | |
| 359 | + # All revisions have to refer to the same meta information as | |
| 360 | + # their changeset. | |
| 361 | + CheckRevCS \ | |
| 362 | + {All revisions have to agree with their changeset about the used meta information} \ | |
| 363 | + {disagrees with its changeset @ about the meta information} { | |
| 364 | + SELECT CT.name, C.cid, F.name, R.rev | |
| 365 | + FROM changeset C, cstype CT, revision R, file F, csrevision CR | |
| 366 | + WHERE C.type = 0 -- revision changesets only | |
| 367 | + AND C.cid = CR.cid -- changeset --> its revisions | |
| 368 | + AND R.rid = CR.rid -- look at them | |
| 369 | + AND R.mid != C.src -- Only those which disagree with changeset about the meta | |
| 370 | + AND R.fid = F.fid -- get file of the revision | |
| 371 | + AND CT.tid = C.type -- get changeset type, for labeling | |
| 372 | + } | |
| 373 | + # All revisions have to agree on the LOD their changeset | |
| 374 | + # belongs to. In other words, all revisions in a changeset | |
| 375 | + # have to refer to the same line of development. | |
| 360 | 376 | # |
| 361 | 377 | # Instead of looking at all pairs of revisions in all |
| 362 | 378 | # changesets we generate the distinct set of all LODs |
| 363 | 379 | # referenced by the revisions of a changeset, look for those |
| 364 | 380 | # with cardinality > 1, and get the identifying information |
| @@ -368,18 +384,20 @@ | ||
| 368 | 384 | {: Its revisions disagree about the LOD they belong to} { |
| 369 | 385 | SELECT T.name, C.cid |
| 370 | 386 | FROM changeset C, cstype T |
| 371 | 387 | WHERE C.cid IN (SELECT U.cid |
| 372 | 388 | FROM (SELECT DISTINCT CR.cid AS cid, R.lod AS lod |
| 373 | - FROM csrevision CR, revision R | |
| 374 | - WHERE CR.rid = R.rid) AS U | |
| 389 | + FROM csrevision CR, changeset C, revision R | |
| 390 | + WHERE CR.rid = R.rid | |
| 391 | + AND C.cid = CR.cid | |
| 392 | + AND C.type = 0) AS U | |
| 375 | 393 | GROUP BY U.cid HAVING COUNT(U.lod) > 1) |
| 376 | 394 | AND T.tid = C.type |
| 377 | 395 | } |
| 378 | - # All revisions in all changesets have to agree on the project | |
| 379 | - # their changeset belongs to. In other words, all revisions in | |
| 380 | - # a changeset have to refer to the same project. | |
| 396 | + # All revisions have to agree on the project their changeset | |
| 397 | + # belongs to. In other words, all revisions in a changeset | |
| 398 | + # have to refer to the same project. | |
| 381 | 399 | # |
| 382 | 400 | # Instead of looking at all pairs of revisions in all |
| 383 | 401 | # changesets we generate the distinct set of all projects |
| 384 | 402 | # referenced by the revisions of a changeset, look for those |
| 385 | 403 | # with cardinality > 1, and get the identifying information |
| @@ -389,12 +407,14 @@ | ||
| 389 | 407 | {: Its revisions disagree about the project they belong to} { |
| 390 | 408 | SELECT T.name, C.cid |
| 391 | 409 | FROM changeset C, cstype T |
| 392 | 410 | WHERE C.cid IN (SELECT U.cid |
| 393 | 411 | FROM (SELECT DISTINCT CR.cid AS cid, F.pid AS pid |
| 394 | - FROM csrevision CR, revision R, file F | |
| 412 | + FROM csrevision CR, changeset C, revision R, file F | |
| 395 | 413 | WHERE CR.rid = R.rid |
| 414 | + AND C.cid = CR.cid | |
| 415 | + AND C.type = 0 | |
| 396 | 416 | AND F.fid = R.fid) AS U |
| 397 | 417 | GROUP BY U.cid HAVING COUNT(U.pid) > 1) |
| 398 | 418 | AND T.tid = C.type |
| 399 | 419 | } |
| 400 | 420 | # All revisions in a single changeset have to belong to |
| @@ -413,71 +433,47 @@ | ||
| 413 | 433 | SELECT T.name, C.cid |
| 414 | 434 | FROM changeset C, cstype T |
| 415 | 435 | WHERE C.cid IN (SELECT VV.cid |
| 416 | 436 | FROM (SELECT U.cid as cid, COUNT (U.fid) AS fcount |
| 417 | 437 | FROM (SELECT DISTINCT CR.cid AS cid, R.fid AS fid |
| 418 | - FROM csrevision CR, revision R | |
| 419 | - WHERE CR.rid = R.rid) AS U | |
| 438 | + FROM csrevision CR, changeset C, revision R | |
| 439 | + WHERE CR.rid = R.rid | |
| 440 | + AND C.cid = CR.cid | |
| 441 | + AND C.type = 0 | |
| 442 | + ) AS U | |
| 420 | 443 | GROUP BY U.cid) AS UU, |
| 421 | 444 | (SELECT V.cid AS cid, COUNT (V.rid) AS rcount |
| 422 | - FROM csrevision V | |
| 445 | + FROM csrevision V, changeset X | |
| 446 | + WHERE X.cid = V.cid | |
| 447 | + AND X.type = 0 | |
| 423 | 448 | GROUP BY V.cid) AS VV |
| 424 | 449 | WHERE VV.cid = UU.cid |
| 425 | 450 | AND UU.fcount < VV.rcount) |
| 426 | 451 | AND T.tid = C.type |
| 427 | 452 | } |
| 428 | 453 | return |
| 429 | 454 | } |
| 430 | 455 | |
| 431 | - proc RevisionChangesets {} { | |
| 432 | - # This code performs a number of paranoid checks of the | |
| 433 | - # database, searching for inconsistent changeset/revision | |
| 434 | - # information. | |
| 435 | - | |
| 436 | - upvar 1 n n ; # Counter for the checks (we print an id before | |
| 437 | - # the main label). | |
| 438 | - | |
| 439 | - # All revisions used by revision changesets have to refer to | |
| 440 | - # the same meta information as their changeset. | |
| 441 | - CheckInCS \ | |
| 442 | - {All revisions have to agree with their revision changeset about the used meta information} \ | |
| 443 | - {disagrees with its revision changeset @ about the meta information} { | |
| 444 | - SELECT CT.name, C.cid, F.name, R.rev | |
| 445 | - FROM changeset C, cstype CT, revision R, file F, csrevision CR | |
| 446 | - WHERE C.type = 0 -- revision changesets only | |
| 447 | - AND C.cid = CR.cid -- changeset --> its revisions | |
| 448 | - AND R.rid = CR.rid -- look at them | |
| 449 | - AND R.mid != C.src -- Only those which disagree with changeset about the meta | |
| 450 | - AND R.fid = F.fid -- get file of the revision | |
| 451 | - AND CT.tid = C.type -- get changeset type, for labeling | |
| 452 | - } | |
| 453 | - return | |
| 454 | - } | |
| 455 | - | |
| 456 | 456 | proc TagChangesets {} { |
| 457 | 457 | # This code performs a number of paranoid checks of the |
| 458 | 458 | # database, searching for inconsistent changeset/revision |
| 459 | 459 | # information. |
| 460 | 460 | |
| 461 | - return ; # Disabled for now, bottlenecks ... | |
| 462 | - | |
| 463 | 461 | upvar 1 n n ; # Counter for the checks (we print an id before |
| 464 | 462 | # the main label). |
| 465 | 463 | } |
| 466 | 464 | |
| 467 | 465 | proc BranchChangesets {} { |
| 468 | 466 | # This code performs a number of paranoid checks of the |
| 469 | 467 | # database, searching for inconsistent changeset/revision |
| 470 | 468 | # information. |
| 471 | 469 | |
| 472 | - return ; # Disabled for now, bottlenecks ... | |
| 473 | - | |
| 474 | 470 | upvar 1 n n ; # Counter for the checks (we print an id before |
| 475 | 471 | # the main label). |
| 476 | 472 | } |
| 477 | 473 | |
| 478 | - proc SymbolChangesets {} { | |
| 474 | + proc ___UnusedChangesetChecks___ {} { | |
| 479 | 475 | # This code performs a number of paranoid checks of the |
| 480 | 476 | # database, searching for inconsistent changeset/revision |
| 481 | 477 | # information. |
| 482 | 478 | |
| 483 | 479 | return ; # Disabled for now, bottlenecks ... |
| @@ -491,11 +487,11 @@ | ||
| 491 | 487 | # TODO: Try to rephrase the checks to make more use of |
| 492 | 488 | # indices, set and stream operations. |
| 493 | 489 | |
| 494 | 490 | # All revisions used by tag symbol changesets have to have the |
| 495 | 491 | # changeset's tag associated with them. |
| 496 | - CheckInCS \ | |
| 492 | + CheckRevCS \ | |
| 497 | 493 | {All revisions used by tag symbol changesets have to have the changeset's tag attached to them} \ |
| 498 | 494 | {does not have the tag of its symbol changeset @ attached to it} { |
| 499 | 495 | SELECT CT.name, C.cid, F.name, R.rev |
| 500 | 496 | FROM changeset C, cstype CT, revision R, file F, csrevision CR, tag T |
| 501 | 497 | WHERE C.type = 1 -- symbol changesets only |
| @@ -510,11 +506,11 @@ | ||
| 510 | 506 | } |
| 511 | 507 | |
| 512 | 508 | # All revisions used by branch symbol changesets have to have |
| 513 | 509 | # the changeset's branch associated with them. |
| 514 | 510 | |
| 515 | - CheckInCS \ | |
| 511 | + CheckRevCS \ | |
| 516 | 512 | {All revisions used by branch symbol changesets have to have the changeset's branch attached to them} \ |
| 517 | 513 | {does not have the branch of its symbol changeset @ attached to it} { |
| 518 | 514 | SELECT CT.name, C.cid, F.name, R.rev, C.cid |
| 519 | 515 | FROM changeset C, cstype CT, revision R, file F, csrevision CR, branch B |
| 520 | 516 | WHERE C.type = 1 -- symbol changesets only |
| @@ -542,11 +538,11 @@ | ||
| 542 | 538 | proc CheckRev {header label sql} { |
| 543 | 539 | upvar 1 n n |
| 544 | 540 | set ok 1 |
| 545 | 541 | foreach {fname revnr} [state run $sql] { |
| 546 | 542 | set ok 0 |
| 547 | - trouble fatal "$fname <$revnr> $label" | |
| 543 | + trouble fatal "${revnr}::$fname $label" | |
| 548 | 544 | } |
| 549 | 545 | log write 5 integrity {\[[format %02d [incr n]]\] [expr {$ok ? "Ok " : "Failed"}] ... $header} |
| 550 | 546 | return |
| 551 | 547 | } |
| 552 | 548 | |
| @@ -581,11 +577,11 @@ | ||
| 581 | 577 | } |
| 582 | 578 | log write 5 integrity {\[[format %02d [incr n]]\] [expr {$ok ? "Ok " : "Failed"}] ... $header} |
| 583 | 579 | return |
| 584 | 580 | } |
| 585 | 581 | |
| 586 | - proc CheckInCS {header label sql} { | |
| 582 | + proc CheckRevCS {header label sql} { | |
| 587 | 583 | upvar 1 n n |
| 588 | 584 | set ok 1 |
| 589 | 585 | foreach {cstype csid fname revnr} [state run $sql] { |
| 590 | 586 | set ok 0 |
| 591 | 587 | set b "<$cstype $csid>" |
| 592 | 588 |
| --- tools/cvs2fossil/lib/c2f_integrity.tcl | |
| +++ tools/cvs2fossil/lib/c2f_integrity.tcl | |
| @@ -300,44 +300,46 @@ | |
| 300 | ; |
| 301 | } |
| 302 | return |
| 303 | } |
| 304 | |
| 305 | proc AllChangesets {} { |
| 306 | # This code performs a number of paranoid checks of the |
| 307 | # database, searching for inconsistent changeset/revision |
| 308 | # information. |
| 309 | |
| 310 | upvar 1 n n ; # Counter for the checks (we print an id before |
| 311 | # the main label). |
| 312 | |
| 313 | # Find all revisions which are not used by at least one |
| 314 | # revision changeset. |
| 315 | CheckRev \ |
| 316 | {All revisions have to be used by least one revision changeset} \ |
| 317 | {is not used by a revision changeset} { |
| 318 | -- Unused revisions = All revisions |
| 319 | -- - revisions used by revision changesets. |
| 320 | -- |
| 321 | -- Both sets can be computed easily, and subtracted |
| 322 | -- from each other. Then we can get the associated |
| 323 | -- file (name) for display. |
| 324 | |
| 325 | SELECT F.name, R.rev |
| 326 | FROM revision R, file F |
| 327 | WHERE R.rid IN (SELECT rid FROM revision -- All revisions |
| 328 | EXCEPT -- subtract |
| 329 | SELECT CR.rid FROM csrevision CR, changeset C -- revisions used |
| 330 | WHERE C.cid = CR.cid -- by any revision |
| 331 | AND C.type = 0) -- changeset |
| 332 | AND R.fid = F.fid -- get file of unused revision |
| 333 | } |
| 334 | # Find all revisions which are used by more than one revision |
| 335 | # changeset. |
| 336 | CheckRev \ |
| 337 | {All revisions have to be used by at most one revision changeset} \ |
| 338 | {is used by multiple revision changesets} { |
| 339 | -- Principle of operation: Get all revision/changeset |
| 340 | -- pairs for all revision changesets, group by |
| 341 | -- revision to aggregate the changeset, counting |
| 342 | -- them. From the resulting revision/count table |
| 343 | -- select those with more than one user, and get their |
| @@ -347,18 +349,32 @@ | |
| 347 | FROM revision R, file F, |
| 348 | (SELECT CR.rid AS rid, count(CR.cid) AS count |
| 349 | FROM csrevision CR, changeset C |
| 350 | WHERE C.type = 0 |
| 351 | AND C.cid = CR.cid |
| 352 | GROUP BY CR.rid ) AS U |
| 353 | WHERE U.count > 1 |
| 354 | AND R.rid = U.rid |
| 355 | AND R.fid = F.fid |
| 356 | } |
| 357 | # All revisions in all changesets have to agree on the LOD |
| 358 | # their changeset belongs to. In other words, all revisions in |
| 359 | # a changeset have to refer to the same line of development. |
| 360 | # |
| 361 | # Instead of looking at all pairs of revisions in all |
| 362 | # changesets we generate the distinct set of all LODs |
| 363 | # referenced by the revisions of a changeset, look for those |
| 364 | # with cardinality > 1, and get the identifying information |
| @@ -368,18 +384,20 @@ | |
| 368 | {: Its revisions disagree about the LOD they belong to} { |
| 369 | SELECT T.name, C.cid |
| 370 | FROM changeset C, cstype T |
| 371 | WHERE C.cid IN (SELECT U.cid |
| 372 | FROM (SELECT DISTINCT CR.cid AS cid, R.lod AS lod |
| 373 | FROM csrevision CR, revision R |
| 374 | WHERE CR.rid = R.rid) AS U |
| 375 | GROUP BY U.cid HAVING COUNT(U.lod) > 1) |
| 376 | AND T.tid = C.type |
| 377 | } |
| 378 | # All revisions in all changesets have to agree on the project |
| 379 | # their changeset belongs to. In other words, all revisions in |
| 380 | # a changeset have to refer to the same project. |
| 381 | # |
| 382 | # Instead of looking at all pairs of revisions in all |
| 383 | # changesets we generate the distinct set of all projects |
| 384 | # referenced by the revisions of a changeset, look for those |
| 385 | # with cardinality > 1, and get the identifying information |
| @@ -389,12 +407,14 @@ | |
| 389 | {: Its revisions disagree about the project they belong to} { |
| 390 | SELECT T.name, C.cid |
| 391 | FROM changeset C, cstype T |
| 392 | WHERE C.cid IN (SELECT U.cid |
| 393 | FROM (SELECT DISTINCT CR.cid AS cid, F.pid AS pid |
| 394 | FROM csrevision CR, revision R, file F |
| 395 | WHERE CR.rid = R.rid |
| 396 | AND F.fid = R.fid) AS U |
| 397 | GROUP BY U.cid HAVING COUNT(U.pid) > 1) |
| 398 | AND T.tid = C.type |
| 399 | } |
| 400 | # All revisions in a single changeset have to belong to |
| @@ -413,71 +433,47 @@ | |
| 413 | SELECT T.name, C.cid |
| 414 | FROM changeset C, cstype T |
| 415 | WHERE C.cid IN (SELECT VV.cid |
| 416 | FROM (SELECT U.cid as cid, COUNT (U.fid) AS fcount |
| 417 | FROM (SELECT DISTINCT CR.cid AS cid, R.fid AS fid |
| 418 | FROM csrevision CR, revision R |
| 419 | WHERE CR.rid = R.rid) AS U |
| 420 | GROUP BY U.cid) AS UU, |
| 421 | (SELECT V.cid AS cid, COUNT (V.rid) AS rcount |
| 422 | FROM csrevision V |
| 423 | GROUP BY V.cid) AS VV |
| 424 | WHERE VV.cid = UU.cid |
| 425 | AND UU.fcount < VV.rcount) |
| 426 | AND T.tid = C.type |
| 427 | } |
| 428 | return |
| 429 | } |
| 430 | |
| 431 | proc RevisionChangesets {} { |
| 432 | # This code performs a number of paranoid checks of the |
| 433 | # database, searching for inconsistent changeset/revision |
| 434 | # information. |
| 435 | |
| 436 | upvar 1 n n ; # Counter for the checks (we print an id before |
| 437 | # the main label). |
| 438 | |
| 439 | # All revisions used by revision changesets have to refer to |
| 440 | # the same meta information as their changeset. |
| 441 | CheckInCS \ |
| 442 | {All revisions have to agree with their revision changeset about the used meta information} \ |
| 443 | {disagrees with its revision changeset @ about the meta information} { |
| 444 | SELECT CT.name, C.cid, F.name, R.rev |
| 445 | FROM changeset C, cstype CT, revision R, file F, csrevision CR |
| 446 | WHERE C.type = 0 -- revision changesets only |
| 447 | AND C.cid = CR.cid -- changeset --> its revisions |
| 448 | AND R.rid = CR.rid -- look at them |
| 449 | AND R.mid != C.src -- Only those which disagree with changeset about the meta |
| 450 | AND R.fid = F.fid -- get file of the revision |
| 451 | AND CT.tid = C.type -- get changeset type, for labeling |
| 452 | } |
| 453 | return |
| 454 | } |
| 455 | |
| 456 | proc TagChangesets {} { |
| 457 | # This code performs a number of paranoid checks of the |
| 458 | # database, searching for inconsistent changeset/revision |
| 459 | # information. |
| 460 | |
| 461 | return ; # Disabled for now, bottlenecks ... |
| 462 | |
| 463 | upvar 1 n n ; # Counter for the checks (we print an id before |
| 464 | # the main label). |
| 465 | } |
| 466 | |
| 467 | proc BranchChangesets {} { |
| 468 | # This code performs a number of paranoid checks of the |
| 469 | # database, searching for inconsistent changeset/revision |
| 470 | # information. |
| 471 | |
| 472 | return ; # Disabled for now, bottlenecks ... |
| 473 | |
| 474 | upvar 1 n n ; # Counter for the checks (we print an id before |
| 475 | # the main label). |
| 476 | } |
| 477 | |
| 478 | proc SymbolChangesets {} { |
| 479 | # This code performs a number of paranoid checks of the |
| 480 | # database, searching for inconsistent changeset/revision |
| 481 | # information. |
| 482 | |
| 483 | return ; # Disabled for now, bottlenecks ... |
| @@ -491,11 +487,11 @@ | |
| 491 | # TODO: Try to rephrase the checks to make more use of |
| 492 | # indices, set and stream operations. |
| 493 | |
| 494 | # All revisions used by tag symbol changesets have to have the |
| 495 | # changeset's tag associated with them. |
| 496 | CheckInCS \ |
| 497 | {All revisions used by tag symbol changesets have to have the changeset's tag attached to them} \ |
| 498 | {does not have the tag of its symbol changeset @ attached to it} { |
| 499 | SELECT CT.name, C.cid, F.name, R.rev |
| 500 | FROM changeset C, cstype CT, revision R, file F, csrevision CR, tag T |
| 501 | WHERE C.type = 1 -- symbol changesets only |
| @@ -510,11 +506,11 @@ | |
| 510 | } |
| 511 | |
| 512 | # All revisions used by branch symbol changesets have to have |
| 513 | # the changeset's branch associated with them. |
| 514 | |
| 515 | CheckInCS \ |
| 516 | {All revisions used by branch symbol changesets have to have the changeset's branch attached to them} \ |
| 517 | {does not have the branch of its symbol changeset @ attached to it} { |
| 518 | SELECT CT.name, C.cid, F.name, R.rev, C.cid |
| 519 | FROM changeset C, cstype CT, revision R, file F, csrevision CR, branch B |
| 520 | WHERE C.type = 1 -- symbol changesets only |
| @@ -542,11 +538,11 @@ | |
| 542 | proc CheckRev {header label sql} { |
| 543 | upvar 1 n n |
| 544 | set ok 1 |
| 545 | foreach {fname revnr} [state run $sql] { |
| 546 | set ok 0 |
| 547 | trouble fatal "$fname <$revnr> $label" |
| 548 | } |
| 549 | log write 5 integrity {\[[format %02d [incr n]]\] [expr {$ok ? "Ok " : "Failed"}] ... $header} |
| 550 | return |
| 551 | } |
| 552 | |
| @@ -581,11 +577,11 @@ | |
| 581 | } |
| 582 | log write 5 integrity {\[[format %02d [incr n]]\] [expr {$ok ? "Ok " : "Failed"}] ... $header} |
| 583 | return |
| 584 | } |
| 585 | |
| 586 | proc CheckInCS {header label sql} { |
| 587 | upvar 1 n n |
| 588 | set ok 1 |
| 589 | foreach {cstype csid fname revnr} [state run $sql] { |
| 590 | set ok 0 |
| 591 | set b "<$cstype $csid>" |
| 592 |
| --- tools/cvs2fossil/lib/c2f_integrity.tcl | |
| +++ tools/cvs2fossil/lib/c2f_integrity.tcl | |
| @@ -300,44 +300,46 @@ | |
| 300 | ; |
| 301 | } |
| 302 | return |
| 303 | } |
| 304 | |
| 305 | proc RevisionChangesets {} { |
| 306 | # This code performs a number of paranoid checks of the |
| 307 | # database, searching for inconsistent changeset/revision |
| 308 | # information. |
| 309 | |
| 310 | upvar 1 n n ; # Counter for the checks (we print an id before |
| 311 | # the main label). |
| 312 | |
| 313 | # Find all revisions which are not used by at least one |
| 314 | # changeset. |
| 315 | CheckRev \ |
| 316 | {All revisions have to be used by least one changeset} \ |
| 317 | {is not used by a changeset} { |
| 318 | -- Unused revisions = All revisions |
| 319 | -- - revisions used by revision changesets. |
| 320 | -- |
| 321 | -- Both sets can be computed easily, and subtracted |
| 322 | -- from each other. Then we can get the associated |
| 323 | -- file (name) for display. |
| 324 | |
| 325 | SELECT F.name, R.rev |
| 326 | FROM revision R, file F |
| 327 | WHERE R.rid IN (SELECT rid |
| 328 | FROM revision -- All revisions |
| 329 | EXCEPT -- subtract |
| 330 | SELECT CR.rid |
| 331 | FROM csrevision CR, changeset C -- revisions used |
| 332 | WHERE C.cid = CR.cid -- by any revision |
| 333 | AND C.type = 0) -- changeset |
| 334 | AND R.fid = F.fid -- get file of unused revision |
| 335 | } |
| 336 | # Find all revisions which are used by more than one |
| 337 | # changeset. |
| 338 | CheckRev \ |
| 339 | {All revisions have to be used by at most one changeset} \ |
| 340 | {is used by multiple changesets} { |
| 341 | -- Principle of operation: Get all revision/changeset |
| 342 | -- pairs for all revision changesets, group by |
| 343 | -- revision to aggregate the changeset, counting |
| 344 | -- them. From the resulting revision/count table |
| 345 | -- select those with more than one user, and get their |
| @@ -347,18 +349,32 @@ | |
| 349 | FROM revision R, file F, |
| 350 | (SELECT CR.rid AS rid, count(CR.cid) AS count |
| 351 | FROM csrevision CR, changeset C |
| 352 | WHERE C.type = 0 |
| 353 | AND C.cid = CR.cid |
| 354 | GROUP BY CR.rid) AS U |
| 355 | WHERE U.count > 1 |
| 356 | AND R.rid = U.rid |
| 357 | AND R.fid = F.fid |
| 358 | } |
| 359 | # All revisions have to refer to the same meta information as |
| 360 | # their changeset. |
| 361 | CheckRevCS \ |
| 362 | {All revisions have to agree with their changeset about the used meta information} \ |
| 363 | {disagrees with its changeset @ about the meta information} { |
| 364 | SELECT CT.name, C.cid, F.name, R.rev |
| 365 | FROM changeset C, cstype CT, revision R, file F, csrevision CR |
| 366 | WHERE C.type = 0 -- revision changesets only |
| 367 | AND C.cid = CR.cid -- changeset --> its revisions |
| 368 | AND R.rid = CR.rid -- look at them |
| 369 | AND R.mid != C.src -- Only those which disagree with changeset about the meta |
| 370 | AND R.fid = F.fid -- get file of the revision |
| 371 | AND CT.tid = C.type -- get changeset type, for labeling |
| 372 | } |
| 373 | # All revisions have to agree on the LOD their changeset |
| 374 | # belongs to. In other words, all revisions in a changeset |
| 375 | # have to refer to the same line of development. |
| 376 | # |
| 377 | # Instead of looking at all pairs of revisions in all |
| 378 | # changesets we generate the distinct set of all LODs |
| 379 | # referenced by the revisions of a changeset, look for those |
| 380 | # with cardinality > 1, and get the identifying information |
| @@ -368,18 +384,20 @@ | |
| 384 | {: Its revisions disagree about the LOD they belong to} { |
| 385 | SELECT T.name, C.cid |
| 386 | FROM changeset C, cstype T |
| 387 | WHERE C.cid IN (SELECT U.cid |
| 388 | FROM (SELECT DISTINCT CR.cid AS cid, R.lod AS lod |
| 389 | FROM csrevision CR, changeset C, revision R |
| 390 | WHERE CR.rid = R.rid |
| 391 | AND C.cid = CR.cid |
| 392 | AND C.type = 0) AS U |
| 393 | GROUP BY U.cid HAVING COUNT(U.lod) > 1) |
| 394 | AND T.tid = C.type |
| 395 | } |
| 396 | # All revisions have to agree on the project their changeset |
| 397 | # belongs to. In other words, all revisions in a changeset |
| 398 | # have to refer to the same project. |
| 399 | # |
| 400 | # Instead of looking at all pairs of revisions in all |
| 401 | # changesets we generate the distinct set of all projects |
| 402 | # referenced by the revisions of a changeset, look for those |
| 403 | # with cardinality > 1, and get the identifying information |
| @@ -389,12 +407,14 @@ | |
| 407 | {: Its revisions disagree about the project they belong to} { |
| 408 | SELECT T.name, C.cid |
| 409 | FROM changeset C, cstype T |
| 410 | WHERE C.cid IN (SELECT U.cid |
| 411 | FROM (SELECT DISTINCT CR.cid AS cid, F.pid AS pid |
| 412 | FROM csrevision CR, changeset C, revision R, file F |
| 413 | WHERE CR.rid = R.rid |
| 414 | AND C.cid = CR.cid |
| 415 | AND C.type = 0 |
| 416 | AND F.fid = R.fid) AS U |
| 417 | GROUP BY U.cid HAVING COUNT(U.pid) > 1) |
| 418 | AND T.tid = C.type |
| 419 | } |
| 420 | # All revisions in a single changeset have to belong to |
| @@ -413,71 +433,47 @@ | |
| 433 | SELECT T.name, C.cid |
| 434 | FROM changeset C, cstype T |
| 435 | WHERE C.cid IN (SELECT VV.cid |
| 436 | FROM (SELECT U.cid as cid, COUNT (U.fid) AS fcount |
| 437 | FROM (SELECT DISTINCT CR.cid AS cid, R.fid AS fid |
| 438 | FROM csrevision CR, changeset C, revision R |
| 439 | WHERE CR.rid = R.rid |
| 440 | AND C.cid = CR.cid |
| 441 | AND C.type = 0 |
| 442 | ) AS U |
| 443 | GROUP BY U.cid) AS UU, |
| 444 | (SELECT V.cid AS cid, COUNT (V.rid) AS rcount |
| 445 | FROM csrevision V, changeset X |
| 446 | WHERE X.cid = V.cid |
| 447 | AND X.type = 0 |
| 448 | GROUP BY V.cid) AS VV |
| 449 | WHERE VV.cid = UU.cid |
| 450 | AND UU.fcount < VV.rcount) |
| 451 | AND T.tid = C.type |
| 452 | } |
| 453 | return |
| 454 | } |
| 455 | |
| 456 | proc TagChangesets {} { |
| 457 | # This code performs a number of paranoid checks of the |
| 458 | # database, searching for inconsistent changeset/revision |
| 459 | # information. |
| 460 | |
| 461 | upvar 1 n n ; # Counter for the checks (we print an id before |
| 462 | # the main label). |
| 463 | } |
| 464 | |
| 465 | proc BranchChangesets {} { |
| 466 | # This code performs a number of paranoid checks of the |
| 467 | # database, searching for inconsistent changeset/revision |
| 468 | # information. |
| 469 | |
| 470 | upvar 1 n n ; # Counter for the checks (we print an id before |
| 471 | # the main label). |
| 472 | } |
| 473 | |
| 474 | proc ___UnusedChangesetChecks___ {} { |
| 475 | # This code performs a number of paranoid checks of the |
| 476 | # database, searching for inconsistent changeset/revision |
| 477 | # information. |
| 478 | |
| 479 | return ; # Disabled for now, bottlenecks ... |
| @@ -491,11 +487,11 @@ | |
| 487 | # TODO: Try to rephrase the checks to make more use of |
| 488 | # indices, set and stream operations. |
| 489 | |
| 490 | # All revisions used by tag symbol changesets have to have the |
| 491 | # changeset's tag associated with them. |
| 492 | CheckRevCS \ |
| 493 | {All revisions used by tag symbol changesets have to have the changeset's tag attached to them} \ |
| 494 | {does not have the tag of its symbol changeset @ attached to it} { |
| 495 | SELECT CT.name, C.cid, F.name, R.rev |
| 496 | FROM changeset C, cstype CT, revision R, file F, csrevision CR, tag T |
| 497 | WHERE C.type = 1 -- symbol changesets only |
| @@ -510,11 +506,11 @@ | |
| 506 | } |
| 507 | |
| 508 | # All revisions used by branch symbol changesets have to have |
| 509 | # the changeset's branch associated with them. |
| 510 | |
| 511 | CheckRevCS \ |
| 512 | {All revisions used by branch symbol changesets have to have the changeset's branch attached to them} \ |
| 513 | {does not have the branch of its symbol changeset @ attached to it} { |
| 514 | SELECT CT.name, C.cid, F.name, R.rev, C.cid |
| 515 | FROM changeset C, cstype CT, revision R, file F, csrevision CR, branch B |
| 516 | WHERE C.type = 1 -- symbol changesets only |
| @@ -542,11 +538,11 @@ | |
| 538 | proc CheckRev {header label sql} { |
| 539 | upvar 1 n n |
| 540 | set ok 1 |
| 541 | foreach {fname revnr} [state run $sql] { |
| 542 | set ok 0 |
| 543 | trouble fatal "${revnr}::$fname $label" |
| 544 | } |
| 545 | log write 5 integrity {\[[format %02d [incr n]]\] [expr {$ok ? "Ok " : "Failed"}] ... $header} |
| 546 | return |
| 547 | } |
| 548 | |
| @@ -581,11 +577,11 @@ | |
| 577 | } |
| 578 | log write 5 integrity {\[[format %02d [incr n]]\] [expr {$ok ? "Ok " : "Failed"}] ... $header} |
| 579 | return |
| 580 | } |
| 581 | |
| 582 | proc CheckRevCS {header label sql} { |
| 583 | upvar 1 n n |
| 584 | set ok 1 |
| 585 | foreach {cstype csid fname revnr} [state run $sql] { |
| 586 | set ok 0 |
| 587 | set b "<$cstype $csid>" |
| 588 |