Overview
SHA1 Hash: | 1deb3786aac3dcb45787279503292297fb03f446 |
---|---|
Date: | 2007-10-26 05:28:24 |
User: | aku |
Comment: | Added saving of the fundamental symbol information (project level). |
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 [78ad19a406] to [00f1aee876].
@@ -43,10 +43,11 @@ method printbase {} { if {$mybase eq ""} {return <Repository>} return $mybase } + method id {} { return $myid } method setid {id} { set myid $id ; return } method addfile {rcs usr executable {fid {}}} { set myfiles($rcs) [list $usr $executable $fid] return @@ -68,15 +69,15 @@ method defmeta {bid aid cid} { return [$myrepository defmeta $myid $bid $aid $cid] } method getsymbol {name} { - if {![info exists mysymbols($name)]} { - set mysymbols($name) \ - [sym %AUTO% $name [$myrepository defsymbol $myid $name]] + if {![info exists mysymbol($name)]} { + set mysymbol($name) \ + [sym %AUTO% $name [$myrepository defsymbol $myid $name] $self] } - return $mysymbols($name) + return $mysymbol($name) } # pass I persistence method persist {} { TheFiles ; # Force id assignment. @@ -107,17 +108,24 @@ } # 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. + # has already been saved and dropped. This was done + # immediately after processing it, i.e. as part of the main + # segment of the pass, to keep out use of memory under + # control. + # + # The repository level information has been saved as well too, + # just before saving the projects started. So now we just have + # to save the remaining project level parts to fix the + # left-over dangling references, which are the symbols. state transaction { - # TODO: per project persistence (symbols, meta data) + foreach {name symbol} [array get mysymbol] { + $symbol persistrev + } } return } # # ## ### ##### ######## ############# @@ -130,11 +138,11 @@ 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 + variable mysymbol -array {} ; # Map symbol names to project-level # symbol objects. # # ## ### ##### ######## ############# ## Internal methods
Modified tools/cvs2fossil/lib/c2f_psym.tcl from [52d4c35526] to [6432e54926].
@@ -13,36 +13,62 @@ ## Symbols (Tags, Branches) per project. # # ## ### ##### ######## ############# ##################### ## 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::state ; # State storage. # # ## ### ##### ######## ############# ##################### ## snit::type ::vc::fossil::import::cvs::project::sym { # # ## ### ##### ######## ############# ## Public API - constructor {name id} { - set myname $name - set myid $id + constructor {name id project} { + set myname $name + set myid $id + set myproject $project return } method name {} { return $myname } method id {} { return $myid } # # ## ### ##### ######## ############# + + method persistrev {} { + set pid [$myproject id] + + # TODO: Compute the various counts. All the necessary + # TODO: information is already in the database. Actually it + # TODO: never was in memory. + + state transaction { + state run { + INSERT INTO symbol ( sid, pid, name, type, tag_count, branch_count, commit_count) + VALUES ($myid, $pid, $myname, $myundef, 0, 0, 0); + } + } + return + } + + # # ## ### ##### ######## ############# ## State - variable myname {} ; # The symbol's name - variable myid {} ; # Repository wide numeric id of the symbol. - # This implicitly encodes the project as - # well. + variable myproject {} ; # Reference to the project object + # containing the symbol. + variable myname {} ; # The symbol's name + variable myid {} ; # Repository wide numeric id of the + # symbol. This implicitly encodes the + # project as well. + + typevariable mytag 1 ; # Code for symbols which are tags. + typevariable mybranch 2 ; # Code for symbols which are branches. + typevariable myundef 3 ; # Code for symbols of unknown type. # # ## ### ##### ######## ############# ## Internal methods # # ## ### ##### ######## ############# @@ -56,12 +82,15 @@ # # ## ### ##### ######## ############# } namespace eval ::vc::fossil::import::cvs::project { namespace export sym + namespace eval sym { + namespace import ::vc::fossil::import::cvs::state + } } # # ## ### ##### ######## ############# ##################### ## Ready package provide vc::fossil::import::cvs::project::sym 1.0 return