Fossil SCM
Added convenience command to the state package when the sql returns a single row. Added more statistics about revisions, tags, branches, symbols, changesets to various passes.
Commit
96b7bfb83401cc7e8ea8ad0eb803e6f50b3b50ff
Parent
ce7fb48e8c175ce…
8 files changed
+4
+4
+1
-1
+11
-7
+2
+2
-4
+94
-4
+4
~
tools/cvs2fossil/lib/c2f_pbreakrcycle.tcl
~
tools/cvs2fossil/lib/c2f_pbreakscycle.tcl
~
tools/cvs2fossil/lib/c2f_pcollrev.tcl
~
tools/cvs2fossil/lib/c2f_pfiltersym.tcl
~
tools/cvs2fossil/lib/c2f_pinitcsets.tcl
~
tools/cvs2fossil/lib/c2f_prev.tcl
~
tools/cvs2fossil/lib/c2f_repository.tcl
~
tools/cvs2fossil/lib/c2f_state.tcl
| --- tools/cvs2fossil/lib/c2f_pbreakrcycle.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_pbreakrcycle.tcl | ||
| @@ -20,10 +20,11 @@ | ||
| 20 | 20 | |
| 21 | 21 | package require Tcl 8.4 ; # Required runtime. |
| 22 | 22 | package require snit ; # OO system. |
| 23 | 23 | package require struct::list ; # Higher order list operations. |
| 24 | 24 | package require vc::tools::log ; # User feedback. |
| 25 | +package require vc::fossil::import::cvs::repository ; # Repository management. | |
| 25 | 26 | package require vc::fossil::import::cvs::cyclebreaker ; # Breaking dependency cycles. |
| 26 | 27 | package require vc::fossil::import::cvs::state ; # State storage. |
| 27 | 28 | package require vc::fossil::import::cvs::project::rev ; # Project level changesets |
| 28 | 29 | |
| 29 | 30 | # # ## ### ##### ######## ############# ##################### |
| @@ -76,10 +77,12 @@ | ||
| 76 | 77 | state transaction { |
| 77 | 78 | cyclebreaker run [struct::list filter [project::rev all] \ |
| 78 | 79 | [myproc IsByRevision]] \ |
| 79 | 80 | [myproc SaveOrder] |
| 80 | 81 | } |
| 82 | + | |
| 83 | + repository printcsetstatistics | |
| 81 | 84 | return |
| 82 | 85 | } |
| 83 | 86 | |
| 84 | 87 | typemethod discard {} { |
| 85 | 88 | # Pass manager interface. Executed for all passes after the |
| @@ -119,10 +122,11 @@ | ||
| 119 | 122 | |
| 120 | 123 | namespace eval ::vc::fossil::import::cvs::pass { |
| 121 | 124 | namespace export breakrcycle |
| 122 | 125 | namespace eval breakrcycle { |
| 123 | 126 | namespace import ::vc::fossil::import::cvs::cyclebreaker |
| 127 | + namespace import ::vc::fossil::import::cvs::repository | |
| 124 | 128 | namespace import ::vc::fossil::import::cvs::state |
| 125 | 129 | namespace eval project { |
| 126 | 130 | namespace import ::vc::fossil::import::cvs::project::rev |
| 127 | 131 | } |
| 128 | 132 | namespace import ::vc::tools::log |
| 129 | 133 |
| --- tools/cvs2fossil/lib/c2f_pbreakrcycle.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pbreakrcycle.tcl | |
| @@ -20,10 +20,11 @@ | |
| 20 | |
| 21 | package require Tcl 8.4 ; # Required runtime. |
| 22 | package require snit ; # OO system. |
| 23 | package require struct::list ; # Higher order list operations. |
| 24 | package require vc::tools::log ; # User feedback. |
| 25 | package require vc::fossil::import::cvs::cyclebreaker ; # Breaking dependency cycles. |
| 26 | package require vc::fossil::import::cvs::state ; # State storage. |
| 27 | package require vc::fossil::import::cvs::project::rev ; # Project level changesets |
| 28 | |
| 29 | # # ## ### ##### ######## ############# ##################### |
| @@ -76,10 +77,12 @@ | |
| 76 | state transaction { |
| 77 | cyclebreaker run [struct::list filter [project::rev all] \ |
| 78 | [myproc IsByRevision]] \ |
| 79 | [myproc SaveOrder] |
| 80 | } |
| 81 | return |
| 82 | } |
| 83 | |
| 84 | typemethod discard {} { |
| 85 | # Pass manager interface. Executed for all passes after the |
| @@ -119,10 +122,11 @@ | |
| 119 | |
| 120 | namespace eval ::vc::fossil::import::cvs::pass { |
| 121 | namespace export breakrcycle |
| 122 | namespace eval breakrcycle { |
| 123 | namespace import ::vc::fossil::import::cvs::cyclebreaker |
| 124 | namespace import ::vc::fossil::import::cvs::state |
| 125 | namespace eval project { |
| 126 | namespace import ::vc::fossil::import::cvs::project::rev |
| 127 | } |
| 128 | namespace import ::vc::tools::log |
| 129 |
| --- tools/cvs2fossil/lib/c2f_pbreakrcycle.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pbreakrcycle.tcl | |
| @@ -20,10 +20,11 @@ | |
| 20 | |
| 21 | package require Tcl 8.4 ; # Required runtime. |
| 22 | package require snit ; # OO system. |
| 23 | package require struct::list ; # Higher order list operations. |
| 24 | package require vc::tools::log ; # User feedback. |
| 25 | package require vc::fossil::import::cvs::repository ; # Repository management. |
| 26 | package require vc::fossil::import::cvs::cyclebreaker ; # Breaking dependency cycles. |
| 27 | package require vc::fossil::import::cvs::state ; # State storage. |
| 28 | package require vc::fossil::import::cvs::project::rev ; # Project level changesets |
| 29 | |
| 30 | # # ## ### ##### ######## ############# ##################### |
| @@ -76,10 +77,12 @@ | |
| 77 | state transaction { |
| 78 | cyclebreaker run [struct::list filter [project::rev all] \ |
| 79 | [myproc IsByRevision]] \ |
| 80 | [myproc SaveOrder] |
| 81 | } |
| 82 | |
| 83 | repository printcsetstatistics |
| 84 | return |
| 85 | } |
| 86 | |
| 87 | typemethod discard {} { |
| 88 | # Pass manager interface. Executed for all passes after the |
| @@ -119,10 +122,11 @@ | |
| 122 | |
| 123 | namespace eval ::vc::fossil::import::cvs::pass { |
| 124 | namespace export breakrcycle |
| 125 | namespace eval breakrcycle { |
| 126 | namespace import ::vc::fossil::import::cvs::cyclebreaker |
| 127 | namespace import ::vc::fossil::import::cvs::repository |
| 128 | namespace import ::vc::fossil::import::cvs::state |
| 129 | namespace eval project { |
| 130 | namespace import ::vc::fossil::import::cvs::project::rev |
| 131 | } |
| 132 | namespace import ::vc::tools::log |
| 133 |
| --- tools/cvs2fossil/lib/c2f_pbreakscycle.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_pbreakscycle.tcl | ||
| @@ -20,10 +20,11 @@ | ||
| 20 | 20 | |
| 21 | 21 | package require Tcl 8.4 ; # Required runtime. |
| 22 | 22 | package require snit ; # OO system. |
| 23 | 23 | package require struct::list ; # Higher order list operations. |
| 24 | 24 | package require vc::fossil::import::cvs::cyclebreaker ; # Breaking dependency cycles. |
| 25 | +package require vc::fossil::import::cvs::repository ; # Repository management. | |
| 25 | 26 | package require vc::fossil::import::cvs::state ; # State storage. |
| 26 | 27 | package require vc::fossil::import::cvs::project::rev ; # Project level changesets |
| 27 | 28 | |
| 28 | 29 | # # ## ### ##### ######## ############# ##################### |
| 29 | 30 | ## Register the pass with the management |
| @@ -63,10 +64,12 @@ | ||
| 63 | 64 | |
| 64 | 65 | state transaction { |
| 65 | 66 | cyclebreaker run [struct::list filter [project::rev all] \ |
| 66 | 67 | [myproc IsBySymbol]] |
| 67 | 68 | } |
| 69 | + | |
| 70 | + repository printcsetstatistics | |
| 68 | 71 | return |
| 69 | 72 | } |
| 70 | 73 | |
| 71 | 74 | typemethod discard {} { |
| 72 | 75 | # Pass manager interface. Executed for all passes after the |
| @@ -92,10 +95,11 @@ | ||
| 92 | 95 | |
| 93 | 96 | namespace eval ::vc::fossil::import::cvs::pass { |
| 94 | 97 | namespace export breakscycle |
| 95 | 98 | namespace eval breakscycle { |
| 96 | 99 | namespace import ::vc::fossil::import::cvs::cyclebreaker |
| 100 | + namespace import ::vc::fossil::import::cvs::repository | |
| 97 | 101 | namespace import ::vc::fossil::import::cvs::state |
| 98 | 102 | namespace eval project { |
| 99 | 103 | namespace import ::vc::fossil::import::cvs::project::rev |
| 100 | 104 | } |
| 101 | 105 | } |
| 102 | 106 |
| --- tools/cvs2fossil/lib/c2f_pbreakscycle.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pbreakscycle.tcl | |
| @@ -20,10 +20,11 @@ | |
| 20 | |
| 21 | package require Tcl 8.4 ; # Required runtime. |
| 22 | package require snit ; # OO system. |
| 23 | package require struct::list ; # Higher order list operations. |
| 24 | package require vc::fossil::import::cvs::cyclebreaker ; # Breaking dependency cycles. |
| 25 | package require vc::fossil::import::cvs::state ; # State storage. |
| 26 | package require vc::fossil::import::cvs::project::rev ; # Project level changesets |
| 27 | |
| 28 | # # ## ### ##### ######## ############# ##################### |
| 29 | ## Register the pass with the management |
| @@ -63,10 +64,12 @@ | |
| 63 | |
| 64 | state transaction { |
| 65 | cyclebreaker run [struct::list filter [project::rev all] \ |
| 66 | [myproc IsBySymbol]] |
| 67 | } |
| 68 | return |
| 69 | } |
| 70 | |
| 71 | typemethod discard {} { |
| 72 | # Pass manager interface. Executed for all passes after the |
| @@ -92,10 +95,11 @@ | |
| 92 | |
| 93 | namespace eval ::vc::fossil::import::cvs::pass { |
| 94 | namespace export breakscycle |
| 95 | namespace eval breakscycle { |
| 96 | namespace import ::vc::fossil::import::cvs::cyclebreaker |
| 97 | namespace import ::vc::fossil::import::cvs::state |
| 98 | namespace eval project { |
| 99 | namespace import ::vc::fossil::import::cvs::project::rev |
| 100 | } |
| 101 | } |
| 102 |
| --- tools/cvs2fossil/lib/c2f_pbreakscycle.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pbreakscycle.tcl | |
| @@ -20,10 +20,11 @@ | |
| 20 | |
| 21 | package require Tcl 8.4 ; # Required runtime. |
| 22 | package require snit ; # OO system. |
| 23 | package require struct::list ; # Higher order list operations. |
| 24 | package require vc::fossil::import::cvs::cyclebreaker ; # Breaking dependency cycles. |
| 25 | package require vc::fossil::import::cvs::repository ; # Repository management. |
| 26 | package require vc::fossil::import::cvs::state ; # State storage. |
| 27 | package require vc::fossil::import::cvs::project::rev ; # Project level changesets |
| 28 | |
| 29 | # # ## ### ##### ######## ############# ##################### |
| 30 | ## Register the pass with the management |
| @@ -63,10 +64,12 @@ | |
| 64 | |
| 65 | state transaction { |
| 66 | cyclebreaker run [struct::list filter [project::rev all] \ |
| 67 | [myproc IsBySymbol]] |
| 68 | } |
| 69 | |
| 70 | repository printcsetstatistics |
| 71 | return |
| 72 | } |
| 73 | |
| 74 | typemethod discard {} { |
| 75 | # Pass manager interface. Executed for all passes after the |
| @@ -92,10 +95,11 @@ | |
| 95 | |
| 96 | namespace eval ::vc::fossil::import::cvs::pass { |
| 97 | namespace export breakscycle |
| 98 | namespace eval breakscycle { |
| 99 | namespace import ::vc::fossil::import::cvs::cyclebreaker |
| 100 | namespace import ::vc::fossil::import::cvs::repository |
| 101 | namespace import ::vc::fossil::import::cvs::state |
| 102 | namespace eval project { |
| 103 | namespace import ::vc::fossil::import::cvs::project::rev |
| 104 | } |
| 105 | } |
| 106 |
| --- tools/cvs2fossil/lib/c2f_pcollrev.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_pcollrev.tcl | ||
| @@ -339,12 +339,12 @@ | ||
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | $project purgeghostsymbols |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - repository printrevstatistics | |
| 345 | 344 | repository persistrev |
| 345 | + repository printrevstatistics | |
| 346 | 346 | integrity strict |
| 347 | 347 | |
| 348 | 348 | log write 1 collrev "Scan completed" |
| 349 | 349 | return |
| 350 | 350 | } |
| 351 | 351 |
| --- tools/cvs2fossil/lib/c2f_pcollrev.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pcollrev.tcl | |
| @@ -339,12 +339,12 @@ | |
| 339 | } |
| 340 | |
| 341 | $project purgeghostsymbols |
| 342 | } |
| 343 | |
| 344 | repository printrevstatistics |
| 345 | repository persistrev |
| 346 | integrity strict |
| 347 | |
| 348 | log write 1 collrev "Scan completed" |
| 349 | return |
| 350 | } |
| 351 |
| --- tools/cvs2fossil/lib/c2f_pcollrev.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pcollrev.tcl | |
| @@ -339,12 +339,12 @@ | |
| 339 | } |
| 340 | |
| 341 | $project purgeghostsymbols |
| 342 | } |
| 343 | |
| 344 | repository persistrev |
| 345 | repository printrevstatistics |
| 346 | integrity strict |
| 347 | |
| 348 | log write 1 collrev "Scan completed" |
| 349 | return |
| 350 | } |
| 351 |
| --- tools/cvs2fossil/lib/c2f_pfiltersym.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_pfiltersym.tcl | ||
| @@ -19,10 +19,11 @@ | ||
| 19 | 19 | |
| 20 | 20 | package require Tcl 8.4 ; # Required runtime. |
| 21 | 21 | package require snit ; # OO system. |
| 22 | 22 | package require vc::tools::misc ; # Text formatting. |
| 23 | 23 | package require vc::tools::log ; # User feedback. |
| 24 | +package require vc::fossil::import::cvs::repository ; # Repository management. | |
| 24 | 25 | package require vc::fossil::import::cvs::state ; # State storage. |
| 25 | 26 | package require vc::fossil::import::cvs::integrity ; # State storage integrity checks. |
| 26 | 27 | package require vc::fossil::import::cvs::project::sym ; # Project level symbols |
| 27 | 28 | |
| 28 | 29 | # # ## ### ##### ######## ############# ##################### |
| @@ -80,10 +81,12 @@ | ||
| 80 | 81 | state transaction { |
| 81 | 82 | FilterExcludedSymbols |
| 82 | 83 | MutateSymbols |
| 83 | 84 | AdjustParents |
| 84 | 85 | RefineSymbols |
| 86 | + | |
| 87 | + repository printrevstatistics | |
| 85 | 88 | |
| 86 | 89 | # Strict integrity enforces that all meta entries are in |
| 87 | 90 | # the same LOD as the revision using them. At this point |
| 88 | 91 | # this may not be true any longer. If a NTDB was excluded |
| 89 | 92 | # then all revisions it shared with the trunk were moved |
| @@ -111,11 +114,11 @@ | ||
| 111 | 114 | |
| 112 | 115 | # # ## ### ##### ######## ############# |
| 113 | 116 | ## Internal methods |
| 114 | 117 | |
| 115 | 118 | proc FilterExcludedSymbols {} { |
| 116 | - log write 3 filtersym "Filter out excluded symbols and users" | |
| 119 | + log write 3 filtersym "Remove the excluded symbols and their users" | |
| 117 | 120 | |
| 118 | 121 | # We pull all the excluded symbols together into a table for |
| 119 | 122 | # easy reference by the upcoming DELETE and other statements. |
| 120 | 123 | # ('x IN table' clauses). |
| 121 | 124 | |
| @@ -159,13 +162,13 @@ | ||
| 159 | 162 | # 'dbchild'. The associated 'dbparent' is squashed |
| 160 | 163 | # instead. All parents of the joints are moved to the |
| 161 | 164 | # trunk as well. |
| 162 | 165 | |
| 163 | 166 | set tjoint $link($joint) |
| 164 | - set tlod [lindex [state run { | |
| 167 | + set tlod [state one { | |
| 165 | 168 | SELECT lod FROM revision WHERE rid = $tjoint |
| 166 | - }] 0] | |
| 169 | + }] | |
| 167 | 170 | |
| 168 | 171 | # Covnert db/parent/child into regular parent/child links. |
| 169 | 172 | state run { |
| 170 | 173 | UPDATE revision SET dbparent = NULL, parent = $joint WHERE rid = $tjoint ; |
| 171 | 174 | UPDATE revision SET dbchild = NULL, child = $tjoint WHERE rid = $joint ; |
| @@ -349,16 +352,16 @@ | ||
| 349 | 352 | # |
| 350 | 353 | # ... AND P.pid IN (SELECT B.sid |
| 351 | 354 | # FROM branch B |
| 352 | 355 | # WHERE B.root = R.rid) |
| 353 | 356 | |
| 354 | - if {![lindex [state run { | |
| 357 | + if {![state one { | |
| 355 | 358 | SELECT COUNT(*) |
| 356 | 359 | FROM branch B |
| 357 | 360 | WHERE B.sid = $pid |
| 358 | 361 | AND B.root = $rid |
| 359 | - }] 0]} { | |
| 362 | + }]} { | |
| 360 | 363 | incr tmax -1 |
| 361 | 364 | set mxs [format $fmt $tmax] |
| 362 | 365 | continue |
| 363 | 366 | } |
| 364 | 367 | |
| @@ -406,17 +409,17 @@ | ||
| 406 | 409 | # ... AND P.pid IN (SELECT BX.sid |
| 407 | 410 | # FROM branch BX |
| 408 | 411 | # WHERE BX.root = R.rid |
| 409 | 412 | # AND BX.pos > B.pos) |
| 410 | 413 | |
| 411 | - if {![lindex [state run { | |
| 414 | + if {![state one { | |
| 412 | 415 | SELECT COUNT(*) |
| 413 | 416 | FROM branch B |
| 414 | 417 | WHERE B.sid = $pid |
| 415 | 418 | AND B.root = $rid |
| 416 | 419 | AND B.pos > $pos |
| 417 | - }] 0]} { | |
| 420 | + }]} { | |
| 418 | 421 | incr bmax -1 |
| 419 | 422 | set mxs [format $fmt $bmax] |
| 420 | 423 | continue |
| 421 | 424 | } |
| 422 | 425 | |
| @@ -498,10 +501,11 @@ | ||
| 498 | 501 | } |
| 499 | 502 | |
| 500 | 503 | namespace eval ::vc::fossil::import::cvs::pass { |
| 501 | 504 | namespace export filtersym |
| 502 | 505 | namespace eval filtersym { |
| 506 | + namespace import ::vc::fossil::import::cvs::repository | |
| 503 | 507 | namespace import ::vc::fossil::import::cvs::state |
| 504 | 508 | namespace import ::vc::fossil::import::cvs::integrity |
| 505 | 509 | namespace eval project { |
| 506 | 510 | namespace import ::vc::fossil::import::cvs::project::sym |
| 507 | 511 | } |
| 508 | 512 |
| --- tools/cvs2fossil/lib/c2f_pfiltersym.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pfiltersym.tcl | |
| @@ -19,10 +19,11 @@ | |
| 19 | |
| 20 | package require Tcl 8.4 ; # Required runtime. |
| 21 | package require snit ; # OO system. |
| 22 | package require vc::tools::misc ; # Text formatting. |
| 23 | package require vc::tools::log ; # User feedback. |
| 24 | package require vc::fossil::import::cvs::state ; # State storage. |
| 25 | package require vc::fossil::import::cvs::integrity ; # State storage integrity checks. |
| 26 | package require vc::fossil::import::cvs::project::sym ; # Project level symbols |
| 27 | |
| 28 | # # ## ### ##### ######## ############# ##################### |
| @@ -80,10 +81,12 @@ | |
| 80 | state transaction { |
| 81 | FilterExcludedSymbols |
| 82 | MutateSymbols |
| 83 | AdjustParents |
| 84 | RefineSymbols |
| 85 | |
| 86 | # Strict integrity enforces that all meta entries are in |
| 87 | # the same LOD as the revision using them. At this point |
| 88 | # this may not be true any longer. If a NTDB was excluded |
| 89 | # then all revisions it shared with the trunk were moved |
| @@ -111,11 +114,11 @@ | |
| 111 | |
| 112 | # # ## ### ##### ######## ############# |
| 113 | ## Internal methods |
| 114 | |
| 115 | proc FilterExcludedSymbols {} { |
| 116 | log write 3 filtersym "Filter out excluded symbols and users" |
| 117 | |
| 118 | # We pull all the excluded symbols together into a table for |
| 119 | # easy reference by the upcoming DELETE and other statements. |
| 120 | # ('x IN table' clauses). |
| 121 | |
| @@ -159,13 +162,13 @@ | |
| 159 | # 'dbchild'. The associated 'dbparent' is squashed |
| 160 | # instead. All parents of the joints are moved to the |
| 161 | # trunk as well. |
| 162 | |
| 163 | set tjoint $link($joint) |
| 164 | set tlod [lindex [state run { |
| 165 | SELECT lod FROM revision WHERE rid = $tjoint |
| 166 | }] 0] |
| 167 | |
| 168 | # Covnert db/parent/child into regular parent/child links. |
| 169 | state run { |
| 170 | UPDATE revision SET dbparent = NULL, parent = $joint WHERE rid = $tjoint ; |
| 171 | UPDATE revision SET dbchild = NULL, child = $tjoint WHERE rid = $joint ; |
| @@ -349,16 +352,16 @@ | |
| 349 | # |
| 350 | # ... AND P.pid IN (SELECT B.sid |
| 351 | # FROM branch B |
| 352 | # WHERE B.root = R.rid) |
| 353 | |
| 354 | if {![lindex [state run { |
| 355 | SELECT COUNT(*) |
| 356 | FROM branch B |
| 357 | WHERE B.sid = $pid |
| 358 | AND B.root = $rid |
| 359 | }] 0]} { |
| 360 | incr tmax -1 |
| 361 | set mxs [format $fmt $tmax] |
| 362 | continue |
| 363 | } |
| 364 | |
| @@ -406,17 +409,17 @@ | |
| 406 | # ... AND P.pid IN (SELECT BX.sid |
| 407 | # FROM branch BX |
| 408 | # WHERE BX.root = R.rid |
| 409 | # AND BX.pos > B.pos) |
| 410 | |
| 411 | if {![lindex [state run { |
| 412 | SELECT COUNT(*) |
| 413 | FROM branch B |
| 414 | WHERE B.sid = $pid |
| 415 | AND B.root = $rid |
| 416 | AND B.pos > $pos |
| 417 | }] 0]} { |
| 418 | incr bmax -1 |
| 419 | set mxs [format $fmt $bmax] |
| 420 | continue |
| 421 | } |
| 422 | |
| @@ -498,10 +501,11 @@ | |
| 498 | } |
| 499 | |
| 500 | namespace eval ::vc::fossil::import::cvs::pass { |
| 501 | namespace export filtersym |
| 502 | namespace eval filtersym { |
| 503 | namespace import ::vc::fossil::import::cvs::state |
| 504 | namespace import ::vc::fossil::import::cvs::integrity |
| 505 | namespace eval project { |
| 506 | namespace import ::vc::fossil::import::cvs::project::sym |
| 507 | } |
| 508 |
| --- tools/cvs2fossil/lib/c2f_pfiltersym.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pfiltersym.tcl | |
| @@ -19,10 +19,11 @@ | |
| 19 | |
| 20 | package require Tcl 8.4 ; # Required runtime. |
| 21 | package require snit ; # OO system. |
| 22 | package require vc::tools::misc ; # Text formatting. |
| 23 | package require vc::tools::log ; # User feedback. |
| 24 | package require vc::fossil::import::cvs::repository ; # Repository management. |
| 25 | package require vc::fossil::import::cvs::state ; # State storage. |
| 26 | package require vc::fossil::import::cvs::integrity ; # State storage integrity checks. |
| 27 | package require vc::fossil::import::cvs::project::sym ; # Project level symbols |
| 28 | |
| 29 | # # ## ### ##### ######## ############# ##################### |
| @@ -80,10 +81,12 @@ | |
| 81 | state transaction { |
| 82 | FilterExcludedSymbols |
| 83 | MutateSymbols |
| 84 | AdjustParents |
| 85 | RefineSymbols |
| 86 | |
| 87 | repository printrevstatistics |
| 88 | |
| 89 | # Strict integrity enforces that all meta entries are in |
| 90 | # the same LOD as the revision using them. At this point |
| 91 | # this may not be true any longer. If a NTDB was excluded |
| 92 | # then all revisions it shared with the trunk were moved |
| @@ -111,11 +114,11 @@ | |
| 114 | |
| 115 | # # ## ### ##### ######## ############# |
| 116 | ## Internal methods |
| 117 | |
| 118 | proc FilterExcludedSymbols {} { |
| 119 | log write 3 filtersym "Remove the excluded symbols and their users" |
| 120 | |
| 121 | # We pull all the excluded symbols together into a table for |
| 122 | # easy reference by the upcoming DELETE and other statements. |
| 123 | # ('x IN table' clauses). |
| 124 | |
| @@ -159,13 +162,13 @@ | |
| 162 | # 'dbchild'. The associated 'dbparent' is squashed |
| 163 | # instead. All parents of the joints are moved to the |
| 164 | # trunk as well. |
| 165 | |
| 166 | set tjoint $link($joint) |
| 167 | set tlod [state one { |
| 168 | SELECT lod FROM revision WHERE rid = $tjoint |
| 169 | }] |
| 170 | |
| 171 | # Covnert db/parent/child into regular parent/child links. |
| 172 | state run { |
| 173 | UPDATE revision SET dbparent = NULL, parent = $joint WHERE rid = $tjoint ; |
| 174 | UPDATE revision SET dbchild = NULL, child = $tjoint WHERE rid = $joint ; |
| @@ -349,16 +352,16 @@ | |
| 352 | # |
| 353 | # ... AND P.pid IN (SELECT B.sid |
| 354 | # FROM branch B |
| 355 | # WHERE B.root = R.rid) |
| 356 | |
| 357 | if {![state one { |
| 358 | SELECT COUNT(*) |
| 359 | FROM branch B |
| 360 | WHERE B.sid = $pid |
| 361 | AND B.root = $rid |
| 362 | }]} { |
| 363 | incr tmax -1 |
| 364 | set mxs [format $fmt $tmax] |
| 365 | continue |
| 366 | } |
| 367 | |
| @@ -406,17 +409,17 @@ | |
| 409 | # ... AND P.pid IN (SELECT BX.sid |
| 410 | # FROM branch BX |
| 411 | # WHERE BX.root = R.rid |
| 412 | # AND BX.pos > B.pos) |
| 413 | |
| 414 | if {![state one { |
| 415 | SELECT COUNT(*) |
| 416 | FROM branch B |
| 417 | WHERE B.sid = $pid |
| 418 | AND B.root = $rid |
| 419 | AND B.pos > $pos |
| 420 | }]} { |
| 421 | incr bmax -1 |
| 422 | set mxs [format $fmt $bmax] |
| 423 | continue |
| 424 | } |
| 425 | |
| @@ -498,10 +501,11 @@ | |
| 501 | } |
| 502 | |
| 503 | namespace eval ::vc::fossil::import::cvs::pass { |
| 504 | namespace export filtersym |
| 505 | namespace eval filtersym { |
| 506 | namespace import ::vc::fossil::import::cvs::repository |
| 507 | namespace import ::vc::fossil::import::cvs::state |
| 508 | namespace import ::vc::fossil::import::cvs::integrity |
| 509 | namespace eval project { |
| 510 | namespace import ::vc::fossil::import::cvs::project::sym |
| 511 | } |
| 512 |
| --- tools/cvs2fossil/lib/c2f_pinitcsets.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_pinitcsets.tcl | ||
| @@ -131,10 +131,12 @@ | ||
| 131 | 131 | state transaction { |
| 132 | 132 | CreateRevisionChangesets ; # Group file revisions into csets. |
| 133 | 133 | BreakInternalDependencies ; # Split the csets based on internal conflicts. |
| 134 | 134 | CreateSymbolChangesets ; # Create csets for tags and branches. |
| 135 | 135 | PersistTheChangesets |
| 136 | + | |
| 137 | + repository printcsetstatistics | |
| 136 | 138 | } |
| 137 | 139 | return |
| 138 | 140 | } |
| 139 | 141 | |
| 140 | 142 | typemethod discard {} { |
| 141 | 143 |
| --- tools/cvs2fossil/lib/c2f_pinitcsets.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pinitcsets.tcl | |
| @@ -131,10 +131,12 @@ | |
| 131 | state transaction { |
| 132 | CreateRevisionChangesets ; # Group file revisions into csets. |
| 133 | BreakInternalDependencies ; # Split the csets based on internal conflicts. |
| 134 | CreateSymbolChangesets ; # Create csets for tags and branches. |
| 135 | PersistTheChangesets |
| 136 | } |
| 137 | return |
| 138 | } |
| 139 | |
| 140 | typemethod discard {} { |
| 141 |
| --- tools/cvs2fossil/lib/c2f_pinitcsets.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pinitcsets.tcl | |
| @@ -131,10 +131,12 @@ | |
| 131 | state transaction { |
| 132 | CreateRevisionChangesets ; # Group file revisions into csets. |
| 133 | BreakInternalDependencies ; # Split the csets based on internal conflicts. |
| 134 | CreateSymbolChangesets ; # Create csets for tags and branches. |
| 135 | PersistTheChangesets |
| 136 | |
| 137 | repository printcsetstatistics |
| 138 | } |
| 139 | return |
| 140 | } |
| 141 | |
| 142 | typemethod discard {} { |
| 143 |
| --- tools/cvs2fossil/lib/c2f_prev.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_prev.tcl | ||
| @@ -142,11 +142,11 @@ | ||
| 142 | 142 | # dependencies cut before we remove them from |
| 143 | 143 | # consideration, for documentation later. |
| 144 | 144 | |
| 145 | 145 | set breaks($best) $cross($best) |
| 146 | 146 | |
| 147 | - log write 6 csets "Best break @ $best, cuts [nsp $cross($best) dependency dependencies]" | |
| 147 | + log write 6 csets "Best break @ $best, cutting [nsp $cross($best) dependency dependencies]" | |
| 148 | 148 | |
| 149 | 149 | # Note: The value of best is an abolute location in |
| 150 | 150 | # myrevisions. Use the start of current to make it an |
| 151 | 151 | # index absolute to current. |
| 152 | 152 | |
| @@ -286,13 +286,11 @@ | ||
| 286 | 286 | return |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | typemethod loadcounter {} { |
| 290 | 290 | # Initialize the counter from the state |
| 291 | - set mycounter [lindex [state run { | |
| 292 | - SELECT MAX(cid) FROM changeset | |
| 293 | - }] 0] | |
| 291 | + set mycounter [state one { SELECT MAX(cid) FROM changeset }] | |
| 294 | 292 | return |
| 295 | 293 | } |
| 296 | 294 | |
| 297 | 295 | proc PullInternalSuccessorRevisions {dv revisions} { |
| 298 | 296 | upvar 1 $dv dependencies |
| 299 | 297 |
| --- tools/cvs2fossil/lib/c2f_prev.tcl | |
| +++ tools/cvs2fossil/lib/c2f_prev.tcl | |
| @@ -142,11 +142,11 @@ | |
| 142 | # dependencies cut before we remove them from |
| 143 | # consideration, for documentation later. |
| 144 | |
| 145 | set breaks($best) $cross($best) |
| 146 | |
| 147 | log write 6 csets "Best break @ $best, cuts [nsp $cross($best) dependency dependencies]" |
| 148 | |
| 149 | # Note: The value of best is an abolute location in |
| 150 | # myrevisions. Use the start of current to make it an |
| 151 | # index absolute to current. |
| 152 | |
| @@ -286,13 +286,11 @@ | |
| 286 | return |
| 287 | } |
| 288 | |
| 289 | typemethod loadcounter {} { |
| 290 | # Initialize the counter from the state |
| 291 | set mycounter [lindex [state run { |
| 292 | SELECT MAX(cid) FROM changeset |
| 293 | }] 0] |
| 294 | return |
| 295 | } |
| 296 | |
| 297 | proc PullInternalSuccessorRevisions {dv revisions} { |
| 298 | upvar 1 $dv dependencies |
| 299 |
| --- tools/cvs2fossil/lib/c2f_prev.tcl | |
| +++ tools/cvs2fossil/lib/c2f_prev.tcl | |
| @@ -142,11 +142,11 @@ | |
| 142 | # dependencies cut before we remove them from |
| 143 | # consideration, for documentation later. |
| 144 | |
| 145 | set breaks($best) $cross($best) |
| 146 | |
| 147 | log write 6 csets "Best break @ $best, cutting [nsp $cross($best) dependency dependencies]" |
| 148 | |
| 149 | # Note: The value of best is an abolute location in |
| 150 | # myrevisions. Use the start of current to make it an |
| 151 | # index absolute to current. |
| 152 | |
| @@ -286,13 +286,11 @@ | |
| 286 | return |
| 287 | } |
| 288 | |
| 289 | typemethod loadcounter {} { |
| 290 | # Initialize the counter from the state |
| 291 | set mycounter [state one { SELECT MAX(cid) FROM changeset }] |
| 292 | return |
| 293 | } |
| 294 | |
| 295 | proc PullInternalSuccessorRevisions {dv revisions} { |
| 296 | upvar 1 $dv dependencies |
| 297 |
| --- tools/cvs2fossil/lib/c2f_repository.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_repository.tcl | ||
| @@ -89,11 +89,11 @@ | ||
| 89 | 89 | # pass I results |
| 90 | 90 | typemethod printstatistics {} { |
| 91 | 91 | set prlist [TheProjects] |
| 92 | 92 | set npr [llength $prlist] |
| 93 | 93 | |
| 94 | - log write 2 repository "Scanned [nsp $npr project]" | |
| 94 | + log write 2 repository "Statistics: Scanned [nsp $npr project]" | |
| 95 | 95 | |
| 96 | 96 | if {$npr > 1} { |
| 97 | 97 | set bmax [max [struct::list map $prlist [myproc .BaseLength]]] |
| 98 | 98 | incr bmax 2 |
| 99 | 99 | set bfmt %-${bmax}s |
| @@ -106,11 +106,11 @@ | ||
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | set keep {} |
| 109 | 109 | foreach p $prlist { |
| 110 | 110 | set nfiles [llength [$p filenames]] |
| 111 | - set line "Project [format $bfmt \"[$p printbase]\"] : [format $nfmt $nfiles] [sp $nfiles file]" | |
| 111 | + set line "Statistics: Project [format $bfmt \"[$p printbase]\"] : [format $nfmt $nfiles] [sp $nfiles file]" | |
| 112 | 112 | if {$nfiles < 1} { |
| 113 | 113 | append line ", dropped" |
| 114 | 114 | } else { |
| 115 | 115 | lappend keep $p |
| 116 | 116 | } |
| @@ -164,12 +164,59 @@ | ||
| 164 | 164 | return |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | # pass II results |
| 168 | 168 | typemethod printrevstatistics {} { |
| 169 | - log write 2 repository "Scanned ..." | |
| 170 | - # number of revisions, symbols, repository wide, per project ... | |
| 169 | + log write 2 repository "Revision statistics" | |
| 170 | + # number of revisions, symbols, repository wide, and per project ... | |
| 171 | + | |
| 172 | + set rcount [state one { SELECT COUNT (*) FROM revision }] | |
| 173 | + set tcount [state one { SELECT COUNT (*) FROM tag }] | |
| 174 | + set bcount [state one { SELECT COUNT (*) FROM branch }] | |
| 175 | + set scount [state one { SELECT COUNT (*) FROM symbol }] | |
| 176 | + set acount [state one { SELECT COUNT (*) FROM author }] | |
| 177 | + set ccount [state one { SELECT COUNT (*) FROM cmessage }] | |
| 178 | + set fmt %[string length [max [list $rcount $tcount $bcount $scount $acount $ccount]]]s | |
| 179 | + | |
| 180 | + log write 2 repository "Statistics: [format $fmt $rcount] [sp $rcount revision]" | |
| 181 | + log write 2 repository "Statistics: [format $fmt $tcount] [sp $tcount tag]" | |
| 182 | + log write 2 repository "Statistics: [format $fmt $bcount] [sp $bcount branch branches]" | |
| 183 | + log write 2 repository "Statistics: [format $fmt $scount] [sp $scount symbol]" | |
| 184 | + log write 2 repository "Statistics: [format $fmt $acount] [sp $acount author]" | |
| 185 | + log write 2 repository "Statistics: [format $fmt $ccount] [sp $ccount {log message}]" | |
| 186 | + | |
| 187 | + set prlist [TheProjects] | |
| 188 | + set npr [llength $prlist] | |
| 189 | + | |
| 190 | + if {$npr > 1} { | |
| 191 | + set bmax [max [struct::list map $prlist [myproc .BaseLength]]] | |
| 192 | + incr bmax 2 | |
| 193 | + set bfmt %-${bmax}s | |
| 194 | + } else { | |
| 195 | + set bfmt %s | |
| 196 | + } | |
| 197 | + | |
| 198 | + foreach p $prlist { | |
| 199 | + set pid [$p id] | |
| 200 | + set prefix "Statistics: Project [format $bfmt \"[$p printbase]\"]" | |
| 201 | + regsub -all {[^ ]} $prefix { } blanks | |
| 202 | + set sep " : " | |
| 203 | + | |
| 204 | + set rcount [state one { SELECT COUNT (*) FROM revision R, file F WHERE R.fid = F.fid AND F.pid = $pid }] | |
| 205 | + set tcount [state one { SELECT COUNT (*) FROM tag T, file F WHERE T.fid = F.fid AND F.pid = $pid }] | |
| 206 | + set bcount [state one { SELECT COUNT (*) FROM branch B, file F WHERE B.fid = F.fid AND F.pid = $pid }] | |
| 207 | + set scount [state one { SELECT COUNT (*) FROM symbol WHERE pid = $pid }] | |
| 208 | + set acount [state one { SELECT COUNT (*) FROM author WHERE aid IN (SELECT DISTINCT aid FROM meta WHERE pid = $pid) }] | |
| 209 | + set ccount [state one { SELECT COUNT (*) FROM cmessage WHERE cid IN (SELECT DISTINCT cid FROM meta WHERE pid = $pid) }] | |
| 210 | + | |
| 211 | + log write 2 repository "$prefix$sep[format $fmt $rcount] [sp $rcount revision]" | |
| 212 | + log write 2 repository "$blanks$sep[format $fmt $tcount] [sp $tcount tag]" | |
| 213 | + log write 2 repository "$blanks$sep[format $fmt $bcount] [sp $bcount branch branches]" | |
| 214 | + log write 2 repository "$blanks$sep[format $fmt $scount] [sp $scount symbol]" | |
| 215 | + log write 2 repository "$blanks$sep[format $fmt $acount] [sp $acount author]" | |
| 216 | + log write 2 repository "$blanks$sep[format $fmt $ccount] [sp $ccount {log message}]" | |
| 217 | + } | |
| 171 | 218 | return |
| 172 | 219 | } |
| 173 | 220 | |
| 174 | 221 | # pass II persistence |
| 175 | 222 | typemethod persistrev {} { |
| @@ -226,10 +273,53 @@ | ||
| 226 | 273 | |
| 227 | 274 | typemethod projectof {pid} { |
| 228 | 275 | return $myprojmap($pid) |
| 229 | 276 | } |
| 230 | 277 | |
| 278 | + | |
| 279 | + # pass IV+ results | |
| 280 | + typemethod printcsetstatistics {} { | |
| 281 | + log write 2 repository "Changeset statistics" | |
| 282 | + # number of revisions, symbols, repository wide, and per project ... | |
| 283 | + | |
| 284 | + set ccount [state one { SELECT COUNT (*) FROM changeset }] | |
| 285 | + set rcount [state one { SELECT COUNT (*) FROM changeset WHERE type = 0 }] | |
| 286 | + set scount [state one { SELECT COUNT (*) FROM changeset WHERE type = 1 }] | |
| 287 | + set fmt %[string length [max [list $ccount $rcount $scount]]]s | |
| 288 | + | |
| 289 | + log write 2 repository "Statistics: [format $fmt $ccount] [sp $ccount changeset]" | |
| 290 | + log write 2 repository "Statistics: [format $fmt $rcount] [sp $rcount {revision changeset}]" | |
| 291 | + log write 2 repository "Statistics: [format $fmt $scount] [sp $scount {symbol changeset}]" | |
| 292 | + | |
| 293 | + set prlist [TheProjects] | |
| 294 | + set npr [llength $prlist] | |
| 295 | + | |
| 296 | + if {$npr > 1} { | |
| 297 | + set bmax [max [struct::list map $prlist [myproc .BaseLength]]] | |
| 298 | + incr bmax 2 | |
| 299 | + set bfmt %-${bmax}s | |
| 300 | + } else { | |
| 301 | + set bfmt %s | |
| 302 | + } | |
| 303 | + | |
| 304 | + foreach p $prlist { | |
| 305 | + set pid [$p id] | |
| 306 | + set prefix "Statistics: Project [format $bfmt \"[$p printbase]\"]" | |
| 307 | + regsub -all {[^ ]} $prefix { } blanks | |
| 308 | + set sep " : " | |
| 309 | + | |
| 310 | + set ccount [state one { SELECT COUNT (*) FROM changeset WHERE pid = $pid }] | |
| 311 | + set rcount [state one { SELECT COUNT (*) FROM changeset WHERE pid = $pid AND type = 0 }] | |
| 312 | + set scount [state one { SELECT COUNT (*) FROM changeset WHERE pid = $pid AND type = 1 }] | |
| 313 | + | |
| 314 | + log write 2 repository "$prefix$sep[format $fmt $ccount] [sp $ccount changeset]" | |
| 315 | + log write 2 repository "$blanks$sep[format $fmt $rcount] [sp $rcount {revision changeset}]" | |
| 316 | + log write 2 repository "$blanks$sep[format $fmt $scount] [sp $scount {symbol changeset}]" | |
| 317 | + } | |
| 318 | + return | |
| 319 | + } | |
| 320 | + | |
| 231 | 321 | # # ## ### ##### ######## ############# |
| 232 | 322 | ## State |
| 233 | 323 | |
| 234 | 324 | typevariable mybase {} ; # Base path to CVS repository. |
| 235 | 325 | typevariable myprojpaths {} ; # List of paths to all declared |
| 236 | 326 |
| --- tools/cvs2fossil/lib/c2f_repository.tcl | |
| +++ tools/cvs2fossil/lib/c2f_repository.tcl | |
| @@ -89,11 +89,11 @@ | |
| 89 | # pass I results |
| 90 | typemethod printstatistics {} { |
| 91 | set prlist [TheProjects] |
| 92 | set npr [llength $prlist] |
| 93 | |
| 94 | log write 2 repository "Scanned [nsp $npr project]" |
| 95 | |
| 96 | if {$npr > 1} { |
| 97 | set bmax [max [struct::list map $prlist [myproc .BaseLength]]] |
| 98 | incr bmax 2 |
| 99 | set bfmt %-${bmax}s |
| @@ -106,11 +106,11 @@ | |
| 106 | } |
| 107 | |
| 108 | set keep {} |
| 109 | foreach p $prlist { |
| 110 | set nfiles [llength [$p filenames]] |
| 111 | set line "Project [format $bfmt \"[$p printbase]\"] : [format $nfmt $nfiles] [sp $nfiles file]" |
| 112 | if {$nfiles < 1} { |
| 113 | append line ", dropped" |
| 114 | } else { |
| 115 | lappend keep $p |
| 116 | } |
| @@ -164,12 +164,59 @@ | |
| 164 | return |
| 165 | } |
| 166 | |
| 167 | # pass II results |
| 168 | typemethod printrevstatistics {} { |
| 169 | log write 2 repository "Scanned ..." |
| 170 | # number of revisions, symbols, repository wide, per project ... |
| 171 | return |
| 172 | } |
| 173 | |
| 174 | # pass II persistence |
| 175 | typemethod persistrev {} { |
| @@ -226,10 +273,53 @@ | |
| 226 | |
| 227 | typemethod projectof {pid} { |
| 228 | return $myprojmap($pid) |
| 229 | } |
| 230 | |
| 231 | # # ## ### ##### ######## ############# |
| 232 | ## State |
| 233 | |
| 234 | typevariable mybase {} ; # Base path to CVS repository. |
| 235 | typevariable myprojpaths {} ; # List of paths to all declared |
| 236 |
| --- tools/cvs2fossil/lib/c2f_repository.tcl | |
| +++ tools/cvs2fossil/lib/c2f_repository.tcl | |
| @@ -89,11 +89,11 @@ | |
| 89 | # pass I results |
| 90 | typemethod printstatistics {} { |
| 91 | set prlist [TheProjects] |
| 92 | set npr [llength $prlist] |
| 93 | |
| 94 | log write 2 repository "Statistics: Scanned [nsp $npr project]" |
| 95 | |
| 96 | if {$npr > 1} { |
| 97 | set bmax [max [struct::list map $prlist [myproc .BaseLength]]] |
| 98 | incr bmax 2 |
| 99 | set bfmt %-${bmax}s |
| @@ -106,11 +106,11 @@ | |
| 106 | } |
| 107 | |
| 108 | set keep {} |
| 109 | foreach p $prlist { |
| 110 | set nfiles [llength [$p filenames]] |
| 111 | set line "Statistics: Project [format $bfmt \"[$p printbase]\"] : [format $nfmt $nfiles] [sp $nfiles file]" |
| 112 | if {$nfiles < 1} { |
| 113 | append line ", dropped" |
| 114 | } else { |
| 115 | lappend keep $p |
| 116 | } |
| @@ -164,12 +164,59 @@ | |
| 164 | return |
| 165 | } |
| 166 | |
| 167 | # pass II results |
| 168 | typemethod printrevstatistics {} { |
| 169 | log write 2 repository "Revision statistics" |
| 170 | # number of revisions, symbols, repository wide, and per project ... |
| 171 | |
| 172 | set rcount [state one { SELECT COUNT (*) FROM revision }] |
| 173 | set tcount [state one { SELECT COUNT (*) FROM tag }] |
| 174 | set bcount [state one { SELECT COUNT (*) FROM branch }] |
| 175 | set scount [state one { SELECT COUNT (*) FROM symbol }] |
| 176 | set acount [state one { SELECT COUNT (*) FROM author }] |
| 177 | set ccount [state one { SELECT COUNT (*) FROM cmessage }] |
| 178 | set fmt %[string length [max [list $rcount $tcount $bcount $scount $acount $ccount]]]s |
| 179 | |
| 180 | log write 2 repository "Statistics: [format $fmt $rcount] [sp $rcount revision]" |
| 181 | log write 2 repository "Statistics: [format $fmt $tcount] [sp $tcount tag]" |
| 182 | log write 2 repository "Statistics: [format $fmt $bcount] [sp $bcount branch branches]" |
| 183 | log write 2 repository "Statistics: [format $fmt $scount] [sp $scount symbol]" |
| 184 | log write 2 repository "Statistics: [format $fmt $acount] [sp $acount author]" |
| 185 | log write 2 repository "Statistics: [format $fmt $ccount] [sp $ccount {log message}]" |
| 186 | |
| 187 | set prlist [TheProjects] |
| 188 | set npr [llength $prlist] |
| 189 | |
| 190 | if {$npr > 1} { |
| 191 | set bmax [max [struct::list map $prlist [myproc .BaseLength]]] |
| 192 | incr bmax 2 |
| 193 | set bfmt %-${bmax}s |
| 194 | } else { |
| 195 | set bfmt %s |
| 196 | } |
| 197 | |
| 198 | foreach p $prlist { |
| 199 | set pid [$p id] |
| 200 | set prefix "Statistics: Project [format $bfmt \"[$p printbase]\"]" |
| 201 | regsub -all {[^ ]} $prefix { } blanks |
| 202 | set sep " : " |
| 203 | |
| 204 | set rcount [state one { SELECT COUNT (*) FROM revision R, file F WHERE R.fid = F.fid AND F.pid = $pid }] |
| 205 | set tcount [state one { SELECT COUNT (*) FROM tag T, file F WHERE T.fid = F.fid AND F.pid = $pid }] |
| 206 | set bcount [state one { SELECT COUNT (*) FROM branch B, file F WHERE B.fid = F.fid AND F.pid = $pid }] |
| 207 | set scount [state one { SELECT COUNT (*) FROM symbol WHERE pid = $pid }] |
| 208 | set acount [state one { SELECT COUNT (*) FROM author WHERE aid IN (SELECT DISTINCT aid FROM meta WHERE pid = $pid) }] |
| 209 | set ccount [state one { SELECT COUNT (*) FROM cmessage WHERE cid IN (SELECT DISTINCT cid FROM meta WHERE pid = $pid) }] |
| 210 | |
| 211 | log write 2 repository "$prefix$sep[format $fmt $rcount] [sp $rcount revision]" |
| 212 | log write 2 repository "$blanks$sep[format $fmt $tcount] [sp $tcount tag]" |
| 213 | log write 2 repository "$blanks$sep[format $fmt $bcount] [sp $bcount branch branches]" |
| 214 | log write 2 repository "$blanks$sep[format $fmt $scount] [sp $scount symbol]" |
| 215 | log write 2 repository "$blanks$sep[format $fmt $acount] [sp $acount author]" |
| 216 | log write 2 repository "$blanks$sep[format $fmt $ccount] [sp $ccount {log message}]" |
| 217 | } |
| 218 | return |
| 219 | } |
| 220 | |
| 221 | # pass II persistence |
| 222 | typemethod persistrev {} { |
| @@ -226,10 +273,53 @@ | |
| 273 | |
| 274 | typemethod projectof {pid} { |
| 275 | return $myprojmap($pid) |
| 276 | } |
| 277 | |
| 278 | |
| 279 | # pass IV+ results |
| 280 | typemethod printcsetstatistics {} { |
| 281 | log write 2 repository "Changeset statistics" |
| 282 | # number of revisions, symbols, repository wide, and per project ... |
| 283 | |
| 284 | set ccount [state one { SELECT COUNT (*) FROM changeset }] |
| 285 | set rcount [state one { SELECT COUNT (*) FROM changeset WHERE type = 0 }] |
| 286 | set scount [state one { SELECT COUNT (*) FROM changeset WHERE type = 1 }] |
| 287 | set fmt %[string length [max [list $ccount $rcount $scount]]]s |
| 288 | |
| 289 | log write 2 repository "Statistics: [format $fmt $ccount] [sp $ccount changeset]" |
| 290 | log write 2 repository "Statistics: [format $fmt $rcount] [sp $rcount {revision changeset}]" |
| 291 | log write 2 repository "Statistics: [format $fmt $scount] [sp $scount {symbol changeset}]" |
| 292 | |
| 293 | set prlist [TheProjects] |
| 294 | set npr [llength $prlist] |
| 295 | |
| 296 | if {$npr > 1} { |
| 297 | set bmax [max [struct::list map $prlist [myproc .BaseLength]]] |
| 298 | incr bmax 2 |
| 299 | set bfmt %-${bmax}s |
| 300 | } else { |
| 301 | set bfmt %s |
| 302 | } |
| 303 | |
| 304 | foreach p $prlist { |
| 305 | set pid [$p id] |
| 306 | set prefix "Statistics: Project [format $bfmt \"[$p printbase]\"]" |
| 307 | regsub -all {[^ ]} $prefix { } blanks |
| 308 | set sep " : " |
| 309 | |
| 310 | set ccount [state one { SELECT COUNT (*) FROM changeset WHERE pid = $pid }] |
| 311 | set rcount [state one { SELECT COUNT (*) FROM changeset WHERE pid = $pid AND type = 0 }] |
| 312 | set scount [state one { SELECT COUNT (*) FROM changeset WHERE pid = $pid AND type = 1 }] |
| 313 | |
| 314 | log write 2 repository "$prefix$sep[format $fmt $ccount] [sp $ccount changeset]" |
| 315 | log write 2 repository "$blanks$sep[format $fmt $rcount] [sp $rcount {revision changeset}]" |
| 316 | log write 2 repository "$blanks$sep[format $fmt $scount] [sp $scount {symbol changeset}]" |
| 317 | } |
| 318 | return |
| 319 | } |
| 320 | |
| 321 | # # ## ### ##### ######## ############# |
| 322 | ## State |
| 323 | |
| 324 | typevariable mybase {} ; # Base path to CVS repository. |
| 325 | typevariable myprojpaths {} ; # List of paths to all declared |
| 326 |
| --- tools/cvs2fossil/lib/c2f_state.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_state.tcl | ||
| @@ -144,10 +144,14 @@ | ||
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | typemethod run {args} { |
| 147 | 147 | return [uplevel 1 [linsert $args 0 $mystate eval]] |
| 148 | 148 | } |
| 149 | + | |
| 150 | + typemethod one {args} { | |
| 151 | + return [lindex [uplevel 1 [linsert $args 0 $mystate eval]] 0] | |
| 152 | + } | |
| 149 | 153 | |
| 150 | 154 | typemethod transaction {script} { |
| 151 | 155 | return [uplevel 1 [list $mystate transaction $script]] |
| 152 | 156 | } |
| 153 | 157 | |
| 154 | 158 |
| --- tools/cvs2fossil/lib/c2f_state.tcl | |
| +++ tools/cvs2fossil/lib/c2f_state.tcl | |
| @@ -144,10 +144,14 @@ | |
| 144 | } |
| 145 | |
| 146 | typemethod run {args} { |
| 147 | return [uplevel 1 [linsert $args 0 $mystate eval]] |
| 148 | } |
| 149 | |
| 150 | typemethod transaction {script} { |
| 151 | return [uplevel 1 [list $mystate transaction $script]] |
| 152 | } |
| 153 | |
| 154 |
| --- tools/cvs2fossil/lib/c2f_state.tcl | |
| +++ tools/cvs2fossil/lib/c2f_state.tcl | |
| @@ -144,10 +144,14 @@ | |
| 144 | } |
| 145 | |
| 146 | typemethod run {args} { |
| 147 | return [uplevel 1 [linsert $args 0 $mystate eval]] |
| 148 | } |
| 149 | |
| 150 | typemethod one {args} { |
| 151 | return [lindex [uplevel 1 [linsert $args 0 $mystate eval]] 0] |
| 152 | } |
| 153 | |
| 154 | typemethod transaction {script} { |
| 155 | return [uplevel 1 [list $mystate transaction $script]] |
| 156 | } |
| 157 | |
| 158 |