Fossil SCM
Added code for the loading of pass II data (currently only the smybols) from the state when pass II is skipped.
Commit
c3d5104084f1efe90c40608171ef82969f7065de
Parent
77904c1f5170c66…
6 files changed
+18
-5
+4
+12
-3
+4
+40
-4
+6
| --- tools/cvs2fossil/lib/c2f_pcollrev.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_pcollrev.tcl | ||
| @@ -8,20 +8,18 @@ | ||
| 8 | 8 | # This software consists of voluntary contributions made by many |
| 9 | 9 | # individuals. For exact contribution history, see the revision |
| 10 | 10 | # history and logs, available at http://fossil-scm.hwaci.com/fossil |
| 11 | 11 | # # ## ### ##### ######## ############# ##################### |
| 12 | 12 | |
| 13 | -## Pass II. This pass parses the colected rcs archives and extracts | |
| 13 | +## Pass II. This pass parses the collected rcs archives and extracts | |
| 14 | 14 | ## all the information they contain (revisions, and symbols). |
| 15 | 15 | |
| 16 | 16 | # # ## ### ##### ######## ############# ##################### |
| 17 | 17 | ## Requirements |
| 18 | 18 | |
| 19 | 19 | package require Tcl 8.4 ; # Required runtime. |
| 20 | 20 | package require snit ; # OO system. |
| 21 | -package require fileutil::traverse ; # Directory traversal. | |
| 22 | -package require fileutil ; # File & path utilities. | |
| 23 | 21 | package require vc::tools::trouble ; # Error reporting. |
| 24 | 22 | package require vc::tools::log ; # User feedback. |
| 25 | 23 | package require vc::fossil::import::cvs::pass ; # Pass management. |
| 26 | 24 | package require vc::fossil::import::cvs::repository ; # Repository management. |
| 27 | 25 | package require vc::fossil::import::cvs::state ; # State storage. |
| @@ -176,11 +174,11 @@ | ||
| 176 | 174 | |
| 177 | 175 | state writing symbol { |
| 178 | 176 | sid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 179 | 177 | pid INTEGER NOT NULL REFERENCES project, -- Project the symbol belongs to |
| 180 | 178 | name TEXT NOT NULL, |
| 181 | - type INTEGER NOT NULL, -- enum { tag = 1, branch, undefined } | |
| 179 | + type INTEGER NOT NULL REFERENCES symtype, -- enum { excluded = 0, tag, branch, undefined } | |
| 182 | 180 | |
| 183 | 181 | tag_count INTEGER NOT NULL, -- How often the symbol is used as tag. |
| 184 | 182 | branch_count INTEGER NOT NULL, -- How often the symbol is used as branch |
| 185 | 183 | commit_count INTEGER NOT NULL, -- How often a file was committed on the symbol |
| 186 | 184 | |
| @@ -203,10 +201,22 @@ | ||
| 203 | 201 | sid INTEGER NOT NULL REFERENCES symbol, -- |
| 204 | 202 | pid INTEGER NOT NULL REFERENCES symbol, -- Possible parent of sid |
| 205 | 203 | n INTEGER NOT NULL, -- How often pid can act as parent. |
| 206 | 204 | UNIQUE (sid, pid) |
| 207 | 205 | } |
| 206 | + | |
| 207 | + state writing symtype { | |
| 208 | + tid INTEGER NOT NULL PRIMARY KEY, | |
| 209 | + name TEXT NOT NULL, | |
| 210 | + UNIQUE (name) | |
| 211 | + } | |
| 212 | + state run { | |
| 213 | + INSERT INTO symtype VALUES (0,'excluded'); | |
| 214 | + INSERT INTO symtype VALUES (1,'tag'); | |
| 215 | + INSERT INTO symtype VALUES (2,'branch'); | |
| 216 | + INSERT INTO symtype VALUES (3,'undefined'); | |
| 217 | + } | |
| 208 | 218 | |
| 209 | 219 | state writing meta { |
| 210 | 220 | -- Meta data of revisions. See revision.mid for the |
| 211 | 221 | -- reference. Many revisions can share meta data. This is |
| 212 | 222 | -- actually one of the criterions used to sort revisions |
| @@ -249,11 +259,13 @@ | ||
| 249 | 259 | |
| 250 | 260 | return |
| 251 | 261 | } |
| 252 | 262 | |
| 253 | 263 | typemethod load {} { |
| 254 | - # TODO | |
| 264 | + state reading symbol | |
| 265 | + | |
| 266 | + repository loadsymbols | |
| 255 | 267 | return |
| 256 | 268 | } |
| 257 | 269 | |
| 258 | 270 | typemethod run {} { |
| 259 | 271 | # Pass manager interface. Executed to perform the |
| @@ -313,10 +325,11 @@ | ||
| 313 | 325 | state discard tag |
| 314 | 326 | state discard branch |
| 315 | 327 | state discard symbol |
| 316 | 328 | state discard blocker |
| 317 | 329 | state discard parent |
| 330 | + state discard symtype | |
| 318 | 331 | state discard meta |
| 319 | 332 | state discard author |
| 320 | 333 | state discard cmessage |
| 321 | 334 | return |
| 322 | 335 | } |
| 323 | 336 |
| --- tools/cvs2fossil/lib/c2f_pcollrev.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pcollrev.tcl | |
| @@ -8,20 +8,18 @@ | |
| 8 | # This software consists of voluntary contributions made by many |
| 9 | # individuals. For exact contribution history, see the revision |
| 10 | # history and logs, available at http://fossil-scm.hwaci.com/fossil |
| 11 | # # ## ### ##### ######## ############# ##################### |
| 12 | |
| 13 | ## Pass II. This pass parses the colected rcs archives and extracts |
| 14 | ## all the information they contain (revisions, and symbols). |
| 15 | |
| 16 | # # ## ### ##### ######## ############# ##################### |
| 17 | ## Requirements |
| 18 | |
| 19 | package require Tcl 8.4 ; # Required runtime. |
| 20 | package require snit ; # OO system. |
| 21 | package require fileutil::traverse ; # Directory traversal. |
| 22 | package require fileutil ; # File & path utilities. |
| 23 | package require vc::tools::trouble ; # Error reporting. |
| 24 | package require vc::tools::log ; # User feedback. |
| 25 | package require vc::fossil::import::cvs::pass ; # Pass management. |
| 26 | package require vc::fossil::import::cvs::repository ; # Repository management. |
| 27 | package require vc::fossil::import::cvs::state ; # State storage. |
| @@ -176,11 +174,11 @@ | |
| 176 | |
| 177 | state writing symbol { |
| 178 | sid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 179 | pid INTEGER NOT NULL REFERENCES project, -- Project the symbol belongs to |
| 180 | name TEXT NOT NULL, |
| 181 | type INTEGER NOT NULL, -- enum { tag = 1, branch, undefined } |
| 182 | |
| 183 | tag_count INTEGER NOT NULL, -- How often the symbol is used as tag. |
| 184 | branch_count INTEGER NOT NULL, -- How often the symbol is used as branch |
| 185 | commit_count INTEGER NOT NULL, -- How often a file was committed on the symbol |
| 186 | |
| @@ -203,10 +201,22 @@ | |
| 203 | sid INTEGER NOT NULL REFERENCES symbol, -- |
| 204 | pid INTEGER NOT NULL REFERENCES symbol, -- Possible parent of sid |
| 205 | n INTEGER NOT NULL, -- How often pid can act as parent. |
| 206 | UNIQUE (sid, pid) |
| 207 | } |
| 208 | |
| 209 | state writing meta { |
| 210 | -- Meta data of revisions. See revision.mid for the |
| 211 | -- reference. Many revisions can share meta data. This is |
| 212 | -- actually one of the criterions used to sort revisions |
| @@ -249,11 +259,13 @@ | |
| 249 | |
| 250 | return |
| 251 | } |
| 252 | |
| 253 | typemethod load {} { |
| 254 | # TODO |
| 255 | return |
| 256 | } |
| 257 | |
| 258 | typemethod run {} { |
| 259 | # Pass manager interface. Executed to perform the |
| @@ -313,10 +325,11 @@ | |
| 313 | state discard tag |
| 314 | state discard branch |
| 315 | state discard symbol |
| 316 | state discard blocker |
| 317 | state discard parent |
| 318 | state discard meta |
| 319 | state discard author |
| 320 | state discard cmessage |
| 321 | return |
| 322 | } |
| 323 |
| --- tools/cvs2fossil/lib/c2f_pcollrev.tcl | |
| +++ tools/cvs2fossil/lib/c2f_pcollrev.tcl | |
| @@ -8,20 +8,18 @@ | |
| 8 | # This software consists of voluntary contributions made by many |
| 9 | # individuals. For exact contribution history, see the revision |
| 10 | # history and logs, available at http://fossil-scm.hwaci.com/fossil |
| 11 | # # ## ### ##### ######## ############# ##################### |
| 12 | |
| 13 | ## Pass II. This pass parses the collected rcs archives and extracts |
| 14 | ## all the information they contain (revisions, and symbols). |
| 15 | |
| 16 | # # ## ### ##### ######## ############# ##################### |
| 17 | ## Requirements |
| 18 | |
| 19 | package require Tcl 8.4 ; # Required runtime. |
| 20 | package require snit ; # OO system. |
| 21 | package require vc::tools::trouble ; # Error reporting. |
| 22 | package require vc::tools::log ; # User feedback. |
| 23 | package require vc::fossil::import::cvs::pass ; # Pass management. |
| 24 | package require vc::fossil::import::cvs::repository ; # Repository management. |
| 25 | package require vc::fossil::import::cvs::state ; # State storage. |
| @@ -176,11 +174,11 @@ | |
| 174 | |
| 175 | state writing symbol { |
| 176 | sid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
| 177 | pid INTEGER NOT NULL REFERENCES project, -- Project the symbol belongs to |
| 178 | name TEXT NOT NULL, |
| 179 | type INTEGER NOT NULL REFERENCES symtype, -- enum { excluded = 0, tag, branch, undefined } |
| 180 | |
| 181 | tag_count INTEGER NOT NULL, -- How often the symbol is used as tag. |
| 182 | branch_count INTEGER NOT NULL, -- How often the symbol is used as branch |
| 183 | commit_count INTEGER NOT NULL, -- How often a file was committed on the symbol |
| 184 | |
| @@ -203,10 +201,22 @@ | |
| 201 | sid INTEGER NOT NULL REFERENCES symbol, -- |
| 202 | pid INTEGER NOT NULL REFERENCES symbol, -- Possible parent of sid |
| 203 | n INTEGER NOT NULL, -- How often pid can act as parent. |
| 204 | UNIQUE (sid, pid) |
| 205 | } |
| 206 | |
| 207 | state writing symtype { |
| 208 | tid INTEGER NOT NULL PRIMARY KEY, |
| 209 | name TEXT NOT NULL, |
| 210 | UNIQUE (name) |
| 211 | } |
| 212 | state run { |
| 213 | INSERT INTO symtype VALUES (0,'excluded'); |
| 214 | INSERT INTO symtype VALUES (1,'tag'); |
| 215 | INSERT INTO symtype VALUES (2,'branch'); |
| 216 | INSERT INTO symtype VALUES (3,'undefined'); |
| 217 | } |
| 218 | |
| 219 | state writing meta { |
| 220 | -- Meta data of revisions. See revision.mid for the |
| 221 | -- reference. Many revisions can share meta data. This is |
| 222 | -- actually one of the criterions used to sort revisions |
| @@ -249,11 +259,13 @@ | |
| 259 | |
| 260 | return |
| 261 | } |
| 262 | |
| 263 | typemethod load {} { |
| 264 | state reading symbol |
| 265 | |
| 266 | repository loadsymbols |
| 267 | return |
| 268 | } |
| 269 | |
| 270 | typemethod run {} { |
| 271 | # Pass manager interface. Executed to perform the |
| @@ -313,10 +325,11 @@ | |
| 325 | state discard tag |
| 326 | state discard branch |
| 327 | state discard symbol |
| 328 | state discard blocker |
| 329 | state discard parent |
| 330 | state discard symtype |
| 331 | state discard meta |
| 332 | state discard author |
| 333 | state discard cmessage |
| 334 | return |
| 335 | } |
| 336 |
| --- tools/cvs2fossil/lib/c2f_project.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_project.tcl | ||
| @@ -77,10 +77,14 @@ | ||
| 77 | 77 | set mysymbol($name) \ |
| 78 | 78 | [sym %AUTO% $name [$myrepository defsymbol $myid $name] $self] |
| 79 | 79 | } |
| 80 | 80 | return $mysymbol($name) |
| 81 | 81 | } |
| 82 | + | |
| 83 | + method hassymbol {name} { | |
| 84 | + return [info exists mysymbol($name)] | |
| 85 | + } | |
| 82 | 86 | |
| 83 | 87 | method purgeghostsymbols {} { |
| 84 | 88 | set changes 1 |
| 85 | 89 | while {$changes} { |
| 86 | 90 | set changes 0 |
| 87 | 91 |
| --- tools/cvs2fossil/lib/c2f_project.tcl | |
| +++ tools/cvs2fossil/lib/c2f_project.tcl | |
| @@ -77,10 +77,14 @@ | |
| 77 | set mysymbol($name) \ |
| 78 | [sym %AUTO% $name [$myrepository defsymbol $myid $name] $self] |
| 79 | } |
| 80 | return $mysymbol($name) |
| 81 | } |
| 82 | |
| 83 | method purgeghostsymbols {} { |
| 84 | set changes 1 |
| 85 | while {$changes} { |
| 86 | set changes 0 |
| 87 |
| --- tools/cvs2fossil/lib/c2f_project.tcl | |
| +++ tools/cvs2fossil/lib/c2f_project.tcl | |
| @@ -77,10 +77,14 @@ | |
| 77 | set mysymbol($name) \ |
| 78 | [sym %AUTO% $name [$myrepository defsymbol $myid $name] $self] |
| 79 | } |
| 80 | return $mysymbol($name) |
| 81 | } |
| 82 | |
| 83 | method hassymbol {name} { |
| 84 | return [info exists mysymbol($name)] |
| 85 | } |
| 86 | |
| 87 | method purgeghostsymbols {} { |
| 88 | set changes 1 |
| 89 | while {$changes} { |
| 90 | set changes 0 |
| 91 |
+12
-3
| --- tools/cvs2fossil/lib/c2f_psym.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_psym.tcl | ||
| @@ -37,10 +37,17 @@ | ||
| 37 | 37 | method name {} { return $myname } |
| 38 | 38 | method id {} { return $myid } |
| 39 | 39 | |
| 40 | 40 | # # ## ### ##### ######## ############# |
| 41 | 41 | ## Symbol statistics |
| 42 | + | |
| 43 | + method defcounts {tc bc cc} { | |
| 44 | + set mybranchcount $tc | |
| 45 | + set mytagcount $bc | |
| 46 | + set mycommitcount $cc | |
| 47 | + return | |
| 48 | + } | |
| 42 | 49 | |
| 43 | 50 | method countasbranch {} { incr mybranchcount ; return } |
| 44 | 51 | method countastag {} { incr mytagcount ; return } |
| 45 | 52 | method countacommit {} { incr mycommitcount ; return } |
| 46 | 53 | |
| @@ -120,13 +127,15 @@ | ||
| 120 | 127 | |
| 121 | 128 | variable mypparent -array {} ; # Maps from symbols to the number |
| 122 | 129 | # of files in which it could have |
| 123 | 130 | # been a parent of this symbol. |
| 124 | 131 | |
| 125 | - typevariable mytag 1 ; # Code for symbols which are tags. | |
| 126 | - typevariable mybranch 2 ; # Code for symbols which are branches. | |
| 127 | - typevariable myundef 3 ; # Code for symbols of unknown type. | |
| 132 | + # Keep the codes below in sync with 'pass::collrev/setup('symtype'). | |
| 133 | + typevariable myexcluded 0 ; # Code for symbols which are excluded. | |
| 134 | + typevariable mytag 1 ; # Code for symbols which are tags. | |
| 135 | + typevariable mybranch 2 ; # Code for symbols which are branches. | |
| 136 | + typevariable myundef 3 ; # Code for symbols of unknown type. | |
| 128 | 137 | |
| 129 | 138 | # # ## ### ##### ######## ############# |
| 130 | 139 | ## Internal methods |
| 131 | 140 | |
| 132 | 141 | # # ## ### ##### ######## ############# |
| 133 | 142 |
| --- tools/cvs2fossil/lib/c2f_psym.tcl | |
| +++ tools/cvs2fossil/lib/c2f_psym.tcl | |
| @@ -37,10 +37,17 @@ | |
| 37 | method name {} { return $myname } |
| 38 | method id {} { return $myid } |
| 39 | |
| 40 | # # ## ### ##### ######## ############# |
| 41 | ## Symbol statistics |
| 42 | |
| 43 | method countasbranch {} { incr mybranchcount ; return } |
| 44 | method countastag {} { incr mytagcount ; return } |
| 45 | method countacommit {} { incr mycommitcount ; return } |
| 46 | |
| @@ -120,13 +127,15 @@ | |
| 120 | |
| 121 | variable mypparent -array {} ; # Maps from symbols to the number |
| 122 | # of files in which it could have |
| 123 | # been a parent of this symbol. |
| 124 | |
| 125 | typevariable mytag 1 ; # Code for symbols which are tags. |
| 126 | typevariable mybranch 2 ; # Code for symbols which are branches. |
| 127 | typevariable myundef 3 ; # Code for symbols of unknown type. |
| 128 | |
| 129 | # # ## ### ##### ######## ############# |
| 130 | ## Internal methods |
| 131 | |
| 132 | # # ## ### ##### ######## ############# |
| 133 |
| --- tools/cvs2fossil/lib/c2f_psym.tcl | |
| +++ tools/cvs2fossil/lib/c2f_psym.tcl | |
| @@ -37,10 +37,17 @@ | |
| 37 | method name {} { return $myname } |
| 38 | method id {} { return $myid } |
| 39 | |
| 40 | # # ## ### ##### ######## ############# |
| 41 | ## Symbol statistics |
| 42 | |
| 43 | method defcounts {tc bc cc} { |
| 44 | set mybranchcount $tc |
| 45 | set mytagcount $bc |
| 46 | set mycommitcount $cc |
| 47 | return |
| 48 | } |
| 49 | |
| 50 | method countasbranch {} { incr mybranchcount ; return } |
| 51 | method countastag {} { incr mytagcount ; return } |
| 52 | method countacommit {} { incr mycommitcount ; return } |
| 53 | |
| @@ -120,13 +127,15 @@ | |
| 127 | |
| 128 | variable mypparent -array {} ; # Maps from symbols to the number |
| 129 | # of files in which it could have |
| 130 | # been a parent of this symbol. |
| 131 | |
| 132 | # Keep the codes below in sync with 'pass::collrev/setup('symtype'). |
| 133 | typevariable myexcluded 0 ; # Code for symbols which are excluded. |
| 134 | typevariable mytag 1 ; # Code for symbols which are tags. |
| 135 | typevariable mybranch 2 ; # Code for symbols which are branches. |
| 136 | typevariable myundef 3 ; # Code for symbols of unknown type. |
| 137 | |
| 138 | # # ## ### ##### ######## ############# |
| 139 | ## Internal methods |
| 140 | |
| 141 | # # ## ### ##### ######## ############# |
| 142 |
| --- tools/cvs2fossil/lib/c2f_ptrunk.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_ptrunk.tcl | ||
| @@ -37,10 +37,14 @@ | ||
| 37 | 37 | |
| 38 | 38 | method name {} { return $myname } |
| 39 | 39 | method id {} { return $myid } |
| 40 | 40 | method istrunk {} { return 1 } |
| 41 | 41 | method symbol {} { return $self } |
| 42 | + | |
| 43 | + method forceid {id} { set myid $id ; return } | |
| 44 | + | |
| 45 | + method defcounts {tc bc cc} {} | |
| 42 | 46 | |
| 43 | 47 | method countasbranch {} {} |
| 44 | 48 | method countastag {} {} |
| 45 | 49 | method countacommit {} {} |
| 46 | 50 | |
| 47 | 51 |
| --- tools/cvs2fossil/lib/c2f_ptrunk.tcl | |
| +++ tools/cvs2fossil/lib/c2f_ptrunk.tcl | |
| @@ -37,10 +37,14 @@ | |
| 37 | |
| 38 | method name {} { return $myname } |
| 39 | method id {} { return $myid } |
| 40 | method istrunk {} { return 1 } |
| 41 | method symbol {} { return $self } |
| 42 | |
| 43 | method countasbranch {} {} |
| 44 | method countastag {} {} |
| 45 | method countacommit {} {} |
| 46 | |
| 47 |
| --- tools/cvs2fossil/lib/c2f_ptrunk.tcl | |
| +++ tools/cvs2fossil/lib/c2f_ptrunk.tcl | |
| @@ -37,10 +37,14 @@ | |
| 37 | |
| 38 | method name {} { return $myname } |
| 39 | method id {} { return $myid } |
| 40 | method istrunk {} { return 1 } |
| 41 | method symbol {} { return $self } |
| 42 | |
| 43 | method forceid {id} { set myid $id ; return } |
| 44 | |
| 45 | method defcounts {tc bc cc} {} |
| 46 | |
| 47 | method countasbranch {} {} |
| 48 | method countastag {} {} |
| 49 | method countacommit {} {} |
| 50 | |
| 51 |
| --- tools/cvs2fossil/lib/c2f_repository.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_repository.tcl | ||
| @@ -138,23 +138,25 @@ | ||
| 138 | 138 | } |
| 139 | 139 | return |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | typemethod load {} { |
| 143 | - array set pr {} | |
| 144 | 143 | state transaction { |
| 145 | 144 | foreach {pid name} [state run { |
| 146 | 145 | SELECT pid, name FROM project ; |
| 147 | 146 | }] { |
| 147 | + set project [project %AUTO% $name $type] | |
| 148 | + | |
| 148 | 149 | lappend myprojpaths $name |
| 149 | - lappend myprojects [set pr($pid) [project %AUTO% $name $type]] | |
| 150 | - $pr($pid) setid $pid | |
| 150 | + lappend myprojects $project | |
| 151 | + set myprojmap($pid) $project | |
| 152 | + $project setid $pid | |
| 151 | 153 | } |
| 152 | 154 | foreach {fid pid name visible exec} [state run { |
| 153 | 155 | SELECT fid, pid, name, visible, exec FROM file ; |
| 154 | 156 | }] { |
| 155 | - $pr($pid) addfile $name $visible $exec $fid | |
| 157 | + $myprojmap($pid) addfile $name $visible $exec $fid | |
| 156 | 158 | } |
| 157 | 159 | } |
| 158 | 160 | return |
| 159 | 161 | } |
| 160 | 162 | |
| @@ -176,19 +178,53 @@ | ||
| 176 | 178 | SaveMeta |
| 177 | 179 | foreach p [TheProjects] { $p persistrev } |
| 178 | 180 | } |
| 179 | 181 | return |
| 180 | 182 | } |
| 183 | + | |
| 184 | + typemethod loadsymbols {} { | |
| 185 | + state transaction { | |
| 186 | + # We load the symbol ids at large to have the mapping | |
| 187 | + # right from the beginning. | |
| 188 | + | |
| 189 | + foreach {sid pid name tc bc cc} [state run { | |
| 190 | + SELECT sid, pid, name, tag_count, branch_count, commit_count | |
| 191 | + FROM symbol | |
| 192 | + ; | |
| 193 | + }] { | |
| 194 | + $mysymbol map $sid [list $pid $name] | |
| 195 | + set project $myprojmap($pid) | |
| 196 | + | |
| 197 | + set force [$project hassymbol $name] | |
| 198 | + set symbol [$project getsymbol $name] | |
| 199 | + | |
| 200 | + # Forcing happens only for the trunks. | |
| 201 | + if {$force} { $symbol forceid $sid } | |
| 202 | + | |
| 203 | + # Set the loaded counts. | |
| 204 | + $symbol defcounts $tc $bc $cc | |
| 205 | + | |
| 206 | + # Note: The type is neither retrieved nor set, for | |
| 207 | + # this is used to load the pass II data, which means | |
| 208 | + # that everything is 'undefined' at this point anyway. | |
| 209 | + | |
| 210 | + # future: $symbol load (blockers, and parents) | |
| 211 | + } | |
| 212 | + } | |
| 213 | + return | |
| 214 | + } | |
| 181 | 215 | |
| 182 | 216 | # # ## ### ##### ######## ############# |
| 183 | 217 | ## State |
| 184 | 218 | |
| 185 | 219 | typevariable mybase {} ; # Base path to CVS repository. |
| 186 | 220 | typevariable myprojpaths {} ; # List of paths to all declared |
| 187 | 221 | # projects, relative to mybase. |
| 188 | 222 | typevariable myprojects {} ; # List of objects for all |
| 189 | 223 | # declared projects. |
| 224 | + typevariable myprojmap -array {} ; # Map from project ids to their | |
| 225 | + # objects. | |
| 190 | 226 | typevariable myauthor {} ; # Names of all authors found, |
| 191 | 227 | # maps to their ids. |
| 192 | 228 | typevariable mycmsg {} ; # All commit messages found, |
| 193 | 229 | # maps to their ids. |
| 194 | 230 | typevariable mymeta {} ; # Maps all meta data tuples |
| 195 | 231 |
| --- tools/cvs2fossil/lib/c2f_repository.tcl | |
| +++ tools/cvs2fossil/lib/c2f_repository.tcl | |
| @@ -138,23 +138,25 @@ | |
| 138 | } |
| 139 | return |
| 140 | } |
| 141 | |
| 142 | typemethod load {} { |
| 143 | array set pr {} |
| 144 | state transaction { |
| 145 | foreach {pid name} [state run { |
| 146 | SELECT pid, name FROM project ; |
| 147 | }] { |
| 148 | lappend myprojpaths $name |
| 149 | lappend myprojects [set pr($pid) [project %AUTO% $name $type]] |
| 150 | $pr($pid) setid $pid |
| 151 | } |
| 152 | foreach {fid pid name visible exec} [state run { |
| 153 | SELECT fid, pid, name, visible, exec FROM file ; |
| 154 | }] { |
| 155 | $pr($pid) addfile $name $visible $exec $fid |
| 156 | } |
| 157 | } |
| 158 | return |
| 159 | } |
| 160 | |
| @@ -176,19 +178,53 @@ | |
| 176 | SaveMeta |
| 177 | foreach p [TheProjects] { $p persistrev } |
| 178 | } |
| 179 | return |
| 180 | } |
| 181 | |
| 182 | # # ## ### ##### ######## ############# |
| 183 | ## State |
| 184 | |
| 185 | typevariable mybase {} ; # Base path to CVS repository. |
| 186 | typevariable myprojpaths {} ; # List of paths to all declared |
| 187 | # projects, relative to mybase. |
| 188 | typevariable myprojects {} ; # List of objects for all |
| 189 | # declared projects. |
| 190 | typevariable myauthor {} ; # Names of all authors found, |
| 191 | # maps to their ids. |
| 192 | typevariable mycmsg {} ; # All commit messages found, |
| 193 | # maps to their ids. |
| 194 | typevariable mymeta {} ; # Maps all meta data tuples |
| 195 |
| --- tools/cvs2fossil/lib/c2f_repository.tcl | |
| +++ tools/cvs2fossil/lib/c2f_repository.tcl | |
| @@ -138,23 +138,25 @@ | |
| 138 | } |
| 139 | return |
| 140 | } |
| 141 | |
| 142 | typemethod load {} { |
| 143 | state transaction { |
| 144 | foreach {pid name} [state run { |
| 145 | SELECT pid, name FROM project ; |
| 146 | }] { |
| 147 | set project [project %AUTO% $name $type] |
| 148 | |
| 149 | lappend myprojpaths $name |
| 150 | lappend myprojects $project |
| 151 | set myprojmap($pid) $project |
| 152 | $project setid $pid |
| 153 | } |
| 154 | foreach {fid pid name visible exec} [state run { |
| 155 | SELECT fid, pid, name, visible, exec FROM file ; |
| 156 | }] { |
| 157 | $myprojmap($pid) addfile $name $visible $exec $fid |
| 158 | } |
| 159 | } |
| 160 | return |
| 161 | } |
| 162 | |
| @@ -176,19 +178,53 @@ | |
| 178 | SaveMeta |
| 179 | foreach p [TheProjects] { $p persistrev } |
| 180 | } |
| 181 | return |
| 182 | } |
| 183 | |
| 184 | typemethod loadsymbols {} { |
| 185 | state transaction { |
| 186 | # We load the symbol ids at large to have the mapping |
| 187 | # right from the beginning. |
| 188 | |
| 189 | foreach {sid pid name tc bc cc} [state run { |
| 190 | SELECT sid, pid, name, tag_count, branch_count, commit_count |
| 191 | FROM symbol |
| 192 | ; |
| 193 | }] { |
| 194 | $mysymbol map $sid [list $pid $name] |
| 195 | set project $myprojmap($pid) |
| 196 | |
| 197 | set force [$project hassymbol $name] |
| 198 | set symbol [$project getsymbol $name] |
| 199 | |
| 200 | # Forcing happens only for the trunks. |
| 201 | if {$force} { $symbol forceid $sid } |
| 202 | |
| 203 | # Set the loaded counts. |
| 204 | $symbol defcounts $tc $bc $cc |
| 205 | |
| 206 | # Note: The type is neither retrieved nor set, for |
| 207 | # this is used to load the pass II data, which means |
| 208 | # that everything is 'undefined' at this point anyway. |
| 209 | |
| 210 | # future: $symbol load (blockers, and parents) |
| 211 | } |
| 212 | } |
| 213 | return |
| 214 | } |
| 215 | |
| 216 | # # ## ### ##### ######## ############# |
| 217 | ## State |
| 218 | |
| 219 | typevariable mybase {} ; # Base path to CVS repository. |
| 220 | typevariable myprojpaths {} ; # List of paths to all declared |
| 221 | # projects, relative to mybase. |
| 222 | typevariable myprojects {} ; # List of objects for all |
| 223 | # declared projects. |
| 224 | typevariable myprojmap -array {} ; # Map from project ids to their |
| 225 | # objects. |
| 226 | typevariable myauthor {} ; # Names of all authors found, |
| 227 | # maps to their ids. |
| 228 | typevariable mycmsg {} ; # All commit messages found, |
| 229 | # maps to their ids. |
| 230 | typevariable mymeta {} ; # Maps all meta data tuples |
| 231 |
| --- tools/cvs2fossil/lib/id.tcl | ||
| +++ tools/cvs2fossil/lib/id.tcl | ||
| @@ -32,10 +32,16 @@ | ||
| 32 | 32 | set mydata($key) $mycounter |
| 33 | 33 | set myinvert($mycounter) $key |
| 34 | 34 | |
| 35 | 35 | return $mycounter |
| 36 | 36 | } |
| 37 | + | |
| 38 | + # Explicitly load the database with a mapping. | |
| 39 | + method map {id key} { | |
| 40 | + set mydata($key) $id | |
| 41 | + set myinvert($id) $key | |
| 42 | + } | |
| 37 | 43 | |
| 38 | 44 | method keyof {id} { return $myinvert($id) } |
| 39 | 45 | method get {} { return [array get mydata] } |
| 40 | 46 | |
| 41 | 47 | # # ## ### ##### ######## ############# |
| 42 | 48 |
| --- tools/cvs2fossil/lib/id.tcl | |
| +++ tools/cvs2fossil/lib/id.tcl | |
| @@ -32,10 +32,16 @@ | |
| 32 | set mydata($key) $mycounter |
| 33 | set myinvert($mycounter) $key |
| 34 | |
| 35 | return $mycounter |
| 36 | } |
| 37 | |
| 38 | method keyof {id} { return $myinvert($id) } |
| 39 | method get {} { return [array get mydata] } |
| 40 | |
| 41 | # # ## ### ##### ######## ############# |
| 42 |
| --- tools/cvs2fossil/lib/id.tcl | |
| +++ tools/cvs2fossil/lib/id.tcl | |
| @@ -32,10 +32,16 @@ | |
| 32 | set mydata($key) $mycounter |
| 33 | set myinvert($mycounter) $key |
| 34 | |
| 35 | return $mycounter |
| 36 | } |
| 37 | |
| 38 | # Explicitly load the database with a mapping. |
| 39 | method map {id key} { |
| 40 | set mydata($key) $id |
| 41 | set myinvert($id) $key |
| 42 | } |
| 43 | |
| 44 | method keyof {id} { return $myinvert($id) } |
| 45 | method get {} { return [array get mydata] } |
| 46 | |
| 47 | # # ## ### ##### ######## ############# |
| 48 |