Fossil SCM

Fluff: Renamed state methods use/reading/writing to usedb/use/extend for clarity. Updated all callers. Extended state module with code to dump the SQL statements it receives to a file for analysis. Extended the 'use' declarations of several passes.

aku 2007-12-02 23:47 trunk
Commit e288af39955b2602cd601c2cd928b8e68c7ff8d9
--- tools/cvs2fossil/lib/c2f_option.tcl
+++ tools/cvs2fossil/lib/c2f_option.tcl
@@ -73,18 +73,19 @@
7373
--project { repository add [Value arguments] }
7474
-v -
7575
--verbose { log verbose }
7676
-q -
7777
--quiet { log quiet }
78
- --state { state use [Value arguments] }
78
+ --state { state usedb [Value arguments] }
7979
--trunk-only { repository trunkonly! }
8080
--exclude { project::sym exclude [Value arguments] }
8181
--force-tag { project::sym forcetag [Value arguments] }
8282
--force-branch { project::sym forcebranch [Value arguments] }
8383
--batch { log noprogress }
8484
--dots { cyclebreaker dotsto [Value arguments] }
8585
--watch { cyclebreaker watch [Value arguments] }
86
+ --statesavequeriesto { state savequeriesto [Value arguments] }
8687
default {
8788
Usage $badoption$option\n$gethelp
8889
}
8990
}
9091
}
@@ -142,10 +143,12 @@
142143
trouble info " --force-branch ?PROJECT:?SYMBOL"
143144
trouble info " Force the named symbol from all or just"
144145
trouble info " the specified project to be converted as"
145146
trouble info " branch. Both project and symbol names"
146147
trouble info " are glob patterns."
148
+ trouble info ""
149
+ trouble info " Debug options"
147150
trouble info ""
148151
trouble info " --dots PATH Write the changeset graphs before, after,"
149152
trouble info " and during breaking the of cycles to the"
150153
trouble info " direcotry PATH, using GraphViz's dot format"
151154
trouble info ""
152155
--- tools/cvs2fossil/lib/c2f_option.tcl
+++ tools/cvs2fossil/lib/c2f_option.tcl
@@ -73,18 +73,19 @@
73 --project { repository add [Value arguments] }
74 -v -
75 --verbose { log verbose }
76 -q -
77 --quiet { log quiet }
78 --state { state use [Value arguments] }
79 --trunk-only { repository trunkonly! }
80 --exclude { project::sym exclude [Value arguments] }
81 --force-tag { project::sym forcetag [Value arguments] }
82 --force-branch { project::sym forcebranch [Value arguments] }
83 --batch { log noprogress }
84 --dots { cyclebreaker dotsto [Value arguments] }
85 --watch { cyclebreaker watch [Value arguments] }
 
86 default {
87 Usage $badoption$option\n$gethelp
88 }
89 }
90 }
@@ -142,10 +143,12 @@
142 trouble info " --force-branch ?PROJECT:?SYMBOL"
143 trouble info " Force the named symbol from all or just"
144 trouble info " the specified project to be converted as"
145 trouble info " branch. Both project and symbol names"
146 trouble info " are glob patterns."
 
 
147 trouble info ""
148 trouble info " --dots PATH Write the changeset graphs before, after,"
149 trouble info " and during breaking the of cycles to the"
150 trouble info " direcotry PATH, using GraphViz's dot format"
151 trouble info ""
152
--- tools/cvs2fossil/lib/c2f_option.tcl
+++ tools/cvs2fossil/lib/c2f_option.tcl
@@ -73,18 +73,19 @@
73 --project { repository add [Value arguments] }
74 -v -
75 --verbose { log verbose }
76 -q -
77 --quiet { log quiet }
78 --state { state usedb [Value arguments] }
79 --trunk-only { repository trunkonly! }
80 --exclude { project::sym exclude [Value arguments] }
81 --force-tag { project::sym forcetag [Value arguments] }
82 --force-branch { project::sym forcebranch [Value arguments] }
83 --batch { log noprogress }
84 --dots { cyclebreaker dotsto [Value arguments] }
85 --watch { cyclebreaker watch [Value arguments] }
86 --statesavequeriesto { state savequeriesto [Value arguments] }
87 default {
88 Usage $badoption$option\n$gethelp
89 }
90 }
91 }
@@ -142,10 +143,12 @@
143 trouble info " --force-branch ?PROJECT:?SYMBOL"
144 trouble info " Force the named symbol from all or just"
145 trouble info " the specified project to be converted as"
146 trouble info " branch. Both project and symbol names"
147 trouble info " are glob patterns."
148 trouble info ""
149 trouble info " Debug options"
150 trouble info ""
151 trouble info " --dots PATH Write the changeset graphs before, after,"
152 trouble info " and during breaking the of cycles to the"
153 trouble info " direcotry PATH, using GraphViz's dot format"
154 trouble info ""
155
--- tools/cvs2fossil/lib/c2f_pass.tcl
+++ tools/cvs2fossil/lib/c2f_pass.tcl
@@ -125,28 +125,36 @@
125125
126126
state release
127127
ShowTimes
128128
return
129129
}
130
+
131
+ typemethod current {} { return $mycurrentpass }
132
+
133
+ # # ## ### ##### ######## #############
134
+ ## Internal methods
130135
131136
proc Time {pass useconds} {
132137
::variable mytime
133138
lappend mytime $pass $useconds
139
+ ShowTime $pass $useconds
134140
return
135141
}
136142
137143
proc ShowTimes {} {
138144
::variable mytime
139145
foreach {pass useconds} $mytime {
140
- set sec [format %8.2f [expr {double($useconds)/1e6}]]
141
- log write 0 pass "$sec sec/$pass"
146
+ ShowTime $pass $useconds
142147
}
143148
return
144149
}
145150
146
- # # ## ### ##### ######## #############
147
- ## Internal methods
151
+ proc ShowTime {pass useconds} {
152
+ set sec [format %8.2f [expr {double($useconds)/1e6}]]
153
+ log write 0 pass "$sec sec/$pass"
154
+ return
155
+ }
148156
149157
proc Ok? {code label ov {emptyok 1}} {
150158
upvar 1 $ov ok
151159
::variable mydesc
152160
if {$emptyok && ($code eq "")} return
@@ -180,13 +188,14 @@
180188
181189
typevariable mypasses {} ; # List of registered passes (codes).
182190
typevariable mydesc -array {} ; # Pass descriptions (one line).
183191
typevariable mycmd -array {} ; # Pass callback command.
184192
185
- typevariable mystart -1
186
- typevariable myend -1
187
- typevariable mytime {} ; # Timing data for each executed pass.
193
+ typevariable mystart -1
194
+ typevariable myend -1
195
+ typevariable mytime {} ; # Timing data for each executed pass.
196
+ typevariable mycurrentpass {} ; # Pass currently running.
188197
189198
# # ## ### ##### ######## #############
190199
## Configuration
191200
192201
pragma -hasinstances no ; # singleton
193202
--- tools/cvs2fossil/lib/c2f_pass.tcl
+++ tools/cvs2fossil/lib/c2f_pass.tcl
@@ -125,28 +125,36 @@
125
126 state release
127 ShowTimes
128 return
129 }
 
 
 
 
 
130
131 proc Time {pass useconds} {
132 ::variable mytime
133 lappend mytime $pass $useconds
 
134 return
135 }
136
137 proc ShowTimes {} {
138 ::variable mytime
139 foreach {pass useconds} $mytime {
140 set sec [format %8.2f [expr {double($useconds)/1e6}]]
141 log write 0 pass "$sec sec/$pass"
142 }
143 return
144 }
145
146 # # ## ### ##### ######## #############
147 ## Internal methods
 
 
 
148
149 proc Ok? {code label ov {emptyok 1}} {
150 upvar 1 $ov ok
151 ::variable mydesc
152 if {$emptyok && ($code eq "")} return
@@ -180,13 +188,14 @@
180
181 typevariable mypasses {} ; # List of registered passes (codes).
182 typevariable mydesc -array {} ; # Pass descriptions (one line).
183 typevariable mycmd -array {} ; # Pass callback command.
184
185 typevariable mystart -1
186 typevariable myend -1
187 typevariable mytime {} ; # Timing data for each executed pass.
 
188
189 # # ## ### ##### ######## #############
190 ## Configuration
191
192 pragma -hasinstances no ; # singleton
193
--- tools/cvs2fossil/lib/c2f_pass.tcl
+++ tools/cvs2fossil/lib/c2f_pass.tcl
@@ -125,28 +125,36 @@
125
126 state release
127 ShowTimes
128 return
129 }
130
131 typemethod current {} { return $mycurrentpass }
132
133 # # ## ### ##### ######## #############
134 ## Internal methods
135
136 proc Time {pass useconds} {
137 ::variable mytime
138 lappend mytime $pass $useconds
139 ShowTime $pass $useconds
140 return
141 }
142
143 proc ShowTimes {} {
144 ::variable mytime
145 foreach {pass useconds} $mytime {
146 ShowTime $pass $useconds
 
147 }
148 return
149 }
150
151 proc ShowTime {pass useconds} {
152 set sec [format %8.2f [expr {double($useconds)/1e6}]]
153 log write 0 pass "$sec sec/$pass"
154 return
155 }
156
157 proc Ok? {code label ov {emptyok 1}} {
158 upvar 1 $ov ok
159 ::variable mydesc
160 if {$emptyok && ($code eq "")} return
@@ -180,13 +188,14 @@
188
189 typevariable mypasses {} ; # List of registered passes (codes).
190 typevariable mydesc -array {} ; # Pass descriptions (one line).
191 typevariable mycmd -array {} ; # Pass callback command.
192
193 typevariable mystart -1
194 typevariable myend -1
195 typevariable mytime {} ; # Timing data for each executed pass.
196 typevariable mycurrentpass {} ; # Pass currently running.
197
198 # # ## ### ##### ######## #############
199 ## Configuration
200
201 pragma -hasinstances no ; # singleton
202
--- tools/cvs2fossil/lib/c2f_patopsort.tcl
+++ tools/cvs2fossil/lib/c2f_patopsort.tcl
@@ -43,15 +43,20 @@
4343
4444
typemethod setup {} {
4545
# Define the names and structure of the persistent state of
4646
# this pass.
4747
48
- state reading revision
49
- state reading changeset
50
- state reading csorder
48
+ state use revision
49
+ state use tag
50
+ state use branch
51
+ state use symbol
52
+ state use changeset
53
+ state use csitem
54
+ state use cssuccessor
55
+ state use csorder
5156
52
- state writing cstimestamp {
57
+ state extend cstimestamp {
5358
-- Commit order of all changesets based on their
5459
-- dependencies, plus a monotonically increasing
5560
-- timestamp.
5661
5762
cid INTEGER NOT NULL REFERENCES changeset,
5863
--- tools/cvs2fossil/lib/c2f_patopsort.tcl
+++ tools/cvs2fossil/lib/c2f_patopsort.tcl
@@ -43,15 +43,20 @@
43
44 typemethod setup {} {
45 # Define the names and structure of the persistent state of
46 # this pass.
47
48 state reading revision
49 state reading changeset
50 state reading csorder
 
 
 
 
 
51
52 state writing cstimestamp {
53 -- Commit order of all changesets based on their
54 -- dependencies, plus a monotonically increasing
55 -- timestamp.
56
57 cid INTEGER NOT NULL REFERENCES changeset,
58
--- tools/cvs2fossil/lib/c2f_patopsort.tcl
+++ tools/cvs2fossil/lib/c2f_patopsort.tcl
@@ -43,15 +43,20 @@
43
44 typemethod setup {} {
45 # Define the names and structure of the persistent state of
46 # this pass.
47
48 state use revision
49 state use tag
50 state use branch
51 state use symbol
52 state use changeset
53 state use csitem
54 state use cssuccessor
55 state use csorder
56
57 state extend cstimestamp {
58 -- Commit order of all changesets based on their
59 -- dependencies, plus a monotonically increasing
60 -- timestamp.
61
62 cid INTEGER NOT NULL REFERENCES changeset,
63
--- tools/cvs2fossil/lib/c2f_pbreakacycle.tcl
+++ tools/cvs2fossil/lib/c2f_pbreakacycle.tcl
@@ -49,13 +49,17 @@
4949
5050
typemethod setup {} {
5151
# Define the names and structure of the persistent state of
5252
# this pass.
5353
54
- state reading changeset
55
- state reading csitem
56
- state reading csorder
54
+ state use revision
55
+ state use tag
56
+ state use branch
57
+ state use symbol
58
+ state use changeset
59
+ state use csitem
60
+ state use cssuccessor
5761
return
5862
}
5963
6064
typemethod load {} {
6165
# Pass manager interface. Executed to load data computed by
6266
--- tools/cvs2fossil/lib/c2f_pbreakacycle.tcl
+++ tools/cvs2fossil/lib/c2f_pbreakacycle.tcl
@@ -49,13 +49,17 @@
49
50 typemethod setup {} {
51 # Define the names and structure of the persistent state of
52 # this pass.
53
54 state reading changeset
55 state reading csitem
56 state reading csorder
 
 
 
 
57 return
58 }
59
60 typemethod load {} {
61 # Pass manager interface. Executed to load data computed by
62
--- tools/cvs2fossil/lib/c2f_pbreakacycle.tcl
+++ tools/cvs2fossil/lib/c2f_pbreakacycle.tcl
@@ -49,13 +49,17 @@
49
50 typemethod setup {} {
51 # Define the names and structure of the persistent state of
52 # this pass.
53
54 state use revision
55 state use tag
56 state use branch
57 state use symbol
58 state use changeset
59 state use csitem
60 state use cssuccessor
61 return
62 }
63
64 typemethod load {} {
65 # Pass manager interface. Executed to load data computed by
66
--- tools/cvs2fossil/lib/c2f_pbreakrcycle.tcl
+++ tools/cvs2fossil/lib/c2f_pbreakrcycle.tcl
@@ -45,13 +45,17 @@
4545
4646
typemethod setup {} {
4747
# Define the names and structure of the persistent state of
4848
# this pass.
4949
50
- state reading revision
51
- state reading changeset
52
- state reading csitem
50
+ state use revision
51
+ state use symbol
52
+ state use changeset
53
+ state use csitem
54
+ state use cstype
55
+ state use cssuccessor
56
+
5357
return
5458
}
5559
5660
typemethod load {} {
5761
# Pass manager interface. Executed to load data computed by
5862
--- tools/cvs2fossil/lib/c2f_pbreakrcycle.tcl
+++ tools/cvs2fossil/lib/c2f_pbreakrcycle.tcl
@@ -45,13 +45,17 @@
45
46 typemethod setup {} {
47 # Define the names and structure of the persistent state of
48 # this pass.
49
50 state reading revision
51 state reading changeset
52 state reading csitem
 
 
 
 
53 return
54 }
55
56 typemethod load {} {
57 # Pass manager interface. Executed to load data computed by
58
--- tools/cvs2fossil/lib/c2f_pbreakrcycle.tcl
+++ tools/cvs2fossil/lib/c2f_pbreakrcycle.tcl
@@ -45,13 +45,17 @@
45
46 typemethod setup {} {
47 # Define the names and structure of the persistent state of
48 # this pass.
49
50 state use revision
51 state use symbol
52 state use changeset
53 state use csitem
54 state use cstype
55 state use cssuccessor
56
57 return
58 }
59
60 typemethod load {} {
61 # Pass manager interface. Executed to load data computed by
62
--- tools/cvs2fossil/lib/c2f_pbreakscycle.tcl
+++ tools/cvs2fossil/lib/c2f_pbreakscycle.tcl
@@ -45,13 +45,17 @@
4545
4646
typemethod setup {} {
4747
# Define the names and structure of the persistent state of
4848
# this pass.
4949
50
- state reading revision
51
- state reading changeset
52
- state reading csitem
50
+ state use revision
51
+ state use tag
52
+ state use branch
53
+ state use symbol
54
+ state use changeset
55
+ state use csitem
56
+ state use cssuccessor
5357
return
5458
}
5559
5660
typemethod load {} {
5761
# Pass manager interface. Executed to load data computed by
5862
--- tools/cvs2fossil/lib/c2f_pbreakscycle.tcl
+++ tools/cvs2fossil/lib/c2f_pbreakscycle.tcl
@@ -45,13 +45,17 @@
45
46 typemethod setup {} {
47 # Define the names and structure of the persistent state of
48 # this pass.
49
50 state reading revision
51 state reading changeset
52 state reading csitem
 
 
 
 
53 return
54 }
55
56 typemethod load {} {
57 # Pass manager interface. Executed to load data computed by
58
--- tools/cvs2fossil/lib/c2f_pbreakscycle.tcl
+++ tools/cvs2fossil/lib/c2f_pbreakscycle.tcl
@@ -45,13 +45,17 @@
45
46 typemethod setup {} {
47 # Define the names and structure of the persistent state of
48 # this pass.
49
50 state use revision
51 state use tag
52 state use branch
53 state use symbol
54 state use changeset
55 state use csitem
56 state use cssuccessor
57 return
58 }
59
60 typemethod load {} {
61 # Pass manager interface. Executed to load data computed by
62
--- tools/cvs2fossil/lib/c2f_pcollar.tcl
+++ tools/cvs2fossil/lib/c2f_pcollar.tcl
@@ -63,15 +63,15 @@
6363
# associated with the rcs archive.
6464
6565
# Both projects and files are identified by globally unique
6666
# integer ids, automatically assigned by the database.
6767
68
- state writing project {
68
+ state extend project {
6969
pid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
7070
name TEXT NOT NULL UNIQUE
7171
}
72
- state writing file {
72
+ state extend file {
7373
fid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
7474
pid INTEGER NOT NULL REFERENCES project, -- project the file belongs to
7575
name TEXT NOT NULL,
7676
visible TEXT NOT NULL,
7777
exec INTEGER NOT NULL, -- boolean, 'file executable'.
@@ -83,12 +83,12 @@
8383
typemethod load {} {
8484
# Pass manager interface. Executed for all passes before the
8585
# run passes, to load all data of their pass from the state,
8686
# as if it had been computed by the pass itself.
8787
88
- state reading project
89
- state reading file
88
+ state use project
89
+ state use file
9090
9191
repository load
9292
return
9393
}
9494
9595
--- tools/cvs2fossil/lib/c2f_pcollar.tcl
+++ tools/cvs2fossil/lib/c2f_pcollar.tcl
@@ -63,15 +63,15 @@
63 # associated with the rcs archive.
64
65 # Both projects and files are identified by globally unique
66 # integer ids, automatically assigned by the database.
67
68 state writing project {
69 pid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
70 name TEXT NOT NULL UNIQUE
71 }
72 state writing file {
73 fid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
74 pid INTEGER NOT NULL REFERENCES project, -- project the file belongs to
75 name TEXT NOT NULL,
76 visible TEXT NOT NULL,
77 exec INTEGER NOT NULL, -- boolean, 'file executable'.
@@ -83,12 +83,12 @@
83 typemethod load {} {
84 # Pass manager interface. Executed for all passes before the
85 # run passes, to load all data of their pass from the state,
86 # as if it had been computed by the pass itself.
87
88 state reading project
89 state reading file
90
91 repository load
92 return
93 }
94
95
--- tools/cvs2fossil/lib/c2f_pcollar.tcl
+++ tools/cvs2fossil/lib/c2f_pcollar.tcl
@@ -63,15 +63,15 @@
63 # associated with the rcs archive.
64
65 # Both projects and files are identified by globally unique
66 # integer ids, automatically assigned by the database.
67
68 state extend project {
69 pid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
70 name TEXT NOT NULL UNIQUE
71 }
72 state extend file {
73 fid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
74 pid INTEGER NOT NULL REFERENCES project, -- project the file belongs to
75 name TEXT NOT NULL,
76 visible TEXT NOT NULL,
77 exec INTEGER NOT NULL, -- boolean, 'file executable'.
@@ -83,12 +83,12 @@
83 typemethod load {} {
84 # Pass manager interface. Executed for all passes before the
85 # run passes, to load all data of their pass from the state,
86 # as if it had been computed by the pass itself.
87
88 state use project
89 state use file
90
91 repository load
92 return
93 }
94
95
--- tools/cvs2fossil/lib/c2f_pcollrev.tcl
+++ tools/cvs2fossil/lib/c2f_pcollrev.tcl
@@ -45,12 +45,12 @@
4545
4646
typemethod setup {} {
4747
# Define names and structure of the persistent state of this
4848
# pass.
4949
50
- state reading project
51
- state reading file
50
+ state use project
51
+ state use file
5252
5353
# We deal with per project and per file data, the first
5454
# collated from the second.
5555
5656
# Per file we have general information, ..., and then
@@ -64,11 +64,11 @@
6464
# Pseudo class hierarchy
6565
# Tag <- Symbol <- Event
6666
# Branch <- Symbol <- Event
6767
# Revision <- Event
6868
69
- state writing revision {
69
+ state extend revision {
7070
-- Revisions. Identified by a global numeric id each
7171
-- belongs to a single file, identified by its id. It
7272
-- further has a dotted revision number (DTN).
7373
--
7474
-- Constraint: The dotted revision number is unique within
@@ -144,11 +144,11 @@
144144
clen INTEGER NOT NULL,
145145
146146
UNIQUE (fid, rev) -- The DTN is unique within the revision's file.
147147
}
148148
149
- state writing optype {
149
+ state extend optype {
150150
oid INTEGER NOT NULL PRIMARY KEY,
151151
name TEXT NOT NULL,
152152
UNIQUE(name)
153153
}
154154
state run {
@@ -156,11 +156,11 @@
156156
INSERT INTO optype VALUES ( 0,'nothing'); -- fixed pieces, see myopstate
157157
INSERT INTO optype VALUES ( 1,'add'); -- in file::rev. myopcode is
158158
INSERT INTO optype VALUES ( 2,'change'); -- loaded from this.
159159
}
160160
161
- state writing revisionbranchchildren {
161
+ state extend revisionbranchchildren {
162162
-- The non-primary children of a revision, as reachable
163163
-- through a branch symbol, are listed here. This is
164164
-- needed by pass 5 to break internal dependencies in a
165165
-- changeset.
166166
@@ -167,11 +167,11 @@
167167
rid INTEGER NOT NULL REFERENCES revision,
168168
brid INTEGER NOT NULL REFERENCES revision,
169169
UNIQUE(rid,brid)
170170
}
171171
172
- state writing tag {
172
+ state extend tag {
173173
tid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
174174
fid INTEGER NOT NULL REFERENCES file, -- File the item belongs to
175175
lod INTEGER REFERENCES symbol, -- Line of development (NULL => Trunk)
176176
sid INTEGER NOT NULL REFERENCES symbol, -- Symbol capturing the tag
177177
@@ -178,11 +178,11 @@
178178
rev INTEGER NOT NULL REFERENCES revision -- The revision being tagged.
179179
} { rev sid }
180180
# Indices on: rev (revision successors)
181181
# sid (tag predecessors, branch successors/predecessors)
182182
183
- state writing branch {
183
+ state extend branch {
184184
bid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
185185
fid INTEGER NOT NULL REFERENCES file, -- File the item belongs to
186186
lod INTEGER REFERENCES symbol, -- Line of development (NULL => Trunk)
187187
sid INTEGER NOT NULL REFERENCES symbol, -- Symbol capturing the branch
188188
@@ -207,11 +207,11 @@
207207
#
208208
# pTrunk <- pLineOfDevelopment
209209
# pBranch <- pSymbol, pLineOfDevelopment
210210
# pTag <- pSymbol, pLineOfDevelopment
211211
212
- state writing symbol {
212
+ state extend symbol {
213213
sid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
214214
pid INTEGER NOT NULL REFERENCES project, -- Project the symbol belongs to
215215
name TEXT NOT NULL,
216216
type INTEGER NOT NULL REFERENCES symtype, -- enum { excluded = 0, tag, branch, undefined }
217217
@@ -220,30 +220,30 @@
220220
commit_count INTEGER NOT NULL, -- How often a file was committed on the symbol
221221
222222
UNIQUE (pid, name) -- Symbols are unique within the project
223223
}
224224
225
- state writing blocker {
225
+ state extend blocker {
226226
-- For each symbol we save which other symbols are
227227
-- blocking its removal (if the user asks for it).
228228
229229
sid INTEGER NOT NULL REFERENCES symbol, --
230230
bid INTEGER NOT NULL REFERENCES symbol, -- Sprouted from sid, blocks it.
231231
UNIQUE (sid, bid)
232232
}
233233
234
- state writing parent {
234
+ state extend parent {
235235
-- For each symbol we save which other symbols can act as
236236
-- a possible parent in some file, and how often.
237237
238238
sid INTEGER NOT NULL REFERENCES symbol, --
239239
pid INTEGER NOT NULL REFERENCES symbol, -- Possible parent of sid
240240
n INTEGER NOT NULL, -- How often pid can act as parent.
241241
UNIQUE (sid, pid)
242242
}
243243
244
- state writing symtype {
244
+ state extend symtype {
245245
tid INTEGER NOT NULL PRIMARY KEY,
246246
name TEXT NOT NULL,
247247
plural TEXT NOT NULL,
248248
UNIQUE (name)
249249
UNIQUE (plural)
@@ -253,11 +253,11 @@
253253
INSERT INTO symtype VALUES (1,'tag', 'tags');
254254
INSERT INTO symtype VALUES (2,'branch', 'branches');
255255
INSERT INTO symtype VALUES (3,'undefined','undefined');
256256
}
257257
258
- state writing meta {
258
+ state extend meta {
259259
-- Meta data of revisions. See revision.mid for the
260260
-- reference. Many revisions can share meta data. This is
261261
-- actually one of the criterions used to sort revisions
262262
-- into changesets.
263263
@@ -284,16 +284,16 @@
284284
}
285285
286286
# Authors and commit messages are fully global, i.e. per
287287
# repository.
288288
289
- state writing author {
289
+ state extend author {
290290
aid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
291291
name TEXT NOT NULL UNIQUE
292292
}
293293
294
- state writing cmessage {
294
+ state extend cmessage {
295295
cid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
296296
text TEXT NOT NULL UNIQUE
297297
}
298298
299299
project::sym getsymtypes
@@ -300,13 +300,13 @@
300300
file::rev getopcodes
301301
return
302302
}
303303
304304
typemethod load {} {
305
- state reading symbol
306
- state reading symtype
307
- state reading optype
305
+ state use symbol
306
+ state use symtype
307
+ state use optype
308308
309309
project::sym getsymtypes
310310
file::rev getopcodes
311311
repository loadsymbols
312312
return
313313
--- tools/cvs2fossil/lib/c2f_pcollrev.tcl
+++ tools/cvs2fossil/lib/c2f_pcollrev.tcl
@@ -45,12 +45,12 @@
45
46 typemethod setup {} {
47 # Define names and structure of the persistent state of this
48 # pass.
49
50 state reading project
51 state reading file
52
53 # We deal with per project and per file data, the first
54 # collated from the second.
55
56 # Per file we have general information, ..., and then
@@ -64,11 +64,11 @@
64 # Pseudo class hierarchy
65 # Tag <- Symbol <- Event
66 # Branch <- Symbol <- Event
67 # Revision <- Event
68
69 state writing revision {
70 -- Revisions. Identified by a global numeric id each
71 -- belongs to a single file, identified by its id. It
72 -- further has a dotted revision number (DTN).
73 --
74 -- Constraint: The dotted revision number is unique within
@@ -144,11 +144,11 @@
144 clen INTEGER NOT NULL,
145
146 UNIQUE (fid, rev) -- The DTN is unique within the revision's file.
147 }
148
149 state writing optype {
150 oid INTEGER NOT NULL PRIMARY KEY,
151 name TEXT NOT NULL,
152 UNIQUE(name)
153 }
154 state run {
@@ -156,11 +156,11 @@
156 INSERT INTO optype VALUES ( 0,'nothing'); -- fixed pieces, see myopstate
157 INSERT INTO optype VALUES ( 1,'add'); -- in file::rev. myopcode is
158 INSERT INTO optype VALUES ( 2,'change'); -- loaded from this.
159 }
160
161 state writing revisionbranchchildren {
162 -- The non-primary children of a revision, as reachable
163 -- through a branch symbol, are listed here. This is
164 -- needed by pass 5 to break internal dependencies in a
165 -- changeset.
166
@@ -167,11 +167,11 @@
167 rid INTEGER NOT NULL REFERENCES revision,
168 brid INTEGER NOT NULL REFERENCES revision,
169 UNIQUE(rid,brid)
170 }
171
172 state writing tag {
173 tid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
174 fid INTEGER NOT NULL REFERENCES file, -- File the item belongs to
175 lod INTEGER REFERENCES symbol, -- Line of development (NULL => Trunk)
176 sid INTEGER NOT NULL REFERENCES symbol, -- Symbol capturing the tag
177
@@ -178,11 +178,11 @@
178 rev INTEGER NOT NULL REFERENCES revision -- The revision being tagged.
179 } { rev sid }
180 # Indices on: rev (revision successors)
181 # sid (tag predecessors, branch successors/predecessors)
182
183 state writing branch {
184 bid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
185 fid INTEGER NOT NULL REFERENCES file, -- File the item belongs to
186 lod INTEGER REFERENCES symbol, -- Line of development (NULL => Trunk)
187 sid INTEGER NOT NULL REFERENCES symbol, -- Symbol capturing the branch
188
@@ -207,11 +207,11 @@
207 #
208 # pTrunk <- pLineOfDevelopment
209 # pBranch <- pSymbol, pLineOfDevelopment
210 # pTag <- pSymbol, pLineOfDevelopment
211
212 state writing symbol {
213 sid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
214 pid INTEGER NOT NULL REFERENCES project, -- Project the symbol belongs to
215 name TEXT NOT NULL,
216 type INTEGER NOT NULL REFERENCES symtype, -- enum { excluded = 0, tag, branch, undefined }
217
@@ -220,30 +220,30 @@
220 commit_count INTEGER NOT NULL, -- How often a file was committed on the symbol
221
222 UNIQUE (pid, name) -- Symbols are unique within the project
223 }
224
225 state writing blocker {
226 -- For each symbol we save which other symbols are
227 -- blocking its removal (if the user asks for it).
228
229 sid INTEGER NOT NULL REFERENCES symbol, --
230 bid INTEGER NOT NULL REFERENCES symbol, -- Sprouted from sid, blocks it.
231 UNIQUE (sid, bid)
232 }
233
234 state writing parent {
235 -- For each symbol we save which other symbols can act as
236 -- a possible parent in some file, and how often.
237
238 sid INTEGER NOT NULL REFERENCES symbol, --
239 pid INTEGER NOT NULL REFERENCES symbol, -- Possible parent of sid
240 n INTEGER NOT NULL, -- How often pid can act as parent.
241 UNIQUE (sid, pid)
242 }
243
244 state writing symtype {
245 tid INTEGER NOT NULL PRIMARY KEY,
246 name TEXT NOT NULL,
247 plural TEXT NOT NULL,
248 UNIQUE (name)
249 UNIQUE (plural)
@@ -253,11 +253,11 @@
253 INSERT INTO symtype VALUES (1,'tag', 'tags');
254 INSERT INTO symtype VALUES (2,'branch', 'branches');
255 INSERT INTO symtype VALUES (3,'undefined','undefined');
256 }
257
258 state writing meta {
259 -- Meta data of revisions. See revision.mid for the
260 -- reference. Many revisions can share meta data. This is
261 -- actually one of the criterions used to sort revisions
262 -- into changesets.
263
@@ -284,16 +284,16 @@
284 }
285
286 # Authors and commit messages are fully global, i.e. per
287 # repository.
288
289 state writing author {
290 aid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
291 name TEXT NOT NULL UNIQUE
292 }
293
294 state writing cmessage {
295 cid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
296 text TEXT NOT NULL UNIQUE
297 }
298
299 project::sym getsymtypes
@@ -300,13 +300,13 @@
300 file::rev getopcodes
301 return
302 }
303
304 typemethod load {} {
305 state reading symbol
306 state reading symtype
307 state reading optype
308
309 project::sym getsymtypes
310 file::rev getopcodes
311 repository loadsymbols
312 return
313
--- tools/cvs2fossil/lib/c2f_pcollrev.tcl
+++ tools/cvs2fossil/lib/c2f_pcollrev.tcl
@@ -45,12 +45,12 @@
45
46 typemethod setup {} {
47 # Define names and structure of the persistent state of this
48 # pass.
49
50 state use project
51 state use file
52
53 # We deal with per project and per file data, the first
54 # collated from the second.
55
56 # Per file we have general information, ..., and then
@@ -64,11 +64,11 @@
64 # Pseudo class hierarchy
65 # Tag <- Symbol <- Event
66 # Branch <- Symbol <- Event
67 # Revision <- Event
68
69 state extend revision {
70 -- Revisions. Identified by a global numeric id each
71 -- belongs to a single file, identified by its id. It
72 -- further has a dotted revision number (DTN).
73 --
74 -- Constraint: The dotted revision number is unique within
@@ -144,11 +144,11 @@
144 clen INTEGER NOT NULL,
145
146 UNIQUE (fid, rev) -- The DTN is unique within the revision's file.
147 }
148
149 state extend optype {
150 oid INTEGER NOT NULL PRIMARY KEY,
151 name TEXT NOT NULL,
152 UNIQUE(name)
153 }
154 state run {
@@ -156,11 +156,11 @@
156 INSERT INTO optype VALUES ( 0,'nothing'); -- fixed pieces, see myopstate
157 INSERT INTO optype VALUES ( 1,'add'); -- in file::rev. myopcode is
158 INSERT INTO optype VALUES ( 2,'change'); -- loaded from this.
159 }
160
161 state extend revisionbranchchildren {
162 -- The non-primary children of a revision, as reachable
163 -- through a branch symbol, are listed here. This is
164 -- needed by pass 5 to break internal dependencies in a
165 -- changeset.
166
@@ -167,11 +167,11 @@
167 rid INTEGER NOT NULL REFERENCES revision,
168 brid INTEGER NOT NULL REFERENCES revision,
169 UNIQUE(rid,brid)
170 }
171
172 state extend tag {
173 tid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
174 fid INTEGER NOT NULL REFERENCES file, -- File the item belongs to
175 lod INTEGER REFERENCES symbol, -- Line of development (NULL => Trunk)
176 sid INTEGER NOT NULL REFERENCES symbol, -- Symbol capturing the tag
177
@@ -178,11 +178,11 @@
178 rev INTEGER NOT NULL REFERENCES revision -- The revision being tagged.
179 } { rev sid }
180 # Indices on: rev (revision successors)
181 # sid (tag predecessors, branch successors/predecessors)
182
183 state extend branch {
184 bid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
185 fid INTEGER NOT NULL REFERENCES file, -- File the item belongs to
186 lod INTEGER REFERENCES symbol, -- Line of development (NULL => Trunk)
187 sid INTEGER NOT NULL REFERENCES symbol, -- Symbol capturing the branch
188
@@ -207,11 +207,11 @@
207 #
208 # pTrunk <- pLineOfDevelopment
209 # pBranch <- pSymbol, pLineOfDevelopment
210 # pTag <- pSymbol, pLineOfDevelopment
211
212 state extend symbol {
213 sid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
214 pid INTEGER NOT NULL REFERENCES project, -- Project the symbol belongs to
215 name TEXT NOT NULL,
216 type INTEGER NOT NULL REFERENCES symtype, -- enum { excluded = 0, tag, branch, undefined }
217
@@ -220,30 +220,30 @@
220 commit_count INTEGER NOT NULL, -- How often a file was committed on the symbol
221
222 UNIQUE (pid, name) -- Symbols are unique within the project
223 }
224
225 state extend blocker {
226 -- For each symbol we save which other symbols are
227 -- blocking its removal (if the user asks for it).
228
229 sid INTEGER NOT NULL REFERENCES symbol, --
230 bid INTEGER NOT NULL REFERENCES symbol, -- Sprouted from sid, blocks it.
231 UNIQUE (sid, bid)
232 }
233
234 state extend parent {
235 -- For each symbol we save which other symbols can act as
236 -- a possible parent in some file, and how often.
237
238 sid INTEGER NOT NULL REFERENCES symbol, --
239 pid INTEGER NOT NULL REFERENCES symbol, -- Possible parent of sid
240 n INTEGER NOT NULL, -- How often pid can act as parent.
241 UNIQUE (sid, pid)
242 }
243
244 state extend symtype {
245 tid INTEGER NOT NULL PRIMARY KEY,
246 name TEXT NOT NULL,
247 plural TEXT NOT NULL,
248 UNIQUE (name)
249 UNIQUE (plural)
@@ -253,11 +253,11 @@
253 INSERT INTO symtype VALUES (1,'tag', 'tags');
254 INSERT INTO symtype VALUES (2,'branch', 'branches');
255 INSERT INTO symtype VALUES (3,'undefined','undefined');
256 }
257
258 state extend meta {
259 -- Meta data of revisions. See revision.mid for the
260 -- reference. Many revisions can share meta data. This is
261 -- actually one of the criterions used to sort revisions
262 -- into changesets.
263
@@ -284,16 +284,16 @@
284 }
285
286 # Authors and commit messages are fully global, i.e. per
287 # repository.
288
289 state extend author {
290 aid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
291 name TEXT NOT NULL UNIQUE
292 }
293
294 state extend cmessage {
295 cid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
296 text TEXT NOT NULL UNIQUE
297 }
298
299 project::sym getsymtypes
@@ -300,13 +300,13 @@
300 file::rev getopcodes
301 return
302 }
303
304 typemethod load {} {
305 state use symbol
306 state use symtype
307 state use optype
308
309 project::sym getsymtypes
310 file::rev getopcodes
311 repository loadsymbols
312 return
313
--- tools/cvs2fossil/lib/c2f_pcollsym.tcl
+++ tools/cvs2fossil/lib/c2f_pcollsym.tcl
@@ -43,15 +43,17 @@
4343
4444
typemethod setup {} {
4545
# Define names and structure of the persistent state of this
4646
# pass.
4747
48
- state reading symbol
49
- state reading blocker
50
- state reading parent
48
+ state use project
49
+ state use symbol
50
+ state use symtype
51
+ state use blocker
52
+ state use parent
5153
52
- state writing preferedparent {
54
+ state extend preferedparent {
5355
-- For each symbol the prefered parent. This describes the
5456
-- tree of the found lines of development. Actually a
5557
-- forest in case of multiple projects, with one tree per
5658
-- project.
5759
5860
--- tools/cvs2fossil/lib/c2f_pcollsym.tcl
+++ tools/cvs2fossil/lib/c2f_pcollsym.tcl
@@ -43,15 +43,17 @@
43
44 typemethod setup {} {
45 # Define names and structure of the persistent state of this
46 # pass.
47
48 state reading symbol
49 state reading blocker
50 state reading parent
 
 
51
52 state writing preferedparent {
53 -- For each symbol the prefered parent. This describes the
54 -- tree of the found lines of development. Actually a
55 -- forest in case of multiple projects, with one tree per
56 -- project.
57
58
--- tools/cvs2fossil/lib/c2f_pcollsym.tcl
+++ tools/cvs2fossil/lib/c2f_pcollsym.tcl
@@ -43,15 +43,17 @@
43
44 typemethod setup {} {
45 # Define names and structure of the persistent state of this
46 # pass.
47
48 state use project
49 state use symbol
50 state use symtype
51 state use blocker
52 state use parent
53
54 state extend preferedparent {
55 -- For each symbol the prefered parent. This describes the
56 -- tree of the found lines of development. Actually a
57 -- forest in case of multiple projects, with one tree per
58 -- project.
59
60
--- tools/cvs2fossil/lib/c2f_pfiltersym.tcl
+++ tools/cvs2fossil/lib/c2f_pfiltersym.tcl
@@ -43,20 +43,25 @@
4343
4444
typemethod setup {} {
4545
# Define names and structure of the persistent state of this
4646
# pass.
4747
48
- state reading symbol
49
- state reading blocker
50
- state reading parent
51
- state reading preferedparent
52
- state reading revision
53
- state reading revisionbranchchildren
54
- state reading branch
55
- state reading tag
56
-
57
- state writing noop {
48
+ state use project
49
+ state use file
50
+ state use revision
51
+ state use revisionbranchchildren
52
+ state use branch
53
+ state use tag
54
+ state use symbol
55
+ state use blocker
56
+ state use parent
57
+ state use author
58
+ state use cmessage
59
+ state use preferedparent
60
+
61
+ # NOTE: So far no pass coming after this makes us of this information.
62
+ state extend noop {
5863
id INTEGER NOT NULL PRIMARY KEY, -- tag/branch reference
5964
noop INTEGER NOT NULL
6065
}
6166
return
6267
}
6368
--- tools/cvs2fossil/lib/c2f_pfiltersym.tcl
+++ tools/cvs2fossil/lib/c2f_pfiltersym.tcl
@@ -43,20 +43,25 @@
43
44 typemethod setup {} {
45 # Define names and structure of the persistent state of this
46 # pass.
47
48 state reading symbol
49 state reading blocker
50 state reading parent
51 state reading preferedparent
52 state reading revision
53 state reading revisionbranchchildren
54 state reading branch
55 state reading tag
56
57 state writing noop {
 
 
 
 
 
58 id INTEGER NOT NULL PRIMARY KEY, -- tag/branch reference
59 noop INTEGER NOT NULL
60 }
61 return
62 }
63
--- tools/cvs2fossil/lib/c2f_pfiltersym.tcl
+++ tools/cvs2fossil/lib/c2f_pfiltersym.tcl
@@ -43,20 +43,25 @@
43
44 typemethod setup {} {
45 # Define names and structure of the persistent state of this
46 # pass.
47
48 state use project
49 state use file
50 state use revision
51 state use revisionbranchchildren
52 state use branch
53 state use tag
54 state use symbol
55 state use blocker
56 state use parent
57 state use author
58 state use cmessage
59 state use preferedparent
60
61 # NOTE: So far no pass coming after this makes us of this information.
62 state extend noop {
63 id INTEGER NOT NULL PRIMARY KEY, -- tag/branch reference
64 noop INTEGER NOT NULL
65 }
66 return
67 }
68
--- tools/cvs2fossil/lib/c2f_pinitcsets.tcl
+++ tools/cvs2fossil/lib/c2f_pinitcsets.tcl
@@ -43,29 +43,31 @@
4343
4444
typemethod setup {} {
4545
# Define the names and structure of the persistent state of
4646
# this pass.
4747
48
- state reading meta
49
- state reading revision
50
- state reading revisionbranchchildren
51
- state reading branch
52
- state reading tag
53
- state reading symbol
48
+ state use project
49
+ state use file
50
+ state use revision
51
+ state use revisionbranchchildren
52
+ state use branch
53
+ state use tag
54
+ state use symbol
55
+ state use meta
5456
5557
# Data per changeset, namely the project it belongs to, how it
5658
# was induced (revision or symbol), plus reference to the
5759
# primary entry causing it (meta entry or symbol). An adjunct
5860
# table translates the type id's into human readable labels.
5961
60
- state writing changeset {
62
+ state extend changeset {
6163
cid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
6264
pid INTEGER NOT NULL REFERENCES project,
6365
type INTEGER NOT NULL REFERENCES cstype,
6466
src INTEGER NOT NULL -- REFERENCES meta|symbol (type dependent)
6567
}
66
- state writing cstype {
68
+ state extend cstype {
6769
tid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
6870
name TEXT NOT NULL,
6971
UNIQUE (name)
7072
}
7173
# Note: Keep the labels used here in sync with the names for
@@ -86,11 +88,11 @@
8688
# from disparate sources the same id may have different
8789
# meaning, be in different changesets and so is formally not
8890
# unique. So we can only say that it is unique within the
8991
# changeset. The integrity module has stronger checks.
9092
91
- state writing csitem {
93
+ state extend csitem {
9294
cid INTEGER NOT NULL REFERENCES changeset,
9395
pos INTEGER NOT NULL,
9496
iid INTEGER NOT NULL, -- REFERENCES revision|tag|branch
9597
UNIQUE (cid, pos),
9698
UNIQUE (cid, iid)
@@ -104,13 +106,13 @@
104106
typemethod load {} {
105107
# Pass manager interface. Executed to load data computed by
106108
# this pass into memory when this pass is skipped instead of
107109
# executed.
108110
109
- state reading changeset
110
- state reading csitem
111
- state reading cstype
111
+ state use changeset
112
+ state use csitem
113
+ state use cstype
112114
113115
# Need the types first, the constructor in the loop below uses
114116
# them to assert the correctness of type names.
115117
project::rev getcstypes
116118
117119
--- tools/cvs2fossil/lib/c2f_pinitcsets.tcl
+++ tools/cvs2fossil/lib/c2f_pinitcsets.tcl
@@ -43,29 +43,31 @@
43
44 typemethod setup {} {
45 # Define the names and structure of the persistent state of
46 # this pass.
47
48 state reading meta
49 state reading revision
50 state reading revisionbranchchildren
51 state reading branch
52 state reading tag
53 state reading symbol
 
 
54
55 # Data per changeset, namely the project it belongs to, how it
56 # was induced (revision or symbol), plus reference to the
57 # primary entry causing it (meta entry or symbol). An adjunct
58 # table translates the type id's into human readable labels.
59
60 state writing changeset {
61 cid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
62 pid INTEGER NOT NULL REFERENCES project,
63 type INTEGER NOT NULL REFERENCES cstype,
64 src INTEGER NOT NULL -- REFERENCES meta|symbol (type dependent)
65 }
66 state writing cstype {
67 tid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
68 name TEXT NOT NULL,
69 UNIQUE (name)
70 }
71 # Note: Keep the labels used here in sync with the names for
@@ -86,11 +88,11 @@
86 # from disparate sources the same id may have different
87 # meaning, be in different changesets and so is formally not
88 # unique. So we can only say that it is unique within the
89 # changeset. The integrity module has stronger checks.
90
91 state writing csitem {
92 cid INTEGER NOT NULL REFERENCES changeset,
93 pos INTEGER NOT NULL,
94 iid INTEGER NOT NULL, -- REFERENCES revision|tag|branch
95 UNIQUE (cid, pos),
96 UNIQUE (cid, iid)
@@ -104,13 +106,13 @@
104 typemethod load {} {
105 # Pass manager interface. Executed to load data computed by
106 # this pass into memory when this pass is skipped instead of
107 # executed.
108
109 state reading changeset
110 state reading csitem
111 state reading cstype
112
113 # Need the types first, the constructor in the loop below uses
114 # them to assert the correctness of type names.
115 project::rev getcstypes
116
117
--- tools/cvs2fossil/lib/c2f_pinitcsets.tcl
+++ tools/cvs2fossil/lib/c2f_pinitcsets.tcl
@@ -43,29 +43,31 @@
43
44 typemethod setup {} {
45 # Define the names and structure of the persistent state of
46 # this pass.
47
48 state use project
49 state use file
50 state use revision
51 state use revisionbranchchildren
52 state use branch
53 state use tag
54 state use symbol
55 state use meta
56
57 # Data per changeset, namely the project it belongs to, how it
58 # was induced (revision or symbol), plus reference to the
59 # primary entry causing it (meta entry or symbol). An adjunct
60 # table translates the type id's into human readable labels.
61
62 state extend changeset {
63 cid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
64 pid INTEGER NOT NULL REFERENCES project,
65 type INTEGER NOT NULL REFERENCES cstype,
66 src INTEGER NOT NULL -- REFERENCES meta|symbol (type dependent)
67 }
68 state extend cstype {
69 tid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
70 name TEXT NOT NULL,
71 UNIQUE (name)
72 }
73 # Note: Keep the labels used here in sync with the names for
@@ -86,11 +88,11 @@
88 # from disparate sources the same id may have different
89 # meaning, be in different changesets and so is formally not
90 # unique. So we can only say that it is unique within the
91 # changeset. The integrity module has stronger checks.
92
93 state extend csitem {
94 cid INTEGER NOT NULL REFERENCES changeset,
95 pos INTEGER NOT NULL,
96 iid INTEGER NOT NULL, -- REFERENCES revision|tag|branch
97 UNIQUE (cid, pos),
98 UNIQUE (cid, iid)
@@ -104,13 +106,13 @@
106 typemethod load {} {
107 # Pass manager interface. Executed to load data computed by
108 # this pass into memory when this pass is skipped instead of
109 # executed.
110
111 state use changeset
112 state use csitem
113 state use cstype
114
115 # Need the types first, the constructor in the loop below uses
116 # them to assert the correctness of type names.
117 project::rev getcstypes
118
119
--- tools/cvs2fossil/lib/c2f_prtopsort.tcl
+++ tools/cvs2fossil/lib/c2f_prtopsort.tcl
@@ -43,15 +43,18 @@
4343
4444
typemethod setup {} {
4545
# Define the names and structure of the persistent state of
4646
# this pass.
4747
48
- state reading revision
49
- state reading changeset
50
- state reading csitem
48
+ state use revision
49
+ state use symbol
50
+ state use changeset
51
+ state use csitem
52
+ state use cstype
53
+ state use cssuccessor
5154
52
- state writing csorder {
55
+ state extend csorder {
5356
-- Commit order of the revision changesets based on their
5457
-- dependencies
5558
5659
cid INTEGER NOT NULL REFERENCES changeset,
5760
pos INTEGER NOT NULL,
@@ -64,11 +67,11 @@
6467
typemethod load {} {
6568
# Pass manager interface. Executed to load data computed by
6669
# this pass into memory when this pass is skipped instead of
6770
# executed.
6871
69
- state reading changeset
72
+ state use changeset
7073
project::rev loadcounter
7174
return
7275
}
7376
7477
typemethod run {} {
7578
--- tools/cvs2fossil/lib/c2f_prtopsort.tcl
+++ tools/cvs2fossil/lib/c2f_prtopsort.tcl
@@ -43,15 +43,18 @@
43
44 typemethod setup {} {
45 # Define the names and structure of the persistent state of
46 # this pass.
47
48 state reading revision
49 state reading changeset
50 state reading csitem
 
 
 
51
52 state writing csorder {
53 -- Commit order of the revision changesets based on their
54 -- dependencies
55
56 cid INTEGER NOT NULL REFERENCES changeset,
57 pos INTEGER NOT NULL,
@@ -64,11 +67,11 @@
64 typemethod load {} {
65 # Pass manager interface. Executed to load data computed by
66 # this pass into memory when this pass is skipped instead of
67 # executed.
68
69 state reading changeset
70 project::rev loadcounter
71 return
72 }
73
74 typemethod run {} {
75
--- tools/cvs2fossil/lib/c2f_prtopsort.tcl
+++ tools/cvs2fossil/lib/c2f_prtopsort.tcl
@@ -43,15 +43,18 @@
43
44 typemethod setup {} {
45 # Define the names and structure of the persistent state of
46 # this pass.
47
48 state use revision
49 state use symbol
50 state use changeset
51 state use csitem
52 state use cstype
53 state use cssuccessor
54
55 state extend csorder {
56 -- Commit order of the revision changesets based on their
57 -- dependencies
58
59 cid INTEGER NOT NULL REFERENCES changeset,
60 pos INTEGER NOT NULL,
@@ -64,11 +67,11 @@
67 typemethod load {} {
68 # Pass manager interface. Executed to load data computed by
69 # this pass into memory when this pass is skipped instead of
70 # executed.
71
72 state use changeset
73 project::rev loadcounter
74 return
75 }
76
77 typemethod run {} {
78
--- tools/cvs2fossil/lib/c2f_state.tcl
+++ tools/cvs2fossil/lib/c2f_state.tcl
@@ -29,11 +29,11 @@
2929
3030
snit::type ::vc::fossil::import::cvs::state {
3131
# # ## ### ##### ######## #############
3232
## Public API
3333
34
- typemethod use {path} {
34
+ typemethod usedb {path} {
3535
# Immediate validation. There are are two possibilities to
3636
# consider. The path exists or it doesn't.
3737
3838
# In the first case it has to be a readable and writable file,
3939
# and it has to be a proper sqlite database. Further checks
@@ -93,38 +93,41 @@
9393
if {$mypath eq ""} return
9494
file delete $mypath
9595
return
9696
}
9797
98
- typemethod writing {name definition {indices {}}} {
99
- # Method for a user to declare a table its needs for storing
100
- # persistent state, and the expected structure. A possibly
101
- # previously existing definition is dropped.
98
+ # Declare a table needed for the storing of persistent state, and
99
+ # its structure. A possibly previously existing definition is
100
+ # dropped. To be used when a table is needed and not assumed to
101
+ # exist from previous passes.
102102
103
- log write 1 state "writing $name" ; # TODO move to level 5 or so
103
+ typemethod extend {name definition {indices {}}} {
104
+ log write 5 state "extend $name"
105
+ Save "extend $name ================================"
104106
105107
$mystate transaction {
106108
catch { $mystate eval "DROP TABLE $name" }
107109
$mystate eval "CREATE TABLE $name ( $definition )"
108110
109111
set id 0
110112
foreach columns $indices {
111
- log write 1 state "index $name$id" ; # TODO move to level 5 or so
113
+ log write 5 state "index $name$id"
112114
113115
$mystate eval "CREATE INDEX ${name}$id ON ${name} ( [join $columns ,] )"
114116
incr id
115117
}
116118
}
117119
return
118120
}
119121
120
- typemethod reading {name} {
121
- log write 1 state "reading $name" ; # TODO move to level 5 or so
122
+ # Declare that a table is needed for reading from and/or storing
123
+ # to persistent state, and is assumed to already exist. A missing
124
+ # table is an internal error causing an immediate exit.
122125
123
- # Method for a user to declare a table it wishes to read
124
- # from. A missing table is an internal error causing an
125
- # immediate exit.
126
+ typemethod use {name} {
127
+ log write 5 state "use $name"
128
+ Save "use $name ==================================="
126129
127130
set found [llength [$mystate eval {
128131
SELECT name
129132
FROM sqlite_master
130133
WHERE type = 'table'
@@ -141,39 +144,56 @@
141144
142145
typemethod discard {name} {
143146
# Method for a user to remove outdated information from the
144147
# persistent state, table by table.
145148
146
- log write 1 state "discard $name" ; # TODO move to level 5 or so
149
+ log write 5 state "discard $name"
147150
148151
$mystate transaction {
149152
catch { $mystate eval "DROP TABLE $name" }
150153
}
151154
return
152155
}
153156
154157
typemethod run {args} {
158
+ Save $args
155159
return [uplevel 1 [linsert $args 0 $mystate eval]]
156160
}
157161
158162
typemethod one {args} {
159
- return [lindex [uplevel 1 [linsert $args 0 $mystate eval]] 0]
163
+ Save $args
164
+ return [uplevel 1 [linsert $args 0 $mystate onecolumn]]
160165
}
161166
162167
typemethod transaction {script} {
163168
return [uplevel 1 [list $mystate transaction $script]]
164169
}
165170
166171
typemethod id {} {
167172
return [$mystate last_insert_rowid]
168173
}
174
+
175
+ typemethod savequeriesto {path} {
176
+ set mysavepath $path
177
+ return
178
+ }
179
+
180
+ # # ## ### ##### ######## #############
181
+
182
+ proc Save {text} {
183
+ ::variable mysavepath
184
+ if {$mysavepath eq ""} return
185
+ fileutil::appendToFile $mysavepath $text\n\n
186
+ return
187
+ }
169188
170189
# # ## ### ##### ######## #############
171190
## State
172191
173
- typevariable mystate {} ; # Sqlite database (command) holding the converter state.
174
- typevariable mypath {} ; # Path to the database, for cleanup of a temp database.
192
+ typevariable mystate {} ; # Sqlite database (command) holding the converter state.
193
+ typevariable mypath {} ; # Path to the database, for cleanup of a temp database.
194
+ typevariable mysavepath {} ; # Path where to save queries for introspection.
175195
176196
# # ## ### ##### ######## #############
177197
## Internal methods
178198
179199
180200
--- tools/cvs2fossil/lib/c2f_state.tcl
+++ tools/cvs2fossil/lib/c2f_state.tcl
@@ -29,11 +29,11 @@
29
30 snit::type ::vc::fossil::import::cvs::state {
31 # # ## ### ##### ######## #############
32 ## Public API
33
34 typemethod use {path} {
35 # Immediate validation. There are are two possibilities to
36 # consider. The path exists or it doesn't.
37
38 # In the first case it has to be a readable and writable file,
39 # and it has to be a proper sqlite database. Further checks
@@ -93,38 +93,41 @@
93 if {$mypath eq ""} return
94 file delete $mypath
95 return
96 }
97
98 typemethod writing {name definition {indices {}}} {
99 # Method for a user to declare a table its needs for storing
100 # persistent state, and the expected structure. A possibly
101 # previously existing definition is dropped.
102
103 log write 1 state "writing $name" ; # TODO move to level 5 or so
 
 
104
105 $mystate transaction {
106 catch { $mystate eval "DROP TABLE $name" }
107 $mystate eval "CREATE TABLE $name ( $definition )"
108
109 set id 0
110 foreach columns $indices {
111 log write 1 state "index $name$id" ; # TODO move to level 5 or so
112
113 $mystate eval "CREATE INDEX ${name}$id ON ${name} ( [join $columns ,] )"
114 incr id
115 }
116 }
117 return
118 }
119
120 typemethod reading {name} {
121 log write 1 state "reading $name" ; # TODO move to level 5 or so
 
122
123 # Method for a user to declare a table it wishes to read
124 # from. A missing table is an internal error causing an
125 # immediate exit.
126
127 set found [llength [$mystate eval {
128 SELECT name
129 FROM sqlite_master
130 WHERE type = 'table'
@@ -141,39 +144,56 @@
141
142 typemethod discard {name} {
143 # Method for a user to remove outdated information from the
144 # persistent state, table by table.
145
146 log write 1 state "discard $name" ; # TODO move to level 5 or so
147
148 $mystate transaction {
149 catch { $mystate eval "DROP TABLE $name" }
150 }
151 return
152 }
153
154 typemethod run {args} {
 
155 return [uplevel 1 [linsert $args 0 $mystate eval]]
156 }
157
158 typemethod one {args} {
159 return [lindex [uplevel 1 [linsert $args 0 $mystate eval]] 0]
 
160 }
161
162 typemethod transaction {script} {
163 return [uplevel 1 [list $mystate transaction $script]]
164 }
165
166 typemethod id {} {
167 return [$mystate last_insert_rowid]
168 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
170 # # ## ### ##### ######## #############
171 ## State
172
173 typevariable mystate {} ; # Sqlite database (command) holding the converter state.
174 typevariable mypath {} ; # Path to the database, for cleanup of a temp database.
 
175
176 # # ## ### ##### ######## #############
177 ## Internal methods
178
179
180
--- tools/cvs2fossil/lib/c2f_state.tcl
+++ tools/cvs2fossil/lib/c2f_state.tcl
@@ -29,11 +29,11 @@
29
30 snit::type ::vc::fossil::import::cvs::state {
31 # # ## ### ##### ######## #############
32 ## Public API
33
34 typemethod usedb {path} {
35 # Immediate validation. There are are two possibilities to
36 # consider. The path exists or it doesn't.
37
38 # In the first case it has to be a readable and writable file,
39 # and it has to be a proper sqlite database. Further checks
@@ -93,38 +93,41 @@
93 if {$mypath eq ""} return
94 file delete $mypath
95 return
96 }
97
98 # Declare a table needed for the storing of persistent state, and
99 # its structure. A possibly previously existing definition is
100 # dropped. To be used when a table is needed and not assumed to
101 # exist from previous passes.
102
103 typemethod extend {name definition {indices {}}} {
104 log write 5 state "extend $name"
105 Save "extend $name ================================"
106
107 $mystate transaction {
108 catch { $mystate eval "DROP TABLE $name" }
109 $mystate eval "CREATE TABLE $name ( $definition )"
110
111 set id 0
112 foreach columns $indices {
113 log write 5 state "index $name$id"
114
115 $mystate eval "CREATE INDEX ${name}$id ON ${name} ( [join $columns ,] )"
116 incr id
117 }
118 }
119 return
120 }
121
122 # Declare that a table is needed for reading from and/or storing
123 # to persistent state, and is assumed to already exist. A missing
124 # table is an internal error causing an immediate exit.
125
126 typemethod use {name} {
127 log write 5 state "use $name"
128 Save "use $name ==================================="
129
130 set found [llength [$mystate eval {
131 SELECT name
132 FROM sqlite_master
133 WHERE type = 'table'
@@ -141,39 +144,56 @@
144
145 typemethod discard {name} {
146 # Method for a user to remove outdated information from the
147 # persistent state, table by table.
148
149 log write 5 state "discard $name"
150
151 $mystate transaction {
152 catch { $mystate eval "DROP TABLE $name" }
153 }
154 return
155 }
156
157 typemethod run {args} {
158 Save $args
159 return [uplevel 1 [linsert $args 0 $mystate eval]]
160 }
161
162 typemethod one {args} {
163 Save $args
164 return [uplevel 1 [linsert $args 0 $mystate onecolumn]]
165 }
166
167 typemethod transaction {script} {
168 return [uplevel 1 [list $mystate transaction $script]]
169 }
170
171 typemethod id {} {
172 return [$mystate last_insert_rowid]
173 }
174
175 typemethod savequeriesto {path} {
176 set mysavepath $path
177 return
178 }
179
180 # # ## ### ##### ######## #############
181
182 proc Save {text} {
183 ::variable mysavepath
184 if {$mysavepath eq ""} return
185 fileutil::appendToFile $mysavepath $text\n\n
186 return
187 }
188
189 # # ## ### ##### ######## #############
190 ## State
191
192 typevariable mystate {} ; # Sqlite database (command) holding the converter state.
193 typevariable mypath {} ; # Path to the database, for cleanup of a temp database.
194 typevariable mysavepath {} ; # Path where to save queries for introspection.
195
196 # # ## ### ##### ######## #############
197 ## Internal methods
198
199
200

Keyboard Shortcuts

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