Fossil SCM
Extended pass manager to handle the skipped and defered passes coming before and after the actually executed passes. Extended passes I and II to have the required methods. Implemented loading (for skipped passes) as skeletons, implemented discarding (for defered passes) completely. Extended state manager with ability to discard state.
Commit
ae19c0fcb4c72ed82a4bb6354cbbbced11aeed74
Parent
27470a9304a6123…
4 files changed
+15
-4
+23
+27
+12
+15
-4
| --- tools/cvs2fossil/lib/c2f_pass.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_pass.tcl | ||
| @@ -95,27 +95,38 @@ | ||
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | typemethod run {} { |
| 99 | 99 | if {$mystart < 0} {set mystart 0} |
| 100 | - if {$myend < 0} {set myend end} | |
| 100 | + if {$myend < 0} {set myend [expr {[llength $mypasses] - 1}]} | |
| 101 | 101 | |
| 102 | - set runlist [lrange $mypasses $mystart $myend] | |
| 103 | 102 | # TODO: Timing statistics for the passes. |
| 104 | 103 | # TODO: Artifact manager (clean after pass?. need to know skipped/defered passes ?) |
| 105 | 104 | # TODO: |
| 106 | 105 | # TODO: |
| 107 | 106 | |
| 108 | - foreach p $runlist { | |
| 107 | + set skipped [lrange $mypasses 0 [expr {$mystart - 1}]] | |
| 108 | + set run [lrange $mypasses $mystart $myend] | |
| 109 | + set defered [lrange $mypasses [expr {$myend + 1}] end] | |
| 110 | + | |
| 111 | + foreach p $skipped { | |
| 112 | + log write 0 pass "Skip $p" | |
| 113 | + Call $p load | |
| 114 | + } | |
| 115 | + foreach p $run { | |
| 109 | 116 | log write 0 pass "Setup $p" |
| 110 | 117 | Call $p setup |
| 111 | 118 | } |
| 112 | - foreach p $runlist { | |
| 119 | + foreach p $run { | |
| 113 | 120 | log write 0 pass "Begin $p" |
| 114 | 121 | Call $p run |
| 115 | 122 | log write 0 pass "Done $p" |
| 116 | 123 | trouble abort? |
| 124 | + } | |
| 125 | + foreach p $defered { | |
| 126 | + log write 0 pass "Defer $p" | |
| 127 | + Call $p discard | |
| 117 | 128 | } |
| 118 | 129 | |
| 119 | 130 | state release |
| 120 | 131 | return |
| 121 | 132 | } |
| 122 | 133 |
| --- tools/cvs2fossil/lib/c2f_pass.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pass.tcl | |
| @@ -95,27 +95,38 @@ | |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | typemethod run {} { |
| 99 | if {$mystart < 0} {set mystart 0} |
| 100 | if {$myend < 0} {set myend end} |
| 101 | |
| 102 | set runlist [lrange $mypasses $mystart $myend] |
| 103 | # TODO: Timing statistics for the passes. |
| 104 | # TODO: Artifact manager (clean after pass?. need to know skipped/defered passes ?) |
| 105 | # TODO: |
| 106 | # TODO: |
| 107 | |
| 108 | foreach p $runlist { |
| 109 | log write 0 pass "Setup $p" |
| 110 | Call $p setup |
| 111 | } |
| 112 | foreach p $runlist { |
| 113 | log write 0 pass "Begin $p" |
| 114 | Call $p run |
| 115 | log write 0 pass "Done $p" |
| 116 | trouble abort? |
| 117 | } |
| 118 | |
| 119 | state release |
| 120 | return |
| 121 | } |
| 122 |
| --- tools/cvs2fossil/lib/c2f_pass.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pass.tcl | |
| @@ -95,27 +95,38 @@ | |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | typemethod run {} { |
| 99 | if {$mystart < 0} {set mystart 0} |
| 100 | if {$myend < 0} {set myend [expr {[llength $mypasses] - 1}]} |
| 101 | |
| 102 | # TODO: Timing statistics for the passes. |
| 103 | # TODO: Artifact manager (clean after pass?. need to know skipped/defered passes ?) |
| 104 | # TODO: |
| 105 | # TODO: |
| 106 | |
| 107 | set skipped [lrange $mypasses 0 [expr {$mystart - 1}]] |
| 108 | set run [lrange $mypasses $mystart $myend] |
| 109 | set defered [lrange $mypasses [expr {$myend + 1}] end] |
| 110 | |
| 111 | foreach p $skipped { |
| 112 | log write 0 pass "Skip $p" |
| 113 | Call $p load |
| 114 | } |
| 115 | foreach p $run { |
| 116 | log write 0 pass "Setup $p" |
| 117 | Call $p setup |
| 118 | } |
| 119 | foreach p $run { |
| 120 | log write 0 pass "Begin $p" |
| 121 | Call $p run |
| 122 | log write 0 pass "Done $p" |
| 123 | trouble abort? |
| 124 | } |
| 125 | foreach p $defered { |
| 126 | log write 0 pass "Defer $p" |
| 127 | Call $p discard |
| 128 | } |
| 129 | |
| 130 | state release |
| 131 | return |
| 132 | } |
| 133 |
| --- tools/cvs2fossil/lib/c2f_pcollar.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_pcollar.tcl | ||
| @@ -77,12 +77,25 @@ | ||
| 77 | 77 | exec INTEGER NOT NULL, -- boolean, 'file executable'. |
| 78 | 78 | UNIQUE (pid, name) -- file names are unique within a project |
| 79 | 79 | } |
| 80 | 80 | return |
| 81 | 81 | } |
| 82 | + | |
| 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 | + return | |
| 91 | + } | |
| 82 | 92 | |
| 83 | 93 | typemethod run {} { |
| 94 | + # Pass manager interface. Executed to perform the | |
| 95 | + # functionality of the pass. | |
| 96 | + | |
| 84 | 97 | set rbase [repository base?] |
| 85 | 98 | foreach project [repository projects] { |
| 86 | 99 | set base [file join $rbase [$project base]] |
| 87 | 100 | log write 1 collar "Scan $base" |
| 88 | 101 | |
| @@ -126,10 +139,20 @@ | ||
| 126 | 139 | repository persist |
| 127 | 140 | |
| 128 | 141 | log write 1 collar "Scan completed" |
| 129 | 142 | return |
| 130 | 143 | } |
| 144 | + | |
| 145 | + typemethod discard {} { | |
| 146 | + # Pass manager interface. Executed for all passes after the | |
| 147 | + # run passes, to remove all data of this pass from the state, | |
| 148 | + # as being out of date. | |
| 149 | + | |
| 150 | + state discard project | |
| 151 | + state discard file | |
| 152 | + return | |
| 153 | + } | |
| 131 | 154 | |
| 132 | 155 | typemethod ignore_conflicting_attics {} { |
| 133 | 156 | set myignore 1 |
| 134 | 157 | return |
| 135 | 158 | } |
| 136 | 159 |
| --- tools/cvs2fossil/lib/c2f_pcollar.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pcollar.tcl | |
| @@ -77,12 +77,25 @@ | |
| 77 | exec INTEGER NOT NULL, -- boolean, 'file executable'. |
| 78 | UNIQUE (pid, name) -- file names are unique within a project |
| 79 | } |
| 80 | return |
| 81 | } |
| 82 | |
| 83 | typemethod run {} { |
| 84 | set rbase [repository base?] |
| 85 | foreach project [repository projects] { |
| 86 | set base [file join $rbase [$project base]] |
| 87 | log write 1 collar "Scan $base" |
| 88 | |
| @@ -126,10 +139,20 @@ | |
| 126 | repository persist |
| 127 | |
| 128 | log write 1 collar "Scan completed" |
| 129 | return |
| 130 | } |
| 131 | |
| 132 | typemethod ignore_conflicting_attics {} { |
| 133 | set myignore 1 |
| 134 | return |
| 135 | } |
| 136 |
| --- tools/cvs2fossil/lib/c2f_pcollar.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pcollar.tcl | |
| @@ -77,12 +77,25 @@ | |
| 77 | exec INTEGER NOT NULL, -- boolean, 'file executable'. |
| 78 | UNIQUE (pid, name) -- file names are unique within a project |
| 79 | } |
| 80 | return |
| 81 | } |
| 82 | |
| 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 | return |
| 91 | } |
| 92 | |
| 93 | typemethod run {} { |
| 94 | # Pass manager interface. Executed to perform the |
| 95 | # functionality of the pass. |
| 96 | |
| 97 | set rbase [repository base?] |
| 98 | foreach project [repository projects] { |
| 99 | set base [file join $rbase [$project base]] |
| 100 | log write 1 collar "Scan $base" |
| 101 | |
| @@ -126,10 +139,20 @@ | |
| 139 | repository persist |
| 140 | |
| 141 | log write 1 collar "Scan completed" |
| 142 | return |
| 143 | } |
| 144 | |
| 145 | typemethod discard {} { |
| 146 | # Pass manager interface. Executed for all passes after the |
| 147 | # run passes, to remove all data of this pass from the state, |
| 148 | # as being out of date. |
| 149 | |
| 150 | state discard project |
| 151 | state discard file |
| 152 | return |
| 153 | } |
| 154 | |
| 155 | typemethod ignore_conflicting_attics {} { |
| 156 | set myignore 1 |
| 157 | return |
| 158 | } |
| 159 |
| --- tools/cvs2fossil/lib/c2f_pcollrev.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_pcollrev.tcl | ||
| @@ -180,12 +180,20 @@ | ||
| 180 | 180 | # other. I.e. items may not refer to items or symbols which |
| 181 | 181 | # belong to a different project than their own. |
| 182 | 182 | |
| 183 | 183 | return |
| 184 | 184 | } |
| 185 | + | |
| 186 | + typemethod load {} { | |
| 187 | + # TODO | |
| 188 | + return | |
| 189 | + } | |
| 185 | 190 | |
| 186 | 191 | typemethod run {} { |
| 192 | + # Pass manager interface. Executed to perform the | |
| 193 | + # functionality of the pass. | |
| 194 | + | |
| 187 | 195 | set rbase [repository base?] |
| 188 | 196 | foreach project [repository projects] { |
| 189 | 197 | set base [file join $rbase [$project base]] |
| 190 | 198 | log write 1 collrev "Processing $base" |
| 191 | 199 | |
| @@ -210,10 +218,29 @@ | ||
| 210 | 218 | repository persistrev |
| 211 | 219 | |
| 212 | 220 | log write 1 collrev "Scan completed" |
| 213 | 221 | return |
| 214 | 222 | } |
| 223 | + | |
| 224 | + typemethod discard {} { | |
| 225 | + # Pass manager interface. Executed for all passes after the | |
| 226 | + # run passes, to remove all data of this pass from the state, | |
| 227 | + # as being out of date. | |
| 228 | + | |
| 229 | + state discard rcs | |
| 230 | + state discard item | |
| 231 | + state discard revision | |
| 232 | + state discard tag | |
| 233 | + state discard branch | |
| 234 | + state discard symbol | |
| 235 | + state discard blocker | |
| 236 | + state discard parent | |
| 237 | + state discard meta | |
| 238 | + state discard author | |
| 239 | + state discard cmessage | |
| 240 | + return | |
| 241 | + } | |
| 215 | 242 | |
| 216 | 243 | # # ## ### ##### ######## ############# |
| 217 | 244 | ## Internal methods |
| 218 | 245 | |
| 219 | 246 | # # ## ### ##### ######## ############# |
| 220 | 247 |
| --- tools/cvs2fossil/lib/c2f_pcollrev.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pcollrev.tcl | |
| @@ -180,12 +180,20 @@ | |
| 180 | # other. I.e. items may not refer to items or symbols which |
| 181 | # belong to a different project than their own. |
| 182 | |
| 183 | return |
| 184 | } |
| 185 | |
| 186 | typemethod run {} { |
| 187 | set rbase [repository base?] |
| 188 | foreach project [repository projects] { |
| 189 | set base [file join $rbase [$project base]] |
| 190 | log write 1 collrev "Processing $base" |
| 191 | |
| @@ -210,10 +218,29 @@ | |
| 210 | repository persistrev |
| 211 | |
| 212 | log write 1 collrev "Scan completed" |
| 213 | return |
| 214 | } |
| 215 | |
| 216 | # # ## ### ##### ######## ############# |
| 217 | ## Internal methods |
| 218 | |
| 219 | # # ## ### ##### ######## ############# |
| 220 |
| --- tools/cvs2fossil/lib/c2f_pcollrev.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pcollrev.tcl | |
| @@ -180,12 +180,20 @@ | |
| 180 | # other. I.e. items may not refer to items or symbols which |
| 181 | # belong to a different project than their own. |
| 182 | |
| 183 | return |
| 184 | } |
| 185 | |
| 186 | typemethod load {} { |
| 187 | # TODO |
| 188 | return |
| 189 | } |
| 190 | |
| 191 | typemethod run {} { |
| 192 | # Pass manager interface. Executed to perform the |
| 193 | # functionality of the pass. |
| 194 | |
| 195 | set rbase [repository base?] |
| 196 | foreach project [repository projects] { |
| 197 | set base [file join $rbase [$project base]] |
| 198 | log write 1 collrev "Processing $base" |
| 199 | |
| @@ -210,10 +218,29 @@ | |
| 218 | repository persistrev |
| 219 | |
| 220 | log write 1 collrev "Scan completed" |
| 221 | return |
| 222 | } |
| 223 | |
| 224 | typemethod discard {} { |
| 225 | # Pass manager interface. Executed for all passes after the |
| 226 | # run passes, to remove all data of this pass from the state, |
| 227 | # as being out of date. |
| 228 | |
| 229 | state discard rcs |
| 230 | state discard item |
| 231 | state discard revision |
| 232 | state discard tag |
| 233 | state discard branch |
| 234 | state discard symbol |
| 235 | state discard blocker |
| 236 | state discard parent |
| 237 | state discard meta |
| 238 | state discard author |
| 239 | state discard cmessage |
| 240 | return |
| 241 | } |
| 242 | |
| 243 | # # ## ### ##### ######## ############# |
| 244 | ## Internal methods |
| 245 | |
| 246 | # # ## ### ##### ######## ############# |
| 247 |
| --- tools/cvs2fossil/lib/c2f_state.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_state.tcl | ||
| @@ -126,10 +126,22 @@ | ||
| 126 | 126 | |
| 127 | 127 | if {$found} return |
| 128 | 128 | |
| 129 | 129 | trouble internal "The required table \"$name\" is not defined." |
| 130 | 130 | # Not reached |
| 131 | + return | |
| 132 | + } | |
| 133 | + | |
| 134 | + typemethod discard {name} { | |
| 135 | + # Method for a user to remove outdated information from the | |
| 136 | + # persistent state, table by table. | |
| 137 | + | |
| 138 | + log write 0 state "discard $name" ; # TODO move to level 5 or so | |
| 139 | + | |
| 140 | + $mystate transaction { | |
| 141 | + catch { $mystate eval "DROP TABLE $name" } | |
| 142 | + } | |
| 131 | 143 | return |
| 132 | 144 | } |
| 133 | 145 | |
| 134 | 146 | typemethod run {args} { |
| 135 | 147 | return [uplevel 1 [linsert $args 0 $mystate eval]] |
| 136 | 148 |
| --- tools/cvs2fossil/lib/c2f_state.tcl | |
| +++ tools/cvs2fossil/lib/c2f_state.tcl | |
| @@ -126,10 +126,22 @@ | |
| 126 | |
| 127 | if {$found} return |
| 128 | |
| 129 | trouble internal "The required table \"$name\" is not defined." |
| 130 | # Not reached |
| 131 | return |
| 132 | } |
| 133 | |
| 134 | typemethod run {args} { |
| 135 | return [uplevel 1 [linsert $args 0 $mystate eval]] |
| 136 |
| --- tools/cvs2fossil/lib/c2f_state.tcl | |
| +++ tools/cvs2fossil/lib/c2f_state.tcl | |
| @@ -126,10 +126,22 @@ | |
| 126 | |
| 127 | if {$found} return |
| 128 | |
| 129 | trouble internal "The required table \"$name\" is not defined." |
| 130 | # Not reached |
| 131 | return |
| 132 | } |
| 133 | |
| 134 | typemethod discard {name} { |
| 135 | # Method for a user to remove outdated information from the |
| 136 | # persistent state, table by table. |
| 137 | |
| 138 | log write 0 state "discard $name" ; # TODO move to level 5 or so |
| 139 | |
| 140 | $mystate transaction { |
| 141 | catch { $mystate eval "DROP TABLE $name" } |
| 142 | } |
| 143 | return |
| 144 | } |
| 145 | |
| 146 | typemethod run {args} { |
| 147 | return [uplevel 1 [linsert $args 0 $mystate eval]] |
| 148 |