Fossil SCM
Switched procs to methods, got rid of unwieldy and error-prone explicit import of instance variables.
Commit
b5b2d61527be84a9ba57f17b6de305793e3b1dd4
Parent
177a0cc55c3da00…
1 file changed
+36
-64
+36
-64
| --- tools/cvs2fossil/lib/c2f_file.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_file.tcl | ||
| @@ -112,24 +112,24 @@ | ||
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | set myaid($revnr) [$myproject defauthor $author] |
| 115 | 115 | set myrev($revnr) [rev %AUTO% $revnr $date $state $self] |
| 116 | 116 | |
| 117 | - RecordBasicDependencies $revnr $next | |
| 117 | + $self RecordBasicDependencies $revnr $next | |
| 118 | 118 | return |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | method defdone {} { |
| 122 | 122 | # This is all done after the revision tree has been extracted |
| 123 | 123 | # from the file, before the commit mesages and delta texts are |
| 124 | 124 | # processed. |
| 125 | 125 | |
| 126 | - ProcessPrimaryDependencies | |
| 127 | - ProcessBranchDependencies | |
| 128 | - SortBranches | |
| 129 | - ProcessTagDependencies | |
| 130 | - DetermineTheRootRevision | |
| 126 | + $self ProcessPrimaryDependencies | |
| 127 | + $self ProcessBranchDependencies | |
| 128 | + $self SortBranches | |
| 129 | + $self ProcessTagDependencies | |
| 130 | + $self DetermineTheRootRevision | |
| 131 | 131 | return |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | method setdesc {d} {# ignore} |
| 135 | 135 | |
| @@ -161,11 +161,11 @@ | ||
| 161 | 161 | # branch/lod and project information into the group we ensure |
| 162 | 162 | # that any cross-project and cross-branch commits are |
| 163 | 163 | # separated into multiple commits, one in each of the projects |
| 164 | 164 | # and/or branches). |
| 165 | 165 | |
| 166 | - set lod [GetLOD $revnr] | |
| 166 | + set lod [$self GetLOD $revnr] | |
| 167 | 167 | |
| 168 | 168 | $rev setmeta [$myproject defmeta [$lod id] $myaid($revnr) $cmid] |
| 169 | 169 | $rev settext $textrange |
| 170 | 170 | $rev setlod $lod |
| 171 | 171 | |
| @@ -192,18 +192,18 @@ | ||
| 192 | 192 | method done {} { |
| 193 | 193 | # Complete the revisions, branches, and tags. This includes |
| 194 | 194 | # looking for a non-trunk default branch, marking its members |
| 195 | 195 | # and linking them into the trunk. |
| 196 | 196 | |
| 197 | - DetermineRevisionOperations | |
| 198 | - DetermineLinesOfDevelopment | |
| 199 | - HandleNonTrunkDefaultBranch | |
| 200 | - RemoveIrrelevantDeletions | |
| 201 | - RemoveInitialBranchDeletions | |
| 197 | + $self DetermineRevisionOperations | |
| 198 | + $self DetermineLinesOfDevelopment | |
| 199 | + $self HandleNonTrunkDefaultBranch | |
| 200 | + $self RemoveIrrelevantDeletions | |
| 201 | + $self RemoveInitialBranchDeletions | |
| 202 | 202 | |
| 203 | 203 | if {[$myproject trunkonly]} { |
| 204 | - ExcludeNonTrunkInformation | |
| 204 | + $self ExcludeNonTrunkInformation | |
| 205 | 205 | } |
| 206 | 206 | return |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | # # ## ### ##### ######## ############# |
| @@ -306,11 +306,11 @@ | ||
| 306 | 306 | set tag [sym %AUTO% tag $revnr [$myproject getsymbol $name]] |
| 307 | 307 | lappend mytags($revnr) $tag |
| 308 | 308 | return $tag |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - proc RecordBasicDependencies {revnr next} { | |
| 311 | + method RecordBasicDependencies {revnr next} { | |
| 312 | 312 | # Handle the revision dependencies. Record them for now, do |
| 313 | 313 | # nothing with them yet. |
| 314 | 314 | |
| 315 | 315 | # On the trunk the 'next' field points to the previous |
| 316 | 316 | # revision, i.e. the _parent_ of the current one. Example: |
| @@ -326,37 +326,30 @@ | ||
| 326 | 326 | # The dependencies needed here are the logical structure, |
| 327 | 327 | # parent/child, and not the implementation dependent delta |
| 328 | 328 | # pointers. |
| 329 | 329 | |
| 330 | 330 | if {$next eq ""} return |
| 331 | - | |
| 332 | - upvar 1 mydependencies mydependencies | |
| 333 | - | |
| 334 | 331 | # parent -> child |
| 335 | 332 | if {[rev istrunkrevnr $revnr]} { |
| 336 | 333 | lappend mydependencies $next $revnr |
| 337 | 334 | } else { |
| 338 | 335 | lappend mydependencies $revnr $next |
| 339 | 336 | } |
| 340 | 337 | return |
| 341 | 338 | } |
| 342 | 339 | |
| 343 | - proc ProcessPrimaryDependencies {} { | |
| 344 | - upvar 1 mydependencies mydependencies myrev myrev | |
| 345 | - | |
| 340 | + method ProcessPrimaryDependencies {} { | |
| 346 | 341 | foreach {parentrevnr childrevnr} $mydependencies { |
| 347 | 342 | set parent $myrev($parentrevnr) |
| 348 | 343 | set child $myrev($childrevnr) |
| 349 | 344 | $parent setchild $child |
| 350 | 345 | $child setparent $parent |
| 351 | 346 | } |
| 352 | 347 | return |
| 353 | 348 | } |
| 354 | 349 | |
| 355 | - proc ProcessBranchDependencies {} { | |
| 356 | - upvar 1 mybranches mybranches myrev myrev | |
| 357 | - | |
| 350 | + method ProcessBranchDependencies {} { | |
| 358 | 351 | foreach {branchnr branch} [array get mybranches] { |
| 359 | 352 | set revnr [$branch parentrevnr] |
| 360 | 353 | |
| 361 | 354 | if {![info exists myrev($revnr)]} { |
| 362 | 355 | log write 1 file "In '$mypath': The branch '[$branch name]' references" |
| @@ -385,22 +378,16 @@ | ||
| 385 | 378 | } |
| 386 | 379 | } |
| 387 | 380 | return |
| 388 | 381 | } |
| 389 | 382 | |
| 390 | - proc SortBranches {} { | |
| 391 | - upvar 1 myrev myrev | |
| 392 | - | |
| 393 | - foreach {revnr rev} [array get myrev] { | |
| 394 | - $rev sortbranches | |
| 395 | - } | |
| 383 | + method SortBranches {} { | |
| 384 | + foreach {revnr rev} [array get myrev] { $rev sortbranches } | |
| 396 | 385 | return |
| 397 | 386 | } |
| 398 | 387 | |
| 399 | - proc ProcessTagDependencies {} { | |
| 400 | - upvar 1 mytags mytags myrev myrev | |
| 401 | - | |
| 388 | + method ProcessTagDependencies {} { | |
| 402 | 389 | foreach {revnr taglist} [array get mytags] { |
| 403 | 390 | if {![info exists myrev($revnr)]} { |
| 404 | 391 | set n [llength $taglist] |
| 405 | 392 | log write 1 file "In '$mypath': The following [nsp $n tag] reference" |
| 406 | 393 | log write 1 file "the bogus revision '$revnr' and will be ignored." |
| @@ -418,13 +405,11 @@ | ||
| 418 | 405 | } |
| 419 | 406 | } |
| 420 | 407 | return |
| 421 | 408 | } |
| 422 | 409 | |
| 423 | - proc DetermineTheRootRevision {} { | |
| 424 | - upvar 1 myrev myrev myroot myroot | |
| 425 | - | |
| 410 | + method DetermineTheRootRevision {} { | |
| 426 | 411 | # The root is the one revision which has no parent. By |
| 427 | 412 | # checking all revisions we ensure that we can detect and |
| 428 | 413 | # report the case of multiple roots. Without that we could |
| 429 | 414 | # simply take one revision and follow the parent links to |
| 430 | 415 | # their root (sic!). |
| @@ -439,56 +424,49 @@ | ||
| 439 | 424 | # severed from their parent, making them their own root. |
| 440 | 425 | set myroots [list $myroot] |
| 441 | 426 | return |
| 442 | 427 | } |
| 443 | 428 | |
| 444 | - proc DetermineRevisionOperations {} { | |
| 445 | - upvar 1 myrevisions myrevisions | |
| 429 | + method DetermineRevisionOperations {} { | |
| 446 | 430 | foreach rev $myrevisions { $rev determineoperation } |
| 447 | 431 | return |
| 448 | 432 | } |
| 449 | 433 | |
| 450 | - proc DetermineLinesOfDevelopment {} { | |
| 434 | + method DetermineLinesOfDevelopment {} { | |
| 451 | 435 | # For revisions this has been done already, in 'extend'. Now |
| 452 | 436 | # we do this for the branches and tags. |
| 453 | 437 | |
| 454 | - upvar 1 self self mybranches mybranches mytags mytags mytrunk mytrunk | |
| 455 | - | |
| 456 | 438 | foreach {_ branch} [array get mybranches] { |
| 457 | - $branch setlod [GetLOD [$branch parentrevnr]] | |
| 439 | + $branch setlod [$self GetLOD [$branch parentrevnr]] | |
| 458 | 440 | } |
| 459 | 441 | |
| 460 | 442 | foreach {_ taglist} [array get mytags] { |
| 461 | 443 | foreach tag $taglist { |
| 462 | - $tag setlod [GetLOD [$tag tagrevnr]] | |
| 444 | + $tag setlod [$self GetLOD [$tag tagrevnr]] | |
| 463 | 445 | } |
| 464 | 446 | } |
| 465 | 447 | return |
| 466 | 448 | } |
| 467 | 449 | |
| 468 | - proc GetLOD {revnr} { | |
| 450 | + method GetLOD {revnr} { | |
| 469 | 451 | if {[rev istrunkrevnr $revnr]} { |
| 470 | - upvar 1 mytrunk mytrunk | |
| 471 | 452 | return $mytrunk |
| 472 | 453 | } else { |
| 473 | - upvar 1 self self | |
| 474 | 454 | return [$self Rev2Branch $revnr] |
| 475 | 455 | } |
| 476 | 456 | } |
| 477 | 457 | |
| 478 | - proc HandleNonTrunkDefaultBranch {} { | |
| 479 | - upvar 1 myprincipal myprincipal myroot myroot mybranches mybranches myimported myimported myroots myroots myrev myrev | |
| 480 | - | |
| 481 | - set revlist [NonTrunkDefaultRevisions] | |
| 458 | + method HandleNonTrunkDefaultBranch {} { | |
| 459 | + set revlist [$self NonTrunkDefaultRevisions] | |
| 482 | 460 | if {![llength $revlist]} return |
| 483 | 461 | |
| 484 | - AdjustNonTrunkDefaultBranch $revlist | |
| 485 | - CheckLODs | |
| 462 | + $self AdjustNonTrunkDefaultBranch $revlist | |
| 463 | + $self CheckLODs | |
| 486 | 464 | return |
| 487 | 465 | } |
| 488 | 466 | |
| 489 | - proc NonTrunkDefaultRevisions {} { | |
| 467 | + method NonTrunkDefaultRevisions {} { | |
| 490 | 468 | # From cvs2svn the following explanation (with modifications |
| 491 | 469 | # for our algorithm): |
| 492 | 470 | |
| 493 | 471 | # Determine whether there are any non-trunk default branch |
| 494 | 472 | # revisions. |
| @@ -512,12 +490,10 @@ | ||
| 512 | 490 | # all of which are dated before 1.2, and then it has 1.1.1.97 |
| 513 | 491 | # -> 1.1.1.100 dated after 1.2. In this case, we should |
| 514 | 492 | # record 1.1.1.96 as the last vendor revision to have been the |
| 515 | 493 | # head of the default branch. |
| 516 | 494 | |
| 517 | - upvar 1 myprincipal myprincipal myroot myroot mybranches mybranches myimported myimported | |
| 518 | - | |
| 519 | 495 | if {$myprincipal ne ""} { |
| 520 | 496 | # There is still a default branch; that means that all |
| 521 | 497 | # revisions on that branch get marked. |
| 522 | 498 | |
| 523 | 499 | log write 5 file "Found explicitly marked NTDB" |
| @@ -593,12 +569,11 @@ | ||
| 593 | 569 | } else { |
| 594 | 570 | return {} |
| 595 | 571 | } |
| 596 | 572 | } |
| 597 | 573 | |
| 598 | - proc AdjustNonTrunkDefaultBranch {revlist} { | |
| 599 | - upvar 1 myroot myroot myimported myimported myroots myroots myrev myrev mybranches mybranches | |
| 574 | + method AdjustNonTrunkDefaultBranch {revlist} { | |
| 600 | 575 | set stop [$myroot child] ;# rev '1.2' |
| 601 | 576 | |
| 602 | 577 | log write 5 file "Adjusting NTDB containing [nsp [llength $revlist] revision]" |
| 603 | 578 | |
| 604 | 579 | # From cvs2svn the following explanation (with modifications |
| @@ -702,28 +677,25 @@ | ||
| 702 | 677 | $last setdefaultbranchchild $stop |
| 703 | 678 | } |
| 704 | 679 | return |
| 705 | 680 | } |
| 706 | 681 | |
| 707 | - proc CheckLODs {} { | |
| 708 | - upvar 1 mybranches mybranches mytags mytags | |
| 709 | - | |
| 710 | - foreach {_ branch} [array get mybranches] { $branch checklod } | |
| 711 | - | |
| 682 | + method CheckLODs {} { | |
| 683 | + foreach {_ branch} [array get mybranches] { $branch checklod } | |
| 712 | 684 | foreach {_ taglist} [array get mytags] { |
| 713 | 685 | foreach tag $taglist { $tag checklod } |
| 714 | 686 | } |
| 715 | 687 | return |
| 716 | 688 | } |
| 717 | 689 | |
| 718 | - proc RemoveIrrelevantDeletions {} { | |
| 690 | + method RemoveIrrelevantDeletions {} { | |
| 719 | 691 | } |
| 720 | 692 | |
| 721 | - proc RemoveInitialBranchDeletions {} { | |
| 693 | + method RemoveInitialBranchDeletions {} { | |
| 722 | 694 | } |
| 723 | 695 | |
| 724 | - proc ExcludeNonTrunkInformation {} { | |
| 696 | + method ExcludeNonTrunkInformation {} { | |
| 725 | 697 | } |
| 726 | 698 | |
| 727 | 699 | # # ## ### ##### ######## ############# |
| 728 | 700 | ## Configuration |
| 729 | 701 | |
| 730 | 702 |
| --- tools/cvs2fossil/lib/c2f_file.tcl | |
| +++ tools/cvs2fossil/lib/c2f_file.tcl | |
| @@ -112,24 +112,24 @@ | |
| 112 | } |
| 113 | |
| 114 | set myaid($revnr) [$myproject defauthor $author] |
| 115 | set myrev($revnr) [rev %AUTO% $revnr $date $state $self] |
| 116 | |
| 117 | RecordBasicDependencies $revnr $next |
| 118 | return |
| 119 | } |
| 120 | |
| 121 | method defdone {} { |
| 122 | # This is all done after the revision tree has been extracted |
| 123 | # from the file, before the commit mesages and delta texts are |
| 124 | # processed. |
| 125 | |
| 126 | ProcessPrimaryDependencies |
| 127 | ProcessBranchDependencies |
| 128 | SortBranches |
| 129 | ProcessTagDependencies |
| 130 | DetermineTheRootRevision |
| 131 | return |
| 132 | } |
| 133 | |
| 134 | method setdesc {d} {# ignore} |
| 135 | |
| @@ -161,11 +161,11 @@ | |
| 161 | # branch/lod and project information into the group we ensure |
| 162 | # that any cross-project and cross-branch commits are |
| 163 | # separated into multiple commits, one in each of the projects |
| 164 | # and/or branches). |
| 165 | |
| 166 | set lod [GetLOD $revnr] |
| 167 | |
| 168 | $rev setmeta [$myproject defmeta [$lod id] $myaid($revnr) $cmid] |
| 169 | $rev settext $textrange |
| 170 | $rev setlod $lod |
| 171 | |
| @@ -192,18 +192,18 @@ | |
| 192 | method done {} { |
| 193 | # Complete the revisions, branches, and tags. This includes |
| 194 | # looking for a non-trunk default branch, marking its members |
| 195 | # and linking them into the trunk. |
| 196 | |
| 197 | DetermineRevisionOperations |
| 198 | DetermineLinesOfDevelopment |
| 199 | HandleNonTrunkDefaultBranch |
| 200 | RemoveIrrelevantDeletions |
| 201 | RemoveInitialBranchDeletions |
| 202 | |
| 203 | if {[$myproject trunkonly]} { |
| 204 | ExcludeNonTrunkInformation |
| 205 | } |
| 206 | return |
| 207 | } |
| 208 | |
| 209 | # # ## ### ##### ######## ############# |
| @@ -306,11 +306,11 @@ | |
| 306 | set tag [sym %AUTO% tag $revnr [$myproject getsymbol $name]] |
| 307 | lappend mytags($revnr) $tag |
| 308 | return $tag |
| 309 | } |
| 310 | |
| 311 | proc RecordBasicDependencies {revnr next} { |
| 312 | # Handle the revision dependencies. Record them for now, do |
| 313 | # nothing with them yet. |
| 314 | |
| 315 | # On the trunk the 'next' field points to the previous |
| 316 | # revision, i.e. the _parent_ of the current one. Example: |
| @@ -326,37 +326,30 @@ | |
| 326 | # The dependencies needed here are the logical structure, |
| 327 | # parent/child, and not the implementation dependent delta |
| 328 | # pointers. |
| 329 | |
| 330 | if {$next eq ""} return |
| 331 | |
| 332 | upvar 1 mydependencies mydependencies |
| 333 | |
| 334 | # parent -> child |
| 335 | if {[rev istrunkrevnr $revnr]} { |
| 336 | lappend mydependencies $next $revnr |
| 337 | } else { |
| 338 | lappend mydependencies $revnr $next |
| 339 | } |
| 340 | return |
| 341 | } |
| 342 | |
| 343 | proc ProcessPrimaryDependencies {} { |
| 344 | upvar 1 mydependencies mydependencies myrev myrev |
| 345 | |
| 346 | foreach {parentrevnr childrevnr} $mydependencies { |
| 347 | set parent $myrev($parentrevnr) |
| 348 | set child $myrev($childrevnr) |
| 349 | $parent setchild $child |
| 350 | $child setparent $parent |
| 351 | } |
| 352 | return |
| 353 | } |
| 354 | |
| 355 | proc ProcessBranchDependencies {} { |
| 356 | upvar 1 mybranches mybranches myrev myrev |
| 357 | |
| 358 | foreach {branchnr branch} [array get mybranches] { |
| 359 | set revnr [$branch parentrevnr] |
| 360 | |
| 361 | if {![info exists myrev($revnr)]} { |
| 362 | log write 1 file "In '$mypath': The branch '[$branch name]' references" |
| @@ -385,22 +378,16 @@ | |
| 385 | } |
| 386 | } |
| 387 | return |
| 388 | } |
| 389 | |
| 390 | proc SortBranches {} { |
| 391 | upvar 1 myrev myrev |
| 392 | |
| 393 | foreach {revnr rev} [array get myrev] { |
| 394 | $rev sortbranches |
| 395 | } |
| 396 | return |
| 397 | } |
| 398 | |
| 399 | proc ProcessTagDependencies {} { |
| 400 | upvar 1 mytags mytags myrev myrev |
| 401 | |
| 402 | foreach {revnr taglist} [array get mytags] { |
| 403 | if {![info exists myrev($revnr)]} { |
| 404 | set n [llength $taglist] |
| 405 | log write 1 file "In '$mypath': The following [nsp $n tag] reference" |
| 406 | log write 1 file "the bogus revision '$revnr' and will be ignored." |
| @@ -418,13 +405,11 @@ | |
| 418 | } |
| 419 | } |
| 420 | return |
| 421 | } |
| 422 | |
| 423 | proc DetermineTheRootRevision {} { |
| 424 | upvar 1 myrev myrev myroot myroot |
| 425 | |
| 426 | # The root is the one revision which has no parent. By |
| 427 | # checking all revisions we ensure that we can detect and |
| 428 | # report the case of multiple roots. Without that we could |
| 429 | # simply take one revision and follow the parent links to |
| 430 | # their root (sic!). |
| @@ -439,56 +424,49 @@ | |
| 439 | # severed from their parent, making them their own root. |
| 440 | set myroots [list $myroot] |
| 441 | return |
| 442 | } |
| 443 | |
| 444 | proc DetermineRevisionOperations {} { |
| 445 | upvar 1 myrevisions myrevisions |
| 446 | foreach rev $myrevisions { $rev determineoperation } |
| 447 | return |
| 448 | } |
| 449 | |
| 450 | proc DetermineLinesOfDevelopment {} { |
| 451 | # For revisions this has been done already, in 'extend'. Now |
| 452 | # we do this for the branches and tags. |
| 453 | |
| 454 | upvar 1 self self mybranches mybranches mytags mytags mytrunk mytrunk |
| 455 | |
| 456 | foreach {_ branch} [array get mybranches] { |
| 457 | $branch setlod [GetLOD [$branch parentrevnr]] |
| 458 | } |
| 459 | |
| 460 | foreach {_ taglist} [array get mytags] { |
| 461 | foreach tag $taglist { |
| 462 | $tag setlod [GetLOD [$tag tagrevnr]] |
| 463 | } |
| 464 | } |
| 465 | return |
| 466 | } |
| 467 | |
| 468 | proc GetLOD {revnr} { |
| 469 | if {[rev istrunkrevnr $revnr]} { |
| 470 | upvar 1 mytrunk mytrunk |
| 471 | return $mytrunk |
| 472 | } else { |
| 473 | upvar 1 self self |
| 474 | return [$self Rev2Branch $revnr] |
| 475 | } |
| 476 | } |
| 477 | |
| 478 | proc HandleNonTrunkDefaultBranch {} { |
| 479 | upvar 1 myprincipal myprincipal myroot myroot mybranches mybranches myimported myimported myroots myroots myrev myrev |
| 480 | |
| 481 | set revlist [NonTrunkDefaultRevisions] |
| 482 | if {![llength $revlist]} return |
| 483 | |
| 484 | AdjustNonTrunkDefaultBranch $revlist |
| 485 | CheckLODs |
| 486 | return |
| 487 | } |
| 488 | |
| 489 | proc NonTrunkDefaultRevisions {} { |
| 490 | # From cvs2svn the following explanation (with modifications |
| 491 | # for our algorithm): |
| 492 | |
| 493 | # Determine whether there are any non-trunk default branch |
| 494 | # revisions. |
| @@ -512,12 +490,10 @@ | |
| 512 | # all of which are dated before 1.2, and then it has 1.1.1.97 |
| 513 | # -> 1.1.1.100 dated after 1.2. In this case, we should |
| 514 | # record 1.1.1.96 as the last vendor revision to have been the |
| 515 | # head of the default branch. |
| 516 | |
| 517 | upvar 1 myprincipal myprincipal myroot myroot mybranches mybranches myimported myimported |
| 518 | |
| 519 | if {$myprincipal ne ""} { |
| 520 | # There is still a default branch; that means that all |
| 521 | # revisions on that branch get marked. |
| 522 | |
| 523 | log write 5 file "Found explicitly marked NTDB" |
| @@ -593,12 +569,11 @@ | |
| 593 | } else { |
| 594 | return {} |
| 595 | } |
| 596 | } |
| 597 | |
| 598 | proc AdjustNonTrunkDefaultBranch {revlist} { |
| 599 | upvar 1 myroot myroot myimported myimported myroots myroots myrev myrev mybranches mybranches |
| 600 | set stop [$myroot child] ;# rev '1.2' |
| 601 | |
| 602 | log write 5 file "Adjusting NTDB containing [nsp [llength $revlist] revision]" |
| 603 | |
| 604 | # From cvs2svn the following explanation (with modifications |
| @@ -702,28 +677,25 @@ | |
| 702 | $last setdefaultbranchchild $stop |
| 703 | } |
| 704 | return |
| 705 | } |
| 706 | |
| 707 | proc CheckLODs {} { |
| 708 | upvar 1 mybranches mybranches mytags mytags |
| 709 | |
| 710 | foreach {_ branch} [array get mybranches] { $branch checklod } |
| 711 | |
| 712 | foreach {_ taglist} [array get mytags] { |
| 713 | foreach tag $taglist { $tag checklod } |
| 714 | } |
| 715 | return |
| 716 | } |
| 717 | |
| 718 | proc RemoveIrrelevantDeletions {} { |
| 719 | } |
| 720 | |
| 721 | proc RemoveInitialBranchDeletions {} { |
| 722 | } |
| 723 | |
| 724 | proc ExcludeNonTrunkInformation {} { |
| 725 | } |
| 726 | |
| 727 | # # ## ### ##### ######## ############# |
| 728 | ## Configuration |
| 729 | |
| 730 |
| --- tools/cvs2fossil/lib/c2f_file.tcl | |
| +++ tools/cvs2fossil/lib/c2f_file.tcl | |
| @@ -112,24 +112,24 @@ | |
| 112 | } |
| 113 | |
| 114 | set myaid($revnr) [$myproject defauthor $author] |
| 115 | set myrev($revnr) [rev %AUTO% $revnr $date $state $self] |
| 116 | |
| 117 | $self RecordBasicDependencies $revnr $next |
| 118 | return |
| 119 | } |
| 120 | |
| 121 | method defdone {} { |
| 122 | # This is all done after the revision tree has been extracted |
| 123 | # from the file, before the commit mesages and delta texts are |
| 124 | # processed. |
| 125 | |
| 126 | $self ProcessPrimaryDependencies |
| 127 | $self ProcessBranchDependencies |
| 128 | $self SortBranches |
| 129 | $self ProcessTagDependencies |
| 130 | $self DetermineTheRootRevision |
| 131 | return |
| 132 | } |
| 133 | |
| 134 | method setdesc {d} {# ignore} |
| 135 | |
| @@ -161,11 +161,11 @@ | |
| 161 | # branch/lod and project information into the group we ensure |
| 162 | # that any cross-project and cross-branch commits are |
| 163 | # separated into multiple commits, one in each of the projects |
| 164 | # and/or branches). |
| 165 | |
| 166 | set lod [$self GetLOD $revnr] |
| 167 | |
| 168 | $rev setmeta [$myproject defmeta [$lod id] $myaid($revnr) $cmid] |
| 169 | $rev settext $textrange |
| 170 | $rev setlod $lod |
| 171 | |
| @@ -192,18 +192,18 @@ | |
| 192 | method done {} { |
| 193 | # Complete the revisions, branches, and tags. This includes |
| 194 | # looking for a non-trunk default branch, marking its members |
| 195 | # and linking them into the trunk. |
| 196 | |
| 197 | $self DetermineRevisionOperations |
| 198 | $self DetermineLinesOfDevelopment |
| 199 | $self HandleNonTrunkDefaultBranch |
| 200 | $self RemoveIrrelevantDeletions |
| 201 | $self RemoveInitialBranchDeletions |
| 202 | |
| 203 | if {[$myproject trunkonly]} { |
| 204 | $self ExcludeNonTrunkInformation |
| 205 | } |
| 206 | return |
| 207 | } |
| 208 | |
| 209 | # # ## ### ##### ######## ############# |
| @@ -306,11 +306,11 @@ | |
| 306 | set tag [sym %AUTO% tag $revnr [$myproject getsymbol $name]] |
| 307 | lappend mytags($revnr) $tag |
| 308 | return $tag |
| 309 | } |
| 310 | |
| 311 | method RecordBasicDependencies {revnr next} { |
| 312 | # Handle the revision dependencies. Record them for now, do |
| 313 | # nothing with them yet. |
| 314 | |
| 315 | # On the trunk the 'next' field points to the previous |
| 316 | # revision, i.e. the _parent_ of the current one. Example: |
| @@ -326,37 +326,30 @@ | |
| 326 | # The dependencies needed here are the logical structure, |
| 327 | # parent/child, and not the implementation dependent delta |
| 328 | # pointers. |
| 329 | |
| 330 | if {$next eq ""} return |
| 331 | # parent -> child |
| 332 | if {[rev istrunkrevnr $revnr]} { |
| 333 | lappend mydependencies $next $revnr |
| 334 | } else { |
| 335 | lappend mydependencies $revnr $next |
| 336 | } |
| 337 | return |
| 338 | } |
| 339 | |
| 340 | method ProcessPrimaryDependencies {} { |
| 341 | foreach {parentrevnr childrevnr} $mydependencies { |
| 342 | set parent $myrev($parentrevnr) |
| 343 | set child $myrev($childrevnr) |
| 344 | $parent setchild $child |
| 345 | $child setparent $parent |
| 346 | } |
| 347 | return |
| 348 | } |
| 349 | |
| 350 | method ProcessBranchDependencies {} { |
| 351 | foreach {branchnr branch} [array get mybranches] { |
| 352 | set revnr [$branch parentrevnr] |
| 353 | |
| 354 | if {![info exists myrev($revnr)]} { |
| 355 | log write 1 file "In '$mypath': The branch '[$branch name]' references" |
| @@ -385,22 +378,16 @@ | |
| 378 | } |
| 379 | } |
| 380 | return |
| 381 | } |
| 382 | |
| 383 | method SortBranches {} { |
| 384 | foreach {revnr rev} [array get myrev] { $rev sortbranches } |
| 385 | return |
| 386 | } |
| 387 | |
| 388 | method ProcessTagDependencies {} { |
| 389 | foreach {revnr taglist} [array get mytags] { |
| 390 | if {![info exists myrev($revnr)]} { |
| 391 | set n [llength $taglist] |
| 392 | log write 1 file "In '$mypath': The following [nsp $n tag] reference" |
| 393 | log write 1 file "the bogus revision '$revnr' and will be ignored." |
| @@ -418,13 +405,11 @@ | |
| 405 | } |
| 406 | } |
| 407 | return |
| 408 | } |
| 409 | |
| 410 | method DetermineTheRootRevision {} { |
| 411 | # The root is the one revision which has no parent. By |
| 412 | # checking all revisions we ensure that we can detect and |
| 413 | # report the case of multiple roots. Without that we could |
| 414 | # simply take one revision and follow the parent links to |
| 415 | # their root (sic!). |
| @@ -439,56 +424,49 @@ | |
| 424 | # severed from their parent, making them their own root. |
| 425 | set myroots [list $myroot] |
| 426 | return |
| 427 | } |
| 428 | |
| 429 | method DetermineRevisionOperations {} { |
| 430 | foreach rev $myrevisions { $rev determineoperation } |
| 431 | return |
| 432 | } |
| 433 | |
| 434 | method DetermineLinesOfDevelopment {} { |
| 435 | # For revisions this has been done already, in 'extend'. Now |
| 436 | # we do this for the branches and tags. |
| 437 | |
| 438 | foreach {_ branch} [array get mybranches] { |
| 439 | $branch setlod [$self GetLOD [$branch parentrevnr]] |
| 440 | } |
| 441 | |
| 442 | foreach {_ taglist} [array get mytags] { |
| 443 | foreach tag $taglist { |
| 444 | $tag setlod [$self GetLOD [$tag tagrevnr]] |
| 445 | } |
| 446 | } |
| 447 | return |
| 448 | } |
| 449 | |
| 450 | method GetLOD {revnr} { |
| 451 | if {[rev istrunkrevnr $revnr]} { |
| 452 | return $mytrunk |
| 453 | } else { |
| 454 | return [$self Rev2Branch $revnr] |
| 455 | } |
| 456 | } |
| 457 | |
| 458 | method HandleNonTrunkDefaultBranch {} { |
| 459 | set revlist [$self NonTrunkDefaultRevisions] |
| 460 | if {![llength $revlist]} return |
| 461 | |
| 462 | $self AdjustNonTrunkDefaultBranch $revlist |
| 463 | $self CheckLODs |
| 464 | return |
| 465 | } |
| 466 | |
| 467 | method NonTrunkDefaultRevisions {} { |
| 468 | # From cvs2svn the following explanation (with modifications |
| 469 | # for our algorithm): |
| 470 | |
| 471 | # Determine whether there are any non-trunk default branch |
| 472 | # revisions. |
| @@ -512,12 +490,10 @@ | |
| 490 | # all of which are dated before 1.2, and then it has 1.1.1.97 |
| 491 | # -> 1.1.1.100 dated after 1.2. In this case, we should |
| 492 | # record 1.1.1.96 as the last vendor revision to have been the |
| 493 | # head of the default branch. |
| 494 | |
| 495 | if {$myprincipal ne ""} { |
| 496 | # There is still a default branch; that means that all |
| 497 | # revisions on that branch get marked. |
| 498 | |
| 499 | log write 5 file "Found explicitly marked NTDB" |
| @@ -593,12 +569,11 @@ | |
| 569 | } else { |
| 570 | return {} |
| 571 | } |
| 572 | } |
| 573 | |
| 574 | method AdjustNonTrunkDefaultBranch {revlist} { |
| 575 | set stop [$myroot child] ;# rev '1.2' |
| 576 | |
| 577 | log write 5 file "Adjusting NTDB containing [nsp [llength $revlist] revision]" |
| 578 | |
| 579 | # From cvs2svn the following explanation (with modifications |
| @@ -702,28 +677,25 @@ | |
| 677 | $last setdefaultbranchchild $stop |
| 678 | } |
| 679 | return |
| 680 | } |
| 681 | |
| 682 | method CheckLODs {} { |
| 683 | foreach {_ branch} [array get mybranches] { $branch checklod } |
| 684 | foreach {_ taglist} [array get mytags] { |
| 685 | foreach tag $taglist { $tag checklod } |
| 686 | } |
| 687 | return |
| 688 | } |
| 689 | |
| 690 | method RemoveIrrelevantDeletions {} { |
| 691 | } |
| 692 | |
| 693 | method RemoveInitialBranchDeletions {} { |
| 694 | } |
| 695 | |
| 696 | method ExcludeNonTrunkInformation {} { |
| 697 | } |
| 698 | |
| 699 | # # ## ### ##### ######## ############# |
| 700 | ## Configuration |
| 701 | |
| 702 |