Fossil SCM
Continued work on pass II, starting to post-process tags, branches, and revisions, cleaning up cvs quirks, determining higher-level aggregates ...
Commit
e5441b908ddf48ae32e27661a93b5b9cfc3fd63b
Parent
67c24820c7b0915…
5 files changed
+64
-8
+38
-1
+36
-5
+17
-10
+3
+64
-8
| --- tools/cvs2fossil/lib/c2f_file.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_file.tcl | ||
| @@ -33,10 +33,11 @@ | ||
| 33 | 33 | |
| 34 | 34 | constructor {path executable project} { |
| 35 | 35 | set mypath $path |
| 36 | 36 | set myexecutable $executable |
| 37 | 37 | set myproject $project |
| 38 | + set mytrunk [$myproject trunk] | |
| 38 | 39 | return |
| 39 | 40 | } |
| 40 | 41 | |
| 41 | 42 | method path {} { return $mypath } |
| 42 | 43 | method project {} { return $myproject } |
| @@ -151,18 +152,23 @@ | ||
| 151 | 152 | log write 1 file "In file $mypath : Duplicate delta data for revision $revnr" |
| 152 | 153 | log write 1 file "Ignoring the duplicate" |
| 153 | 154 | return |
| 154 | 155 | } |
| 155 | 156 | |
| 156 | - if {[rev istrunkrevnr $revnr]} { | |
| 157 | - set branchid {} | |
| 158 | - } else { | |
| 159 | - set branchid [[$self Rev2Branch $revnr] id] | |
| 160 | - } | |
| 157 | + # Determine the line of development for the revision (project | |
| 158 | + # level). This gives us the branchid too, required for the | |
| 159 | + # meta data group the revision is in. (Note: By putting both | |
| 160 | + # branch/lod and project information into the group we ensure | |
| 161 | + # that any cross-project and cross-branch commits are | |
| 162 | + # separated into multiple commits, one in each of the projects | |
| 163 | + # and/or branches). | |
| 164 | + | |
| 165 | + set lod [GetLOD $revnr] | |
| 161 | 166 | |
| 162 | - $rev setmeta [$myproject defmeta $branchid $myaid($revnr) $cmid] | |
| 167 | + $rev setmeta [$myproject defmeta [$lod id] $myaid($revnr) $cmid] | |
| 163 | 168 | $rev settext $textrange |
| 169 | + $rev setlod $lod | |
| 164 | 170 | |
| 165 | 171 | # If this is revision 1.1, we have to determine whether the |
| 166 | 172 | # file seems to have been created through 'cvs add' instead of |
| 167 | 173 | # 'cvs import'. This can be done by looking at the un- |
| 168 | 174 | # adulterated commit message, as CVS uses a hardwired magic |
| @@ -180,11 +186,21 @@ | ||
| 180 | 186 | |
| 181 | 187 | lappend myrevisions $rev |
| 182 | 188 | return |
| 183 | 189 | } |
| 184 | 190 | |
| 185 | - method done {} {} | |
| 191 | + method done {} { | |
| 192 | + # Complete the revisions, branches, and tags. This includes | |
| 193 | + # looking for a non-trunk default branch, marking its members | |
| 194 | + # and linking them into the trunk. | |
| 195 | + | |
| 196 | + DetermineRevisionOperations | |
| 197 | + DetermineLinesOfDevelopment | |
| 198 | + | |
| 199 | + # list of roots ... first only one, later can become more. | |
| 200 | + return | |
| 201 | + } | |
| 186 | 202 | |
| 187 | 203 | # # ## ### ##### ######## ############# |
| 188 | 204 | ## State |
| 189 | 205 | |
| 190 | 206 | variable mypath {} ; # Path of the file's rcs archive. |
| @@ -228,10 +244,12 @@ | ||
| 228 | 244 | # order of definition. This also defines |
| 229 | 245 | # their order of creation, which is the |
| 230 | 246 | # reverse of definition. I.e. a smaller |
| 231 | 247 | # number means 'Defined earlier', means |
| 232 | 248 | # 'Created later'. |
| 249 | + | |
| 250 | + variable mytrunk {} ; # Direct reference to myproject -> trunk. | |
| 233 | 251 | |
| 234 | 252 | # # ## ### ##### ######## ############# |
| 235 | 253 | ## Internal methods |
| 236 | 254 | |
| 237 | 255 | method RecordBranchCommits {branches} { |
| @@ -336,10 +354,11 @@ | ||
| 336 | 354 | $branch destroy |
| 337 | 355 | unset mybranches($branchnr) |
| 338 | 356 | } else { |
| 339 | 357 | set rev $myrev($revnr) |
| 340 | 358 | $rev addbranch $branch |
| 359 | + $branch setparent $rev | |
| 341 | 360 | |
| 342 | 361 | # If revisions were committed on the branch we store a |
| 343 | 362 | # reference to the branch there, and further declare |
| 344 | 363 | # the first child's parent to be branch's parent, and |
| 345 | 364 | # list this child in the parent revision. |
| @@ -379,11 +398,14 @@ | ||
| 379 | 398 | $tag destroy |
| 380 | 399 | } |
| 381 | 400 | unset mytags($revnr) |
| 382 | 401 | } else { |
| 383 | 402 | set rev $myrev($revnr) |
| 384 | - foreach tag $taglist { $rev addtag $tag } | |
| 403 | + foreach tag $taglist { | |
| 404 | + $rev addtag $tag | |
| 405 | + $tag settagrev $rev | |
| 406 | + } | |
| 385 | 407 | } |
| 386 | 408 | } |
| 387 | 409 | return |
| 388 | 410 | } |
| 389 | 411 | |
| @@ -401,10 +423,44 @@ | ||
| 401 | 423 | if {$myroot ne ""} { trouble internal "Multiple root revisions found" } |
| 402 | 424 | set myroot $rev |
| 403 | 425 | } |
| 404 | 426 | return |
| 405 | 427 | } |
| 428 | + | |
| 429 | + proc DetermineRevisionOperations {} { | |
| 430 | + upvar 1 myrevisions myrevisions | |
| 431 | + foreach rev $myrevisions { $rev determineoperation } | |
| 432 | + return | |
| 433 | + } | |
| 434 | + | |
| 435 | + proc DetermineLinesOfDevelopment {} { | |
| 436 | + # For revisions this has been done already, in 'extend'. Now | |
| 437 | + # we do this for the branches and tags. | |
| 438 | + | |
| 439 | + upvar 1 self self mybranches mybranches mytags mytags mytrunk mytrunk | |
| 440 | + | |
| 441 | + foreach {_ branch} [array get mybranches] { | |
| 442 | + $branch setlod [GetLOD [$branch parentrevnr]] | |
| 443 | + } | |
| 444 | + | |
| 445 | + foreach {_ taglist} [array get mytags] { | |
| 446 | + foreach tag $taglist { | |
| 447 | + $tag setlod [GetLOD [$tag tagrevnr]] | |
| 448 | + } | |
| 449 | + } | |
| 450 | + return | |
| 451 | + } | |
| 452 | + | |
| 453 | + proc GetLOD {revnr} { | |
| 454 | + if {[rev istrunkrevnr $revnr]} { | |
| 455 | + upvar 1 mytrunk mytrunk | |
| 456 | + return $mytrunk | |
| 457 | + } else { | |
| 458 | + upvar 1 self self | |
| 459 | + return [$self Rev2Branch $revnr] | |
| 460 | + } | |
| 461 | + } | |
| 406 | 462 | |
| 407 | 463 | # # ## ### ##### ######## ############# |
| 408 | 464 | ## Configuration |
| 409 | 465 | |
| 410 | 466 | pragma -hastypeinfo no ; # no type introspection |
| 411 | 467 |
| --- tools/cvs2fossil/lib/c2f_file.tcl | |
| +++ tools/cvs2fossil/lib/c2f_file.tcl | |
| @@ -33,10 +33,11 @@ | |
| 33 | |
| 34 | constructor {path executable project} { |
| 35 | set mypath $path |
| 36 | set myexecutable $executable |
| 37 | set myproject $project |
| 38 | return |
| 39 | } |
| 40 | |
| 41 | method path {} { return $mypath } |
| 42 | method project {} { return $myproject } |
| @@ -151,18 +152,23 @@ | |
| 151 | log write 1 file "In file $mypath : Duplicate delta data for revision $revnr" |
| 152 | log write 1 file "Ignoring the duplicate" |
| 153 | return |
| 154 | } |
| 155 | |
| 156 | if {[rev istrunkrevnr $revnr]} { |
| 157 | set branchid {} |
| 158 | } else { |
| 159 | set branchid [[$self Rev2Branch $revnr] id] |
| 160 | } |
| 161 | |
| 162 | $rev setmeta [$myproject defmeta $branchid $myaid($revnr) $cmid] |
| 163 | $rev settext $textrange |
| 164 | |
| 165 | # If this is revision 1.1, we have to determine whether the |
| 166 | # file seems to have been created through 'cvs add' instead of |
| 167 | # 'cvs import'. This can be done by looking at the un- |
| 168 | # adulterated commit message, as CVS uses a hardwired magic |
| @@ -180,11 +186,21 @@ | |
| 180 | |
| 181 | lappend myrevisions $rev |
| 182 | return |
| 183 | } |
| 184 | |
| 185 | method done {} {} |
| 186 | |
| 187 | # # ## ### ##### ######## ############# |
| 188 | ## State |
| 189 | |
| 190 | variable mypath {} ; # Path of the file's rcs archive. |
| @@ -228,10 +244,12 @@ | |
| 228 | # order of definition. This also defines |
| 229 | # their order of creation, which is the |
| 230 | # reverse of definition. I.e. a smaller |
| 231 | # number means 'Defined earlier', means |
| 232 | # 'Created later'. |
| 233 | |
| 234 | # # ## ### ##### ######## ############# |
| 235 | ## Internal methods |
| 236 | |
| 237 | method RecordBranchCommits {branches} { |
| @@ -336,10 +354,11 @@ | |
| 336 | $branch destroy |
| 337 | unset mybranches($branchnr) |
| 338 | } else { |
| 339 | set rev $myrev($revnr) |
| 340 | $rev addbranch $branch |
| 341 | |
| 342 | # If revisions were committed on the branch we store a |
| 343 | # reference to the branch there, and further declare |
| 344 | # the first child's parent to be branch's parent, and |
| 345 | # list this child in the parent revision. |
| @@ -379,11 +398,14 @@ | |
| 379 | $tag destroy |
| 380 | } |
| 381 | unset mytags($revnr) |
| 382 | } else { |
| 383 | set rev $myrev($revnr) |
| 384 | foreach tag $taglist { $rev addtag $tag } |
| 385 | } |
| 386 | } |
| 387 | return |
| 388 | } |
| 389 | |
| @@ -401,10 +423,44 @@ | |
| 401 | if {$myroot ne ""} { trouble internal "Multiple root revisions found" } |
| 402 | set myroot $rev |
| 403 | } |
| 404 | return |
| 405 | } |
| 406 | |
| 407 | # # ## ### ##### ######## ############# |
| 408 | ## Configuration |
| 409 | |
| 410 | pragma -hastypeinfo no ; # no type introspection |
| 411 |
| --- tools/cvs2fossil/lib/c2f_file.tcl | |
| +++ tools/cvs2fossil/lib/c2f_file.tcl | |
| @@ -33,10 +33,11 @@ | |
| 33 | |
| 34 | constructor {path executable project} { |
| 35 | set mypath $path |
| 36 | set myexecutable $executable |
| 37 | set myproject $project |
| 38 | set mytrunk [$myproject trunk] |
| 39 | return |
| 40 | } |
| 41 | |
| 42 | method path {} { return $mypath } |
| 43 | method project {} { return $myproject } |
| @@ -151,18 +152,23 @@ | |
| 152 | log write 1 file "In file $mypath : Duplicate delta data for revision $revnr" |
| 153 | log write 1 file "Ignoring the duplicate" |
| 154 | return |
| 155 | } |
| 156 | |
| 157 | # Determine the line of development for the revision (project |
| 158 | # level). This gives us the branchid too, required for the |
| 159 | # meta data group the revision is in. (Note: By putting both |
| 160 | # branch/lod and project information into the group we ensure |
| 161 | # that any cross-project and cross-branch commits are |
| 162 | # separated into multiple commits, one in each of the projects |
| 163 | # and/or branches). |
| 164 | |
| 165 | set lod [GetLOD $revnr] |
| 166 | |
| 167 | $rev setmeta [$myproject defmeta [$lod id] $myaid($revnr) $cmid] |
| 168 | $rev settext $textrange |
| 169 | $rev setlod $lod |
| 170 | |
| 171 | # If this is revision 1.1, we have to determine whether the |
| 172 | # file seems to have been created through 'cvs add' instead of |
| 173 | # 'cvs import'. This can be done by looking at the un- |
| 174 | # adulterated commit message, as CVS uses a hardwired magic |
| @@ -180,11 +186,21 @@ | |
| 186 | |
| 187 | lappend myrevisions $rev |
| 188 | return |
| 189 | } |
| 190 | |
| 191 | method done {} { |
| 192 | # Complete the revisions, branches, and tags. This includes |
| 193 | # looking for a non-trunk default branch, marking its members |
| 194 | # and linking them into the trunk. |
| 195 | |
| 196 | DetermineRevisionOperations |
| 197 | DetermineLinesOfDevelopment |
| 198 | |
| 199 | # list of roots ... first only one, later can become more. |
| 200 | return |
| 201 | } |
| 202 | |
| 203 | # # ## ### ##### ######## ############# |
| 204 | ## State |
| 205 | |
| 206 | variable mypath {} ; # Path of the file's rcs archive. |
| @@ -228,10 +244,12 @@ | |
| 244 | # order of definition. This also defines |
| 245 | # their order of creation, which is the |
| 246 | # reverse of definition. I.e. a smaller |
| 247 | # number means 'Defined earlier', means |
| 248 | # 'Created later'. |
| 249 | |
| 250 | variable mytrunk {} ; # Direct reference to myproject -> trunk. |
| 251 | |
| 252 | # # ## ### ##### ######## ############# |
| 253 | ## Internal methods |
| 254 | |
| 255 | method RecordBranchCommits {branches} { |
| @@ -336,10 +354,11 @@ | |
| 354 | $branch destroy |
| 355 | unset mybranches($branchnr) |
| 356 | } else { |
| 357 | set rev $myrev($revnr) |
| 358 | $rev addbranch $branch |
| 359 | $branch setparent $rev |
| 360 | |
| 361 | # If revisions were committed on the branch we store a |
| 362 | # reference to the branch there, and further declare |
| 363 | # the first child's parent to be branch's parent, and |
| 364 | # list this child in the parent revision. |
| @@ -379,11 +398,14 @@ | |
| 398 | $tag destroy |
| 399 | } |
| 400 | unset mytags($revnr) |
| 401 | } else { |
| 402 | set rev $myrev($revnr) |
| 403 | foreach tag $taglist { |
| 404 | $rev addtag $tag |
| 405 | $tag settagrev $rev |
| 406 | } |
| 407 | } |
| 408 | } |
| 409 | return |
| 410 | } |
| 411 | |
| @@ -401,10 +423,44 @@ | |
| 423 | if {$myroot ne ""} { trouble internal "Multiple root revisions found" } |
| 424 | set myroot $rev |
| 425 | } |
| 426 | return |
| 427 | } |
| 428 | |
| 429 | proc DetermineRevisionOperations {} { |
| 430 | upvar 1 myrevisions myrevisions |
| 431 | foreach rev $myrevisions { $rev determineoperation } |
| 432 | return |
| 433 | } |
| 434 | |
| 435 | proc DetermineLinesOfDevelopment {} { |
| 436 | # For revisions this has been done already, in 'extend'. Now |
| 437 | # we do this for the branches and tags. |
| 438 | |
| 439 | upvar 1 self self mybranches mybranches mytags mytags mytrunk mytrunk |
| 440 | |
| 441 | foreach {_ branch} [array get mybranches] { |
| 442 | $branch setlod [GetLOD [$branch parentrevnr]] |
| 443 | } |
| 444 | |
| 445 | foreach {_ taglist} [array get mytags] { |
| 446 | foreach tag $taglist { |
| 447 | $tag setlod [GetLOD [$tag tagrevnr]] |
| 448 | } |
| 449 | } |
| 450 | return |
| 451 | } |
| 452 | |
| 453 | proc GetLOD {revnr} { |
| 454 | if {[rev istrunkrevnr $revnr]} { |
| 455 | upvar 1 mytrunk mytrunk |
| 456 | return $mytrunk |
| 457 | } else { |
| 458 | upvar 1 self self |
| 459 | return [$self Rev2Branch $revnr] |
| 460 | } |
| 461 | } |
| 462 | |
| 463 | # # ## ### ##### ######## ############# |
| 464 | ## Configuration |
| 465 | |
| 466 | pragma -hastypeinfo no ; # no type introspection |
| 467 |
+38
-1
| --- tools/cvs2fossil/lib/c2f_frev.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_frev.tcl | ||
| @@ -37,12 +37,15 @@ | ||
| 37 | 37 | # Basic pieces ________________________ |
| 38 | 38 | |
| 39 | 39 | method hasmeta {} { return [expr {$mymetaid ne ""}] } |
| 40 | 40 | method setmeta {meta} { set mymetaid $meta ; return } |
| 41 | 41 | method settext {text} { set mytext $text ; return } |
| 42 | + method setlod {lod} { set mylod $lod ; return } | |
| 42 | 43 | |
| 43 | 44 | method revnr {} { return $myrevnr } |
| 45 | + method state {} { return $mystate } | |
| 46 | + method lod {} { return $mylod } | |
| 44 | 47 | |
| 45 | 48 | # Basic parent/child linkage __________ |
| 46 | 49 | |
| 47 | 50 | method hasparent {} { return [expr {$myparent ne ""}] } |
| 48 | 51 | method haschild {} { return [expr {$mychild ne ""}] } |
| @@ -111,10 +114,25 @@ | ||
| 111 | 114 | struct::list assign $item -> branch position |
| 112 | 115 | lappend mybranches $branch |
| 113 | 116 | } |
| 114 | 117 | return |
| 115 | 118 | } |
| 119 | + | |
| 120 | + method determineoperation {} { | |
| 121 | + # Look at the state of both this revision and its parent to | |
| 122 | + # determine the type opf operation which was performed (add, | |
| 123 | + # modify, delete, none). | |
| 124 | + # | |
| 125 | + # The important information is dead vs not-dead for both, | |
| 126 | + # giving rise to four possible types. | |
| 127 | + | |
| 128 | + set sdead [expr {$mystate eq "dead"}] | |
| 129 | + set pdead [expr {$myparent eq "" || [$myparent state] eq "dead"}] | |
| 130 | + | |
| 131 | + set myoperation $myopstate([list $pdead $sdead]) | |
| 132 | + return | |
| 133 | + } | |
| 116 | 134 | |
| 117 | 135 | # # ## ### ##### ######## ############# |
| 118 | 136 | ## Type API |
| 119 | 137 | |
| 120 | 138 | typemethod istrunkrevnr {revnr} { |
| @@ -160,20 +178,25 @@ | ||
| 160 | 178 | variable mydate {} ; # Timestamp of the revision, seconds since epoch |
| 161 | 179 | variable myorigdate {} ; # Original unmodified timestamp. |
| 162 | 180 | variable mystate {} ; # State of the revision. |
| 163 | 181 | variable myfile {} ; # Ref to the file object the revision belongs to. |
| 164 | 182 | variable mytext {} ; # Range of the (delta) text for this revision in the file. |
| 165 | - | |
| 166 | 183 | variable mymetaid {} ; # Id of the meta data group the revision |
| 167 | 184 | # belongs to. This is later used to put |
| 168 | 185 | # the file revisions into preliminary |
| 169 | 186 | # changesets (aka project revisions). |
| 170 | 187 | # This id encodes 4 pieces of data, |
| 171 | 188 | # namely: the project and branch the |
| 172 | 189 | # revision was committed to, the author |
| 173 | 190 | # who did the commit, and the message |
| 174 | 191 | # used. |
| 192 | + variable mylod {} ; # Reference to the line-of-development | |
| 193 | + # object the revision belongs to. An | |
| 194 | + # alternative idiom would be to call it | |
| 195 | + # the branch the revision is on. This | |
| 196 | + # reference is to a project-level object | |
| 197 | + # (symbol or trunk). | |
| 175 | 198 | |
| 176 | 199 | # Basic parent/child linkage (lines of development) |
| 177 | 200 | |
| 178 | 201 | variable myparent {} ; # Ref to parent revision object. Link required because of |
| 179 | 202 | # ; # 'cvsadmin -o', which can create arbitrary gaps in the |
| @@ -208,10 +231,24 @@ | ||
| 208 | 231 | # ; # mybranches. |
| 209 | 232 | |
| 210 | 233 | # Tag linkage ________________________ |
| 211 | 234 | |
| 212 | 235 | variable mytags {} ; # List of tags (objs) associated with this revision. |
| 236 | + | |
| 237 | + # More derived data | |
| 238 | + | |
| 239 | + variable myoperation {} ; # One of 'add', 'change', 'delete', or | |
| 240 | + # 'nothing'. Derived from our and its | |
| 241 | + # parent's state. | |
| 242 | + | |
| 243 | + # dead(self) x dead(parent) -> operation | |
| 244 | + typevariable myopstate -array { | |
| 245 | + {0 0} change | |
| 246 | + {0 1} delete | |
| 247 | + {1 0} add | |
| 248 | + {1 1} nothing | |
| 249 | + } | |
| 213 | 250 | |
| 214 | 251 | # # ## ### ##### ######## ############# |
| 215 | 252 | ## Internal methods |
| 216 | 253 | |
| 217 | 254 | # # ## ### ##### ######## ############# |
| 218 | 255 |
| --- tools/cvs2fossil/lib/c2f_frev.tcl | |
| +++ tools/cvs2fossil/lib/c2f_frev.tcl | |
| @@ -37,12 +37,15 @@ | |
| 37 | # Basic pieces ________________________ |
| 38 | |
| 39 | method hasmeta {} { return [expr {$mymetaid ne ""}] } |
| 40 | method setmeta {meta} { set mymetaid $meta ; return } |
| 41 | method settext {text} { set mytext $text ; return } |
| 42 | |
| 43 | method revnr {} { return $myrevnr } |
| 44 | |
| 45 | # Basic parent/child linkage __________ |
| 46 | |
| 47 | method hasparent {} { return [expr {$myparent ne ""}] } |
| 48 | method haschild {} { return [expr {$mychild ne ""}] } |
| @@ -111,10 +114,25 @@ | |
| 111 | struct::list assign $item -> branch position |
| 112 | lappend mybranches $branch |
| 113 | } |
| 114 | return |
| 115 | } |
| 116 | |
| 117 | # # ## ### ##### ######## ############# |
| 118 | ## Type API |
| 119 | |
| 120 | typemethod istrunkrevnr {revnr} { |
| @@ -160,20 +178,25 @@ | |
| 160 | variable mydate {} ; # Timestamp of the revision, seconds since epoch |
| 161 | variable myorigdate {} ; # Original unmodified timestamp. |
| 162 | variable mystate {} ; # State of the revision. |
| 163 | variable myfile {} ; # Ref to the file object the revision belongs to. |
| 164 | variable mytext {} ; # Range of the (delta) text for this revision in the file. |
| 165 | |
| 166 | variable mymetaid {} ; # Id of the meta data group the revision |
| 167 | # belongs to. This is later used to put |
| 168 | # the file revisions into preliminary |
| 169 | # changesets (aka project revisions). |
| 170 | # This id encodes 4 pieces of data, |
| 171 | # namely: the project and branch the |
| 172 | # revision was committed to, the author |
| 173 | # who did the commit, and the message |
| 174 | # used. |
| 175 | |
| 176 | # Basic parent/child linkage (lines of development) |
| 177 | |
| 178 | variable myparent {} ; # Ref to parent revision object. Link required because of |
| 179 | # ; # 'cvsadmin -o', which can create arbitrary gaps in the |
| @@ -208,10 +231,24 @@ | |
| 208 | # ; # mybranches. |
| 209 | |
| 210 | # Tag linkage ________________________ |
| 211 | |
| 212 | variable mytags {} ; # List of tags (objs) associated with this revision. |
| 213 | |
| 214 | # # ## ### ##### ######## ############# |
| 215 | ## Internal methods |
| 216 | |
| 217 | # # ## ### ##### ######## ############# |
| 218 |
| --- tools/cvs2fossil/lib/c2f_frev.tcl | |
| +++ tools/cvs2fossil/lib/c2f_frev.tcl | |
| @@ -37,12 +37,15 @@ | |
| 37 | # Basic pieces ________________________ |
| 38 | |
| 39 | method hasmeta {} { return [expr {$mymetaid ne ""}] } |
| 40 | method setmeta {meta} { set mymetaid $meta ; return } |
| 41 | method settext {text} { set mytext $text ; return } |
| 42 | method setlod {lod} { set mylod $lod ; return } |
| 43 | |
| 44 | method revnr {} { return $myrevnr } |
| 45 | method state {} { return $mystate } |
| 46 | method lod {} { return $mylod } |
| 47 | |
| 48 | # Basic parent/child linkage __________ |
| 49 | |
| 50 | method hasparent {} { return [expr {$myparent ne ""}] } |
| 51 | method haschild {} { return [expr {$mychild ne ""}] } |
| @@ -111,10 +114,25 @@ | |
| 114 | struct::list assign $item -> branch position |
| 115 | lappend mybranches $branch |
| 116 | } |
| 117 | return |
| 118 | } |
| 119 | |
| 120 | method determineoperation {} { |
| 121 | # Look at the state of both this revision and its parent to |
| 122 | # determine the type opf operation which was performed (add, |
| 123 | # modify, delete, none). |
| 124 | # |
| 125 | # The important information is dead vs not-dead for both, |
| 126 | # giving rise to four possible types. |
| 127 | |
| 128 | set sdead [expr {$mystate eq "dead"}] |
| 129 | set pdead [expr {$myparent eq "" || [$myparent state] eq "dead"}] |
| 130 | |
| 131 | set myoperation $myopstate([list $pdead $sdead]) |
| 132 | return |
| 133 | } |
| 134 | |
| 135 | # # ## ### ##### ######## ############# |
| 136 | ## Type API |
| 137 | |
| 138 | typemethod istrunkrevnr {revnr} { |
| @@ -160,20 +178,25 @@ | |
| 178 | variable mydate {} ; # Timestamp of the revision, seconds since epoch |
| 179 | variable myorigdate {} ; # Original unmodified timestamp. |
| 180 | variable mystate {} ; # State of the revision. |
| 181 | variable myfile {} ; # Ref to the file object the revision belongs to. |
| 182 | variable mytext {} ; # Range of the (delta) text for this revision in the file. |
| 183 | variable mymetaid {} ; # Id of the meta data group the revision |
| 184 | # belongs to. This is later used to put |
| 185 | # the file revisions into preliminary |
| 186 | # changesets (aka project revisions). |
| 187 | # This id encodes 4 pieces of data, |
| 188 | # namely: the project and branch the |
| 189 | # revision was committed to, the author |
| 190 | # who did the commit, and the message |
| 191 | # used. |
| 192 | variable mylod {} ; # Reference to the line-of-development |
| 193 | # object the revision belongs to. An |
| 194 | # alternative idiom would be to call it |
| 195 | # the branch the revision is on. This |
| 196 | # reference is to a project-level object |
| 197 | # (symbol or trunk). |
| 198 | |
| 199 | # Basic parent/child linkage (lines of development) |
| 200 | |
| 201 | variable myparent {} ; # Ref to parent revision object. Link required because of |
| 202 | # ; # 'cvsadmin -o', which can create arbitrary gaps in the |
| @@ -208,10 +231,24 @@ | |
| 231 | # ; # mybranches. |
| 232 | |
| 233 | # Tag linkage ________________________ |
| 234 | |
| 235 | variable mytags {} ; # List of tags (objs) associated with this revision. |
| 236 | |
| 237 | # More derived data |
| 238 | |
| 239 | variable myoperation {} ; # One of 'add', 'change', 'delete', or |
| 240 | # 'nothing'. Derived from our and its |
| 241 | # parent's state. |
| 242 | |
| 243 | # dead(self) x dead(parent) -> operation |
| 244 | typevariable myopstate -array { |
| 245 | {0 0} change |
| 246 | {0 1} delete |
| 247 | {1 0} add |
| 248 | {1 1} nothing |
| 249 | } |
| 250 | |
| 251 | # # ## ### ##### ######## ############# |
| 252 | ## Internal methods |
| 253 | |
| 254 | # # ## ### ##### ######## ############# |
| 255 |
+36
-5
| --- tools/cvs2fossil/lib/c2f_fsym.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_fsym.tcl | ||
| @@ -51,24 +51,47 @@ | ||
| 51 | 51 | if {$mybranchchildrevnr ne ""} { trouble internal "Child already defined" } |
| 52 | 52 | set mybranchchildrevnr $revnr |
| 53 | 53 | return |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - method setposition {n} { set mybranchposition $n } | |
| 56 | + method setposition {n} { set mybranchposition $n ; return } | |
| 57 | + method setparent {rev} { set mybranchparent $rev ; return } | |
| 57 | 58 | |
| 58 | 59 | method branchnr {} { return $mynr } |
| 59 | 60 | method parentrevnr {} { return $mybranchparentrevnr } |
| 60 | 61 | method childrevnr {} { return $mybranchchildrevnr } |
| 61 | - | |
| 62 | 62 | method haschild {} { return [expr {$mybranchchildrevnr ne ""}] } |
| 63 | 63 | method child {} { return $mybranchchild } |
| 64 | - | |
| 65 | - method position {} { return $mybranchposition } | |
| 64 | + method position {} { return $mybranchposition } | |
| 66 | 65 | |
| 67 | 66 | # Tag acessor methods. |
| 68 | 67 | |
| 69 | - method tagrevnr {} { return $mynr } | |
| 68 | + method tagrevnr {} { return $mynr } | |
| 69 | + method settagrev {rev} {set mytagrev $rev ; return } | |
| 70 | + | |
| 71 | + # Derived information | |
| 72 | + | |
| 73 | + method lod {} { return $mylod } | |
| 74 | + | |
| 75 | + method setlod {lod} { | |
| 76 | + set mylod $lod | |
| 77 | + | |
| 78 | + # Consistency check integrated. The symbol's | |
| 79 | + # line-of-development has to be same as the | |
| 80 | + # line-of-development of its source. | |
| 81 | + | |
| 82 | + switch -exact -- $mytype { | |
| 83 | + branch { set slod [$mybranchparent lod] } | |
| 84 | + tag { set slod [$mytagrev lod] } | |
| 85 | + } | |
| 86 | + | |
| 87 | + if {$mylod ne $slod} { | |
| 88 | + trouble fatal "For [$mysymbol name]: LOD conflict with source, '[$mylod name]' vs. '[$slod name]'" | |
| 89 | + return | |
| 90 | + } | |
| 91 | + return | |
| 92 | + } | |
| 70 | 93 | |
| 71 | 94 | # # ## ### ##### ######## ############# |
| 72 | 95 | ## State |
| 73 | 96 | |
| 74 | 97 | ## Basic, all symbols _________________ |
| @@ -76,10 +99,15 @@ | ||
| 76 | 99 | variable mytype {} ; # Symbol type, 'tag', or 'branch'. |
| 77 | 100 | variable mynr {} ; # Revision number of a 'tag', branch number |
| 78 | 101 | # of a 'branch'. |
| 79 | 102 | variable mysymbol {} ; # Reference to the symbol object of this |
| 80 | 103 | # symbol at the project level. |
| 104 | + variable mylod {} ; # Reference to the line-of-development | |
| 105 | + # object the symbol belongs to. An | |
| 106 | + # alternative idiom would be to call it the | |
| 107 | + # branch the symbol is on. This reference | |
| 108 | + # is to a project-level symbol object. | |
| 81 | 109 | |
| 82 | 110 | ## Branch symbols _____________________ |
| 83 | 111 | |
| 84 | 112 | variable mybranchparentrevnr {} ; # The number of the parent |
| 85 | 113 | # revision, derived from our |
| @@ -95,10 +123,13 @@ | ||
| 95 | 123 | variable mybranchposition {} ; # Relative id of the branch in |
| 96 | 124 | # the file, to sort into |
| 97 | 125 | # creation order. |
| 98 | 126 | |
| 99 | 127 | ## Tag symbols ________________________ |
| 128 | + | |
| 129 | + variable mytagrev {} ; # Reference to the revision object the tag | |
| 130 | + # is on, identified by 'mynr'. | |
| 100 | 131 | |
| 101 | 132 | # ... nothing special ... (only mynr, see basic) |
| 102 | 133 | |
| 103 | 134 | # # ## ### ##### ######## ############# |
| 104 | 135 | ## Internal methods |
| 105 | 136 |
| --- tools/cvs2fossil/lib/c2f_fsym.tcl | |
| +++ tools/cvs2fossil/lib/c2f_fsym.tcl | |
| @@ -51,24 +51,47 @@ | |
| 51 | if {$mybranchchildrevnr ne ""} { trouble internal "Child already defined" } |
| 52 | set mybranchchildrevnr $revnr |
| 53 | return |
| 54 | } |
| 55 | |
| 56 | method setposition {n} { set mybranchposition $n } |
| 57 | |
| 58 | method branchnr {} { return $mynr } |
| 59 | method parentrevnr {} { return $mybranchparentrevnr } |
| 60 | method childrevnr {} { return $mybranchchildrevnr } |
| 61 | |
| 62 | method haschild {} { return [expr {$mybranchchildrevnr ne ""}] } |
| 63 | method child {} { return $mybranchchild } |
| 64 | |
| 65 | method position {} { return $mybranchposition } |
| 66 | |
| 67 | # Tag acessor methods. |
| 68 | |
| 69 | method tagrevnr {} { return $mynr } |
| 70 | |
| 71 | # # ## ### ##### ######## ############# |
| 72 | ## State |
| 73 | |
| 74 | ## Basic, all symbols _________________ |
| @@ -76,10 +99,15 @@ | |
| 76 | variable mytype {} ; # Symbol type, 'tag', or 'branch'. |
| 77 | variable mynr {} ; # Revision number of a 'tag', branch number |
| 78 | # of a 'branch'. |
| 79 | variable mysymbol {} ; # Reference to the symbol object of this |
| 80 | # symbol at the project level. |
| 81 | |
| 82 | ## Branch symbols _____________________ |
| 83 | |
| 84 | variable mybranchparentrevnr {} ; # The number of the parent |
| 85 | # revision, derived from our |
| @@ -95,10 +123,13 @@ | |
| 95 | variable mybranchposition {} ; # Relative id of the branch in |
| 96 | # the file, to sort into |
| 97 | # creation order. |
| 98 | |
| 99 | ## Tag symbols ________________________ |
| 100 | |
| 101 | # ... nothing special ... (only mynr, see basic) |
| 102 | |
| 103 | # # ## ### ##### ######## ############# |
| 104 | ## Internal methods |
| 105 |
| --- tools/cvs2fossil/lib/c2f_fsym.tcl | |
| +++ tools/cvs2fossil/lib/c2f_fsym.tcl | |
| @@ -51,24 +51,47 @@ | |
| 51 | if {$mybranchchildrevnr ne ""} { trouble internal "Child already defined" } |
| 52 | set mybranchchildrevnr $revnr |
| 53 | return |
| 54 | } |
| 55 | |
| 56 | method setposition {n} { set mybranchposition $n ; return } |
| 57 | method setparent {rev} { set mybranchparent $rev ; return } |
| 58 | |
| 59 | method branchnr {} { return $mynr } |
| 60 | method parentrevnr {} { return $mybranchparentrevnr } |
| 61 | method childrevnr {} { return $mybranchchildrevnr } |
| 62 | method haschild {} { return [expr {$mybranchchildrevnr ne ""}] } |
| 63 | method child {} { return $mybranchchild } |
| 64 | method position {} { return $mybranchposition } |
| 65 | |
| 66 | # Tag acessor methods. |
| 67 | |
| 68 | method tagrevnr {} { return $mynr } |
| 69 | method settagrev {rev} {set mytagrev $rev ; return } |
| 70 | |
| 71 | # Derived information |
| 72 | |
| 73 | method lod {} { return $mylod } |
| 74 | |
| 75 | method setlod {lod} { |
| 76 | set mylod $lod |
| 77 | |
| 78 | # Consistency check integrated. The symbol's |
| 79 | # line-of-development has to be same as the |
| 80 | # line-of-development of its source. |
| 81 | |
| 82 | switch -exact -- $mytype { |
| 83 | branch { set slod [$mybranchparent lod] } |
| 84 | tag { set slod [$mytagrev lod] } |
| 85 | } |
| 86 | |
| 87 | if {$mylod ne $slod} { |
| 88 | trouble fatal "For [$mysymbol name]: LOD conflict with source, '[$mylod name]' vs. '[$slod name]'" |
| 89 | return |
| 90 | } |
| 91 | return |
| 92 | } |
| 93 | |
| 94 | # # ## ### ##### ######## ############# |
| 95 | ## State |
| 96 | |
| 97 | ## Basic, all symbols _________________ |
| @@ -76,10 +99,15 @@ | |
| 99 | variable mytype {} ; # Symbol type, 'tag', or 'branch'. |
| 100 | variable mynr {} ; # Revision number of a 'tag', branch number |
| 101 | # of a 'branch'. |
| 102 | variable mysymbol {} ; # Reference to the symbol object of this |
| 103 | # symbol at the project level. |
| 104 | variable mylod {} ; # Reference to the line-of-development |
| 105 | # object the symbol belongs to. An |
| 106 | # alternative idiom would be to call it the |
| 107 | # branch the symbol is on. This reference |
| 108 | # is to a project-level symbol object. |
| 109 | |
| 110 | ## Branch symbols _____________________ |
| 111 | |
| 112 | variable mybranchparentrevnr {} ; # The number of the parent |
| 113 | # revision, derived from our |
| @@ -95,10 +123,13 @@ | |
| 123 | variable mybranchposition {} ; # Relative id of the branch in |
| 124 | # the file, to sort into |
| 125 | # creation order. |
| 126 | |
| 127 | ## Tag symbols ________________________ |
| 128 | |
| 129 | variable mytagrev {} ; # Reference to the revision object the tag |
| 130 | # is on, identified by 'mynr'. |
| 131 | |
| 132 | # ... nothing special ... (only mynr, see basic) |
| 133 | |
| 134 | # # ## ### ##### ######## ############# |
| 135 | ## Internal methods |
| 136 |
+17
-10
| --- tools/cvs2fossil/lib/c2f_project.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_project.tcl | ||
| @@ -13,16 +13,17 @@ | ||
| 13 | 13 | ## Project, part of a CVS repository. Multiple instances are possible. |
| 14 | 14 | |
| 15 | 15 | # # ## ### ##### ######## ############# ##################### |
| 16 | 16 | ## Requirements |
| 17 | 17 | |
| 18 | -package require Tcl 8.4 ; # Required runtime. | |
| 19 | -package require snit ; # OO system. | |
| 20 | -package require vc::fossil::import::cvs::file ; # CVS archive file. | |
| 21 | -package require vc::fossil::import::cvs::state ; # State storage. | |
| 22 | -package require vc::fossil::import::cvs::project::sym ; # Per project symbols. | |
| 23 | -package require struct::list ; # Advanced list operations.. | |
| 18 | +package require Tcl 8.4 ; # Required runtime. | |
| 19 | +package require snit ; # OO system. | |
| 20 | +package require vc::fossil::import::cvs::file ; # CVS archive file. | |
| 21 | +package require vc::fossil::import::cvs::state ; # State storage. | |
| 22 | +package require vc::fossil::import::cvs::project::sym ; # Per project symbols. | |
| 23 | +package require vc::fossil::import::cvs::project::trunk ; # Per project trunk, main lod | |
| 24 | +package require struct::list ; # Advanced list operations.. | |
| 24 | 25 | |
| 25 | 26 | # # ## ### ##### ######## ############# ##################### |
| 26 | 27 | ## |
| 27 | 28 | |
| 28 | 29 | snit::type ::vc::fossil::import::cvs::project { |
| @@ -30,14 +31,16 @@ | ||
| 30 | 31 | ## Public API |
| 31 | 32 | |
| 32 | 33 | constructor {path r} { |
| 33 | 34 | set mybase $path |
| 34 | 35 | set myrepository $r |
| 36 | + set mytrunk [trunk %AUTO%] | |
| 35 | 37 | return |
| 36 | 38 | } |
| 37 | 39 | |
| 38 | - method base {} { return $mybase } | |
| 40 | + method base {} { return $mybase } | |
| 41 | + method trunk {} { return $mytrunk } | |
| 39 | 42 | |
| 40 | 43 | method printbase {} { |
| 41 | 44 | if {$mybase eq ""} {return <Repository>} |
| 42 | 45 | return $mybase |
| 43 | 46 | } |
| @@ -110,16 +113,20 @@ | ||
| 110 | 113 | } |
| 111 | 114 | |
| 112 | 115 | # # ## ### ##### ######## ############# |
| 113 | 116 | ## State |
| 114 | 117 | |
| 115 | - variable mybase {} ; # Project directory | |
| 118 | + variable mybase {} ; # Project directory. | |
| 116 | 119 | variable myid {} ; # Project id in the persistent state. |
| 117 | - variable myfiles -array {} ; # Maps rcs archive to their user files. | |
| 120 | + variable mytrunk {} ; # Reference to the main line of | |
| 121 | + # development for the project. | |
| 122 | + variable myfiles -array {} ; # Maps the rcs archive paths to | |
| 123 | + # their user-visible files. | |
| 118 | 124 | variable myfobj {} ; # File objects for the rcs archives |
| 119 | 125 | variable myrepository {} ; # Repository the prject belongs to. |
| 120 | - variable mysymbols -array {} ; # Map symbol names to project-level symbol objects. | |
| 126 | + variable mysymbols -array {} ; # Map symbol names to project-level | |
| 127 | + # symbol objects. | |
| 121 | 128 | |
| 122 | 129 | # # ## ### ##### ######## ############# |
| 123 | 130 | ## Internal methods |
| 124 | 131 | |
| 125 | 132 | proc TheFiles {} { |
| 126 | 133 |
| --- tools/cvs2fossil/lib/c2f_project.tcl | |
| +++ tools/cvs2fossil/lib/c2f_project.tcl | |
| @@ -13,16 +13,17 @@ | |
| 13 | ## Project, part of a CVS repository. Multiple instances are possible. |
| 14 | |
| 15 | # # ## ### ##### ######## ############# ##################### |
| 16 | ## Requirements |
| 17 | |
| 18 | package require Tcl 8.4 ; # Required runtime. |
| 19 | package require snit ; # OO system. |
| 20 | package require vc::fossil::import::cvs::file ; # CVS archive file. |
| 21 | package require vc::fossil::import::cvs::state ; # State storage. |
| 22 | package require vc::fossil::import::cvs::project::sym ; # Per project symbols. |
| 23 | package require struct::list ; # Advanced list operations.. |
| 24 | |
| 25 | # # ## ### ##### ######## ############# ##################### |
| 26 | ## |
| 27 | |
| 28 | snit::type ::vc::fossil::import::cvs::project { |
| @@ -30,14 +31,16 @@ | |
| 30 | ## Public API |
| 31 | |
| 32 | constructor {path r} { |
| 33 | set mybase $path |
| 34 | set myrepository $r |
| 35 | return |
| 36 | } |
| 37 | |
| 38 | method base {} { return $mybase } |
| 39 | |
| 40 | method printbase {} { |
| 41 | if {$mybase eq ""} {return <Repository>} |
| 42 | return $mybase |
| 43 | } |
| @@ -110,16 +113,20 @@ | |
| 110 | } |
| 111 | |
| 112 | # # ## ### ##### ######## ############# |
| 113 | ## State |
| 114 | |
| 115 | variable mybase {} ; # Project directory |
| 116 | variable myid {} ; # Project id in the persistent state. |
| 117 | variable myfiles -array {} ; # Maps rcs archive to their user files. |
| 118 | variable myfobj {} ; # File objects for the rcs archives |
| 119 | variable myrepository {} ; # Repository the prject belongs to. |
| 120 | variable mysymbols -array {} ; # Map symbol names to project-level symbol objects. |
| 121 | |
| 122 | # # ## ### ##### ######## ############# |
| 123 | ## Internal methods |
| 124 | |
| 125 | proc TheFiles {} { |
| 126 |
| --- tools/cvs2fossil/lib/c2f_project.tcl | |
| +++ tools/cvs2fossil/lib/c2f_project.tcl | |
| @@ -13,16 +13,17 @@ | |
| 13 | ## Project, part of a CVS repository. Multiple instances are possible. |
| 14 | |
| 15 | # # ## ### ##### ######## ############# ##################### |
| 16 | ## Requirements |
| 17 | |
| 18 | package require Tcl 8.4 ; # Required runtime. |
| 19 | package require snit ; # OO system. |
| 20 | package require vc::fossil::import::cvs::file ; # CVS archive file. |
| 21 | package require vc::fossil::import::cvs::state ; # State storage. |
| 22 | package require vc::fossil::import::cvs::project::sym ; # Per project symbols. |
| 23 | package require vc::fossil::import::cvs::project::trunk ; # Per project trunk, main lod |
| 24 | package require struct::list ; # Advanced list operations.. |
| 25 | |
| 26 | # # ## ### ##### ######## ############# ##################### |
| 27 | ## |
| 28 | |
| 29 | snit::type ::vc::fossil::import::cvs::project { |
| @@ -30,14 +31,16 @@ | |
| 31 | ## Public API |
| 32 | |
| 33 | constructor {path r} { |
| 34 | set mybase $path |
| 35 | set myrepository $r |
| 36 | set mytrunk [trunk %AUTO%] |
| 37 | return |
| 38 | } |
| 39 | |
| 40 | method base {} { return $mybase } |
| 41 | method trunk {} { return $mytrunk } |
| 42 | |
| 43 | method printbase {} { |
| 44 | if {$mybase eq ""} {return <Repository>} |
| 45 | return $mybase |
| 46 | } |
| @@ -110,16 +113,20 @@ | |
| 113 | } |
| 114 | |
| 115 | # # ## ### ##### ######## ############# |
| 116 | ## State |
| 117 | |
| 118 | variable mybase {} ; # Project directory. |
| 119 | variable myid {} ; # Project id in the persistent state. |
| 120 | variable mytrunk {} ; # Reference to the main line of |
| 121 | # development for the project. |
| 122 | variable myfiles -array {} ; # Maps the rcs archive paths to |
| 123 | # their user-visible files. |
| 124 | variable myfobj {} ; # File objects for the rcs archives |
| 125 | variable myrepository {} ; # Repository the prject belongs to. |
| 126 | variable mysymbols -array {} ; # Map symbol names to project-level |
| 127 | # symbol objects. |
| 128 | |
| 129 | # # ## ### ##### ######## ############# |
| 130 | ## Internal methods |
| 131 | |
| 132 | proc TheFiles {} { |
| 133 |
| --- tools/cvs2fossil/lib/c2f_ptrunk.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_ptrunk.tcl | ||
| @@ -26,10 +26,13 @@ | ||
| 26 | 26 | ## Public API |
| 27 | 27 | |
| 28 | 28 | constructor {} { |
| 29 | 29 | return |
| 30 | 30 | } |
| 31 | + | |
| 32 | + method name {} { return :trunk: } | |
| 33 | + method id {} { return {} } | |
| 31 | 34 | |
| 32 | 35 | # # ## ### ##### ######## ############# |
| 33 | 36 | ## State |
| 34 | 37 | |
| 35 | 38 | # # ## ### ##### ######## ############# |
| 36 | 39 |
| --- tools/cvs2fossil/lib/c2f_ptrunk.tcl | |
| +++ tools/cvs2fossil/lib/c2f_ptrunk.tcl | |
| @@ -26,10 +26,13 @@ | |
| 26 | ## Public API |
| 27 | |
| 28 | constructor {} { |
| 29 | return |
| 30 | } |
| 31 | |
| 32 | # # ## ### ##### ######## ############# |
| 33 | ## State |
| 34 | |
| 35 | # # ## ### ##### ######## ############# |
| 36 |
| --- tools/cvs2fossil/lib/c2f_ptrunk.tcl | |
| +++ tools/cvs2fossil/lib/c2f_ptrunk.tcl | |
| @@ -26,10 +26,13 @@ | |
| 26 | ## Public API |
| 27 | |
| 28 | constructor {} { |
| 29 | return |
| 30 | } |
| 31 | |
| 32 | method name {} { return :trunk: } |
| 33 | method id {} { return {} } |
| 34 | |
| 35 | # # ## ### ##### ######## ############# |
| 36 | ## State |
| 37 | |
| 38 | # # ## ### ##### ######## ############# |
| 39 |