Fossil SCM
Fluff: Renamed state methods use/reading/writing to usedb/use/extend for clarity. Updated all callers. Extended state module with code to dump the SQL statements it receives to a file for analysis. Extended the 'use' declarations of several passes.
Commit
e288af39955b2602cd601c2cd928b8e68c7ff8d9
Parent
060513f2a9d9794…
13 files changed
+4
-1
+16
-7
+9
-4
+7
-3
+7
-3
+7
-3
+4
-4
+17
-17
+6
-4
+15
-10
+14
-12
+8
-5
+36
-16
~
tools/cvs2fossil/lib/c2f_option.tcl
~
tools/cvs2fossil/lib/c2f_pass.tcl
~
tools/cvs2fossil/lib/c2f_patopsort.tcl
~
tools/cvs2fossil/lib/c2f_pbreakacycle.tcl
~
tools/cvs2fossil/lib/c2f_pbreakrcycle.tcl
~
tools/cvs2fossil/lib/c2f_pbreakscycle.tcl
~
tools/cvs2fossil/lib/c2f_pcollar.tcl
~
tools/cvs2fossil/lib/c2f_pcollrev.tcl
~
tools/cvs2fossil/lib/c2f_pcollsym.tcl
~
tools/cvs2fossil/lib/c2f_pfiltersym.tcl
~
tools/cvs2fossil/lib/c2f_pinitcsets.tcl
~
tools/cvs2fossil/lib/c2f_prtopsort.tcl
~
tools/cvs2fossil/lib/c2f_state.tcl
| --- tools/cvs2fossil/lib/c2f_option.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_option.tcl | ||
| @@ -73,18 +73,19 @@ | ||
| 73 | 73 | --project { repository add [Value arguments] } |
| 74 | 74 | -v - |
| 75 | 75 | --verbose { log verbose } |
| 76 | 76 | -q - |
| 77 | 77 | --quiet { log quiet } |
| 78 | - --state { state use [Value arguments] } | |
| 78 | + --state { state usedb [Value arguments] } | |
| 79 | 79 | --trunk-only { repository trunkonly! } |
| 80 | 80 | --exclude { project::sym exclude [Value arguments] } |
| 81 | 81 | --force-tag { project::sym forcetag [Value arguments] } |
| 82 | 82 | --force-branch { project::sym forcebranch [Value arguments] } |
| 83 | 83 | --batch { log noprogress } |
| 84 | 84 | --dots { cyclebreaker dotsto [Value arguments] } |
| 85 | 85 | --watch { cyclebreaker watch [Value arguments] } |
| 86 | + --statesavequeriesto { state savequeriesto [Value arguments] } | |
| 86 | 87 | default { |
| 87 | 88 | Usage $badoption$option\n$gethelp |
| 88 | 89 | } |
| 89 | 90 | } |
| 90 | 91 | } |
| @@ -142,10 +143,12 @@ | ||
| 142 | 143 | trouble info " --force-branch ?PROJECT:?SYMBOL" |
| 143 | 144 | trouble info " Force the named symbol from all or just" |
| 144 | 145 | trouble info " the specified project to be converted as" |
| 145 | 146 | trouble info " branch. Both project and symbol names" |
| 146 | 147 | trouble info " are glob patterns." |
| 148 | + trouble info "" | |
| 149 | + trouble info " Debug options" | |
| 147 | 150 | trouble info "" |
| 148 | 151 | trouble info " --dots PATH Write the changeset graphs before, after," |
| 149 | 152 | trouble info " and during breaking the of cycles to the" |
| 150 | 153 | trouble info " direcotry PATH, using GraphViz's dot format" |
| 151 | 154 | trouble info "" |
| 152 | 155 |
| --- tools/cvs2fossil/lib/c2f_option.tcl | |
| +++ tools/cvs2fossil/lib/c2f_option.tcl | |
| @@ -73,18 +73,19 @@ | |
| 73 | --project { repository add [Value arguments] } |
| 74 | -v - |
| 75 | --verbose { log verbose } |
| 76 | -q - |
| 77 | --quiet { log quiet } |
| 78 | --state { state use [Value arguments] } |
| 79 | --trunk-only { repository trunkonly! } |
| 80 | --exclude { project::sym exclude [Value arguments] } |
| 81 | --force-tag { project::sym forcetag [Value arguments] } |
| 82 | --force-branch { project::sym forcebranch [Value arguments] } |
| 83 | --batch { log noprogress } |
| 84 | --dots { cyclebreaker dotsto [Value arguments] } |
| 85 | --watch { cyclebreaker watch [Value arguments] } |
| 86 | default { |
| 87 | Usage $badoption$option\n$gethelp |
| 88 | } |
| 89 | } |
| 90 | } |
| @@ -142,10 +143,12 @@ | |
| 142 | trouble info " --force-branch ?PROJECT:?SYMBOL" |
| 143 | trouble info " Force the named symbol from all or just" |
| 144 | trouble info " the specified project to be converted as" |
| 145 | trouble info " branch. Both project and symbol names" |
| 146 | trouble info " are glob patterns." |
| 147 | trouble info "" |
| 148 | trouble info " --dots PATH Write the changeset graphs before, after," |
| 149 | trouble info " and during breaking the of cycles to the" |
| 150 | trouble info " direcotry PATH, using GraphViz's dot format" |
| 151 | trouble info "" |
| 152 |
| --- tools/cvs2fossil/lib/c2f_option.tcl | |
| +++ tools/cvs2fossil/lib/c2f_option.tcl | |
| @@ -73,18 +73,19 @@ | |
| 73 | --project { repository add [Value arguments] } |
| 74 | -v - |
| 75 | --verbose { log verbose } |
| 76 | -q - |
| 77 | --quiet { log quiet } |
| 78 | --state { state usedb [Value arguments] } |
| 79 | --trunk-only { repository trunkonly! } |
| 80 | --exclude { project::sym exclude [Value arguments] } |
| 81 | --force-tag { project::sym forcetag [Value arguments] } |
| 82 | --force-branch { project::sym forcebranch [Value arguments] } |
| 83 | --batch { log noprogress } |
| 84 | --dots { cyclebreaker dotsto [Value arguments] } |
| 85 | --watch { cyclebreaker watch [Value arguments] } |
| 86 | --statesavequeriesto { state savequeriesto [Value arguments] } |
| 87 | default { |
| 88 | Usage $badoption$option\n$gethelp |
| 89 | } |
| 90 | } |
| 91 | } |
| @@ -142,10 +143,12 @@ | |
| 143 | trouble info " --force-branch ?PROJECT:?SYMBOL" |
| 144 | trouble info " Force the named symbol from all or just" |
| 145 | trouble info " the specified project to be converted as" |
| 146 | trouble info " branch. Both project and symbol names" |
| 147 | trouble info " are glob patterns." |
| 148 | trouble info "" |
| 149 | trouble info " Debug options" |
| 150 | trouble info "" |
| 151 | trouble info " --dots PATH Write the changeset graphs before, after," |
| 152 | trouble info " and during breaking the of cycles to the" |
| 153 | trouble info " direcotry PATH, using GraphViz's dot format" |
| 154 | trouble info "" |
| 155 |
+16
-7
| --- tools/cvs2fossil/lib/c2f_pass.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_pass.tcl | ||
| @@ -125,28 +125,36 @@ | ||
| 125 | 125 | |
| 126 | 126 | state release |
| 127 | 127 | ShowTimes |
| 128 | 128 | return |
| 129 | 129 | } |
| 130 | + | |
| 131 | + typemethod current {} { return $mycurrentpass } | |
| 132 | + | |
| 133 | + # # ## ### ##### ######## ############# | |
| 134 | + ## Internal methods | |
| 130 | 135 | |
| 131 | 136 | proc Time {pass useconds} { |
| 132 | 137 | ::variable mytime |
| 133 | 138 | lappend mytime $pass $useconds |
| 139 | + ShowTime $pass $useconds | |
| 134 | 140 | return |
| 135 | 141 | } |
| 136 | 142 | |
| 137 | 143 | proc ShowTimes {} { |
| 138 | 144 | ::variable mytime |
| 139 | 145 | foreach {pass useconds} $mytime { |
| 140 | - set sec [format %8.2f [expr {double($useconds)/1e6}]] | |
| 141 | - log write 0 pass "$sec sec/$pass" | |
| 146 | + ShowTime $pass $useconds | |
| 142 | 147 | } |
| 143 | 148 | return |
| 144 | 149 | } |
| 145 | 150 | |
| 146 | - # # ## ### ##### ######## ############# | |
| 147 | - ## Internal methods | |
| 151 | + proc ShowTime {pass useconds} { | |
| 152 | + set sec [format %8.2f [expr {double($useconds)/1e6}]] | |
| 153 | + log write 0 pass "$sec sec/$pass" | |
| 154 | + return | |
| 155 | + } | |
| 148 | 156 | |
| 149 | 157 | proc Ok? {code label ov {emptyok 1}} { |
| 150 | 158 | upvar 1 $ov ok |
| 151 | 159 | ::variable mydesc |
| 152 | 160 | if {$emptyok && ($code eq "")} return |
| @@ -180,13 +188,14 @@ | ||
| 180 | 188 | |
| 181 | 189 | typevariable mypasses {} ; # List of registered passes (codes). |
| 182 | 190 | typevariable mydesc -array {} ; # Pass descriptions (one line). |
| 183 | 191 | typevariable mycmd -array {} ; # Pass callback command. |
| 184 | 192 | |
| 185 | - typevariable mystart -1 | |
| 186 | - typevariable myend -1 | |
| 187 | - typevariable mytime {} ; # Timing data for each executed pass. | |
| 193 | + typevariable mystart -1 | |
| 194 | + typevariable myend -1 | |
| 195 | + typevariable mytime {} ; # Timing data for each executed pass. | |
| 196 | + typevariable mycurrentpass {} ; # Pass currently running. | |
| 188 | 197 | |
| 189 | 198 | # # ## ### ##### ######## ############# |
| 190 | 199 | ## Configuration |
| 191 | 200 | |
| 192 | 201 | pragma -hasinstances no ; # singleton |
| 193 | 202 |
| --- tools/cvs2fossil/lib/c2f_pass.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pass.tcl | |
| @@ -125,28 +125,36 @@ | |
| 125 | |
| 126 | state release |
| 127 | ShowTimes |
| 128 | return |
| 129 | } |
| 130 | |
| 131 | proc Time {pass useconds} { |
| 132 | ::variable mytime |
| 133 | lappend mytime $pass $useconds |
| 134 | return |
| 135 | } |
| 136 | |
| 137 | proc ShowTimes {} { |
| 138 | ::variable mytime |
| 139 | foreach {pass useconds} $mytime { |
| 140 | set sec [format %8.2f [expr {double($useconds)/1e6}]] |
| 141 | log write 0 pass "$sec sec/$pass" |
| 142 | } |
| 143 | return |
| 144 | } |
| 145 | |
| 146 | # # ## ### ##### ######## ############# |
| 147 | ## Internal methods |
| 148 | |
| 149 | proc Ok? {code label ov {emptyok 1}} { |
| 150 | upvar 1 $ov ok |
| 151 | ::variable mydesc |
| 152 | if {$emptyok && ($code eq "")} return |
| @@ -180,13 +188,14 @@ | |
| 180 | |
| 181 | typevariable mypasses {} ; # List of registered passes (codes). |
| 182 | typevariable mydesc -array {} ; # Pass descriptions (one line). |
| 183 | typevariable mycmd -array {} ; # Pass callback command. |
| 184 | |
| 185 | typevariable mystart -1 |
| 186 | typevariable myend -1 |
| 187 | typevariable mytime {} ; # Timing data for each executed pass. |
| 188 | |
| 189 | # # ## ### ##### ######## ############# |
| 190 | ## Configuration |
| 191 | |
| 192 | pragma -hasinstances no ; # singleton |
| 193 |
| --- tools/cvs2fossil/lib/c2f_pass.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pass.tcl | |
| @@ -125,28 +125,36 @@ | |
| 125 | |
| 126 | state release |
| 127 | ShowTimes |
| 128 | return |
| 129 | } |
| 130 | |
| 131 | typemethod current {} { return $mycurrentpass } |
| 132 | |
| 133 | # # ## ### ##### ######## ############# |
| 134 | ## Internal methods |
| 135 | |
| 136 | proc Time {pass useconds} { |
| 137 | ::variable mytime |
| 138 | lappend mytime $pass $useconds |
| 139 | ShowTime $pass $useconds |
| 140 | return |
| 141 | } |
| 142 | |
| 143 | proc ShowTimes {} { |
| 144 | ::variable mytime |
| 145 | foreach {pass useconds} $mytime { |
| 146 | ShowTime $pass $useconds |
| 147 | } |
| 148 | return |
| 149 | } |
| 150 | |
| 151 | proc ShowTime {pass useconds} { |
| 152 | set sec [format %8.2f [expr {double($useconds)/1e6}]] |
| 153 | log write 0 pass "$sec sec/$pass" |
| 154 | return |
| 155 | } |
| 156 | |
| 157 | proc Ok? {code label ov {emptyok 1}} { |
| 158 | upvar 1 $ov ok |
| 159 | ::variable mydesc |
| 160 | if {$emptyok && ($code eq "")} return |
| @@ -180,13 +188,14 @@ | |
| 188 | |
| 189 | typevariable mypasses {} ; # List of registered passes (codes). |
| 190 | typevariable mydesc -array {} ; # Pass descriptions (one line). |
| 191 | typevariable mycmd -array {} ; # Pass callback command. |
| 192 | |
| 193 | typevariable mystart -1 |
| 194 | typevariable myend -1 |
| 195 | typevariable mytime {} ; # Timing data for each executed pass. |
| 196 | typevariable mycurrentpass {} ; # Pass currently running. |
| 197 | |
| 198 | # # ## ### ##### ######## ############# |
| 199 | ## Configuration |
| 200 | |
| 201 | pragma -hasinstances no ; # singleton |
| 202 |
| --- tools/cvs2fossil/lib/c2f_patopsort.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_patopsort.tcl | ||
| @@ -43,15 +43,20 @@ | ||
| 43 | 43 | |
| 44 | 44 | typemethod setup {} { |
| 45 | 45 | # Define the names and structure of the persistent state of |
| 46 | 46 | # this pass. |
| 47 | 47 | |
| 48 | - state reading revision | |
| 49 | - state reading changeset | |
| 50 | - state reading csorder | |
| 48 | + state use revision | |
| 49 | + state use tag | |
| 50 | + state use branch | |
| 51 | + state use symbol | |
| 52 | + state use changeset | |
| 53 | + state use csitem | |
| 54 | + state use cssuccessor | |
| 55 | + state use csorder | |
| 51 | 56 | |
| 52 | - state writing cstimestamp { | |
| 57 | + state extend cstimestamp { | |
| 53 | 58 | -- Commit order of all changesets based on their |
| 54 | 59 | -- dependencies, plus a monotonically increasing |
| 55 | 60 | -- timestamp. |
| 56 | 61 | |
| 57 | 62 | cid INTEGER NOT NULL REFERENCES changeset, |
| 58 | 63 |
| --- tools/cvs2fossil/lib/c2f_patopsort.tcl | |
| +++ tools/cvs2fossil/lib/c2f_patopsort.tcl | |
| @@ -43,15 +43,20 @@ | |
| 43 | |
| 44 | typemethod setup {} { |
| 45 | # Define the names and structure of the persistent state of |
| 46 | # this pass. |
| 47 | |
| 48 | state reading revision |
| 49 | state reading changeset |
| 50 | state reading csorder |
| 51 | |
| 52 | state writing cstimestamp { |
| 53 | -- Commit order of all changesets based on their |
| 54 | -- dependencies, plus a monotonically increasing |
| 55 | -- timestamp. |
| 56 | |
| 57 | cid INTEGER NOT NULL REFERENCES changeset, |
| 58 |
| --- tools/cvs2fossil/lib/c2f_patopsort.tcl | |
| +++ tools/cvs2fossil/lib/c2f_patopsort.tcl | |
| @@ -43,15 +43,20 @@ | |
| 43 | |
| 44 | typemethod setup {} { |
| 45 | # Define the names and structure of the persistent state of |
| 46 | # this pass. |
| 47 | |
| 48 | state use revision |
| 49 | state use tag |
| 50 | state use branch |
| 51 | state use symbol |
| 52 | state use changeset |
| 53 | state use csitem |
| 54 | state use cssuccessor |
| 55 | state use csorder |
| 56 | |
| 57 | state extend cstimestamp { |
| 58 | -- Commit order of all changesets based on their |
| 59 | -- dependencies, plus a monotonically increasing |
| 60 | -- timestamp. |
| 61 | |
| 62 | cid INTEGER NOT NULL REFERENCES changeset, |
| 63 |
| --- tools/cvs2fossil/lib/c2f_pbreakacycle.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_pbreakacycle.tcl | ||
| @@ -49,13 +49,17 @@ | ||
| 49 | 49 | |
| 50 | 50 | typemethod setup {} { |
| 51 | 51 | # Define the names and structure of the persistent state of |
| 52 | 52 | # this pass. |
| 53 | 53 | |
| 54 | - state reading changeset | |
| 55 | - state reading csitem | |
| 56 | - state reading csorder | |
| 54 | + state use revision | |
| 55 | + state use tag | |
| 56 | + state use branch | |
| 57 | + state use symbol | |
| 58 | + state use changeset | |
| 59 | + state use csitem | |
| 60 | + state use cssuccessor | |
| 57 | 61 | return |
| 58 | 62 | } |
| 59 | 63 | |
| 60 | 64 | typemethod load {} { |
| 61 | 65 | # Pass manager interface. Executed to load data computed by |
| 62 | 66 |
| --- tools/cvs2fossil/lib/c2f_pbreakacycle.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pbreakacycle.tcl | |
| @@ -49,13 +49,17 @@ | |
| 49 | |
| 50 | typemethod setup {} { |
| 51 | # Define the names and structure of the persistent state of |
| 52 | # this pass. |
| 53 | |
| 54 | state reading changeset |
| 55 | state reading csitem |
| 56 | state reading csorder |
| 57 | return |
| 58 | } |
| 59 | |
| 60 | typemethod load {} { |
| 61 | # Pass manager interface. Executed to load data computed by |
| 62 |
| --- tools/cvs2fossil/lib/c2f_pbreakacycle.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pbreakacycle.tcl | |
| @@ -49,13 +49,17 @@ | |
| 49 | |
| 50 | typemethod setup {} { |
| 51 | # Define the names and structure of the persistent state of |
| 52 | # this pass. |
| 53 | |
| 54 | state use revision |
| 55 | state use tag |
| 56 | state use branch |
| 57 | state use symbol |
| 58 | state use changeset |
| 59 | state use csitem |
| 60 | state use cssuccessor |
| 61 | return |
| 62 | } |
| 63 | |
| 64 | typemethod load {} { |
| 65 | # Pass manager interface. Executed to load data computed by |
| 66 |
| --- tools/cvs2fossil/lib/c2f_pbreakrcycle.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_pbreakrcycle.tcl | ||
| @@ -45,13 +45,17 @@ | ||
| 45 | 45 | |
| 46 | 46 | typemethod setup {} { |
| 47 | 47 | # Define the names and structure of the persistent state of |
| 48 | 48 | # this pass. |
| 49 | 49 | |
| 50 | - state reading revision | |
| 51 | - state reading changeset | |
| 52 | - state reading csitem | |
| 50 | + state use revision | |
| 51 | + state use symbol | |
| 52 | + state use changeset | |
| 53 | + state use csitem | |
| 54 | + state use cstype | |
| 55 | + state use cssuccessor | |
| 56 | + | |
| 53 | 57 | return |
| 54 | 58 | } |
| 55 | 59 | |
| 56 | 60 | typemethod load {} { |
| 57 | 61 | # Pass manager interface. Executed to load data computed by |
| 58 | 62 |
| --- tools/cvs2fossil/lib/c2f_pbreakrcycle.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pbreakrcycle.tcl | |
| @@ -45,13 +45,17 @@ | |
| 45 | |
| 46 | typemethod setup {} { |
| 47 | # Define the names and structure of the persistent state of |
| 48 | # this pass. |
| 49 | |
| 50 | state reading revision |
| 51 | state reading changeset |
| 52 | state reading csitem |
| 53 | return |
| 54 | } |
| 55 | |
| 56 | typemethod load {} { |
| 57 | # Pass manager interface. Executed to load data computed by |
| 58 |
| --- tools/cvs2fossil/lib/c2f_pbreakrcycle.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pbreakrcycle.tcl | |
| @@ -45,13 +45,17 @@ | |
| 45 | |
| 46 | typemethod setup {} { |
| 47 | # Define the names and structure of the persistent state of |
| 48 | # this pass. |
| 49 | |
| 50 | state use revision |
| 51 | state use symbol |
| 52 | state use changeset |
| 53 | state use csitem |
| 54 | state use cstype |
| 55 | state use cssuccessor |
| 56 | |
| 57 | return |
| 58 | } |
| 59 | |
| 60 | typemethod load {} { |
| 61 | # Pass manager interface. Executed to load data computed by |
| 62 |
| --- tools/cvs2fossil/lib/c2f_pbreakscycle.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_pbreakscycle.tcl | ||
| @@ -45,13 +45,17 @@ | ||
| 45 | 45 | |
| 46 | 46 | typemethod setup {} { |
| 47 | 47 | # Define the names and structure of the persistent state of |
| 48 | 48 | # this pass. |
| 49 | 49 | |
| 50 | - state reading revision | |
| 51 | - state reading changeset | |
| 52 | - state reading csitem | |
| 50 | + state use revision | |
| 51 | + state use tag | |
| 52 | + state use branch | |
| 53 | + state use symbol | |
| 54 | + state use changeset | |
| 55 | + state use csitem | |
| 56 | + state use cssuccessor | |
| 53 | 57 | return |
| 54 | 58 | } |
| 55 | 59 | |
| 56 | 60 | typemethod load {} { |
| 57 | 61 | # Pass manager interface. Executed to load data computed by |
| 58 | 62 |
| --- tools/cvs2fossil/lib/c2f_pbreakscycle.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pbreakscycle.tcl | |
| @@ -45,13 +45,17 @@ | |
| 45 | |
| 46 | typemethod setup {} { |
| 47 | # Define the names and structure of the persistent state of |
| 48 | # this pass. |
| 49 | |
| 50 | state reading revision |
| 51 | state reading changeset |
| 52 | state reading csitem |
| 53 | return |
| 54 | } |
| 55 | |
| 56 | typemethod load {} { |
| 57 | # Pass manager interface. Executed to load data computed by |
| 58 |
| --- tools/cvs2fossil/lib/c2f_pbreakscycle.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pbreakscycle.tcl | |
| @@ -45,13 +45,17 @@ | |
| 45 | |
| 46 | typemethod setup {} { |
| 47 | # Define the names and structure of the persistent state of |
| 48 | # this pass. |
| 49 | |
| 50 | state use revision |
| 51 | state use tag |
| 52 | state use branch |
| 53 | state use symbol |
| 54 | state use changeset |
| 55 | state use csitem |
| 56 | state use cssuccessor |
| 57 | return |
| 58 | } |
| 59 | |
| 60 | typemethod load {} { |
| 61 | # Pass manager interface. Executed to load data computed by |
| 62 |
| --- tools/cvs2fossil/lib/c2f_pcollar.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_pcollar.tcl | ||
| @@ -63,15 +63,15 @@ | ||
| 63 | 63 | # associated with the rcs archive. |
| 64 | 64 | |
| 65 | 65 | # Both projects and files are identified by globally unique |
| 66 | 66 | # integer ids, automatically assigned by the database. |
| 67 | 67 | |
| 68 | - state writing project { | |
| 68 | + state extend project { | |
| 69 | 69 | pid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 70 | 70 | name TEXT NOT NULL UNIQUE |
| 71 | 71 | } |
| 72 | - state writing file { | |
| 72 | + state extend file { | |
| 73 | 73 | fid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 74 | 74 | pid INTEGER NOT NULL REFERENCES project, -- project the file belongs to |
| 75 | 75 | name TEXT NOT NULL, |
| 76 | 76 | visible TEXT NOT NULL, |
| 77 | 77 | exec INTEGER NOT NULL, -- boolean, 'file executable'. |
| @@ -83,12 +83,12 @@ | ||
| 83 | 83 | typemethod load {} { |
| 84 | 84 | # Pass manager interface. Executed for all passes before the |
| 85 | 85 | # run passes, to load all data of their pass from the state, |
| 86 | 86 | # as if it had been computed by the pass itself. |
| 87 | 87 | |
| 88 | - state reading project | |
| 89 | - state reading file | |
| 88 | + state use project | |
| 89 | + state use file | |
| 90 | 90 | |
| 91 | 91 | repository load |
| 92 | 92 | return |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 |
| --- tools/cvs2fossil/lib/c2f_pcollar.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pcollar.tcl | |
| @@ -63,15 +63,15 @@ | |
| 63 | # associated with the rcs archive. |
| 64 | |
| 65 | # Both projects and files are identified by globally unique |
| 66 | # integer ids, automatically assigned by the database. |
| 67 | |
| 68 | state writing project { |
| 69 | pid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 70 | name TEXT NOT NULL UNIQUE |
| 71 | } |
| 72 | state writing file { |
| 73 | fid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 74 | pid INTEGER NOT NULL REFERENCES project, -- project the file belongs to |
| 75 | name TEXT NOT NULL, |
| 76 | visible TEXT NOT NULL, |
| 77 | exec INTEGER NOT NULL, -- boolean, 'file executable'. |
| @@ -83,12 +83,12 @@ | |
| 83 | typemethod load {} { |
| 84 | # Pass manager interface. Executed for all passes before the |
| 85 | # run passes, to load all data of their pass from the state, |
| 86 | # as if it had been computed by the pass itself. |
| 87 | |
| 88 | state reading project |
| 89 | state reading file |
| 90 | |
| 91 | repository load |
| 92 | return |
| 93 | } |
| 94 | |
| 95 |
| --- tools/cvs2fossil/lib/c2f_pcollar.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pcollar.tcl | |
| @@ -63,15 +63,15 @@ | |
| 63 | # associated with the rcs archive. |
| 64 | |
| 65 | # Both projects and files are identified by globally unique |
| 66 | # integer ids, automatically assigned by the database. |
| 67 | |
| 68 | state extend project { |
| 69 | pid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 70 | name TEXT NOT NULL UNIQUE |
| 71 | } |
| 72 | state extend file { |
| 73 | fid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 74 | pid INTEGER NOT NULL REFERENCES project, -- project the file belongs to |
| 75 | name TEXT NOT NULL, |
| 76 | visible TEXT NOT NULL, |
| 77 | exec INTEGER NOT NULL, -- boolean, 'file executable'. |
| @@ -83,12 +83,12 @@ | |
| 83 | typemethod load {} { |
| 84 | # Pass manager interface. Executed for all passes before the |
| 85 | # run passes, to load all data of their pass from the state, |
| 86 | # as if it had been computed by the pass itself. |
| 87 | |
| 88 | state use project |
| 89 | state use file |
| 90 | |
| 91 | repository load |
| 92 | return |
| 93 | } |
| 94 | |
| 95 |
+17
-17
| --- tools/cvs2fossil/lib/c2f_pcollrev.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_pcollrev.tcl | ||
| @@ -45,12 +45,12 @@ | ||
| 45 | 45 | |
| 46 | 46 | typemethod setup {} { |
| 47 | 47 | # Define names and structure of the persistent state of this |
| 48 | 48 | # pass. |
| 49 | 49 | |
| 50 | - state reading project | |
| 51 | - state reading file | |
| 50 | + state use project | |
| 51 | + state use file | |
| 52 | 52 | |
| 53 | 53 | # We deal with per project and per file data, the first |
| 54 | 54 | # collated from the second. |
| 55 | 55 | |
| 56 | 56 | # Per file we have general information, ..., and then |
| @@ -64,11 +64,11 @@ | ||
| 64 | 64 | # Pseudo class hierarchy |
| 65 | 65 | # Tag <- Symbol <- Event |
| 66 | 66 | # Branch <- Symbol <- Event |
| 67 | 67 | # Revision <- Event |
| 68 | 68 | |
| 69 | - state writing revision { | |
| 69 | + state extend revision { | |
| 70 | 70 | -- Revisions. Identified by a global numeric id each |
| 71 | 71 | -- belongs to a single file, identified by its id. It |
| 72 | 72 | -- further has a dotted revision number (DTN). |
| 73 | 73 | -- |
| 74 | 74 | -- Constraint: The dotted revision number is unique within |
| @@ -144,11 +144,11 @@ | ||
| 144 | 144 | clen INTEGER NOT NULL, |
| 145 | 145 | |
| 146 | 146 | UNIQUE (fid, rev) -- The DTN is unique within the revision's file. |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - state writing optype { | |
| 149 | + state extend optype { | |
| 150 | 150 | oid INTEGER NOT NULL PRIMARY KEY, |
| 151 | 151 | name TEXT NOT NULL, |
| 152 | 152 | UNIQUE(name) |
| 153 | 153 | } |
| 154 | 154 | state run { |
| @@ -156,11 +156,11 @@ | ||
| 156 | 156 | INSERT INTO optype VALUES ( 0,'nothing'); -- fixed pieces, see myopstate |
| 157 | 157 | INSERT INTO optype VALUES ( 1,'add'); -- in file::rev. myopcode is |
| 158 | 158 | INSERT INTO optype VALUES ( 2,'change'); -- loaded from this. |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - state writing revisionbranchchildren { | |
| 161 | + state extend revisionbranchchildren { | |
| 162 | 162 | -- The non-primary children of a revision, as reachable |
| 163 | 163 | -- through a branch symbol, are listed here. This is |
| 164 | 164 | -- needed by pass 5 to break internal dependencies in a |
| 165 | 165 | -- changeset. |
| 166 | 166 | |
| @@ -167,11 +167,11 @@ | ||
| 167 | 167 | rid INTEGER NOT NULL REFERENCES revision, |
| 168 | 168 | brid INTEGER NOT NULL REFERENCES revision, |
| 169 | 169 | UNIQUE(rid,brid) |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - state writing tag { | |
| 172 | + state extend tag { | |
| 173 | 173 | tid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 174 | 174 | fid INTEGER NOT NULL REFERENCES file, -- File the item belongs to |
| 175 | 175 | lod INTEGER REFERENCES symbol, -- Line of development (NULL => Trunk) |
| 176 | 176 | sid INTEGER NOT NULL REFERENCES symbol, -- Symbol capturing the tag |
| 177 | 177 | |
| @@ -178,11 +178,11 @@ | ||
| 178 | 178 | rev INTEGER NOT NULL REFERENCES revision -- The revision being tagged. |
| 179 | 179 | } { rev sid } |
| 180 | 180 | # Indices on: rev (revision successors) |
| 181 | 181 | # sid (tag predecessors, branch successors/predecessors) |
| 182 | 182 | |
| 183 | - state writing branch { | |
| 183 | + state extend branch { | |
| 184 | 184 | bid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 185 | 185 | fid INTEGER NOT NULL REFERENCES file, -- File the item belongs to |
| 186 | 186 | lod INTEGER REFERENCES symbol, -- Line of development (NULL => Trunk) |
| 187 | 187 | sid INTEGER NOT NULL REFERENCES symbol, -- Symbol capturing the branch |
| 188 | 188 | |
| @@ -207,11 +207,11 @@ | ||
| 207 | 207 | # |
| 208 | 208 | # pTrunk <- pLineOfDevelopment |
| 209 | 209 | # pBranch <- pSymbol, pLineOfDevelopment |
| 210 | 210 | # pTag <- pSymbol, pLineOfDevelopment |
| 211 | 211 | |
| 212 | - state writing symbol { | |
| 212 | + state extend symbol { | |
| 213 | 213 | sid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 214 | 214 | pid INTEGER NOT NULL REFERENCES project, -- Project the symbol belongs to |
| 215 | 215 | name TEXT NOT NULL, |
| 216 | 216 | type INTEGER NOT NULL REFERENCES symtype, -- enum { excluded = 0, tag, branch, undefined } |
| 217 | 217 | |
| @@ -220,30 +220,30 @@ | ||
| 220 | 220 | commit_count INTEGER NOT NULL, -- How often a file was committed on the symbol |
| 221 | 221 | |
| 222 | 222 | UNIQUE (pid, name) -- Symbols are unique within the project |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - state writing blocker { | |
| 225 | + state extend blocker { | |
| 226 | 226 | -- For each symbol we save which other symbols are |
| 227 | 227 | -- blocking its removal (if the user asks for it). |
| 228 | 228 | |
| 229 | 229 | sid INTEGER NOT NULL REFERENCES symbol, -- |
| 230 | 230 | bid INTEGER NOT NULL REFERENCES symbol, -- Sprouted from sid, blocks it. |
| 231 | 231 | UNIQUE (sid, bid) |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - state writing parent { | |
| 234 | + state extend parent { | |
| 235 | 235 | -- For each symbol we save which other symbols can act as |
| 236 | 236 | -- a possible parent in some file, and how often. |
| 237 | 237 | |
| 238 | 238 | sid INTEGER NOT NULL REFERENCES symbol, -- |
| 239 | 239 | pid INTEGER NOT NULL REFERENCES symbol, -- Possible parent of sid |
| 240 | 240 | n INTEGER NOT NULL, -- How often pid can act as parent. |
| 241 | 241 | UNIQUE (sid, pid) |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - state writing symtype { | |
| 244 | + state extend symtype { | |
| 245 | 245 | tid INTEGER NOT NULL PRIMARY KEY, |
| 246 | 246 | name TEXT NOT NULL, |
| 247 | 247 | plural TEXT NOT NULL, |
| 248 | 248 | UNIQUE (name) |
| 249 | 249 | UNIQUE (plural) |
| @@ -253,11 +253,11 @@ | ||
| 253 | 253 | INSERT INTO symtype VALUES (1,'tag', 'tags'); |
| 254 | 254 | INSERT INTO symtype VALUES (2,'branch', 'branches'); |
| 255 | 255 | INSERT INTO symtype VALUES (3,'undefined','undefined'); |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - state writing meta { | |
| 258 | + state extend meta { | |
| 259 | 259 | -- Meta data of revisions. See revision.mid for the |
| 260 | 260 | -- reference. Many revisions can share meta data. This is |
| 261 | 261 | -- actually one of the criterions used to sort revisions |
| 262 | 262 | -- into changesets. |
| 263 | 263 | |
| @@ -284,16 +284,16 @@ | ||
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | # Authors and commit messages are fully global, i.e. per |
| 287 | 287 | # repository. |
| 288 | 288 | |
| 289 | - state writing author { | |
| 289 | + state extend author { | |
| 290 | 290 | aid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 291 | 291 | name TEXT NOT NULL UNIQUE |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | - state writing cmessage { | |
| 294 | + state extend cmessage { | |
| 295 | 295 | cid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 296 | 296 | text TEXT NOT NULL UNIQUE |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | project::sym getsymtypes |
| @@ -300,13 +300,13 @@ | ||
| 300 | 300 | file::rev getopcodes |
| 301 | 301 | return |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | typemethod load {} { |
| 305 | - state reading symbol | |
| 306 | - state reading symtype | |
| 307 | - state reading optype | |
| 305 | + state use symbol | |
| 306 | + state use symtype | |
| 307 | + state use optype | |
| 308 | 308 | |
| 309 | 309 | project::sym getsymtypes |
| 310 | 310 | file::rev getopcodes |
| 311 | 311 | repository loadsymbols |
| 312 | 312 | return |
| 313 | 313 |
| --- tools/cvs2fossil/lib/c2f_pcollrev.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pcollrev.tcl | |
| @@ -45,12 +45,12 @@ | |
| 45 | |
| 46 | typemethod setup {} { |
| 47 | # Define names and structure of the persistent state of this |
| 48 | # pass. |
| 49 | |
| 50 | state reading project |
| 51 | state reading file |
| 52 | |
| 53 | # We deal with per project and per file data, the first |
| 54 | # collated from the second. |
| 55 | |
| 56 | # Per file we have general information, ..., and then |
| @@ -64,11 +64,11 @@ | |
| 64 | # Pseudo class hierarchy |
| 65 | # Tag <- Symbol <- Event |
| 66 | # Branch <- Symbol <- Event |
| 67 | # Revision <- Event |
| 68 | |
| 69 | state writing revision { |
| 70 | -- Revisions. Identified by a global numeric id each |
| 71 | -- belongs to a single file, identified by its id. It |
| 72 | -- further has a dotted revision number (DTN). |
| 73 | -- |
| 74 | -- Constraint: The dotted revision number is unique within |
| @@ -144,11 +144,11 @@ | |
| 144 | clen INTEGER NOT NULL, |
| 145 | |
| 146 | UNIQUE (fid, rev) -- The DTN is unique within the revision's file. |
| 147 | } |
| 148 | |
| 149 | state writing optype { |
| 150 | oid INTEGER NOT NULL PRIMARY KEY, |
| 151 | name TEXT NOT NULL, |
| 152 | UNIQUE(name) |
| 153 | } |
| 154 | state run { |
| @@ -156,11 +156,11 @@ | |
| 156 | INSERT INTO optype VALUES ( 0,'nothing'); -- fixed pieces, see myopstate |
| 157 | INSERT INTO optype VALUES ( 1,'add'); -- in file::rev. myopcode is |
| 158 | INSERT INTO optype VALUES ( 2,'change'); -- loaded from this. |
| 159 | } |
| 160 | |
| 161 | state writing revisionbranchchildren { |
| 162 | -- The non-primary children of a revision, as reachable |
| 163 | -- through a branch symbol, are listed here. This is |
| 164 | -- needed by pass 5 to break internal dependencies in a |
| 165 | -- changeset. |
| 166 | |
| @@ -167,11 +167,11 @@ | |
| 167 | rid INTEGER NOT NULL REFERENCES revision, |
| 168 | brid INTEGER NOT NULL REFERENCES revision, |
| 169 | UNIQUE(rid,brid) |
| 170 | } |
| 171 | |
| 172 | state writing tag { |
| 173 | tid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 174 | fid INTEGER NOT NULL REFERENCES file, -- File the item belongs to |
| 175 | lod INTEGER REFERENCES symbol, -- Line of development (NULL => Trunk) |
| 176 | sid INTEGER NOT NULL REFERENCES symbol, -- Symbol capturing the tag |
| 177 | |
| @@ -178,11 +178,11 @@ | |
| 178 | rev INTEGER NOT NULL REFERENCES revision -- The revision being tagged. |
| 179 | } { rev sid } |
| 180 | # Indices on: rev (revision successors) |
| 181 | # sid (tag predecessors, branch successors/predecessors) |
| 182 | |
| 183 | state writing branch { |
| 184 | bid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 185 | fid INTEGER NOT NULL REFERENCES file, -- File the item belongs to |
| 186 | lod INTEGER REFERENCES symbol, -- Line of development (NULL => Trunk) |
| 187 | sid INTEGER NOT NULL REFERENCES symbol, -- Symbol capturing the branch |
| 188 | |
| @@ -207,11 +207,11 @@ | |
| 207 | # |
| 208 | # pTrunk <- pLineOfDevelopment |
| 209 | # pBranch <- pSymbol, pLineOfDevelopment |
| 210 | # pTag <- pSymbol, pLineOfDevelopment |
| 211 | |
| 212 | state writing symbol { |
| 213 | sid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 214 | pid INTEGER NOT NULL REFERENCES project, -- Project the symbol belongs to |
| 215 | name TEXT NOT NULL, |
| 216 | type INTEGER NOT NULL REFERENCES symtype, -- enum { excluded = 0, tag, branch, undefined } |
| 217 | |
| @@ -220,30 +220,30 @@ | |
| 220 | commit_count INTEGER NOT NULL, -- How often a file was committed on the symbol |
| 221 | |
| 222 | UNIQUE (pid, name) -- Symbols are unique within the project |
| 223 | } |
| 224 | |
| 225 | state writing blocker { |
| 226 | -- For each symbol we save which other symbols are |
| 227 | -- blocking its removal (if the user asks for it). |
| 228 | |
| 229 | sid INTEGER NOT NULL REFERENCES symbol, -- |
| 230 | bid INTEGER NOT NULL REFERENCES symbol, -- Sprouted from sid, blocks it. |
| 231 | UNIQUE (sid, bid) |
| 232 | } |
| 233 | |
| 234 | state writing parent { |
| 235 | -- For each symbol we save which other symbols can act as |
| 236 | -- a possible parent in some file, and how often. |
| 237 | |
| 238 | sid INTEGER NOT NULL REFERENCES symbol, -- |
| 239 | pid INTEGER NOT NULL REFERENCES symbol, -- Possible parent of sid |
| 240 | n INTEGER NOT NULL, -- How often pid can act as parent. |
| 241 | UNIQUE (sid, pid) |
| 242 | } |
| 243 | |
| 244 | state writing symtype { |
| 245 | tid INTEGER NOT NULL PRIMARY KEY, |
| 246 | name TEXT NOT NULL, |
| 247 | plural TEXT NOT NULL, |
| 248 | UNIQUE (name) |
| 249 | UNIQUE (plural) |
| @@ -253,11 +253,11 @@ | |
| 253 | INSERT INTO symtype VALUES (1,'tag', 'tags'); |
| 254 | INSERT INTO symtype VALUES (2,'branch', 'branches'); |
| 255 | INSERT INTO symtype VALUES (3,'undefined','undefined'); |
| 256 | } |
| 257 | |
| 258 | state writing meta { |
| 259 | -- Meta data of revisions. See revision.mid for the |
| 260 | -- reference. Many revisions can share meta data. This is |
| 261 | -- actually one of the criterions used to sort revisions |
| 262 | -- into changesets. |
| 263 | |
| @@ -284,16 +284,16 @@ | |
| 284 | } |
| 285 | |
| 286 | # Authors and commit messages are fully global, i.e. per |
| 287 | # repository. |
| 288 | |
| 289 | state writing author { |
| 290 | aid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 291 | name TEXT NOT NULL UNIQUE |
| 292 | } |
| 293 | |
| 294 | state writing cmessage { |
| 295 | cid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 296 | text TEXT NOT NULL UNIQUE |
| 297 | } |
| 298 | |
| 299 | project::sym getsymtypes |
| @@ -300,13 +300,13 @@ | |
| 300 | file::rev getopcodes |
| 301 | return |
| 302 | } |
| 303 | |
| 304 | typemethod load {} { |
| 305 | state reading symbol |
| 306 | state reading symtype |
| 307 | state reading optype |
| 308 | |
| 309 | project::sym getsymtypes |
| 310 | file::rev getopcodes |
| 311 | repository loadsymbols |
| 312 | return |
| 313 |
| --- tools/cvs2fossil/lib/c2f_pcollrev.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pcollrev.tcl | |
| @@ -45,12 +45,12 @@ | |
| 45 | |
| 46 | typemethod setup {} { |
| 47 | # Define names and structure of the persistent state of this |
| 48 | # pass. |
| 49 | |
| 50 | state use project |
| 51 | state use file |
| 52 | |
| 53 | # We deal with per project and per file data, the first |
| 54 | # collated from the second. |
| 55 | |
| 56 | # Per file we have general information, ..., and then |
| @@ -64,11 +64,11 @@ | |
| 64 | # Pseudo class hierarchy |
| 65 | # Tag <- Symbol <- Event |
| 66 | # Branch <- Symbol <- Event |
| 67 | # Revision <- Event |
| 68 | |
| 69 | state extend revision { |
| 70 | -- Revisions. Identified by a global numeric id each |
| 71 | -- belongs to a single file, identified by its id. It |
| 72 | -- further has a dotted revision number (DTN). |
| 73 | -- |
| 74 | -- Constraint: The dotted revision number is unique within |
| @@ -144,11 +144,11 @@ | |
| 144 | clen INTEGER NOT NULL, |
| 145 | |
| 146 | UNIQUE (fid, rev) -- The DTN is unique within the revision's file. |
| 147 | } |
| 148 | |
| 149 | state extend optype { |
| 150 | oid INTEGER NOT NULL PRIMARY KEY, |
| 151 | name TEXT NOT NULL, |
| 152 | UNIQUE(name) |
| 153 | } |
| 154 | state run { |
| @@ -156,11 +156,11 @@ | |
| 156 | INSERT INTO optype VALUES ( 0,'nothing'); -- fixed pieces, see myopstate |
| 157 | INSERT INTO optype VALUES ( 1,'add'); -- in file::rev. myopcode is |
| 158 | INSERT INTO optype VALUES ( 2,'change'); -- loaded from this. |
| 159 | } |
| 160 | |
| 161 | state extend revisionbranchchildren { |
| 162 | -- The non-primary children of a revision, as reachable |
| 163 | -- through a branch symbol, are listed here. This is |
| 164 | -- needed by pass 5 to break internal dependencies in a |
| 165 | -- changeset. |
| 166 | |
| @@ -167,11 +167,11 @@ | |
| 167 | rid INTEGER NOT NULL REFERENCES revision, |
| 168 | brid INTEGER NOT NULL REFERENCES revision, |
| 169 | UNIQUE(rid,brid) |
| 170 | } |
| 171 | |
| 172 | state extend tag { |
| 173 | tid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 174 | fid INTEGER NOT NULL REFERENCES file, -- File the item belongs to |
| 175 | lod INTEGER REFERENCES symbol, -- Line of development (NULL => Trunk) |
| 176 | sid INTEGER NOT NULL REFERENCES symbol, -- Symbol capturing the tag |
| 177 | |
| @@ -178,11 +178,11 @@ | |
| 178 | rev INTEGER NOT NULL REFERENCES revision -- The revision being tagged. |
| 179 | } { rev sid } |
| 180 | # Indices on: rev (revision successors) |
| 181 | # sid (tag predecessors, branch successors/predecessors) |
| 182 | |
| 183 | state extend branch { |
| 184 | bid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 185 | fid INTEGER NOT NULL REFERENCES file, -- File the item belongs to |
| 186 | lod INTEGER REFERENCES symbol, -- Line of development (NULL => Trunk) |
| 187 | sid INTEGER NOT NULL REFERENCES symbol, -- Symbol capturing the branch |
| 188 | |
| @@ -207,11 +207,11 @@ | |
| 207 | # |
| 208 | # pTrunk <- pLineOfDevelopment |
| 209 | # pBranch <- pSymbol, pLineOfDevelopment |
| 210 | # pTag <- pSymbol, pLineOfDevelopment |
| 211 | |
| 212 | state extend symbol { |
| 213 | sid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 214 | pid INTEGER NOT NULL REFERENCES project, -- Project the symbol belongs to |
| 215 | name TEXT NOT NULL, |
| 216 | type INTEGER NOT NULL REFERENCES symtype, -- enum { excluded = 0, tag, branch, undefined } |
| 217 | |
| @@ -220,30 +220,30 @@ | |
| 220 | commit_count INTEGER NOT NULL, -- How often a file was committed on the symbol |
| 221 | |
| 222 | UNIQUE (pid, name) -- Symbols are unique within the project |
| 223 | } |
| 224 | |
| 225 | state extend blocker { |
| 226 | -- For each symbol we save which other symbols are |
| 227 | -- blocking its removal (if the user asks for it). |
| 228 | |
| 229 | sid INTEGER NOT NULL REFERENCES symbol, -- |
| 230 | bid INTEGER NOT NULL REFERENCES symbol, -- Sprouted from sid, blocks it. |
| 231 | UNIQUE (sid, bid) |
| 232 | } |
| 233 | |
| 234 | state extend parent { |
| 235 | -- For each symbol we save which other symbols can act as |
| 236 | -- a possible parent in some file, and how often. |
| 237 | |
| 238 | sid INTEGER NOT NULL REFERENCES symbol, -- |
| 239 | pid INTEGER NOT NULL REFERENCES symbol, -- Possible parent of sid |
| 240 | n INTEGER NOT NULL, -- How often pid can act as parent. |
| 241 | UNIQUE (sid, pid) |
| 242 | } |
| 243 | |
| 244 | state extend symtype { |
| 245 | tid INTEGER NOT NULL PRIMARY KEY, |
| 246 | name TEXT NOT NULL, |
| 247 | plural TEXT NOT NULL, |
| 248 | UNIQUE (name) |
| 249 | UNIQUE (plural) |
| @@ -253,11 +253,11 @@ | |
| 253 | INSERT INTO symtype VALUES (1,'tag', 'tags'); |
| 254 | INSERT INTO symtype VALUES (2,'branch', 'branches'); |
| 255 | INSERT INTO symtype VALUES (3,'undefined','undefined'); |
| 256 | } |
| 257 | |
| 258 | state extend meta { |
| 259 | -- Meta data of revisions. See revision.mid for the |
| 260 | -- reference. Many revisions can share meta data. This is |
| 261 | -- actually one of the criterions used to sort revisions |
| 262 | -- into changesets. |
| 263 | |
| @@ -284,16 +284,16 @@ | |
| 284 | } |
| 285 | |
| 286 | # Authors and commit messages are fully global, i.e. per |
| 287 | # repository. |
| 288 | |
| 289 | state extend author { |
| 290 | aid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 291 | name TEXT NOT NULL UNIQUE |
| 292 | } |
| 293 | |
| 294 | state extend cmessage { |
| 295 | cid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 296 | text TEXT NOT NULL UNIQUE |
| 297 | } |
| 298 | |
| 299 | project::sym getsymtypes |
| @@ -300,13 +300,13 @@ | |
| 300 | file::rev getopcodes |
| 301 | return |
| 302 | } |
| 303 | |
| 304 | typemethod load {} { |
| 305 | state use symbol |
| 306 | state use symtype |
| 307 | state use optype |
| 308 | |
| 309 | project::sym getsymtypes |
| 310 | file::rev getopcodes |
| 311 | repository loadsymbols |
| 312 | return |
| 313 |
| --- tools/cvs2fossil/lib/c2f_pcollsym.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_pcollsym.tcl | ||
| @@ -43,15 +43,17 @@ | ||
| 43 | 43 | |
| 44 | 44 | typemethod setup {} { |
| 45 | 45 | # Define names and structure of the persistent state of this |
| 46 | 46 | # pass. |
| 47 | 47 | |
| 48 | - state reading symbol | |
| 49 | - state reading blocker | |
| 50 | - state reading parent | |
| 48 | + state use project | |
| 49 | + state use symbol | |
| 50 | + state use symtype | |
| 51 | + state use blocker | |
| 52 | + state use parent | |
| 51 | 53 | |
| 52 | - state writing preferedparent { | |
| 54 | + state extend preferedparent { | |
| 53 | 55 | -- For each symbol the prefered parent. This describes the |
| 54 | 56 | -- tree of the found lines of development. Actually a |
| 55 | 57 | -- forest in case of multiple projects, with one tree per |
| 56 | 58 | -- project. |
| 57 | 59 | |
| 58 | 60 |
| --- tools/cvs2fossil/lib/c2f_pcollsym.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pcollsym.tcl | |
| @@ -43,15 +43,17 @@ | |
| 43 | |
| 44 | typemethod setup {} { |
| 45 | # Define names and structure of the persistent state of this |
| 46 | # pass. |
| 47 | |
| 48 | state reading symbol |
| 49 | state reading blocker |
| 50 | state reading parent |
| 51 | |
| 52 | state writing preferedparent { |
| 53 | -- For each symbol the prefered parent. This describes the |
| 54 | -- tree of the found lines of development. Actually a |
| 55 | -- forest in case of multiple projects, with one tree per |
| 56 | -- project. |
| 57 | |
| 58 |
| --- tools/cvs2fossil/lib/c2f_pcollsym.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pcollsym.tcl | |
| @@ -43,15 +43,17 @@ | |
| 43 | |
| 44 | typemethod setup {} { |
| 45 | # Define names and structure of the persistent state of this |
| 46 | # pass. |
| 47 | |
| 48 | state use project |
| 49 | state use symbol |
| 50 | state use symtype |
| 51 | state use blocker |
| 52 | state use parent |
| 53 | |
| 54 | state extend preferedparent { |
| 55 | -- For each symbol the prefered parent. This describes the |
| 56 | -- tree of the found lines of development. Actually a |
| 57 | -- forest in case of multiple projects, with one tree per |
| 58 | -- project. |
| 59 | |
| 60 |
+15
-10
| --- tools/cvs2fossil/lib/c2f_pfiltersym.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_pfiltersym.tcl | ||
| @@ -43,20 +43,25 @@ | ||
| 43 | 43 | |
| 44 | 44 | typemethod setup {} { |
| 45 | 45 | # Define names and structure of the persistent state of this |
| 46 | 46 | # pass. |
| 47 | 47 | |
| 48 | - state reading symbol | |
| 49 | - state reading blocker | |
| 50 | - state reading parent | |
| 51 | - state reading preferedparent | |
| 52 | - state reading revision | |
| 53 | - state reading revisionbranchchildren | |
| 54 | - state reading branch | |
| 55 | - state reading tag | |
| 56 | - | |
| 57 | - state writing noop { | |
| 48 | + state use project | |
| 49 | + state use file | |
| 50 | + state use revision | |
| 51 | + state use revisionbranchchildren | |
| 52 | + state use branch | |
| 53 | + state use tag | |
| 54 | + state use symbol | |
| 55 | + state use blocker | |
| 56 | + state use parent | |
| 57 | + state use author | |
| 58 | + state use cmessage | |
| 59 | + state use preferedparent | |
| 60 | + | |
| 61 | + # NOTE: So far no pass coming after this makes us of this information. | |
| 62 | + state extend noop { | |
| 58 | 63 | id INTEGER NOT NULL PRIMARY KEY, -- tag/branch reference |
| 59 | 64 | noop INTEGER NOT NULL |
| 60 | 65 | } |
| 61 | 66 | return |
| 62 | 67 | } |
| 63 | 68 |
| --- tools/cvs2fossil/lib/c2f_pfiltersym.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pfiltersym.tcl | |
| @@ -43,20 +43,25 @@ | |
| 43 | |
| 44 | typemethod setup {} { |
| 45 | # Define names and structure of the persistent state of this |
| 46 | # pass. |
| 47 | |
| 48 | state reading symbol |
| 49 | state reading blocker |
| 50 | state reading parent |
| 51 | state reading preferedparent |
| 52 | state reading revision |
| 53 | state reading revisionbranchchildren |
| 54 | state reading branch |
| 55 | state reading tag |
| 56 | |
| 57 | state writing noop { |
| 58 | id INTEGER NOT NULL PRIMARY KEY, -- tag/branch reference |
| 59 | noop INTEGER NOT NULL |
| 60 | } |
| 61 | return |
| 62 | } |
| 63 |
| --- tools/cvs2fossil/lib/c2f_pfiltersym.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pfiltersym.tcl | |
| @@ -43,20 +43,25 @@ | |
| 43 | |
| 44 | typemethod setup {} { |
| 45 | # Define names and structure of the persistent state of this |
| 46 | # pass. |
| 47 | |
| 48 | state use project |
| 49 | state use file |
| 50 | state use revision |
| 51 | state use revisionbranchchildren |
| 52 | state use branch |
| 53 | state use tag |
| 54 | state use symbol |
| 55 | state use blocker |
| 56 | state use parent |
| 57 | state use author |
| 58 | state use cmessage |
| 59 | state use preferedparent |
| 60 | |
| 61 | # NOTE: So far no pass coming after this makes us of this information. |
| 62 | state extend noop { |
| 63 | id INTEGER NOT NULL PRIMARY KEY, -- tag/branch reference |
| 64 | noop INTEGER NOT NULL |
| 65 | } |
| 66 | return |
| 67 | } |
| 68 |
+14
-12
| --- tools/cvs2fossil/lib/c2f_pinitcsets.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_pinitcsets.tcl | ||
| @@ -43,29 +43,31 @@ | ||
| 43 | 43 | |
| 44 | 44 | typemethod setup {} { |
| 45 | 45 | # Define the names and structure of the persistent state of |
| 46 | 46 | # this pass. |
| 47 | 47 | |
| 48 | - state reading meta | |
| 49 | - state reading revision | |
| 50 | - state reading revisionbranchchildren | |
| 51 | - state reading branch | |
| 52 | - state reading tag | |
| 53 | - state reading symbol | |
| 48 | + state use project | |
| 49 | + state use file | |
| 50 | + state use revision | |
| 51 | + state use revisionbranchchildren | |
| 52 | + state use branch | |
| 53 | + state use tag | |
| 54 | + state use symbol | |
| 55 | + state use meta | |
| 54 | 56 | |
| 55 | 57 | # Data per changeset, namely the project it belongs to, how it |
| 56 | 58 | # was induced (revision or symbol), plus reference to the |
| 57 | 59 | # primary entry causing it (meta entry or symbol). An adjunct |
| 58 | 60 | # table translates the type id's into human readable labels. |
| 59 | 61 | |
| 60 | - state writing changeset { | |
| 62 | + state extend changeset { | |
| 61 | 63 | cid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 62 | 64 | pid INTEGER NOT NULL REFERENCES project, |
| 63 | 65 | type INTEGER NOT NULL REFERENCES cstype, |
| 64 | 66 | src INTEGER NOT NULL -- REFERENCES meta|symbol (type dependent) |
| 65 | 67 | } |
| 66 | - state writing cstype { | |
| 68 | + state extend cstype { | |
| 67 | 69 | tid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 68 | 70 | name TEXT NOT NULL, |
| 69 | 71 | UNIQUE (name) |
| 70 | 72 | } |
| 71 | 73 | # Note: Keep the labels used here in sync with the names for |
| @@ -86,11 +88,11 @@ | ||
| 86 | 88 | # from disparate sources the same id may have different |
| 87 | 89 | # meaning, be in different changesets and so is formally not |
| 88 | 90 | # unique. So we can only say that it is unique within the |
| 89 | 91 | # changeset. The integrity module has stronger checks. |
| 90 | 92 | |
| 91 | - state writing csitem { | |
| 93 | + state extend csitem { | |
| 92 | 94 | cid INTEGER NOT NULL REFERENCES changeset, |
| 93 | 95 | pos INTEGER NOT NULL, |
| 94 | 96 | iid INTEGER NOT NULL, -- REFERENCES revision|tag|branch |
| 95 | 97 | UNIQUE (cid, pos), |
| 96 | 98 | UNIQUE (cid, iid) |
| @@ -104,13 +106,13 @@ | ||
| 104 | 106 | typemethod load {} { |
| 105 | 107 | # Pass manager interface. Executed to load data computed by |
| 106 | 108 | # this pass into memory when this pass is skipped instead of |
| 107 | 109 | # executed. |
| 108 | 110 | |
| 109 | - state reading changeset | |
| 110 | - state reading csitem | |
| 111 | - state reading cstype | |
| 111 | + state use changeset | |
| 112 | + state use csitem | |
| 113 | + state use cstype | |
| 112 | 114 | |
| 113 | 115 | # Need the types first, the constructor in the loop below uses |
| 114 | 116 | # them to assert the correctness of type names. |
| 115 | 117 | project::rev getcstypes |
| 116 | 118 | |
| 117 | 119 |
| --- tools/cvs2fossil/lib/c2f_pinitcsets.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pinitcsets.tcl | |
| @@ -43,29 +43,31 @@ | |
| 43 | |
| 44 | typemethod setup {} { |
| 45 | # Define the names and structure of the persistent state of |
| 46 | # this pass. |
| 47 | |
| 48 | state reading meta |
| 49 | state reading revision |
| 50 | state reading revisionbranchchildren |
| 51 | state reading branch |
| 52 | state reading tag |
| 53 | state reading symbol |
| 54 | |
| 55 | # Data per changeset, namely the project it belongs to, how it |
| 56 | # was induced (revision or symbol), plus reference to the |
| 57 | # primary entry causing it (meta entry or symbol). An adjunct |
| 58 | # table translates the type id's into human readable labels. |
| 59 | |
| 60 | state writing changeset { |
| 61 | cid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 62 | pid INTEGER NOT NULL REFERENCES project, |
| 63 | type INTEGER NOT NULL REFERENCES cstype, |
| 64 | src INTEGER NOT NULL -- REFERENCES meta|symbol (type dependent) |
| 65 | } |
| 66 | state writing cstype { |
| 67 | tid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 68 | name TEXT NOT NULL, |
| 69 | UNIQUE (name) |
| 70 | } |
| 71 | # Note: Keep the labels used here in sync with the names for |
| @@ -86,11 +88,11 @@ | |
| 86 | # from disparate sources the same id may have different |
| 87 | # meaning, be in different changesets and so is formally not |
| 88 | # unique. So we can only say that it is unique within the |
| 89 | # changeset. The integrity module has stronger checks. |
| 90 | |
| 91 | state writing csitem { |
| 92 | cid INTEGER NOT NULL REFERENCES changeset, |
| 93 | pos INTEGER NOT NULL, |
| 94 | iid INTEGER NOT NULL, -- REFERENCES revision|tag|branch |
| 95 | UNIQUE (cid, pos), |
| 96 | UNIQUE (cid, iid) |
| @@ -104,13 +106,13 @@ | |
| 104 | typemethod load {} { |
| 105 | # Pass manager interface. Executed to load data computed by |
| 106 | # this pass into memory when this pass is skipped instead of |
| 107 | # executed. |
| 108 | |
| 109 | state reading changeset |
| 110 | state reading csitem |
| 111 | state reading cstype |
| 112 | |
| 113 | # Need the types first, the constructor in the loop below uses |
| 114 | # them to assert the correctness of type names. |
| 115 | project::rev getcstypes |
| 116 | |
| 117 |
| --- tools/cvs2fossil/lib/c2f_pinitcsets.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pinitcsets.tcl | |
| @@ -43,29 +43,31 @@ | |
| 43 | |
| 44 | typemethod setup {} { |
| 45 | # Define the names and structure of the persistent state of |
| 46 | # this pass. |
| 47 | |
| 48 | state use project |
| 49 | state use file |
| 50 | state use revision |
| 51 | state use revisionbranchchildren |
| 52 | state use branch |
| 53 | state use tag |
| 54 | state use symbol |
| 55 | state use meta |
| 56 | |
| 57 | # Data per changeset, namely the project it belongs to, how it |
| 58 | # was induced (revision or symbol), plus reference to the |
| 59 | # primary entry causing it (meta entry or symbol). An adjunct |
| 60 | # table translates the type id's into human readable labels. |
| 61 | |
| 62 | state extend changeset { |
| 63 | cid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 64 | pid INTEGER NOT NULL REFERENCES project, |
| 65 | type INTEGER NOT NULL REFERENCES cstype, |
| 66 | src INTEGER NOT NULL -- REFERENCES meta|symbol (type dependent) |
| 67 | } |
| 68 | state extend cstype { |
| 69 | tid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 70 | name TEXT NOT NULL, |
| 71 | UNIQUE (name) |
| 72 | } |
| 73 | # Note: Keep the labels used here in sync with the names for |
| @@ -86,11 +88,11 @@ | |
| 88 | # from disparate sources the same id may have different |
| 89 | # meaning, be in different changesets and so is formally not |
| 90 | # unique. So we can only say that it is unique within the |
| 91 | # changeset. The integrity module has stronger checks. |
| 92 | |
| 93 | state extend csitem { |
| 94 | cid INTEGER NOT NULL REFERENCES changeset, |
| 95 | pos INTEGER NOT NULL, |
| 96 | iid INTEGER NOT NULL, -- REFERENCES revision|tag|branch |
| 97 | UNIQUE (cid, pos), |
| 98 | UNIQUE (cid, iid) |
| @@ -104,13 +106,13 @@ | |
| 106 | typemethod load {} { |
| 107 | # Pass manager interface. Executed to load data computed by |
| 108 | # this pass into memory when this pass is skipped instead of |
| 109 | # executed. |
| 110 | |
| 111 | state use changeset |
| 112 | state use csitem |
| 113 | state use cstype |
| 114 | |
| 115 | # Need the types first, the constructor in the loop below uses |
| 116 | # them to assert the correctness of type names. |
| 117 | project::rev getcstypes |
| 118 | |
| 119 |
| --- tools/cvs2fossil/lib/c2f_prtopsort.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_prtopsort.tcl | ||
| @@ -43,15 +43,18 @@ | ||
| 43 | 43 | |
| 44 | 44 | typemethod setup {} { |
| 45 | 45 | # Define the names and structure of the persistent state of |
| 46 | 46 | # this pass. |
| 47 | 47 | |
| 48 | - state reading revision | |
| 49 | - state reading changeset | |
| 50 | - state reading csitem | |
| 48 | + state use revision | |
| 49 | + state use symbol | |
| 50 | + state use changeset | |
| 51 | + state use csitem | |
| 52 | + state use cstype | |
| 53 | + state use cssuccessor | |
| 51 | 54 | |
| 52 | - state writing csorder { | |
| 55 | + state extend csorder { | |
| 53 | 56 | -- Commit order of the revision changesets based on their |
| 54 | 57 | -- dependencies |
| 55 | 58 | |
| 56 | 59 | cid INTEGER NOT NULL REFERENCES changeset, |
| 57 | 60 | pos INTEGER NOT NULL, |
| @@ -64,11 +67,11 @@ | ||
| 64 | 67 | typemethod load {} { |
| 65 | 68 | # Pass manager interface. Executed to load data computed by |
| 66 | 69 | # this pass into memory when this pass is skipped instead of |
| 67 | 70 | # executed. |
| 68 | 71 | |
| 69 | - state reading changeset | |
| 72 | + state use changeset | |
| 70 | 73 | project::rev loadcounter |
| 71 | 74 | return |
| 72 | 75 | } |
| 73 | 76 | |
| 74 | 77 | typemethod run {} { |
| 75 | 78 |
| --- tools/cvs2fossil/lib/c2f_prtopsort.tcl | |
| +++ tools/cvs2fossil/lib/c2f_prtopsort.tcl | |
| @@ -43,15 +43,18 @@ | |
| 43 | |
| 44 | typemethod setup {} { |
| 45 | # Define the names and structure of the persistent state of |
| 46 | # this pass. |
| 47 | |
| 48 | state reading revision |
| 49 | state reading changeset |
| 50 | state reading csitem |
| 51 | |
| 52 | state writing csorder { |
| 53 | -- Commit order of the revision changesets based on their |
| 54 | -- dependencies |
| 55 | |
| 56 | cid INTEGER NOT NULL REFERENCES changeset, |
| 57 | pos INTEGER NOT NULL, |
| @@ -64,11 +67,11 @@ | |
| 64 | typemethod load {} { |
| 65 | # Pass manager interface. Executed to load data computed by |
| 66 | # this pass into memory when this pass is skipped instead of |
| 67 | # executed. |
| 68 | |
| 69 | state reading changeset |
| 70 | project::rev loadcounter |
| 71 | return |
| 72 | } |
| 73 | |
| 74 | typemethod run {} { |
| 75 |
| --- tools/cvs2fossil/lib/c2f_prtopsort.tcl | |
| +++ tools/cvs2fossil/lib/c2f_prtopsort.tcl | |
| @@ -43,15 +43,18 @@ | |
| 43 | |
| 44 | typemethod setup {} { |
| 45 | # Define the names and structure of the persistent state of |
| 46 | # this pass. |
| 47 | |
| 48 | state use revision |
| 49 | state use symbol |
| 50 | state use changeset |
| 51 | state use csitem |
| 52 | state use cstype |
| 53 | state use cssuccessor |
| 54 | |
| 55 | state extend csorder { |
| 56 | -- Commit order of the revision changesets based on their |
| 57 | -- dependencies |
| 58 | |
| 59 | cid INTEGER NOT NULL REFERENCES changeset, |
| 60 | pos INTEGER NOT NULL, |
| @@ -64,11 +67,11 @@ | |
| 67 | typemethod load {} { |
| 68 | # Pass manager interface. Executed to load data computed by |
| 69 | # this pass into memory when this pass is skipped instead of |
| 70 | # executed. |
| 71 | |
| 72 | state use changeset |
| 73 | project::rev loadcounter |
| 74 | return |
| 75 | } |
| 76 | |
| 77 | typemethod run {} { |
| 78 |
+36
-16
| --- tools/cvs2fossil/lib/c2f_state.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_state.tcl | ||
| @@ -29,11 +29,11 @@ | ||
| 29 | 29 | |
| 30 | 30 | snit::type ::vc::fossil::import::cvs::state { |
| 31 | 31 | # # ## ### ##### ######## ############# |
| 32 | 32 | ## Public API |
| 33 | 33 | |
| 34 | - typemethod use {path} { | |
| 34 | + typemethod usedb {path} { | |
| 35 | 35 | # Immediate validation. There are are two possibilities to |
| 36 | 36 | # consider. The path exists or it doesn't. |
| 37 | 37 | |
| 38 | 38 | # In the first case it has to be a readable and writable file, |
| 39 | 39 | # and it has to be a proper sqlite database. Further checks |
| @@ -93,38 +93,41 @@ | ||
| 93 | 93 | if {$mypath eq ""} return |
| 94 | 94 | file delete $mypath |
| 95 | 95 | return |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - typemethod writing {name definition {indices {}}} { | |
| 99 | - # Method for a user to declare a table its needs for storing | |
| 100 | - # persistent state, and the expected structure. A possibly | |
| 101 | - # previously existing definition is dropped. | |
| 98 | + # Declare a table needed for the storing of persistent state, and | |
| 99 | + # its structure. A possibly previously existing definition is | |
| 100 | + # dropped. To be used when a table is needed and not assumed to | |
| 101 | + # exist from previous passes. | |
| 102 | 102 | |
| 103 | - log write 1 state "writing $name" ; # TODO move to level 5 or so | |
| 103 | + typemethod extend {name definition {indices {}}} { | |
| 104 | + log write 5 state "extend $name" | |
| 105 | + Save "extend $name ================================" | |
| 104 | 106 | |
| 105 | 107 | $mystate transaction { |
| 106 | 108 | catch { $mystate eval "DROP TABLE $name" } |
| 107 | 109 | $mystate eval "CREATE TABLE $name ( $definition )" |
| 108 | 110 | |
| 109 | 111 | set id 0 |
| 110 | 112 | foreach columns $indices { |
| 111 | - log write 1 state "index $name$id" ; # TODO move to level 5 or so | |
| 113 | + log write 5 state "index $name$id" | |
| 112 | 114 | |
| 113 | 115 | $mystate eval "CREATE INDEX ${name}$id ON ${name} ( [join $columns ,] )" |
| 114 | 116 | incr id |
| 115 | 117 | } |
| 116 | 118 | } |
| 117 | 119 | return |
| 118 | 120 | } |
| 119 | 121 | |
| 120 | - typemethod reading {name} { | |
| 121 | - log write 1 state "reading $name" ; # TODO move to level 5 or so | |
| 122 | + # Declare that a table is needed for reading from and/or storing | |
| 123 | + # to persistent state, and is assumed to already exist. A missing | |
| 124 | + # table is an internal error causing an immediate exit. | |
| 122 | 125 | |
| 123 | - # Method for a user to declare a table it wishes to read | |
| 124 | - # from. A missing table is an internal error causing an | |
| 125 | - # immediate exit. | |
| 126 | + typemethod use {name} { | |
| 127 | + log write 5 state "use $name" | |
| 128 | + Save "use $name ===================================" | |
| 126 | 129 | |
| 127 | 130 | set found [llength [$mystate eval { |
| 128 | 131 | SELECT name |
| 129 | 132 | FROM sqlite_master |
| 130 | 133 | WHERE type = 'table' |
| @@ -141,39 +144,56 @@ | ||
| 141 | 144 | |
| 142 | 145 | typemethod discard {name} { |
| 143 | 146 | # Method for a user to remove outdated information from the |
| 144 | 147 | # persistent state, table by table. |
| 145 | 148 | |
| 146 | - log write 1 state "discard $name" ; # TODO move to level 5 or so | |
| 149 | + log write 5 state "discard $name" | |
| 147 | 150 | |
| 148 | 151 | $mystate transaction { |
| 149 | 152 | catch { $mystate eval "DROP TABLE $name" } |
| 150 | 153 | } |
| 151 | 154 | return |
| 152 | 155 | } |
| 153 | 156 | |
| 154 | 157 | typemethod run {args} { |
| 158 | + Save $args | |
| 155 | 159 | return [uplevel 1 [linsert $args 0 $mystate eval]] |
| 156 | 160 | } |
| 157 | 161 | |
| 158 | 162 | typemethod one {args} { |
| 159 | - return [lindex [uplevel 1 [linsert $args 0 $mystate eval]] 0] | |
| 163 | + Save $args | |
| 164 | + return [uplevel 1 [linsert $args 0 $mystate onecolumn]] | |
| 160 | 165 | } |
| 161 | 166 | |
| 162 | 167 | typemethod transaction {script} { |
| 163 | 168 | return [uplevel 1 [list $mystate transaction $script]] |
| 164 | 169 | } |
| 165 | 170 | |
| 166 | 171 | typemethod id {} { |
| 167 | 172 | return [$mystate last_insert_rowid] |
| 168 | 173 | } |
| 174 | + | |
| 175 | + typemethod savequeriesto {path} { | |
| 176 | + set mysavepath $path | |
| 177 | + return | |
| 178 | + } | |
| 179 | + | |
| 180 | + # # ## ### ##### ######## ############# | |
| 181 | + | |
| 182 | + proc Save {text} { | |
| 183 | + ::variable mysavepath | |
| 184 | + if {$mysavepath eq ""} return | |
| 185 | + fileutil::appendToFile $mysavepath $text\n\n | |
| 186 | + return | |
| 187 | + } | |
| 169 | 188 | |
| 170 | 189 | # # ## ### ##### ######## ############# |
| 171 | 190 | ## State |
| 172 | 191 | |
| 173 | - typevariable mystate {} ; # Sqlite database (command) holding the converter state. | |
| 174 | - typevariable mypath {} ; # Path to the database, for cleanup of a temp database. | |
| 192 | + typevariable mystate {} ; # Sqlite database (command) holding the converter state. | |
| 193 | + typevariable mypath {} ; # Path to the database, for cleanup of a temp database. | |
| 194 | + typevariable mysavepath {} ; # Path where to save queries for introspection. | |
| 175 | 195 | |
| 176 | 196 | # # ## ### ##### ######## ############# |
| 177 | 197 | ## Internal methods |
| 178 | 198 | |
| 179 | 199 | |
| 180 | 200 |
| --- tools/cvs2fossil/lib/c2f_state.tcl | |
| +++ tools/cvs2fossil/lib/c2f_state.tcl | |
| @@ -29,11 +29,11 @@ | |
| 29 | |
| 30 | snit::type ::vc::fossil::import::cvs::state { |
| 31 | # # ## ### ##### ######## ############# |
| 32 | ## Public API |
| 33 | |
| 34 | typemethod use {path} { |
| 35 | # Immediate validation. There are are two possibilities to |
| 36 | # consider. The path exists or it doesn't. |
| 37 | |
| 38 | # In the first case it has to be a readable and writable file, |
| 39 | # and it has to be a proper sqlite database. Further checks |
| @@ -93,38 +93,41 @@ | |
| 93 | if {$mypath eq ""} return |
| 94 | file delete $mypath |
| 95 | return |
| 96 | } |
| 97 | |
| 98 | typemethod writing {name definition {indices {}}} { |
| 99 | # Method for a user to declare a table its needs for storing |
| 100 | # persistent state, and the expected structure. A possibly |
| 101 | # previously existing definition is dropped. |
| 102 | |
| 103 | log write 1 state "writing $name" ; # TODO move to level 5 or so |
| 104 | |
| 105 | $mystate transaction { |
| 106 | catch { $mystate eval "DROP TABLE $name" } |
| 107 | $mystate eval "CREATE TABLE $name ( $definition )" |
| 108 | |
| 109 | set id 0 |
| 110 | foreach columns $indices { |
| 111 | log write 1 state "index $name$id" ; # TODO move to level 5 or so |
| 112 | |
| 113 | $mystate eval "CREATE INDEX ${name}$id ON ${name} ( [join $columns ,] )" |
| 114 | incr id |
| 115 | } |
| 116 | } |
| 117 | return |
| 118 | } |
| 119 | |
| 120 | typemethod reading {name} { |
| 121 | log write 1 state "reading $name" ; # TODO move to level 5 or so |
| 122 | |
| 123 | # Method for a user to declare a table it wishes to read |
| 124 | # from. A missing table is an internal error causing an |
| 125 | # immediate exit. |
| 126 | |
| 127 | set found [llength [$mystate eval { |
| 128 | SELECT name |
| 129 | FROM sqlite_master |
| 130 | WHERE type = 'table' |
| @@ -141,39 +144,56 @@ | |
| 141 | |
| 142 | typemethod discard {name} { |
| 143 | # Method for a user to remove outdated information from the |
| 144 | # persistent state, table by table. |
| 145 | |
| 146 | log write 1 state "discard $name" ; # TODO move to level 5 or so |
| 147 | |
| 148 | $mystate transaction { |
| 149 | catch { $mystate eval "DROP TABLE $name" } |
| 150 | } |
| 151 | return |
| 152 | } |
| 153 | |
| 154 | typemethod run {args} { |
| 155 | return [uplevel 1 [linsert $args 0 $mystate eval]] |
| 156 | } |
| 157 | |
| 158 | typemethod one {args} { |
| 159 | return [lindex [uplevel 1 [linsert $args 0 $mystate eval]] 0] |
| 160 | } |
| 161 | |
| 162 | typemethod transaction {script} { |
| 163 | return [uplevel 1 [list $mystate transaction $script]] |
| 164 | } |
| 165 | |
| 166 | typemethod id {} { |
| 167 | return [$mystate last_insert_rowid] |
| 168 | } |
| 169 | |
| 170 | # # ## ### ##### ######## ############# |
| 171 | ## State |
| 172 | |
| 173 | typevariable mystate {} ; # Sqlite database (command) holding the converter state. |
| 174 | typevariable mypath {} ; # Path to the database, for cleanup of a temp database. |
| 175 | |
| 176 | # # ## ### ##### ######## ############# |
| 177 | ## Internal methods |
| 178 | |
| 179 | |
| 180 |
| --- tools/cvs2fossil/lib/c2f_state.tcl | |
| +++ tools/cvs2fossil/lib/c2f_state.tcl | |
| @@ -29,11 +29,11 @@ | |
| 29 | |
| 30 | snit::type ::vc::fossil::import::cvs::state { |
| 31 | # # ## ### ##### ######## ############# |
| 32 | ## Public API |
| 33 | |
| 34 | typemethod usedb {path} { |
| 35 | # Immediate validation. There are are two possibilities to |
| 36 | # consider. The path exists or it doesn't. |
| 37 | |
| 38 | # In the first case it has to be a readable and writable file, |
| 39 | # and it has to be a proper sqlite database. Further checks |
| @@ -93,38 +93,41 @@ | |
| 93 | if {$mypath eq ""} return |
| 94 | file delete $mypath |
| 95 | return |
| 96 | } |
| 97 | |
| 98 | # Declare a table needed for the storing of persistent state, and |
| 99 | # its structure. A possibly previously existing definition is |
| 100 | # dropped. To be used when a table is needed and not assumed to |
| 101 | # exist from previous passes. |
| 102 | |
| 103 | typemethod extend {name definition {indices {}}} { |
| 104 | log write 5 state "extend $name" |
| 105 | Save "extend $name ================================" |
| 106 | |
| 107 | $mystate transaction { |
| 108 | catch { $mystate eval "DROP TABLE $name" } |
| 109 | $mystate eval "CREATE TABLE $name ( $definition )" |
| 110 | |
| 111 | set id 0 |
| 112 | foreach columns $indices { |
| 113 | log write 5 state "index $name$id" |
| 114 | |
| 115 | $mystate eval "CREATE INDEX ${name}$id ON ${name} ( [join $columns ,] )" |
| 116 | incr id |
| 117 | } |
| 118 | } |
| 119 | return |
| 120 | } |
| 121 | |
| 122 | # Declare that a table is needed for reading from and/or storing |
| 123 | # to persistent state, and is assumed to already exist. A missing |
| 124 | # table is an internal error causing an immediate exit. |
| 125 | |
| 126 | typemethod use {name} { |
| 127 | log write 5 state "use $name" |
| 128 | Save "use $name ===================================" |
| 129 | |
| 130 | set found [llength [$mystate eval { |
| 131 | SELECT name |
| 132 | FROM sqlite_master |
| 133 | WHERE type = 'table' |
| @@ -141,39 +144,56 @@ | |
| 144 | |
| 145 | typemethod discard {name} { |
| 146 | # Method for a user to remove outdated information from the |
| 147 | # persistent state, table by table. |
| 148 | |
| 149 | log write 5 state "discard $name" |
| 150 | |
| 151 | $mystate transaction { |
| 152 | catch { $mystate eval "DROP TABLE $name" } |
| 153 | } |
| 154 | return |
| 155 | } |
| 156 | |
| 157 | typemethod run {args} { |
| 158 | Save $args |
| 159 | return [uplevel 1 [linsert $args 0 $mystate eval]] |
| 160 | } |
| 161 | |
| 162 | typemethod one {args} { |
| 163 | Save $args |
| 164 | return [uplevel 1 [linsert $args 0 $mystate onecolumn]] |
| 165 | } |
| 166 | |
| 167 | typemethod transaction {script} { |
| 168 | return [uplevel 1 [list $mystate transaction $script]] |
| 169 | } |
| 170 | |
| 171 | typemethod id {} { |
| 172 | return [$mystate last_insert_rowid] |
| 173 | } |
| 174 | |
| 175 | typemethod savequeriesto {path} { |
| 176 | set mysavepath $path |
| 177 | return |
| 178 | } |
| 179 | |
| 180 | # # ## ### ##### ######## ############# |
| 181 | |
| 182 | proc Save {text} { |
| 183 | ::variable mysavepath |
| 184 | if {$mysavepath eq ""} return |
| 185 | fileutil::appendToFile $mysavepath $text\n\n |
| 186 | return |
| 187 | } |
| 188 | |
| 189 | # # ## ### ##### ######## ############# |
| 190 | ## State |
| 191 | |
| 192 | typevariable mystate {} ; # Sqlite database (command) holding the converter state. |
| 193 | typevariable mypath {} ; # Path to the database, for cleanup of a temp database. |
| 194 | typevariable mysavepath {} ; # Path where to save queries for introspection. |
| 195 | |
| 196 | # # ## ### ##### ######## ############# |
| 197 | ## Internal methods |
| 198 | |
| 199 | |
| 200 |