Fossil SCM
Added saving of the fundamental symbol information (project level).
Commit
1deb3786aac3dcb45787279503292297fb03f446
Parent
89e9b357edc1bcb…
2 files changed
+18
-10
+38
-9
+18
-10
| --- tools/cvs2fossil/lib/c2f_project.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_project.tcl | ||
| @@ -43,10 +43,11 @@ | ||
| 43 | 43 | method printbase {} { |
| 44 | 44 | if {$mybase eq ""} {return <Repository>} |
| 45 | 45 | return $mybase |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | + method id {} { return $myid } | |
| 48 | 49 | method setid {id} { set myid $id ; return } |
| 49 | 50 | |
| 50 | 51 | method addfile {rcs usr executable {fid {}}} { |
| 51 | 52 | set myfiles($rcs) [list $usr $executable $fid] |
| 52 | 53 | return |
| @@ -68,15 +69,15 @@ | ||
| 68 | 69 | method defmeta {bid aid cid} { |
| 69 | 70 | return [$myrepository defmeta $myid $bid $aid $cid] |
| 70 | 71 | } |
| 71 | 72 | |
| 72 | 73 | method getsymbol {name} { |
| 73 | - if {![info exists mysymbols($name)]} { | |
| 74 | - set mysymbols($name) \ | |
| 75 | - [sym %AUTO% $name [$myrepository defsymbol $myid $name]] | |
| 74 | + if {![info exists mysymbol($name)]} { | |
| 75 | + set mysymbol($name) \ | |
| 76 | + [sym %AUTO% $name [$myrepository defsymbol $myid $name] $self] | |
| 76 | 77 | } |
| 77 | - return $mysymbols($name) | |
| 78 | + return $mysymbol($name) | |
| 78 | 79 | } |
| 79 | 80 | |
| 80 | 81 | # pass I persistence |
| 81 | 82 | method persist {} { |
| 82 | 83 | TheFiles ; # Force id assignment. |
| @@ -107,17 +108,24 @@ | ||
| 107 | 108 | } |
| 108 | 109 | |
| 109 | 110 | # pass II persistence |
| 110 | 111 | method persistrev {} { |
| 111 | 112 | # Note: The per file information (incl. revisions and symbols) |
| 112 | - # has already been saved and dropped, immediately after | |
| 113 | - # processing it, to keep out use of memory under control. Now | |
| 114 | - # we just have to save the remaining project level parts to | |
| 115 | - # fix the left-over dangling references. | |
| 113 | + # has already been saved and dropped. This was done | |
| 114 | + # immediately after processing it, i.e. as part of the main | |
| 115 | + # segment of the pass, to keep out use of memory under | |
| 116 | + # control. | |
| 117 | + # | |
| 118 | + # The repository level information has been saved as well too, | |
| 119 | + # just before saving the projects started. So now we just have | |
| 120 | + # to save the remaining project level parts to fix the | |
| 121 | + # left-over dangling references, which are the symbols. | |
| 116 | 122 | |
| 117 | 123 | state transaction { |
| 118 | - # TODO: per project persistence (symbols, meta data) | |
| 124 | + foreach {name symbol} [array get mysymbol] { | |
| 125 | + $symbol persistrev | |
| 126 | + } | |
| 119 | 127 | } |
| 120 | 128 | return |
| 121 | 129 | } |
| 122 | 130 | |
| 123 | 131 | # # ## ### ##### ######## ############# |
| @@ -130,11 +138,11 @@ | ||
| 130 | 138 | variable myfiles -array {} ; # Maps the rcs archive paths to |
| 131 | 139 | # their user-visible files. |
| 132 | 140 | variable myfobj {} ; # File objects for the rcs archives |
| 133 | 141 | variable myfmap -array {} ; # Map rcs archive to their object. |
| 134 | 142 | variable myrepository {} ; # Repository the prject belongs to. |
| 135 | - variable mysymbols -array {} ; # Map symbol names to project-level | |
| 143 | + variable mysymbol -array {} ; # Map symbol names to project-level | |
| 136 | 144 | # symbol objects. |
| 137 | 145 | |
| 138 | 146 | # # ## ### ##### ######## ############# |
| 139 | 147 | ## Internal methods |
| 140 | 148 | |
| 141 | 149 |
| --- tools/cvs2fossil/lib/c2f_project.tcl | |
| +++ tools/cvs2fossil/lib/c2f_project.tcl | |
| @@ -43,10 +43,11 @@ | |
| 43 | method printbase {} { |
| 44 | if {$mybase eq ""} {return <Repository>} |
| 45 | return $mybase |
| 46 | } |
| 47 | |
| 48 | method setid {id} { set myid $id ; return } |
| 49 | |
| 50 | method addfile {rcs usr executable {fid {}}} { |
| 51 | set myfiles($rcs) [list $usr $executable $fid] |
| 52 | return |
| @@ -68,15 +69,15 @@ | |
| 68 | method defmeta {bid aid cid} { |
| 69 | return [$myrepository defmeta $myid $bid $aid $cid] |
| 70 | } |
| 71 | |
| 72 | method getsymbol {name} { |
| 73 | if {![info exists mysymbols($name)]} { |
| 74 | set mysymbols($name) \ |
| 75 | [sym %AUTO% $name [$myrepository defsymbol $myid $name]] |
| 76 | } |
| 77 | return $mysymbols($name) |
| 78 | } |
| 79 | |
| 80 | # pass I persistence |
| 81 | method persist {} { |
| 82 | TheFiles ; # Force id assignment. |
| @@ -107,17 +108,24 @@ | |
| 107 | } |
| 108 | |
| 109 | # pass II persistence |
| 110 | method persistrev {} { |
| 111 | # Note: The per file information (incl. revisions and symbols) |
| 112 | # has already been saved and dropped, immediately after |
| 113 | # processing it, to keep out use of memory under control. Now |
| 114 | # we just have to save the remaining project level parts to |
| 115 | # fix the left-over dangling references. |
| 116 | |
| 117 | state transaction { |
| 118 | # TODO: per project persistence (symbols, meta data) |
| 119 | } |
| 120 | return |
| 121 | } |
| 122 | |
| 123 | # # ## ### ##### ######## ############# |
| @@ -130,11 +138,11 @@ | |
| 130 | variable myfiles -array {} ; # Maps the rcs archive paths to |
| 131 | # their user-visible files. |
| 132 | variable myfobj {} ; # File objects for the rcs archives |
| 133 | variable myfmap -array {} ; # Map rcs archive to their object. |
| 134 | variable myrepository {} ; # Repository the prject belongs to. |
| 135 | variable mysymbols -array {} ; # Map symbol names to project-level |
| 136 | # symbol objects. |
| 137 | |
| 138 | # # ## ### ##### ######## ############# |
| 139 | ## Internal methods |
| 140 | |
| 141 |
| --- tools/cvs2fossil/lib/c2f_project.tcl | |
| +++ tools/cvs2fossil/lib/c2f_project.tcl | |
| @@ -43,10 +43,11 @@ | |
| 43 | method printbase {} { |
| 44 | if {$mybase eq ""} {return <Repository>} |
| 45 | return $mybase |
| 46 | } |
| 47 | |
| 48 | method id {} { return $myid } |
| 49 | method setid {id} { set myid $id ; return } |
| 50 | |
| 51 | method addfile {rcs usr executable {fid {}}} { |
| 52 | set myfiles($rcs) [list $usr $executable $fid] |
| 53 | return |
| @@ -68,15 +69,15 @@ | |
| 69 | method defmeta {bid aid cid} { |
| 70 | return [$myrepository defmeta $myid $bid $aid $cid] |
| 71 | } |
| 72 | |
| 73 | method getsymbol {name} { |
| 74 | if {![info exists mysymbol($name)]} { |
| 75 | set mysymbol($name) \ |
| 76 | [sym %AUTO% $name [$myrepository defsymbol $myid $name] $self] |
| 77 | } |
| 78 | return $mysymbol($name) |
| 79 | } |
| 80 | |
| 81 | # pass I persistence |
| 82 | method persist {} { |
| 83 | TheFiles ; # Force id assignment. |
| @@ -107,17 +108,24 @@ | |
| 108 | } |
| 109 | |
| 110 | # pass II persistence |
| 111 | method persistrev {} { |
| 112 | # Note: The per file information (incl. revisions and symbols) |
| 113 | # has already been saved and dropped. This was done |
| 114 | # immediately after processing it, i.e. as part of the main |
| 115 | # segment of the pass, to keep out use of memory under |
| 116 | # control. |
| 117 | # |
| 118 | # The repository level information has been saved as well too, |
| 119 | # just before saving the projects started. So now we just have |
| 120 | # to save the remaining project level parts to fix the |
| 121 | # left-over dangling references, which are the symbols. |
| 122 | |
| 123 | state transaction { |
| 124 | foreach {name symbol} [array get mysymbol] { |
| 125 | $symbol persistrev |
| 126 | } |
| 127 | } |
| 128 | return |
| 129 | } |
| 130 | |
| 131 | # # ## ### ##### ######## ############# |
| @@ -130,11 +138,11 @@ | |
| 138 | variable myfiles -array {} ; # Maps the rcs archive paths to |
| 139 | # their user-visible files. |
| 140 | variable myfobj {} ; # File objects for the rcs archives |
| 141 | variable myfmap -array {} ; # Map rcs archive to their object. |
| 142 | variable myrepository {} ; # Repository the prject belongs to. |
| 143 | variable mysymbol -array {} ; # Map symbol names to project-level |
| 144 | # symbol objects. |
| 145 | |
| 146 | # # ## ### ##### ######## ############# |
| 147 | ## Internal methods |
| 148 | |
| 149 |
+38
-9
| --- tools/cvs2fossil/lib/c2f_psym.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_psym.tcl | ||
| @@ -13,36 +13,62 @@ | ||
| 13 | 13 | ## Symbols (Tags, Branches) per project. |
| 14 | 14 | |
| 15 | 15 | # # ## ### ##### ######## ############# ##################### |
| 16 | 16 | ## Requirements |
| 17 | 17 | |
| 18 | -package require Tcl 8.4 ; # Required runtime. | |
| 19 | -package require snit ; # OO system. | |
| 18 | +package require Tcl 8.4 ; # Required runtime. | |
| 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::sym { |
| 25 | 26 | # # ## ### ##### ######## ############# |
| 26 | 27 | ## Public API |
| 27 | 28 | |
| 28 | - constructor {name id} { | |
| 29 | - set myname $name | |
| 30 | - set myid $id | |
| 29 | + constructor {name id project} { | |
| 30 | + set myname $name | |
| 31 | + set myid $id | |
| 32 | + set myproject $project | |
| 31 | 33 | return |
| 32 | 34 | } |
| 33 | 35 | |
| 34 | 36 | method name {} { return $myname } |
| 35 | 37 | method id {} { return $myid } |
| 38 | + | |
| 39 | + # # ## ### ##### ######## ############# | |
| 40 | + | |
| 41 | + method persistrev {} { | |
| 42 | + set pid [$myproject id] | |
| 43 | + | |
| 44 | + # TODO: Compute the various counts. All the necessary | |
| 45 | + # TODO: information is already in the database. Actually it | |
| 46 | + # TODO: never was in memory. | |
| 47 | + | |
| 48 | + state transaction { | |
| 49 | + state run { | |
| 50 | + INSERT INTO symbol ( sid, pid, name, type, tag_count, branch_count, commit_count) | |
| 51 | + VALUES ($myid, $pid, $myname, $myundef, 0, 0, 0); | |
| 52 | + } | |
| 53 | + } | |
| 54 | + return | |
| 55 | + } | |
| 36 | 56 | |
| 37 | 57 | # # ## ### ##### ######## ############# |
| 38 | 58 | ## State |
| 39 | 59 | |
| 40 | - variable myname {} ; # The symbol's name | |
| 41 | - variable myid {} ; # Repository wide numeric id of the symbol. | |
| 42 | - # This implicitly encodes the project as | |
| 43 | - # well. | |
| 60 | + variable myproject {} ; # Reference to the project object | |
| 61 | + # containing the symbol. | |
| 62 | + variable myname {} ; # The symbol's name | |
| 63 | + variable myid {} ; # Repository wide numeric id of the | |
| 64 | + # symbol. This implicitly encodes the | |
| 65 | + # project as well. | |
| 66 | + | |
| 67 | + typevariable mytag 1 ; # Code for symbols which are tags. | |
| 68 | + typevariable mybranch 2 ; # Code for symbols which are branches. | |
| 69 | + typevariable myundef 3 ; # Code for symbols of unknown type. | |
| 44 | 70 | |
| 45 | 71 | # # ## ### ##### ######## ############# |
| 46 | 72 | ## Internal methods |
| 47 | 73 | |
| 48 | 74 | # # ## ### ##### ######## ############# |
| @@ -56,12 +82,15 @@ | ||
| 56 | 82 | # # ## ### ##### ######## ############# |
| 57 | 83 | } |
| 58 | 84 | |
| 59 | 85 | namespace eval ::vc::fossil::import::cvs::project { |
| 60 | 86 | namespace export sym |
| 87 | + namespace eval sym { | |
| 88 | + namespace import ::vc::fossil::import::cvs::state | |
| 89 | + } | |
| 61 | 90 | } |
| 62 | 91 | |
| 63 | 92 | # # ## ### ##### ######## ############# ##################### |
| 64 | 93 | ## Ready |
| 65 | 94 | |
| 66 | 95 | package provide vc::fossil::import::cvs::project::sym 1.0 |
| 67 | 96 | return |
| 68 | 97 |
| --- tools/cvs2fossil/lib/c2f_psym.tcl | |
| +++ tools/cvs2fossil/lib/c2f_psym.tcl | |
| @@ -13,36 +13,62 @@ | |
| 13 | ## Symbols (Tags, Branches) per project. |
| 14 | |
| 15 | # # ## ### ##### ######## ############# ##################### |
| 16 | ## Requirements |
| 17 | |
| 18 | package require Tcl 8.4 ; # Required runtime. |
| 19 | package require snit ; # OO system. |
| 20 | |
| 21 | # # ## ### ##### ######## ############# ##################### |
| 22 | ## |
| 23 | |
| 24 | snit::type ::vc::fossil::import::cvs::project::sym { |
| 25 | # # ## ### ##### ######## ############# |
| 26 | ## Public API |
| 27 | |
| 28 | constructor {name id} { |
| 29 | set myname $name |
| 30 | set myid $id |
| 31 | return |
| 32 | } |
| 33 | |
| 34 | method name {} { return $myname } |
| 35 | method id {} { return $myid } |
| 36 | |
| 37 | # # ## ### ##### ######## ############# |
| 38 | ## State |
| 39 | |
| 40 | variable myname {} ; # The symbol's name |
| 41 | variable myid {} ; # Repository wide numeric id of the symbol. |
| 42 | # This implicitly encodes the project as |
| 43 | # well. |
| 44 | |
| 45 | # # ## ### ##### ######## ############# |
| 46 | ## Internal methods |
| 47 | |
| 48 | # # ## ### ##### ######## ############# |
| @@ -56,12 +82,15 @@ | |
| 56 | # # ## ### ##### ######## ############# |
| 57 | } |
| 58 | |
| 59 | namespace eval ::vc::fossil::import::cvs::project { |
| 60 | namespace export sym |
| 61 | } |
| 62 | |
| 63 | # # ## ### ##### ######## ############# ##################### |
| 64 | ## Ready |
| 65 | |
| 66 | package provide vc::fossil::import::cvs::project::sym 1.0 |
| 67 | return |
| 68 |
| --- tools/cvs2fossil/lib/c2f_psym.tcl | |
| +++ tools/cvs2fossil/lib/c2f_psym.tcl | |
| @@ -13,36 +13,62 @@ | |
| 13 | ## Symbols (Tags, Branches) per project. |
| 14 | |
| 15 | # # ## ### ##### ######## ############# ##################### |
| 16 | ## Requirements |
| 17 | |
| 18 | package require Tcl 8.4 ; # Required runtime. |
| 19 | package require snit ; # OO system. |
| 20 | package require vc::fossil::import::cvs::state ; # State storage. |
| 21 | |
| 22 | # # ## ### ##### ######## ############# ##################### |
| 23 | ## |
| 24 | |
| 25 | snit::type ::vc::fossil::import::cvs::project::sym { |
| 26 | # # ## ### ##### ######## ############# |
| 27 | ## Public API |
| 28 | |
| 29 | constructor {name id project} { |
| 30 | set myname $name |
| 31 | set myid $id |
| 32 | set myproject $project |
| 33 | return |
| 34 | } |
| 35 | |
| 36 | method name {} { return $myname } |
| 37 | method id {} { return $myid } |
| 38 | |
| 39 | # # ## ### ##### ######## ############# |
| 40 | |
| 41 | method persistrev {} { |
| 42 | set pid [$myproject id] |
| 43 | |
| 44 | # TODO: Compute the various counts. All the necessary |
| 45 | # TODO: information is already in the database. Actually it |
| 46 | # TODO: never was in memory. |
| 47 | |
| 48 | state transaction { |
| 49 | state run { |
| 50 | INSERT INTO symbol ( sid, pid, name, type, tag_count, branch_count, commit_count) |
| 51 | VALUES ($myid, $pid, $myname, $myundef, 0, 0, 0); |
| 52 | } |
| 53 | } |
| 54 | return |
| 55 | } |
| 56 | |
| 57 | # # ## ### ##### ######## ############# |
| 58 | ## State |
| 59 | |
| 60 | variable myproject {} ; # Reference to the project object |
| 61 | # containing the symbol. |
| 62 | variable myname {} ; # The symbol's name |
| 63 | variable myid {} ; # Repository wide numeric id of the |
| 64 | # symbol. This implicitly encodes the |
| 65 | # project as well. |
| 66 | |
| 67 | typevariable mytag 1 ; # Code for symbols which are tags. |
| 68 | typevariable mybranch 2 ; # Code for symbols which are branches. |
| 69 | typevariable myundef 3 ; # Code for symbols of unknown type. |
| 70 | |
| 71 | # # ## ### ##### ######## ############# |
| 72 | ## Internal methods |
| 73 | |
| 74 | # # ## ### ##### ######## ############# |
| @@ -56,12 +82,15 @@ | |
| 82 | # # ## ### ##### ######## ############# |
| 83 | } |
| 84 | |
| 85 | namespace eval ::vc::fossil::import::cvs::project { |
| 86 | namespace export sym |
| 87 | namespace eval sym { |
| 88 | namespace import ::vc::fossil::import::cvs::state |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | # # ## ### ##### ######## ############# ##################### |
| 93 | ## Ready |
| 94 | |
| 95 | package provide vc::fossil::import::cvs::project::sym 1.0 |
| 96 | return |
| 97 |