| | @@ -15,10 +15,11 @@ |
| 15 | 15 | # # ## ### ##### ######## ############# ##################### |
| 16 | 16 | ## Requirements |
| 17 | 17 | |
| 18 | 18 | package require Tcl 8.4 ; # Required runtime. |
| 19 | 19 | package require snit ; # OO system. |
| 20 | +package require vc::fossil::import::cvs::state ; # State storage |
| 20 | 21 | |
| 21 | 22 | # # ## ### ##### ######## ############# ##################### |
| 22 | 23 | ## |
| 23 | 24 | |
| 24 | 25 | snit::type ::vc::fossil::import::cvs::project { |
| | @@ -43,10 +44,34 @@ |
| 43 | 44 | } |
| 44 | 45 | |
| 45 | 46 | method files {} { |
| 46 | 47 | return [array names myfiles] |
| 47 | 48 | } |
| 49 | + |
| 50 | + method persist {} { |
| 51 | + state transaction { |
| 52 | + # Project data first. Required so that we have its id |
| 53 | + # ready for the files. |
| 54 | + |
| 55 | + state run { |
| 56 | + INSERT INTO project (pid, name) |
| 57 | + VALUES (NULL, $mybase); |
| 58 | + } |
| 59 | + set pid [state id] |
| 60 | + |
| 61 | + # Then all files, with proper backreference to their |
| 62 | + # project. |
| 63 | + |
| 64 | + foreach {rcs usr} [array get myfiles] { |
| 65 | + state run { |
| 66 | + INSERT INTO file (fid, pid, name, visible) |
| 67 | + VALUES (NULL, $pid, $rcs, $usr); |
| 68 | + } |
| 69 | + } |
| 70 | + } |
| 71 | + return |
| 72 | + } |
| 48 | 73 | |
| 49 | 74 | # # ## ### ##### ######## ############# |
| 50 | 75 | ## State |
| 51 | 76 | |
| 52 | 77 | variable mybase {} ; # Project directory |
| | @@ -63,12 +88,15 @@ |
| 63 | 88 | # # ## ### ##### ######## ############# |
| 64 | 89 | } |
| 65 | 90 | |
| 66 | 91 | namespace eval ::vc::fossil::import::cvs { |
| 67 | 92 | namespace export project |
| 93 | + namespace eval project { |
| 94 | + namespace import ::vc::fossil::import::cvs::state |
| 95 | + } |
| 68 | 96 | } |
| 69 | 97 | |
| 70 | 98 | # # ## ### ##### ######## ############# ##################### |
| 71 | 99 | ## Ready |
| 72 | 100 | |
| 73 | 101 | package provide vc::fossil::import::cvs::project 1.0 |
| 74 | 102 | return |
| 75 | 103 | |