Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Extended handling of id's for files so that we have them for backreferences from symbols and revisions. Completed persistence of revisions and symbols at file-level and fixed small problem with left-over links to branches. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
adf168e23e3d3812bb7c49d385a1bfd7 |
| User & Date: | aku 2007-10-24 08:01:01.000 |
Context
|
2007-10-24
| ||
| 14:44 | Extended pass manager to keep timing data for the executed passes and show them after completion of all passes. ... (check-in: 05f9c95573 user: aku tags: trunk) | |
| 08:01 | Extended handling of id's for files so that we have them for backreferences from symbols and revisions. Completed persistence of revisions and symbols at file-level and fixed small problem with left-over links to branches. ... (check-in: adf168e23e user: aku tags: trunk) | |
| 07:54 | Disabled check for control characters in the log message. Allowing this for the moment, lets see if we run into trouble later on. Further reworked the check of symbol names, disallow forward slashs only at end. Found legal tags containing forward slashs in the middle. ... (check-in: fa643aa91d user: aku tags: trunk) | |
Changes
Changes to tools/cvs2fossil/lib/c2f_file.tcl.
| ︙ | ︙ | |||
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
## Requirements
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::tools::trouble ; # Error reporting.
package require vc::tools::log ; # User feedback
package require vc::tools::misc ; # Text formatting
# # ## ### ##### ######## ############# #####################
##
snit::type ::vc::fossil::import::cvs::file {
# # ## ### ##### ######## #############
## Public API
| > | > > > > > > > > | 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 50 51 52 53 54 55 56 57 58 59 |
## Requirements
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
# # ## ### ##### ######## ############# #####################
##
snit::type ::vc::fossil::import::cvs::file {
# # ## ### ##### ######## #############
## Public API
constructor {id path usrpath executable project} {
set myid $id
set mypath $path
set myusrpath $usrpath
set myexecutable $executable
set myproject $project
set mytrunk [$myproject trunk]
return
}
method setid {id} {
if {$myid ne ""} { trouble internal "File '$mypath' already has an id, '$myid'" }
set myid $id
return
}
method id {} { return $myid }
method path {} { return $mypath }
method usrpath {} { return $myusrpath }
method project {} { return $myproject }
delegate method commitmessageof to myproject
# # ## ### ##### ######## #############
|
| ︙ | ︙ | |||
62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
#method extend {rev commitmsg deltarange} {puts "extend $commitmsg $deltarange"}
#method done {} {puts done}
# # ## ### ##### ######## #############
## Persistence (pass II)
method persist {} {
}
method drop {} {
foreach {_ rev} [array get myrev] { $rev destroy }
foreach {_ branch} [array get mybranches] { $branch destroy }
foreach {_ taglist} [array get mytags] {
foreach tag $taglist { $tag destroy }
| > > > > > > > > > > > > > > > > > > > > | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
#method extend {rev commitmsg deltarange} {puts "extend $commitmsg $deltarange"}
#method done {} {puts done}
# # ## ### ##### ######## #############
## Persistence (pass II)
method persist {} {
# First collect the reachable revisions and symbols, then
# assign id's to all. They are sorted so that we will have ids
# which sort in order of creation. Then we can save them. This
# is done bottom up. Revisions, then symbols. __NOTE__ This
# works only because sqlite is not checking foreign key
# references during insert. This allows to have dangling
# references which are fixed later. The longest dangling
# references are for the project level symbols, these we do
# not save here, but at the end of the pass. What we need are
# the ids, hence the two phases.
struct::list assign [$self Active] revisions symbols
foreach rev $revisions { $rev defid }
foreach sym $symbols { $sym defid }
state transaction {
foreach rev $revisions { $rev persist }
foreach sym $symbols { $sym persist }
}
return
}
method drop {} {
foreach {_ rev} [array get myrev] { $rev destroy }
foreach {_ branch} [array get mybranches] { $branch destroy }
foreach {_ taglist} [array get mytags] {
foreach tag $taglist { $tag destroy }
|
| ︙ | ︙ | |||
218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
}
return
}
# # ## ### ##### ######## #############
## State
variable mypath {} ; # Path of the file's rcs archive.
variable myusrpath {} ; # Path of the file as seen by users.
variable myexecutable 0 ; # Boolean flag 'file executable'.
variable myproject {} ; # Reference to the project object
# the file belongs to.
variable myrev -array {} ; # Maps revision number to the
# associated revision object.
| > | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
}
return
}
# # ## ### ##### ######## #############
## State
variable myid {} ; # File id in the persistent state.
variable mypath {} ; # Path of the file's rcs archive.
variable myusrpath {} ; # Path of the file as seen by users.
variable myexecutable 0 ; # Boolean flag 'file executable'.
variable myproject {} ; # Reference to the project object
# the file belongs to.
variable myrev -array {} ; # Maps revision number to the
# associated revision object.
|
| ︙ | ︙ | |||
306 307 308 309 310 311 312 |
method AddBranch {name branchnr} {
if {[info exists mybranches($branchnr)]} {
log write 1 file "In '$mypath': Branch '$branchnr' named '[$mybranches($branchnr) name]'"
log write 1 file "Cannot have second name '$name', ignoring it"
return
}
| | | | 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 |
method AddBranch {name branchnr} {
if {[info exists mybranches($branchnr)]} {
log write 1 file "In '$mypath': Branch '$branchnr' named '[$mybranches($branchnr) name]'"
log write 1 file "Cannot have second name '$name', ignoring it"
return
}
set branch [sym %AUTO% branch $branchnr [$myproject getsymbol $name] $self]
$branch setposition [incr mybranchcnt]
set mybranches($branchnr) $branch
return $branch
}
method AddTag {name revnr} {
set tag [sym %AUTO% tag $revnr [$myproject getsymbol $name] $self]
lappend mytags($revnr) $tag
return $tag
}
method RecordBasicDependencies {revnr next} {
# Handle the revision dependencies. Record them for now, do
# nothing with them yet.
|
| ︙ | ︙ | |||
376 377 378 379 380 381 382 | $branch setparent $rev # If revisions were committed on the branch we store a # reference to the branch there, and further declare # the first child's parent to be branch's parent, and # list this child in the parent revision. | | | 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 |
$branch setparent $rev
# If revisions were committed on the branch we store a
# reference to the branch there, and further declare
# the first child's parent to be branch's parent, and
# list this child in the parent revision.
if {[$branch haschildrev]} {
set childrevnr [$branch childrevnr]
set child $myrev($childrevnr)
$branch setchild $child
$child setparentbranch $branch
$child setparent $rev
$rev addchildonbranch $child
|
| ︙ | ︙ | |||
668 669 670 671 672 673 674 675 676 677 678 679 680 681 |
# Cut out the vendor branch symbol
set vendor [$first parentbranch]
if {$vendor eq ""} { trouble internal "First NTDB revision has no branch" }
if {[$vendor parent] eq $rev11} {
$rev11 removebranch $vendor
$rev11 removechildonbranch $first
$first cutfromparentbranch
lappend myroots $first
}
# Change the type of first (typically from Change to Add):
$first retype add
| > | 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 |
# Cut out the vendor branch symbol
set vendor [$first parentbranch]
if {$vendor eq ""} { trouble internal "First NTDB revision has no branch" }
if {[$vendor parent] eq $rev11} {
$rev11 removebranch $vendor
$rev11 removechildonbranch $first
$vendor cutchild
$first cutfromparentbranch
lappend myroots $first
}
# Change the type of first (typically from Change to Add):
$first retype add
|
| ︙ | ︙ | |||
724 725 726 727 728 729 730 |
ldelete myroots $root
if {[$root haschild]} {
set child [$root child]
$child cutfromparent
lappend myroots $child
}
| | > | 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 |
ldelete myroots $root
if {[$root haschild]} {
set child [$root child]
$child cutfromparent
lappend myroots $child
}
# Cut out the branches spawned by the revision to be
# deleted. If the branch has revisions they should already
# use operation 'add', no need to change that. The first
# revision on each branch becomes a new and disconnected
# root.
foreach branch [$root branches] {
if {![$branch haschild]} continue
set first [$branch child]
$first cutfromparentbranch
$first cutfromparent
$branch cutchild
lappend myroots $first
}
$root removeallbranches
# Tagging a dead revision doesn't do anything, so remove
# any tags that were set on it.
|
| ︙ | ︙ | |||
777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 |
set branch [$root parentbranch]
set parent [$root parent]
set child [$root child]
ldelete myroots $root
lappend myroots $child
$child cutfromparent
$parent removebranch $branch
$parent removechildonbranch $root
}
return
}
method LinesOfDevelopment {} {
| > > | 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 |
set branch [$root parentbranch]
set parent [$root parent]
set child [$root child]
ldelete myroots $root
lappend myroots $child
$branch cutchild
$child cutfromparent
$parent removebranch $branch
$parent removechildonbranch $root
}
return
}
method LinesOfDevelopment {} {
|
| ︙ | ︙ | |||
968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 |
$tag setlod $mytrunk
}
set root [$root child]
}
return
}
# # ## ### ##### ######## #############
## Configuration
pragma -hastypeinfo no ; # no type introspection
pragma -hasinfo no ; # no object introspection
pragma -hastypemethods no ; # type is not relevant.
# # ## ### ##### ######## #############
}
namespace eval ::vc::fossil::import::cvs {
namespace export file
namespace eval file {
# 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
}
}
# # ## ### ##### ######## ############# #####################
## Ready
package provide vc::fossil::import::cvs::file 1.0
return
| > > > > > > > > > > > > > > > > > > > > | 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 |
$tag setlod $mytrunk
}
set root [$root child]
}
return
}
method Active {} {
set revisions {}
set symbols {}
foreach root [$self LinesOfDevelopment] {
if {[$root hasparentbranch]} { lappend symbols [$root parentbranch] }
while {$root ne ""} {
lappend revisions $root
foreach tag [$root tags] { lappend symbols $tag }
foreach branch [$root branches] { lappend symbols $branch }
set lod [$root lod]
if {![$lod istrunk]} { lappend symbols $lod }
set root [$root child]
}
}
return [list [lsort -unique -dict $revisions] [lsort -unique -dict $symbols]]
}
# # ## ### ##### ######## #############
## Configuration
pragma -hastypeinfo no ; # no type introspection
pragma -hasinfo no ; # no object introspection
pragma -hastypemethods no ; # type is not relevant.
# # ## ### ##### ######## #############
}
namespace eval ::vc::fossil::import::cvs {
namespace export file
namespace eval file {
# 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
|
Changes to tools/cvs2fossil/lib/c2f_frev.tcl.
| ︙ | ︙ | |||
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 |
# # ## ### ##### ######## ############# #####################
## Requirements
package require Tcl 8.4 ; # Required runtime.
package require snit ; # OO system.
package require vc::tools::misc ; # Text formatting
# # ## ### ##### ######## ############# #####################
##
snit::type ::vc::fossil::import::cvs::file::rev {
# # ## ### ##### ######## #############
## Public API
constructor {revnr date state thefile} {
set myrevnr $revnr
set mydate $date
set myorigdate $date
set mystate $state
set myfile $thefile
return
}
# Basic pieces ________________________
method hasmeta {} { return [expr {$mymetaid ne ""}] }
method hastext {} {
struct::list assign $mytext s e
return [expr {$s <= $e}]
}
| > > > > > > > > | 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 47 48 49 50 51 52 |
# # ## ### ##### ######## ############# #####################
## 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
constructor {revnr date state thefile} {
set myrevnr $revnr
set mydate $date
set myorigdate $date
set mystate $state
set myfile $thefile
return
}
method defid {} {
set myid [incr myidcounter]
return
}
method id {} { return $myid }
# Basic pieces ________________________
method hasmeta {} { return [expr {$mymetaid ne ""}] }
method hastext {} {
struct::list assign $mytext s e
return [expr {$s <= $e}]
}
|
| ︙ | ︙ | |||
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 |
return [join [lrange [split $revnr .] 0 end-1] .]
}
typemethod 2branchparentrevnr {branchnr} {
# Chop the last segment off
return [join [lrange [split $branchnr .] 0 end-1] .]
}
# # ## ### ##### ######## #############
## State
typevariable mybranchpattern {^((?:\d+\.\d+\.)+)(?:0\.)?(\d+)$}
# First a nonzero even number of digit groups with trailing dot
# CVS then sticks an extra 0 in here; RCS does not.
# And the last digit group.
variable myrevnr {} ; # Revision number of the revision.
variable mydate {} ; # Timestamp of the revision, seconds since epoch
variable myorigdate {} ; # Original unmodified timestamp.
variable mystate {} ; # State of the revision.
variable myfile {} ; # Ref to the file object the revision belongs to.
variable mytext {} ; # Range of the (delta) text for this revision in the file.
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 |
return [join [lrange [split $revnr .] 0 end-1] .]
}
typemethod 2branchparentrevnr {branchnr} {
# Chop the last segment off
return [join [lrange [split $branchnr .] 0 end-1] .]
}
# # ## ### ##### ######## #############
method persist {} {
set fid [$myfile id]
set op $myopcode($myoperation)
set idb $myisondefaultbranch
struct::list assign $mytext cs cl
set cl [expr {$cl - $cs}]
lappend map @L@ [expr { [$mylod istrunk] ? "NULL" : [$mylod id] }]
lappend map @P@ [expr { ($myparent eq "") ? "NULL" : [$myparent id] }]
lappend map @C@ [expr { ($mychild eq "") ? "NULL" : [$mychild id] }]
lappend map @DP [expr { ($mydbparent eq "") ? "NULL" : [$mydbparent id] }]
lappend map @DC [expr { ($mydbchild eq "") ? "NULL" : [$mydbchild id] }]
lappend map @BP [expr { ($myparentbranch eq "") ? "NULL" : [$myparentbranch id] }]
set cmd {
INSERT INTO revision ( rid, fid, lod, rev, date, state, mid, cs, cl, op, isdefault, parent, child, dbparent, dbchild, bparent)
VALUES ($myid, $fid, @L@, $myrevnr, $mydate, $mystate, $mymetaid, $cs, $cl, $op, $idb, @P@, @C@, @DP, @DC, @BP);
}
state transaction {
state run [string map $map $cmd]
}
return
}
# # ## ### ##### ######## #############
## State
# Persistent: myid - revision.rid
# myfile - revision.fid
# mylod - revision.lod
# myrevnr - revision.rev
# mydate - revision.date
# mystate - revision.state
# mymetaid - revision.mid
# mytext - revision.{cs,cl}
# myparent - revision.parent
# mychild - revision.child
# myparentbranch - revision.bparent
# myoperation - revision.op
# myisondefaultbranch - revision.isdefault
# mydbparent - revision.dbparent
# mydbchild - revision.dbchild
typevariable mybranchpattern {^((?:\d+\.\d+\.)+)(?:0\.)?(\d+)$}
# First a nonzero even number of digit groups with trailing dot
# CVS then sticks an extra 0 in here; RCS does not.
# And the last digit group.
typevariable myidcounter 0 ; # Counter for revision ids.
variable myid {} ; # Revision id.
variable myrevnr {} ; # Revision number of the revision.
variable mydate {} ; # Timestamp of the revision, seconds since epoch
variable myorigdate {} ; # Original unmodified timestamp.
variable mystate {} ; # State of the revision.
variable myfile {} ; # Ref to the file object the revision belongs to.
variable mytext {} ; # Range of the (delta) text for this revision in the file.
|
| ︙ | ︙ | |||
422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 |
# dead(self) x dead(parent) -> operation
typevariable myopstate -array {
{0 0} change
{0 1} delete
{1 0} add
{1 1} nothing
}
# # ## ### ##### ######## #############
## Internal methods
# # ## ### ##### ######## #############
## Configuration
pragma -hastypeinfo no ; # no type introspection
pragma -hasinfo no ; # no object introspection
pragma -simpledispatch yes ; # simple fast dispatch
# # ## ### ##### ######## #############
}
namespace eval ::vc::fossil::import::cvs::file {
namespace export rev
namespace eval rev {
namespace import ::vc::tools::misc::*
}
}
# # ## ### ##### ######## ############# #####################
## Ready
package provide vc::fossil::import::cvs::file::rev 1.0
return
| > > > > > > > | 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 |
# dead(self) x dead(parent) -> operation
typevariable myopstate -array {
{0 0} change
{0 1} delete
{1 0} add
{1 1} nothing
}
typevariable myopcode -array {
change 2
delete -1
add 1
nothing 0
}
# # ## ### ##### ######## #############
## Internal methods
# # ## ### ##### ######## #############
## Configuration
pragma -hastypeinfo no ; # no type introspection
pragma -hasinfo no ; # no object introspection
pragma -simpledispatch yes ; # simple fast dispatch
# # ## ### ##### ######## #############
}
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
|
Changes to tools/cvs2fossil/lib/c2f_fsym.tcl.
| ︙ | ︙ | |||
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::trouble ; # Error reporting.
package require vc::fossil::import::cvs::file::rev ; # CVS per file revisions.
# # ## ### ##### ######## ############# #####################
##
snit::type ::vc::fossil::import::cvs::file::sym {
# # ## ### ##### ######## #############
## Public API
| > | > > > > > > > > > > | | 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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# # ## ### ##### ######## ############# #####################
## 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 {
branch { SetupBranch }
tag { }
default { trouble internal "Bad symbol type '$mytype'" }
}
return
}
method defid {} {
set myid [incr myidcounter]
return
}
method fid {} { return $myid }
# Symbol acessor methods.
delegate method name to mysymbol
delegate method id to mysymbol
method istrunk {} { return 0 }
# Branch acessor methods.
method setchildrevnr {revnr} {
if {$mybranchchildrevnr ne ""} { trouble internal "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 }
method cutchild {} { set mybranchchild "" ; return }
method branchnr {} { return $mynr }
method parentrevnr {} { return $mybranchparentrevnr }
method childrevnr {} { return $mybranchchildrevnr }
method haschildrev {} { return [expr {$mybranchchildrevnr ne ""}] }
method haschild {} { return [expr {$mybranchchild ne ""}] }
method parent {} { return $mybranchparent }
method child {} { return $mybranchchild }
method position {} { return $mybranchposition }
# Tag acessor methods.
|
| ︙ | ︙ | |||
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
if {$mylod ne $slod} {
trouble fatal "For $mytype [$mysymbol name]: LOD conflict with source, '[$mylod name]' vs. '[$slod name]'"
return
}
return
}
# # ## ### ##### ######## #############
## State
## Basic, all symbols _________________
variable mytype {} ; # Symbol type, 'tag', or 'branch'.
variable mynr {} ; # Revision number of a 'tag', branch number
# of a 'branch'.
variable mysymbol {} ; # Reference to the symbol object of this
# symbol at the project level.
variable mylod {} ; # Reference to the line-of-development
# object the symbol belongs to. An
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 106 107 108 109 110 111 112 113 114 115 116 117 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 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
if {$mylod ne $slod} {
trouble fatal "For $mytype [$mysymbol name]: LOD conflict with source, '[$mylod name]' vs. '[$slod name]'"
return
}
return
}
# # ## ### ##### ######## #############
method persist {} {
# Save the information we need after the collection pass.
# NOTE: mybranchposition is currently not saved. This can
# likely be figured out later from the id itself. If yes, we
# can also get rid of 'sortbranches' (cvs::file) and the
# associated information.
set fid [$myfile id]
set sid [$mysymbol id]
lappend map @L@ [expr { [$mylod istrunk] ? "NULL" : [$mylod id] }]
switch -exact -- $mytype {
tag {
set rid [$mytagrev id]
set cmd {
INSERT INTO tag ( tid, fid, lod, sid, rev)
VALUES ($myid, $fid, @L@, $sid, $rid);
}
}
branch {
lappend map @F@ [expr { ($mybranchchild eq "") ? "NULL" : [$mybranchchild id] }]
set rid [$mybranchparent id]
set cmd {
INSERT INTO branch ( bid, fid, lod, sid, root, first, bra )
VALUES ($myid, $fid, @L@, $sid, $rid, @F@, $mynr);
}
}
}
state transaction {
state run [string map $map $cmd]
}
return
}
# # ## ### ##### ######## #############
## State
# Persistent:
# Tag: myid - tag.tid
# myfile - tag.fid
# mylod - tag.lod
# mysymbol - tag.sid
# mytagrev - tag.rev
#
# Branch: myid - branch.bid
# myfile - branch.fid
# mylod - branch.lod
# mysymbol - branch.sid
# mybranchparent - branch.root
# mybranchchild - branch.first
# mynr - branch.bra
typevariable myidcounter 0 ; # Counter for symbol ids.
variable myid {} ; # Symbol id.
## Basic, all symbols _________________
variable myfile {} ; # Reference to the file the symbol is in.
variable mytype {} ; # Symbol type, 'tag', or 'branch'.
variable mynr {} ; # Revision number of a 'tag', branch number
# of a 'branch'.
variable mysymbol {} ; # Reference to the symbol object of this
# symbol at the project level.
variable mylod {} ; # Reference to the line-of-development
# object the symbol belongs to. An
|
| ︙ | ︙ | |||
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# # ## ### ##### ######## #############
}
namespace eval ::vc::fossil::import::cvs::file {
namespace export sym
namespace eval sym {
namespace import ::vc::fossil::import::cvs::file::rev
namespace import ::vc::tools::trouble
}
}
# # ## ### ##### ######## ############# #####################
## Ready
package provide vc::fossil::import::cvs::file::sym 1.0
return
| > | 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
# # ## ### ##### ######## #############
}
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
|
Changes to tools/cvs2fossil/lib/c2f_pcollrev.tcl.
| ︙ | ︙ | |||
54 55 56 57 58 59 60 | # Per file we have general information, ..., and then # revisions and symbols. The latter can be further separated # into tags and branches. At project level the per-file # symbols information is merged. # File level ... | | > | | | | < < < < < < < < < | | < | < < < < | | | | | > > | > > > > | | > > > > > > > | > > | > | > | > > > | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# Per file we have general information, ..., and then
# revisions and symbols. The latter can be further separated
# into tags and branches. At project level the per-file
# symbols information is merged.
# File level ...
# Revisions, Branches, Tags
#
# Pseudo class hierarchy
# Tag <- Symbol <- Event
# Branch <- Symbol <- Event
# Revision <- Event
state writing revision {
rid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
fid INTEGER NOT NULL REFERENCES file, -- File the item belongs to
lod INTEGER REFERENCES symbol, -- Line of development (NULL => Trunk)
-- The tags and branches belonging to a revision can be
-- determined by selecting on the backreferences in the
-- tag and branch tables.
rev TEXT NOT NULL, -- revision number
date INTEGER NOT NULL, -- date of entry, seconds since epoch
state TEXT NOT NULL, -- state of revision
mid INTEGER NOT NULL REFERENCES meta, -- meta data (author, commit message)
cs INTEGER NOT NULL, -- Revision content as offset and
cl INTEGER NOT NULL, -- length into the archive file.
-- Derived information, and links
-- Basic: Parent/Child
-- NTDB: DefaultParent/DefaultChild
-- Branches: Branch parent revision
op INTEGER NOT NULL,
isdefault INTEGER NOT NULL,
parent INTEGER REFERENCES revision,
child INTEGER REFERENCES revision,
dbparent INTEGER REFERENCES revision,
dbchild INTEGER REFERENCES revision,
bparent INTEGER REFERENCES symbol
}
state writing tag {
tid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
fid INTEGER NOT NULL REFERENCES file, -- File the item belongs to
lod INTEGER REFERENCES symbol, -- Line of development (NULL => Trunk)
sid INTEGER NOT NULL REFERENCES symbol, -- Symbol capturing the tag
rev INTEGER NOT NULL REFERENCES revision -- The revision being tagged.
}
state writing branch {
bid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
fid INTEGER NOT NULL REFERENCES file, -- File the item belongs to
lod INTEGER REFERENCES symbol, -- Line of development (NULL => Trunk)
sid INTEGER NOT NULL REFERENCES symbol, -- Symbol capturing the branch
root INTEGER NOT NULL REFERENCES revision, -- Revision the branch sprouts from
first INTEGER REFERENCES revision, -- First revision committed to the branch
bra TEXT NOT NULL -- branch number
}
# It is in principle possible to collapse the four tables
# above (from item to barnch) into a single table, with
|
| ︙ | ︙ | |||
205 206 207 208 209 210 211 |
global errorCode
if {$errorCode eq "vc::rcs::parser"} {
trouble fatal "$path is not a valid RCS archive ($msg)"
} else {
global errorInfo
trouble internal $errorInfo
}
| < | | | | | > | | | | > > < < | 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
global errorCode
if {$errorCode eq "vc::rcs::parser"} {
trouble fatal "$path is not a valid RCS archive ($msg)"
} else {
global errorInfo
trouble internal $errorInfo
}
} else {
# We persist the core of the data collected about
# each file immediately after it has been parsed
# and wrangled into shape, and then drop it from
# memory. This is done to keep the amount of
# required memory within sensible limits. Without
# doing it this way we would easily gobble up 1G
# of RAM or more with all the objects (revisions
# and file-level symbols).
$file persist
}
$file drop
}
}
repository printrevstatistics
repository persistrev
log write 1 collrev "Scan completed"
return
}
typemethod discard {} {
# Pass manager interface. Executed for all passes after the
# run passes, to remove all data of this pass from the state,
# as being out of date.
state discard revision
state discard tag
state discard branch
state discard symbol
state discard blocker
state discard parent
state discard meta
|
| ︙ | ︙ |
Changes to tools/cvs2fossil/lib/c2f_project.tcl.
| ︙ | ︙ | |||
43 44 45 46 47 48 49 |
method printbase {} {
if {$mybase eq ""} {return <Repository>}
return $mybase
}
method setid {id} { set myid $id ; return }
| | | | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
method printbase {} {
if {$mybase eq ""} {return <Repository>}
return $mybase
}
method setid {id} { set myid $id ; return }
method addfile {rcs usr executable {fid {}}} {
set myfiles($rcs) [list $usr $executable $fid]
return
}
method filenames {} {
return [lsort -dict [array names myfiles]]
}
|
| ︙ | ︙ | |||
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
[sym %AUTO% $name [$myrepository defsymbol $myid $name]]
}
return $mysymbols($name)
}
# pass I persistence
method persist {} {
state transaction {
# Project data first. Required so that we have its id
# ready for the files.
state run {
INSERT INTO project (pid, name)
VALUES (NULL, $mybase);
}
set myid [state id]
# Then all files, with proper backreference to their
# project.
| > > | | > > > > > > > < < < > | | | > | > | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 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 156 157 158 159 160 161 162 163 |
[sym %AUTO% $name [$myrepository defsymbol $myid $name]]
}
return $mysymbols($name)
}
# pass I persistence
method persist {} {
TheFiles ; # Force id assignment.
state transaction {
# Project data first. Required so that we have its id
# ready for the files.
state run {
INSERT INTO project (pid, name)
VALUES (NULL, $mybase);
}
set myid [state id]
# Then all files, with proper backreference to their
# project.
foreach rcs [lsort -dict [array names myfiles]] {
struct::list assign $myfiles($rcs) usr executable _fid_
state run {
INSERT INTO file (fid, pid, name, visible, exec)
VALUES (NULL, $myid, $rcs, $usr, $executable);
}
$myfmap($rcs) setid [state id]
}
}
return
}
# pass II persistence
method persistrev {} {
# Note: The per file information (incl. revisions and symbols)
# has already been saved and dropped, immediately after
# processing it, to keep out use of memory under control. Now
# we just have to save the remaining project level parts to
# fix the left-over dangling references.
state transaction {
# TODO: per project persistence (symbols, meta data)
}
return
}
# # ## ### ##### ######## #############
## State
variable mybase {} ; # Project directory.
variable myid {} ; # Project id in the persistent state.
variable mytrunk {} ; # Reference to the main line of
# development for the project.
variable myfiles -array {} ; # Maps the rcs archive paths to
# their user-visible files.
variable myfobj {} ; # File objects for the rcs archives
variable myfmap -array {} ; # Map rcs archive to their object.
variable myrepository {} ; # Repository the prject belongs to.
variable mysymbols -array {} ; # Map symbol names to project-level
# symbol objects.
# # ## ### ##### ######## #############
## Internal methods
proc TheFiles {} {
upvar 1 myfiles myfiles myfobj myfobj self self myfmap myfmap
if {![llength $myfobj]} {
set myfobj [EmptyFiles myfiles]
}
return $myfobj
}
proc EmptyFiles {fv} {
upvar 1 $fv myfiles self self myfmap myfmap
set res {}
foreach rcs [lsort -dict [array names myfiles]] {
struct::list assign $myfiles($rcs) f executable fid
set file [file %AUTO% $fid $rcs $f $executable $self]
lappend res $file
set myfmap($rcs) $file
}
return $res
}
# # ## ### ##### ######## #############
## Configuration
|
| ︙ | ︙ |
Changes to tools/cvs2fossil/lib/c2f_repository.tcl.
| ︙ | ︙ | |||
148 149 150 151 152 153 154 |
lappend myprojpaths $name
lappend myprojects [set pr($pid) [project %AUTO% $name $type]]
$pr($pid) setid $pid
}
foreach {fid pid name visible exec} [state run {
SELECT fid, pid, name, visible, exec FROM file ;
}] {
| | | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
lappend myprojpaths $name
lappend myprojects [set pr($pid) [project %AUTO% $name $type]]
$pr($pid) setid $pid
}
foreach {fid pid name visible exec} [state run {
SELECT fid, pid, name, visible, exec FROM file ;
}] {
$pr($pid) addfile $name $visible $exec $fid
}
}
return
}
# pass II results
typemethod printrevstatistics {} {
|
| ︙ | ︙ |