Fossil SCM

Added saving of the fundamental symbol information (project level).

aku 2007-10-26 05:28 trunk
Commit 1deb3786aac3dcb45787279503292297fb03f446
--- tools/cvs2fossil/lib/c2f_project.tcl
+++ tools/cvs2fossil/lib/c2f_project.tcl
@@ -43,10 +43,11 @@
4343
method printbase {} {
4444
if {$mybase eq ""} {return <Repository>}
4545
return $mybase
4646
}
4747
48
+ method id {} { return $myid }
4849
method setid {id} { set myid $id ; return }
4950
5051
method addfile {rcs usr executable {fid {}}} {
5152
set myfiles($rcs) [list $usr $executable $fid]
5253
return
@@ -68,15 +69,15 @@
6869
method defmeta {bid aid cid} {
6970
return [$myrepository defmeta $myid $bid $aid $cid]
7071
}
7172
7273
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]
7677
}
77
- return $mysymbols($name)
78
+ return $mysymbol($name)
7879
}
7980
8081
# pass I persistence
8182
method persist {} {
8283
TheFiles ; # Force id assignment.
@@ -107,17 +108,24 @@
107108
}
108109
109110
# pass II persistence
110111
method persistrev {} {
111112
# 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.
116122
117123
state transaction {
118
- # TODO: per project persistence (symbols, meta data)
124
+ foreach {name symbol} [array get mysymbol] {
125
+ $symbol persistrev
126
+ }
119127
}
120128
return
121129
}
122130
123131
# # ## ### ##### ######## #############
@@ -130,11 +138,11 @@
130138
variable myfiles -array {} ; # Maps the rcs archive paths to
131139
# their user-visible files.
132140
variable myfobj {} ; # File objects for the rcs archives
133141
variable myfmap -array {} ; # Map rcs archive to their object.
134142
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
136144
# symbol objects.
137145
138146
# # ## ### ##### ######## #############
139147
## Internal methods
140148
141149
--- 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
--- tools/cvs2fossil/lib/c2f_psym.tcl
+++ tools/cvs2fossil/lib/c2f_psym.tcl
@@ -13,36 +13,62 @@
1313
## Symbols (Tags, Branches) per project.
1414
1515
# # ## ### ##### ######## ############# #####################
1616
## Requirements
1717
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.
2021
2122
# # ## ### ##### ######## ############# #####################
2223
##
2324
2425
snit::type ::vc::fossil::import::cvs::project::sym {
2526
# # ## ### ##### ######## #############
2627
## Public API
2728
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
3133
return
3234
}
3335
3436
method name {} { return $myname }
3537
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
+ }
3656
3757
# # ## ### ##### ######## #############
3858
## State
3959
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.
4470
4571
# # ## ### ##### ######## #############
4672
## Internal methods
4773
4874
# # ## ### ##### ######## #############
@@ -56,12 +82,15 @@
5682
# # ## ### ##### ######## #############
5783
}
5884
5985
namespace eval ::vc::fossil::import::cvs::project {
6086
namespace export sym
87
+ namespace eval sym {
88
+ namespace import ::vc::fossil::import::cvs::state
89
+ }
6190
}
6291
6392
# # ## ### ##### ######## ############# #####################
6493
## Ready
6594
6695
package provide vc::fossil::import::cvs::project::sym 1.0
6796
return
6897
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button