Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Added convenience method for assertions and used it in place of the existing if/trouble internal constructions. Changed API of 'log write' so that we can defer substituation of the message to when the write actually happen, and converted all places which would be hit by double-substitution. The remaining 'log write' calls will be converted incrementally. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
47d52d1efd967e4ee4f1159b822c175e |
| User & Date: | aku 2007-11-28 05:39:49.000 |
Context
|
2007-11-28
| ||
| 08:35 | Bugfix in FilterSym pass. Grafting branches operated on the tags table :( ... (check-in: 8ce7ffff21 user: aku tags: trunk) | |
| 05:39 | Added convenience method for assertions and used it in place of the existing if/trouble internal constructions. Changed API of 'log write' so that we can defer substituation of the message to when the write actually happen, and converted all places which would be hit by double-substitution. The remaining 'log write' calls will be converted incrementally. ... (check-in: 47d52d1efd user: aku tags: trunk) | |
|
2007-11-27
| ||
| 09:07 | Modified to break all backward symbols, not only branches, removed the other custom circle breaking code, should not be needed any longer (See comments for proof). ... (check-in: 6b520e7d97 user: aku tags: trunk) | |
Changes
Changes to tools/cvs2fossil/lib/c2f_file.tcl.
| ︙ | ︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 | package require Tcl 8.4 ; # Required runtime. package require snit ; # OO system. package require struct::set ; # Set operations. package require vc::fossil::import::cvs::file::rev ; # CVS per file revisions. package require vc::fossil::import::cvs::file::sym ; # CVS per file symbols. package require vc::fossil::import::cvs::state ; # State storage. package require vc::tools::trouble ; # Error reporting. package require vc::tools::log ; # User feedback package require vc::tools::misc ; # Text formatting # # ## ### ##### ######## ############# ##################### ## | > | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | package require Tcl 8.4 ; # Required runtime. package require snit ; # OO system. package require struct::set ; # Set operations. package require vc::fossil::import::cvs::file::rev ; # CVS per file revisions. package require vc::fossil::import::cvs::file::sym ; # CVS per file symbols. package require vc::fossil::import::cvs::state ; # State storage. package require vc::fossil::import::cvs::integrity ; # State integrity checks. package require vc::tools::trouble ; # Error reporting. package require vc::tools::log ; # User feedback package require vc::tools::misc ; # Text formatting # # ## ### ##### ######## ############# ##################### ## |
| ︙ | ︙ | |||
40 41 42 43 44 45 46 |
set myexecutable $executable
set myproject $project
set mytrunk [$myproject trunk]
return
}
method setid {id} {
| | | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
set myexecutable $executable
set myproject $project
set mytrunk [$myproject trunk]
return
}
method setid {id} {
integrity assert {$myid eq ""} {File '$mypath' already has an id, '$myid'}
set myid $id
return
}
method id {} { return $myid }
method path {} { return $mypath }
method usrpath {} { return $myusrpath }
|
| ︙ | ︙ | |||
323 324 325 326 327 328 329 |
$branch setchildrevnr $branchrevnr
}
return
}
method Rev2Branch {revnr} {
| | < < | 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 |
$branch setchildrevnr $branchrevnr
}
return
}
method Rev2Branch {revnr} {
integrity assert {![rev istrunkrevnr $revnr]} {Expected a branch revision number}
return $mybranches([rev 2branchnr $revnr])
}
method AddUnlabeledBranch {branchnr} {
return [$self AddBranch unlabeled-$branchnr $branchnr]
}
|
| ︙ | ︙ | |||
459 460 461 462 463 464 465 |
# checking all revisions we ensure that we can detect and
# report the case of multiple roots. Without that we could
# simply take one revision and follow the parent links to
# their root (sic!).
foreach {revnr rev} [array get myrev] {
if {[$rev hasparent]} continue
| | | 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 |
# checking all revisions we ensure that we can detect and
# report the case of multiple roots. Without that we could
# simply take one revision and follow the parent links to
# their root (sic!).
foreach {revnr rev} [array get myrev] {
if {[$rev hasparent]} continue
integrity assert {$myroot eq ""} {Multiple root revisions found}
set myroot $rev
}
# In the future we also need a list, as branches can become
# severed from their parent, making them their own root.
set myroots [list $myroot]
return
|
| ︙ | ︙ | |||
697 698 699 700 701 702 703 | $stop cutfromparent lappend myroots $stop ; # New root, after vendor branch } # Cut out the vendor branch symbol set vendor [$first parentbranch] | | | 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 |
$stop cutfromparent
lappend myroots $stop ; # New root, after vendor branch
}
# Cut out the vendor branch symbol
set vendor [$first parentbranch]
integrity assert {$vendor ne ""} {First NTDB revision has no branch}
if {[$vendor parent] eq $rev11} {
$rev11 removebranch $vendor
$rev11 removechildonbranch $first
$vendor cutchild
$first cutfromparentbranch
lappend myroots $first
}
|
| ︙ | ︙ | |||
952 953 954 955 956 957 958 |
# questionable whether this handling is correct, since the
# non-trunk default branch revisions affect trunk and
# should therefore not just be discarded even if
# --trunk-only.
if {[$root hasdefaultbranchchild]} {
set ntdbchild [$root defaultbranchchild]
| > | | < | | | 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 |
# questionable whether this handling is correct, since the
# non-trunk default branch revisions affect trunk and
# should therefore not just be discarded even if
# --trunk-only.
if {[$root hasdefaultbranchchild]} {
set ntdbchild [$root defaultbranchchild]
integrity assert {
[$ntdbchild defaultbranchparent] eq $ntdbchild
} {ntdb - trunk linkage broken}
$ntdbchild cutdefaultbranchparent
if {[$ntdbchild hasparent]} {
lappend myroots [$ntdbchild parent]
}
}
set root [$root child]
}
return
}
method GraftNTDB2Trunk {root} {
# We can now graft the non-trunk default branch revisions to
# trunk. They should already be alone on a CVSBranch-less
# branch.
integrity assert {![$root hasparentbranch]} {NTDB root still has its branch symbol}
integrity assert {![$root hasbranches]} {NTDB root still has spawned branches}
set last $root
while {[$last haschild]} {set last [$last child]}
if {[$last hasdefaultbranchchild]} {
set rev12 [$last defaultbranchchild]
|
| ︙ | ︙ | |||
1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 |
# Import not required, already a child namespace.
# namespace import ::vc::fossil::import::cvs::file::rev
# namespace import ::vc::fossil::import::cvs::file::sym
namespace import ::vc::tools::misc::*
namespace import ::vc::tools::trouble
namespace import ::vc::tools::log
namespace import ::vc::fossil::import::cvs::state
}
}
# # ## ### ##### ######## ############# #####################
## Ready
package provide vc::fossil::import::cvs::file 1.0
return
| > | 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 |
# Import not required, already a child namespace.
# namespace import ::vc::fossil::import::cvs::file::rev
# namespace import ::vc::fossil::import::cvs::file::sym
namespace import ::vc::tools::misc::*
namespace import ::vc::tools::trouble
namespace import ::vc::tools::log
namespace import ::vc::fossil::import::cvs::state
namespace import ::vc::fossil::import::cvs::integrity
}
}
# # ## ### ##### ######## ############# #####################
## Ready
package provide vc::fossil::import::cvs::file 1.0
return
|
Changes to tools/cvs2fossil/lib/c2f_frev.tcl.
| ︙ | ︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# # ## ### ##### ######## ############# #####################
## Requirements
package require Tcl 8.4 ; # Required runtime.
package require snit ; # OO system.
package require vc::tools::misc ; # Text formatting
package require vc::fossil::import::cvs::state ; # State storage.
# # ## ### ##### ######## ############# #####################
##
snit::type ::vc::fossil::import::cvs::file::rev {
# # ## ### ##### ######## #############
## Public API
| > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# # ## ### ##### ######## ############# #####################
## Requirements
package require Tcl 8.4 ; # Required runtime.
package require snit ; # OO system.
package require vc::tools::misc ; # Text formatting
package require vc::fossil::import::cvs::state ; # State storage.
package require vc::fossil::import::cvs::integrity ; # State integrity checks.
# # ## ### ##### ######## ############# #####################
##
snit::type ::vc::fossil::import::cvs::file::rev {
# # ## ### ##### ######## #############
## Public API
|
| ︙ | ︙ | |||
117 118 119 120 121 122 123 |
# Basic parent/child linkage __________
method hasparent {} { return [expr {$myparent ne ""}] }
method haschild {} { return [expr {$mychild ne ""}] }
method setparent {parent} {
| | | | | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# Basic parent/child linkage __________
method hasparent {} { return [expr {$myparent ne ""}] }
method haschild {} { return [expr {$mychild ne ""}] }
method setparent {parent} {
integrity assert {$myparent eq ""} {Parent already defined}
set myparent $parent
return
}
method cutfromparent {} { set myparent "" ; return }
method cutfromchild {} { set mychild "" ; return }
method setchild {child} {
integrity assert {$mychild eq ""} {Child already defined}
set mychild $child
return
}
method changeparent {parent} { set myparent $parent ; return }
method changechild {child} { set mychild $child ; return }
method parent {} { return $myparent }
method child {} { return $mychild }
# Branch linkage ______________________
method setparentbranch {branch} {
integrity assert {$myparentbranch eq ""} {Branch parent already defined}
set myparentbranch $branch
return
}
method hasparentbranch {} { return [expr {$myparentbranch ne ""}] }
method hasbranches {} { return [llength $mybranches] }
|
| ︙ | ︙ | |||
517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 |
}
namespace eval ::vc::fossil::import::cvs::file {
namespace export rev
namespace eval rev {
namespace import ::vc::tools::misc::*
namespace import ::vc::fossil::import::cvs::state
}
}
# # ## ### ##### ######## ############# #####################
## Ready
package provide vc::fossil::import::cvs::file::rev 1.0
return
| > | 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 |
}
namespace eval ::vc::fossil::import::cvs::file {
namespace export rev
namespace eval rev {
namespace import ::vc::tools::misc::*
namespace import ::vc::fossil::import::cvs::state
namespace import ::vc::fossil::import::cvs::integrity
}
}
# # ## ### ##### ######## ############# #####################
## Ready
package provide vc::fossil::import::cvs::file::rev 1.0
return
|
Changes to tools/cvs2fossil/lib/c2f_fsym.tcl.
| ︙ | ︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
## Requirements
package require Tcl 8.4 ; # Required runtime.
package require snit ; # OO system.
package require vc::tools::trouble ; # Error reporting.
package require vc::fossil::import::cvs::file::rev ; # CVS per file revisions.
package require vc::fossil::import::cvs::state ; # State storage.
# # ## ### ##### ######## ############# #####################
##
snit::type ::vc::fossil::import::cvs::file::sym {
# # ## ### ##### ######## #############
## Public API
constructor {symtype nr symbol file} {
set myfile $file
set mytype $symtype
set mynr $nr
set mysymbol $symbol
switch -exact -- $mytype {
| > | | < > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
## Requirements
package require Tcl 8.4 ; # Required runtime.
package require snit ; # OO system.
package require vc::tools::trouble ; # Error reporting.
package require vc::fossil::import::cvs::file::rev ; # CVS per file revisions.
package require vc::fossil::import::cvs::state ; # State storage.
package require vc::fossil::import::cvs::integrity ; # State integrity checks.
# # ## ### ##### ######## ############# #####################
##
snit::type ::vc::fossil::import::cvs::file::sym {
# # ## ### ##### ######## #############
## Public API
constructor {symtype nr symbol file} {
set myfile $file
set mytype $symtype
set mynr $nr
set mysymbol $symbol
switch -exact -- $mytype {
branch { SetupBranch ; return }
tag { return }
}
integrity assert 0 {Bad symbol type '$mytype'}
return
}
method defid {} {
set myid [incr myidcounter]
return
}
|
| ︙ | ︙ | |||
111 112 113 114 115 116 117 |
#
method istrunk {} { return 0 }
# Branch acessor methods.
method setchildrevnr {revnr} {
| | | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
#
method istrunk {} { return 0 }
# Branch acessor methods.
method setchildrevnr {revnr} {
integrity assert {$mybranchchildrevnr eq ""} {Child already defined}
set mybranchchildrevnr $revnr
return
}
method setposition {n} { set mybranchposition $n ; return }
method setparent {rev} { set mybranchparent $rev ; return }
method setchild {rev} { set mybranchchild $rev ; return }
|
| ︙ | ︙ | |||
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 |
}
namespace eval ::vc::fossil::import::cvs::file {
namespace export sym
namespace eval sym {
namespace import ::vc::fossil::import::cvs::file::rev
namespace import ::vc::fossil::import::cvs::state
namespace import ::vc::tools::trouble
}
}
# # ## ### ##### ######## ############# #####################
## Ready
package provide vc::fossil::import::cvs::file::sym 1.0
return
| > | 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
}
namespace eval ::vc::fossil::import::cvs::file {
namespace export sym
namespace eval sym {
namespace import ::vc::fossil::import::cvs::file::rev
namespace import ::vc::fossil::import::cvs::state
namespace import ::vc::fossil::import::cvs::integrity
namespace import ::vc::tools::trouble
}
}
# # ## ### ##### ######## ############# #####################
## Ready
package provide vc::fossil::import::cvs::file::sym 1.0
return
|
Changes to tools/cvs2fossil/lib/c2f_integrity.tcl.
| ︙ | ︙ | |||
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# # ## ### ##### ######## ############# #####################
##
snit::type ::vc::fossil::import::cvs::integrity {
# # ## ### ##### ######## #############
## Public API
typemethod strict {} {
log write 4 integrity {Check database consistency}
set n 0
AllButMeta
Meta
| > > > > > > > | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# # ## ### ##### ######## ############# #####################
##
snit::type ::vc::fossil::import::cvs::integrity {
# # ## ### ##### ######## #############
## Public API
typemethod assert {expression failmessage} {
set ok [uplevel 1 [list ::expr $expression]]
if {$ok} return
trouble internal [uplevel 1 [list ::subst $failmessage]]
return
}
typemethod strict {} {
log write 4 integrity {Check database consistency}
set n 0
AllButMeta
Meta
|
| ︙ | ︙ | |||
513 514 515 516 517 518 519 |
proc Check {header label sql} {
upvar 1 n n
set ok 1
foreach {fname revnr} [state run $sql] {
set ok 0
trouble fatal "$fname <$revnr> $label"
}
| | | | | 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 |
proc Check {header label sql} {
upvar 1 n n
set ok 1
foreach {fname revnr} [state run $sql] {
set ok 0
trouble fatal "$fname <$revnr> $label"
}
log write 5 integrity {\[[format %02d [incr n]]\] [expr {$ok ? "Ok " : "Failed"}] ... $header}
return
}
proc CheckCS {header label sql} {
upvar 1 n n
set ok 1
foreach {ctype cid} [state run $sql] {
set ok 0
trouble fatal "<$ctype $cid> $label"
}
log write 5 integrity {\[[format %02d [incr n]]\] [expr {$ok ? "Ok " : "Failed"}] ... $header}
return
}
proc CheckInCS {header label sql} {
upvar 1 n n
set ok 1
foreach {cstype csid fname revnr} [state run $sql] {
set ok 0
set b "<$cstype $csid>"
trouble fatal "$fname <$revnr> [string map [list @ $b] $label]"
}
log write 5 integrity {\[[format %02d [incr n]]\] [expr {$ok ? "Ok " : "Failed"}] ... $header}
return
}
# # ## ### ##### ######## #############
## Configuration
pragma -hasinstances no ; # singleton
|
| ︙ | ︙ |
Changes to tools/cvs2fossil/lib/c2f_pass.tcl.
| ︙ | ︙ | |||
13 14 15 16 17 18 19 | ## Pass manager. All passes register here, with code, description, and ## callbacks (... setup, run, finalize). Option processing and help ## query this manager to dynamically create the relevant texts. # # ## ### ##### ######## ############# ##################### ## Requirements | | | | > | | | | > | | < | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
## Pass manager. All passes register here, with code, description, and
## callbacks (... setup, run, finalize). Option processing and help
## query this manager to dynamically create the relevant texts.
# # ## ### ##### ######## ############# #####################
## Requirements
package require Tcl 8.4 ; # Required runtime.
package require snit ; # OO system.
package require vc::fossil::import::cvs::state ; # State storage
package require vc::fossil::import::cvs::integrity ; # State integrity checks.
package require vc::tools::misc ; # Text formatting
package require vc::tools::trouble ; # Error reporting.
package require vc::tools::log ; # User feedback.
package require struct::list ; # Portable lassign
# # ## ### ##### ######## ############# #####################
##
snit::type ::vc::fossil::import::cvs::pass {
# # ## ### ##### ######## #############
## Public API, Methods (Setup, query)
typemethod define {name description command} {
integrity assert {
![info exists mydesc($name)]
} {Multiple definitions for pass code '$name'}
lappend mypasses $name
set mydesc($name) $description
set mycmd($name) $command
return
}
typemethod help {} {
|
| ︙ | ︙ | |||
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
# # ## ### ##### ######## #############
}
namespace eval ::vc::fossil::import::cvs {
namespace export pass
namespace eval pass {
namespace import ::vc::fossil::import::cvs::state
namespace import ::vc::tools::misc::*
namespace import ::vc::tools::trouble
namespace import ::vc::tools::log
log register pass
}
}
# # ## ### ##### ######## ############# #####################
## Ready
package provide vc::fossil::import::cvs::pass 1.0
return
| > | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
# # ## ### ##### ######## #############
}
namespace eval ::vc::fossil::import::cvs {
namespace export pass
namespace eval pass {
namespace import ::vc::fossil::import::cvs::state
namespace import ::vc::fossil::import::cvs::integrity
namespace import ::vc::tools::misc::*
namespace import ::vc::tools::trouble
namespace import ::vc::tools::log
log register pass
}
}
# # ## ### ##### ######## ############# #####################
## Ready
package provide vc::fossil::import::cvs::pass 1.0
return
|
Changes to tools/cvs2fossil/lib/c2f_pbreakacycle.tcl.
| ︙ | ︙ | |||
172 173 174 175 176 177 178 | cyclebreaker replace $graph $cset $replacements # At last check that the normal frament is indeed not # backward, and iterate over the possibly still backward # second fragment. struct::list assign $replacements normal backward | > | | < | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
cyclebreaker replace $graph $cset $replacements
# At last check that the normal frament is indeed not
# backward, and iterate over the possibly still backward
# second fragment.
struct::list assign $replacements normal backward
integrity assert {
![IsBackward $graph $normal]
} {The normal fragment is unexpectedly backward}
set cset $backward
}
return
}
proc IsBackward {dg cset} {
|
| ︙ | ︙ | |||
257 258 259 260 261 262 263 |
# Check that the ordering at the file level is correct. We
# cannot have backward ordering per revision, or something is
# wrong.
foreach revision [array names limits] {
struct::list assign $limits($revision) maxp mins
# Handle min successor position "" as representing infinity
| | | < | | 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
# Check that the ordering at the file level is correct. We
# cannot have backward ordering per revision, or something is
# wrong.
foreach revision [array names limits] {
struct::list assign $limits($revision) maxp mins
# Handle min successor position "" as representing infinity
integrity assert {
($mins eq "") || ($maxp < $mins)
} {Branch revision $revision is backward at file level ($maxp >= $mins)}
}
# Save the limits for the splitter, and compute the border at
# which to split as the minimum of all minimal successor
# positions.
set thelimits [array get limits]
|
| ︙ | ︙ | |||
297 298 299 300 301 302 303 |
if {$maxp >= $border} {
lappend backwardrevisions $rev
} else {
lappend normalrevisions $rev
}
}
| | | | 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
if {$maxp >= $border} {
lappend backwardrevisions $rev
} else {
lappend normalrevisions $rev
}
}
integrity assert {[llength $normalrevisions]} {Set of normal revisions is empty}
integrity assert {[llength $backwardrevisions]} {Set of backward revisions is empty}
return
}
# # ## ### ##### ######## #############
proc KeepOrder {graph at cset} {
|
| ︙ | ︙ | |||
367 368 369 370 371 372 373 |
if {$mylastpos < 0} {
set old "<NONE>"
} else {
::variable mycset
set old [$mycset($mylastpos) str]@$mylastpos
}
| | | 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
if {$mylastpos < 0} {
set old "<NONE>"
} else {
::variable mycset
set old [$mycset($mylastpos) str]@$mylastpos
}
integrity assert 0 {Ordering of revision changesets violated, [$cset str]@$new is not immediately after $old}
}
set mylastpos $new
return
}
proc FormatTR {graph cset} {
|
| ︙ | ︙ |
Changes to tools/cvs2fossil/lib/c2f_pfiltersym.tcl.
| ︙ | ︙ | |||
378 379 380 381 382 383 384 | set tagname $sn($id) set oldname $sx($lod) struct::list assign $fpn($fid) fname prname # Do the grafting. | | | 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 |
set tagname $sn($id)
set oldname $sx($lod)
struct::list assign $fpn($fid) fname prname
# Do the grafting.
log write 4 filtersym {\[[format $fmt $n]/$mxs\] $prname : Grafting tag '$tagname' on $fname/$revnr from '$oldname' onto '$preferedname'}
state run { UPDATE tag SET lod = $pid WHERE tid = $id ; }
incr n
}
log write 3 filtersym "Reparented [nsp $n tag]"
log write 3 filtersym "Adjust branch parents"
|
| ︙ | ︙ | |||
436 437 438 439 440 441 442 | set braname $sn($id) set oldname $sx($lod) struct::list assign $fpn($fid) fname prname # Do the grafting. | | | 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
set braname $sn($id)
set oldname $sx($lod)
struct::list assign $fpn($fid) fname prname
# Do the grafting.
log write 4 filtersym {\[[format $fmt $n]/$mxs\] $prname : Grafting branch '$braname' on $fname/$revnr from '$oldname' onto '$preferedname'}
state run { UPDATE tag SET lod = $pid WHERE tid = $id ; }
incr n
}
log write 3 filtersym "Reparented [nsp $n branch branches]"
return
}
|
| ︙ | ︙ |
Changes to tools/cvs2fossil/lib/c2f_prev.tcl.
| ︙ | ︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
package require Tcl 8.4 ; # Required runtime.
package require snit ; # OO system.
package require vc::tools::misc ; # Text formatting
package require vc::tools::trouble ; # Error reporting.
package require vc::tools::log ; # User feedback.
package require vc::fossil::import::cvs::state ; # State storage.
package require vc::fossil::import::cvs::project::sym ; # Project level symbols
# # ## ### ##### ######## ############# #####################
##
snit::type ::vc::fossil::import::cvs::project::rev {
# # ## ### ##### ######## #############
| > | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
package require Tcl 8.4 ; # Required runtime.
package require snit ; # OO system.
package require vc::tools::misc ; # Text formatting
package require vc::tools::trouble ; # Error reporting.
package require vc::tools::log ; # User feedback.
package require vc::fossil::import::cvs::state ; # State storage.
package require vc::fossil::import::cvs::integrity ; # State integrity checks.
package require vc::fossil::import::cvs::project::sym ; # Project level symbols
# # ## ### ##### ######## ############# #####################
##
snit::type ::vc::fossil::import::cvs::project::rev {
# # ## ### ##### ######## #############
|
| ︙ | ︙ | |||
198 199 200 201 202 203 204 |
set pending [list $range]
set at 0
array set breaks {}
while {$at < [llength $pending]} {
set current [lindex $pending $at]
| | | | | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
set pending [list $range]
set at 0
array set breaks {}
while {$at < [llength $pending]} {
set current [lindex $pending $at]
log write 6 csets {. . .. ... ..... ........ .............}
log write 6 csets {Scheduled [join [PRs [lrange $pending $at end]] { }]}
log write 6 csets {Considering [PR $current] \[$at/[llength $pending]\]}
set best [FindBestBreak $current]
if {$best < 0} {
# The inspected range has no internal
# dependencies. This is a complete fragment.
lappend fragments $current
|
| ︙ | ︙ | |||
231 232 233 234 235 236 237 |
set brel [expr {$best - [lindex $current 0]}]
set bnext $brel ; incr bnext
set fragbefore [lrange $current 0 $brel]
set fragafter [lrange $current $bnext end]
log write 6 csets "New pieces [PR $fragbefore] [PR $fragafter]"
| < | < < | < | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
set brel [expr {$best - [lindex $current 0]}]
set bnext $brel ; incr bnext
set fragbefore [lrange $current 0 $brel]
set fragafter [lrange $current $bnext end]
log write 6 csets "New pieces [PR $fragbefore] [PR $fragafter]"
integrity assert {[llength $fragbefore]} {Found zero-length fragment at the beginning}
integrity assert {[llength $fragafter]} {Found zero-length fragment at the end}
lappend pending $fragbefore $fragafter
CutAt $best
}
incr at
}
|
| ︙ | ︙ | |||
264 265 266 267 268 269 270 | set fragments [lsort -index 0 -integer $fragments] #puts \t.[join [PRs $fragments] .\n\t.]. Border [lindex $fragments 0] firsts firste | < | < < | < > | | < | 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
set fragments [lsort -index 0 -integer $fragments]
#puts \t.[join [PRs $fragments] .\n\t.].
Border [lindex $fragments 0] firsts firste
integrity assert {$firsts == 0} {Bad fragment start @ $firsts, gap, or before beginning of the range}
set laste $firste
foreach fragment [lrange $fragments 1 end] {
Border $fragment s e
integrity assert {$laste == ($s - 1)} {Bad fragment border <$laste | $s>, gap or overlap}
set new [$type %AUTO% $myproject $mytype $mysrcid [lrange $myrevisions $s $e]]
log write 4 csets "Breaking [$self str ] @ $laste, new [$new str], cutting $breaks($laste)"
set laste $e
}
integrity assert {
$laste == ([llength $myrevisions]-1)
} {Bad fragment end @ $laste, gap, or beyond end of the range}
# Put the first fragment into the current changeset, and
# update the in-memory index. We can simply (re)add the
# revisions because we cleared the previously existing
# information, see (*) above. Persistence does not matter
# here, none of the changesets has been saved to the
# persistent state yet.
|
| ︙ | ︙ | |||
363 364 365 366 367 368 369 |
struct::list assign [$cset data] project cstype cssrc
$cset drop
$cset destroy
set newcsets {}
foreach fragmentrevisions $args {
| > | | < | 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
struct::list assign [$cset data] project cstype cssrc
$cset drop
$cset destroy
set newcsets {}
foreach fragmentrevisions $args {
integrity assert {
[llength $fragmentrevisions]
} {Attempted to create an empty changeset, i.e. without revisions}
lappend newcsets [$type %AUTO% $project $cstype $cssrc $fragmentrevisions]
}
foreach c $newcsets { $c persist }
return $newcsets
}
|
| ︙ | ︙ | |||
462 463 464 465 466 467 468 |
AND R.isdefault -- Restrict to NTDB
AND R.dbchild IS NOT NULL -- and last NTDB belonging to trunk
AND RA.rid = R.dbchild -- Go directly to trunk root
AND RA.child IS NOT NULL -- Has primary child.
AND RA.child IN $theset -- Which is also of interest
"] {
# Consider moving this to the integrity module.
| < | < | 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 |
AND R.isdefault -- Restrict to NTDB
AND R.dbchild IS NOT NULL -- and last NTDB belonging to trunk
AND RA.rid = R.dbchild -- Go directly to trunk root
AND RA.child IS NOT NULL -- Has primary child.
AND RA.child IN $theset -- Which is also of interest
"] {
# Consider moving this to the integrity module.
integrity assert {$rid != $child} {Revision $rid depends on itself.}
lappend dependencies($rid) $child
set dep($rid,$child) .
}
# The sql statements above looks only for direct dependencies
# between revision in the changeset. However due to the
# vagaries of meta data it is possible for two revisions of
|
| ︙ | ︙ | |||
562 563 564 565 566 567 568 |
WHERE R.rid IN $theset -- Restrict to revisions of interest
AND R.isdefault -- Restrict to NTDB
AND R.dbchild IS NOT NULL -- and last NTDB belonging to trunk
AND RA.rid = R.dbchild -- Go directly to trunk root
AND RA.child IS NOT NULL -- Has primary child.
"] {
# Consider moving this to the integrity module.
| < | < | 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 |
WHERE R.rid IN $theset -- Restrict to revisions of interest
AND R.isdefault -- Restrict to NTDB
AND R.dbchild IS NOT NULL -- and last NTDB belonging to trunk
AND RA.rid = R.dbchild -- Go directly to trunk root
AND RA.child IS NOT NULL -- Has primary child.
"] {
# Consider moving this to the integrity module.
integrity assert {$rid != $child} {Revision $rid depends on itself.}
lappend dependencies($rid) $child
}
return
}
proc PullPredecessorRevisions {dv revisions} {
upvar 1 $dv dependencies
|
| ︙ | ︙ | |||
609 610 611 612 613 614 615 |
WHERE R.rid IN $theset -- Restrict to revisions of interest
AND NOT R.isdefault -- not on NTDB
AND R.parent IS NOT NULL -- which are not root
AND RA.rid = R.parent -- go to their parent
AND RA.dbparent IS NOT NULL -- which has to refer to NTDB's root
"] {
# Consider moving this to the integrity module.
| < | < | 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 |
WHERE R.rid IN $theset -- Restrict to revisions of interest
AND NOT R.isdefault -- not on NTDB
AND R.parent IS NOT NULL -- which are not root
AND RA.rid = R.parent -- go to their parent
AND RA.dbparent IS NOT NULL -- which has to refer to NTDB's root
"] {
# Consider moving this to the integrity module.
integrity assert {$rid != $parent} {Revision $rid depends on itself.}
lappend dependencies($rid) $parent
}
return
}
proc InitializeBreakState {revisions} {
upvar 1 pos pos cross cross range range depc depc delta delta \
|
| ︙ | ︙ | |||
858 859 860 861 862 863 864 865 866 867 868 869 870 871 |
# # ## ### ##### ######## #############
}
namespace eval ::vc::fossil::import::cvs::project {
namespace export rev
namespace eval rev {
namespace import ::vc::fossil::import::cvs::state
namespace eval project {
namespace import ::vc::fossil::import::cvs::project::sym
}
::variable mybranchcode [project::sym branch]
namespace import ::vc::tools::misc::*
namespace import ::vc::tools::trouble
namespace import ::vc::tools::log
| > | 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 |
# # ## ### ##### ######## #############
}
namespace eval ::vc::fossil::import::cvs::project {
namespace export rev
namespace eval rev {
namespace import ::vc::fossil::import::cvs::state
namespace import ::vc::fossil::import::cvs::integrity
namespace eval project {
namespace import ::vc::fossil::import::cvs::project::sym
}
::variable mybranchcode [project::sym branch]
namespace import ::vc::tools::misc::*
namespace import ::vc::tools::trouble
namespace import ::vc::tools::log
|
| ︙ | ︙ |
Changes to tools/cvs2fossil/lib/c2f_prevlink.tcl.
| ︙ | ︙ | |||
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
package require Tcl 8.4 ; # Required runtime.
package require snit ; # OO system.
package require vc::tools::misc ; # Text formatting
package require vc::tools::trouble ; # Error reporting.
package require vc::tools::log ; # User feedback.
package require vc::fossil::import::cvs::state ; # State storage.
package require vc::fossil::import::cvs::project::rev ; # Project level changesets
# # ## ### ##### ######## ############# #####################
##
snit::type ::vc::fossil::import::cvs::project::revlink {
# # ## ### ##### ######## #############
| > | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
package require Tcl 8.4 ; # Required runtime.
package require snit ; # OO system.
package require vc::tools::misc ; # Text formatting
package require vc::tools::trouble ; # Error reporting.
package require vc::tools::log ; # User feedback.
package require vc::fossil::import::cvs::state ; # State storage.
package require vc::fossil::import::cvs::integrity ; # State integrity checks.
package require vc::fossil::import::cvs::project::rev ; # Project level changesets
# # ## ### ##### ######## ############# #####################
##
snit::type ::vc::fossil::import::cvs::project::revlink {
# # ## ### ##### ######## #############
|
| ︙ | ︙ | |||
120 121 122 123 124 125 126 |
if {$smove < $omove} { return 1 } ; # self is better.
return 0 ; # Self is worse or equal, i.e. not better.
}
method break {} {
| < | < | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
if {$smove < $omove} { return 1 } ; # self is better.
return 0 ; # Self is worse or equal, i.e. not better.
}
method break {} {
integrity assert {[$self breakable]} {Changeset [$mycset str] is not breakable.}
# One thing to choose when splitting CSET is where the
# revision in categories 1 and 2 (none and passthrough
# respectively) are moved to. This is done using the counters.
if {!$mycount(prev)} {
# Nothing in category 3 => 1,2 go there, 4 the other.
|
| ︙ | ︙ | |||
215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
# # ## ### ##### ######## #############
}
namespace eval ::vc::fossil::import::cvs::project {
namespace export revlink
namespace eval revlink {
namespace import ::vc::fossil::import::cvs::state
namespace import ::vc::tools::misc::*
namespace import ::vc::tools::trouble
namespace eval project {
namespace import ::vc::fossil::import::cvs::project::rev
}
namespace import ::vc::tools::log
log register csets
| > | 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
# # ## ### ##### ######## #############
}
namespace eval ::vc::fossil::import::cvs::project {
namespace export revlink
namespace eval revlink {
namespace import ::vc::fossil::import::cvs::state
namespace import ::vc::fossil::import::cvs::integrity
namespace import ::vc::tools::misc::*
namespace import ::vc::tools::trouble
namespace eval project {
namespace import ::vc::fossil::import::cvs::project::rev
}
namespace import ::vc::tools::log
log register csets
|
| ︙ | ︙ |
Changes to tools/cvs2fossil/lib/c2f_psym.tcl.
| ︙ | ︙ | |||
364 365 366 367 368 369 370 |
if {$mytagcount > $mybranchcount} { return $mytag }
if {$mytagcount < $mybranchcount} { return $mybranch }
return $myundef
}
method MarkAs {label chosen} {
| | | 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
if {$mytagcount > $mybranchcount} { return $mytag }
if {$mytagcount < $mybranchcount} { return $mybranch }
return $myundef
}
method MarkAs {label chosen} {
log write 3 symbol {\[$label\] Converting symbol '$myname' as $mysymtype($chosen)}
set mytype $chosen
incr myrulecount($label)
# This is stored directly into the database.
state run {
UPDATE symbol
|
| ︙ | ︙ |
Changes to tools/cvs2fossil/lib/c2f_state.tcl.
| ︙ | ︙ | |||
120 121 122 123 124 125 126 127 |
SELECT name
FROM sqlite_master
WHERE type = 'table'
AND name = $name
;
}]]
if {$found} return
| > < | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
SELECT name
FROM sqlite_master
WHERE type = 'table'
AND name = $name
;
}]]
# No assert, would cause cycle in package dependencies
if {$found} return
trouble internal "The required table \"$name\" is not defined."
# Not reached
return
}
typemethod discard {name} {
# Method for a user to remove outdated information from the
|
| ︙ | ︙ |
Changes to tools/cvs2fossil/lib/log.tcl.
| ︙ | ︙ | |||
28 29 30 31 32 33 34 |
# Write the message 'text' to log, for the named 'system'. The
# message is written if and only if the message verbosity is less
# or equal the chosen verbosity. A message of verbosity 0 cannot
# be blocked.
typemethod write {verbosity system text} {
if {$verbosity > $myloglevel} return
| | > | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# Write the message 'text' to log, for the named 'system'. The
# message is written if and only if the message verbosity is less
# or equal the chosen verbosity. A message of verbosity 0 cannot
# be blocked.
typemethod write {verbosity system text} {
if {$verbosity > $myloglevel} return
uplevel #0 [linsert $mylogcmd end write [System $system] \
[uplevel 1 [list ::subst $text]]]
return
}
# Similar to write, especially in the handling of the verbosity,
# to drive progress displays. It signals that for some long
# running operation we are at tick 'n' of at most 'max' ticks. An
# empty 'max' indicates an infinite progress display.
|
| ︙ | ︙ |