Overview
SHA1 Hash: | 3d88cfd05d2cec7cc9c801c41a39bb8d23481f70 |
---|---|
Date: | 2007-10-06 21:59:03 |
User: | aku |
Comment: | Started capture of revision information in file objects. Capturing authors and commit messages and repository level. Completed persistence for these latter too. Rearranged the requirements, imports, and exports a bit to handle the new dependency cycle repository <- project <- file <- repository |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified tools/cvs2fossil/lib/c2f_file.tcl from [0ad0b453d6] to [16136c408c].
@@ -14,12 +14,13 @@ ## instances are possible. # # ## ### ##### ######## ############# ##################### ## Requirements -package require Tcl 8.4 ; # Required runtime. -package require snit ; # OO system. +package require Tcl 8.4 ; # Required runtime. +package require snit ; # OO system. +package require vc::fossil::import::cvs::repository ; # Repository management. # # ## ### ##### ######## ############# ##################### ## snit::type ::vc::fossil::import::cvs::file { @@ -60,22 +61,63 @@ #method def {rev date author state next branches} {puts "def $rev $date $author $state $next $branches"} #method setdesc {d} {puts desc=$d} #method extend {rev commitmsg deltarange} {puts "extend $commitmsg $deltarange"} #method done {} {puts done} - # # ## ### ##### ######## ############# ## Persistence (pass II) method persist {} { } # # ## ### ##### ######## ############# + ## Implement the sink + + method begin {} {} + method done {} {} + method admindone {} {} + + method sethead {h} { + set myhead $h + return + } + + method setprincipalbranch {b} { + set myprincipal $b + return + } + + method setsymbols {dict} { + # Slice symbols into branches and tags, canonical numbers ... +array set _ $dict +parray _ + } + + method setcomment {c} {# ignore} + method setdesc {d} {# ignore} + + method def {rev date author state next branches} { + set myrev($rev) [list $date $author $state $next $branches] + repository author $author + return + } + + method extend {rev commitmsg deltarange} { + set cm [string trim $commitmsg] + lappend myrev($rev) $cm $deltarange + repository cmessage $cm + return + } + + # # ## ### ##### ######## ############# ## State - variable mypath {} ; # Path of rcs archive - variable myproject {} ; # Project object the file belongs to. + variable mypath {} ; # Path of rcs archive + variable myproject {} ; # Project object the file belongs to. + variable myrev -array {} ; # All revisions and their connections. + variable myhead {} ; # Head revision (rev number) + variable myprincipal {} ; # Principal branch (branch number) # # ## ### ##### ######## ############# ## Internal methods pragma -hastypeinfo no ; # no type introspection @@ -86,12 +128,15 @@ # # ## ### ##### ######## ############# } namespace eval ::vc::fossil::import::cvs { namespace export file + namespace eval file { + namespace import ::vc::fossil::import::cvs::repository + } } # # ## ### ##### ######## ############# ##################### ## Ready package provide vc::fossil::import::cvs::file 1.0 return
Modified tools/cvs2fossil/lib/c2f_repository.tcl from [4b50c06b84] to [dd183de0b5].
@@ -10,19 +10,21 @@ # history and logs, available at http://fossil-scm.hwaci.com/fossil # # ## ### ##### ######## ############# ##################### ## Repository manager. Keeps projects and their files around. +package provide vc::fossil::import::cvs::repository 1.0 + # # ## ### ##### ######## ############# ##################### ## Requirements package require Tcl 8.4 ; # Required runtime. package require snit ; # OO system. package require vc::tools::trouble ; # Error reporting. package require vc::tools::log ; # User feedback. package require vc::tools::misc ; # Text formatting -package require vc::fossil::import::cvs::project ; # CVS projects +# CVS Projects later (see bottom) to handle circular dependency in 'file'. package require vc::fossil::import::cvs::state ; # State storage package require struct::list ; # List operations. package require fileutil ; # File operations. # # ## ### ##### ######## ############# ##################### @@ -68,10 +70,20 @@ foreach pp $myprojpaths { if {![IsProjectBase $mybase/$pp $mybase/CVSROOT msg]} { trouble fatal $msg } } + return + } + + typemethod author {a} { + set myauthor($a) "" + return + } + + typemethod cmessage {cm} { + set mycmsg($cm) "" return } # pass I results typemethod printstatistics {} { @@ -134,22 +146,25 @@ } # pass II persistence typemethod persistrev {} { state transaction { - # TODO: per repository persistence (authors, commit messages) + SaveAuthors + SaveCommitMessages foreach p [TheProjects] { $p persistrev } } return } # # ## ### ##### ######## ############# ## State - typevariable mybase {} - typevariable myprojpaths {} - typevariable myprojects {} + typevariable mybase {} ; # Base path to CVS repository. + typevariable myprojpaths {} ; # Paths to all declared projects, relative to mybase. + typevariable myprojects {} ; # Objects for all declared projects. + typevariable myauthor -array {} ; # Names of all authors found, later with id. + typevariable mycmsg -array {} ; # All commit messages found, later with id. # # ## ### ##### ######## ############# ## Internal methods proc .BaseLength {p} { @@ -201,10 +216,36 @@ lappend res [project %AUTO% ""] } return $res } + proc SaveAuthors {} { + ::variable myauthor + foreach a [lsort -dict [array names myauthor]] { + state run { + INSERT INTO author (aid, name) + VALUES (NULL, $a); + } + # Save id for use by the project/file persistence code. + set myauthor($a) [state id] + } + return + } + + proc SaveCommitMessages {} { + ::variable mycmsg + foreach t [lsort -dict [array names mycmsg]] { + state run { + INSERT INTO cmessage (cid, text) + VALUES (NULL, $t); + } + # Save id for use by the project/file persistence code. + set mycmsg($t) [state id] + } + return + } + # # ## ### ##### ######## ############# ## Configuration pragma -hasinstances no ; # singleton pragma -hastypeinfo no ; # no introspection @@ -213,20 +254,25 @@ # # ## ### ##### ######## ############# } namespace eval ::vc::fossil::import::cvs { namespace export repository - namespace eval repository { - namespace import ::vc::fossil::import::cvs::project - namespace import ::vc::fossil::import::cvs::state - namespace import ::vc::tools::misc::* - namespace import ::vc::tools::trouble - namespace import ::vc::tools::log - log register repository - } +} + +# CVS projects here to handle circular dependency +# repository <- project <- file <- repository + +package require vc::fossil::import::cvs::project + +namespace eval ::vc::fossil::import::cvs::repository { + namespace import ::vc::fossil::import::cvs::project + namespace import ::vc::fossil::import::cvs::state + namespace import ::vc::tools::misc::* + namespace import ::vc::tools::trouble + namespace import ::vc::tools::log + log register repository } # # ## ### ##### ######## ############# ##################### ## Ready -package provide vc::fossil::import::cvs::repository 1.0 return