Overview
SHA1 Hash: | 042d54bae54539a162f79f23faaf7ee45dbded2f |
---|---|
Date: | 2007-10-05 07:27:52 |
User: | aku |
Comment: | Completed integration of state with pass I, now saving projects and files into it. |
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_project.tcl from [116b688f65] to [870e1c1dce].
@@ -15,10 +15,11 @@ # # ## ### ##### ######## ############# ##################### ## Requirements package require Tcl 8.4 ; # Required runtime. package require snit ; # OO system. +package require vc::fossil::import::cvs::state ; # State storage # # ## ### ##### ######## ############# ##################### ## snit::type ::vc::fossil::import::cvs::project { @@ -44,10 +45,34 @@ method files {} { return [array names myfiles] } + 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 pid [state id] + + # Then all files, with proper backreference to their + # project. + + foreach {rcs usr} [array get myfiles] { + state run { + INSERT INTO file (fid, pid, name, visible) + VALUES (NULL, $pid, $rcs, $usr); + } + } + } + return + } + # # ## ### ##### ######## ############# ## State variable mybase {} ; # Project directory variable myfiles -array {} ; # Maps rcss archive to their user files. @@ -63,12 +88,15 @@ # # ## ### ##### ######## ############# } namespace eval ::vc::fossil::import::cvs { namespace export project + namespace eval project { + namespace import ::vc::fossil::import::cvs::state + } } # # ## ### ##### ######## ############# ##################### ## Ready package provide vc::fossil::import::cvs::project 1.0 return
Modified tools/cvs2fossil/lib/c2f_repository.tcl from [10e1f473b9] to [9c6eebce1b].
@@ -19,10 +19,11 @@ 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 +package require vc::fossil::import::cvs::state ; # State storage package require struct::list ; # List operations. package require fileutil ; # File operations. # # ## ### ##### ######## ############# ##################### ## @@ -115,10 +116,14 @@ set projects $keep return } typemethod persist {} { + state transaction { + foreach p [TheProjects] { $p persist } + } + return } # # ## ### ##### ######## ############# ## State @@ -192,10 +197,11 @@ 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::trouble namespace import ::vc::tools::log namespace import ::vc::tools::misc::* log register repository }
Modified tools/cvs2fossil/lib/c2f_state.tcl from [2094dd757c] to [4f1e5d7899].
@@ -127,10 +127,18 @@ return } typemethod run {args} { return [uplevel 1 [linsert $args 0 $mystate eval]] + } + + typemethod transaction {script} { + return [uplevel 1 [list $mystate transaction $script]] + } + + typemethod id {} { + return [$mystate last_insert_rowid] } # # ## ### ##### ######## ############# ## State