Fossil SCM

Extended pass 2, save branch positions, needed for pass 4, and added optype table to have the revision opcodes available in the state as well.

aku 2007-11-07 06:19 trunk
Commit 7ab490df244230f349455bbb106e2093c99a69a0
--- tools/cvs2fossil/lib/c2f_frev.tcl
+++ tools/cvs2fossil/lib/c2f_frev.tcl
@@ -176,11 +176,13 @@
176176
ldelete mybranchchildren $rev
177177
return
178178
}
179179
180180
method sortbranches {} {
181
- if {![llength $mybranches]} return
181
+ # Pass 2: CollectRev
182
+
183
+ if {[llength $mybranches] < 2} return
182184
183185
# Sort the branches spawned by this revision in creation
184186
# order. To help in this our file gave all branches a position
185187
# id, in order of their definition by the RCS archive.
186188
#
@@ -480,10 +482,11 @@
480482
{0 0} change
481483
{0 1} delete
482484
{1 0} add
483485
{1 1} nothing
484486
}
487
+ # Keep myopcode in sync with project::collrev.optype
485488
typevariable myopcode -array {
486489
change 2
487490
delete -1
488491
add 1
489492
nothing 0
490493
--- tools/cvs2fossil/lib/c2f_frev.tcl
+++ tools/cvs2fossil/lib/c2f_frev.tcl
@@ -176,11 +176,13 @@
176 ldelete mybranchchildren $rev
177 return
178 }
179
180 method sortbranches {} {
181 if {![llength $mybranches]} return
 
 
182
183 # Sort the branches spawned by this revision in creation
184 # order. To help in this our file gave all branches a position
185 # id, in order of their definition by the RCS archive.
186 #
@@ -480,10 +482,11 @@
480 {0 0} change
481 {0 1} delete
482 {1 0} add
483 {1 1} nothing
484 }
 
485 typevariable myopcode -array {
486 change 2
487 delete -1
488 add 1
489 nothing 0
490
--- tools/cvs2fossil/lib/c2f_frev.tcl
+++ tools/cvs2fossil/lib/c2f_frev.tcl
@@ -176,11 +176,13 @@
176 ldelete mybranchchildren $rev
177 return
178 }
179
180 method sortbranches {} {
181 # Pass 2: CollectRev
182
183 if {[llength $mybranches] < 2} return
184
185 # Sort the branches spawned by this revision in creation
186 # order. To help in this our file gave all branches a position
187 # id, in order of their definition by the RCS archive.
188 #
@@ -480,10 +482,11 @@
482 {0 0} change
483 {0 1} delete
484 {1 0} add
485 {1 1} nothing
486 }
487 # Keep myopcode in sync with project::collrev.optype
488 typevariable myopcode -array {
489 change 2
490 delete -1
491 add 1
492 nothing 0
493
--- tools/cvs2fossil/lib/c2f_fsym.tcl
+++ tools/cvs2fossil/lib/c2f_fsym.tcl
@@ -169,15 +169,10 @@
169169
# # ## ### ##### ######## #############
170170
171171
method persist {} {
172172
# Save the information we need after the collection pass.
173173
174
- # NOTE: mybranchposition is currently not saved. This can
175
- # likely be figured out later from the id itself. If yes, we
176
- # can also get rid of 'sortbranches' (cvs::file) and the
177
- # associated information.
178
-
179174
set fid [$myfile id]
180175
set sid [$mysymbol id]
181176
set lod [$mylod id]
182177
183178
switch -exact -- $mytype {
@@ -193,12 +188,12 @@
193188
branch {
194189
lappend map @F@ [expr { ($mybranchchild eq "") ? "NULL" : [$mybranchchild id] }]
195190
196191
set rid [$mybranchparent id]
197192
set cmd {
198
- INSERT INTO branch ( bid, fid, lod, sid, root, first, bra )
199
- VALUES ($myid, $fid, $lod, $sid, $rid, @F@, $mynr);
193
+ INSERT INTO branch ( bid, fid, lod, sid, root, first, bra, pos )
194
+ VALUES ($myid, $fid, $lod, $sid, $rid, @F@, $mynr, $mybranchposition);
200195
}
201196
state transaction {
202197
state run [string map $map $cmd]
203198
}
204199
}
205200
--- tools/cvs2fossil/lib/c2f_fsym.tcl
+++ tools/cvs2fossil/lib/c2f_fsym.tcl
@@ -169,15 +169,10 @@
169 # # ## ### ##### ######## #############
170
171 method persist {} {
172 # Save the information we need after the collection pass.
173
174 # NOTE: mybranchposition is currently not saved. This can
175 # likely be figured out later from the id itself. If yes, we
176 # can also get rid of 'sortbranches' (cvs::file) and the
177 # associated information.
178
179 set fid [$myfile id]
180 set sid [$mysymbol id]
181 set lod [$mylod id]
182
183 switch -exact -- $mytype {
@@ -193,12 +188,12 @@
193 branch {
194 lappend map @F@ [expr { ($mybranchchild eq "") ? "NULL" : [$mybranchchild id] }]
195
196 set rid [$mybranchparent id]
197 set cmd {
198 INSERT INTO branch ( bid, fid, lod, sid, root, first, bra )
199 VALUES ($myid, $fid, $lod, $sid, $rid, @F@, $mynr);
200 }
201 state transaction {
202 state run [string map $map $cmd]
203 }
204 }
205
--- tools/cvs2fossil/lib/c2f_fsym.tcl
+++ tools/cvs2fossil/lib/c2f_fsym.tcl
@@ -169,15 +169,10 @@
169 # # ## ### ##### ######## #############
170
171 method persist {} {
172 # Save the information we need after the collection pass.
173
 
 
 
 
 
174 set fid [$myfile id]
175 set sid [$mysymbol id]
176 set lod [$mylod id]
177
178 switch -exact -- $mytype {
@@ -193,12 +188,12 @@
188 branch {
189 lappend map @F@ [expr { ($mybranchchild eq "") ? "NULL" : [$mybranchchild id] }]
190
191 set rid [$mybranchparent id]
192 set cmd {
193 INSERT INTO branch ( bid, fid, lod, sid, root, first, bra, pos )
194 VALUES ($myid, $fid, $lod, $sid, $rid, @F@, $mynr, $mybranchposition);
195 }
196 state transaction {
197 state run [string map $map $cmd]
198 }
199 }
200
--- tools/cvs2fossil/lib/c2f_pcollrev.tcl
+++ tools/cvs2fossil/lib/c2f_pcollrev.tcl
@@ -132,40 +132,50 @@
132132
-- project). The last is encoded as single id, see table
133133
-- 'meta'. The date/time is given in seconds since the
134134
-- epoch, for easy comparison. The text content is an
135135
-- (offset,length) pair into the rcs archive.
136136
137
- op INTEGER NOT NULL,
137
+ op INTEGER NOT NULL REFERENCES optype,
138138
date INTEGER NOT NULL,
139139
state TEXT NOT NULL,
140
- mid INTEGER NOT NULL REFERENCES meta,
140
+ mid INTEGER NOT NULL REFERENCES meta,
141141
coff INTEGER NOT NULL,
142142
clen INTEGER NOT NULL,
143143
144144
UNIQUE (fid, rev) -- The DTN is unique within the revision's file.
145145
}
146
-
146
+ state writing optype {
147
+ oid INTEGER NOT NULL PRIMARY KEY,
148
+ name TEXT NOT NULL,
149
+ UNIQUE(text)
150
+ }
151
+ # Keep optype in sync with file::rev.myopcode
152
+ state run {
153
+ INSERT INTO optype VALUES (-1,'delete');
154
+ INSERT INTO optype VALUES ( 0,'nothing');
155
+ INSERT INTO optype VALUES ( 1,'add');
156
+ INSERT INTO optype VALUES ( 2,'change');
157
+ }
147158
state writing tag {
148159
tid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
149160
fid INTEGER NOT NULL REFERENCES file, -- File the item belongs to
150161
lod INTEGER REFERENCES symbol, -- Line of development (NULL => Trunk)
151
-
152162
sid INTEGER NOT NULL REFERENCES symbol, -- Symbol capturing the tag
153163
154164
rev INTEGER NOT NULL REFERENCES revision -- The revision being tagged.
155165
}
156166
157167
state writing branch {
158168
bid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
159169
fid INTEGER NOT NULL REFERENCES file, -- File the item belongs to
160170
lod INTEGER REFERENCES symbol, -- Line of development (NULL => Trunk)
161
-
162171
sid INTEGER NOT NULL REFERENCES symbol, -- Symbol capturing the branch
163172
164173
root INTEGER NOT NULL REFERENCES revision, -- Revision the branch sprouts from
165174
first INTEGER REFERENCES revision, -- First revision committed to the branch
166
- bra TEXT NOT NULL -- branch number
175
+ bra TEXT NOT NULL, -- branch number
176
+ pos INTEGER NOT NULL -- creation order in root.
167177
}
168178
169179
# Project level ...
170180
# pLineOfDevelopment, pSymbol, pBranch, pTag, pTrunk
171181
#
@@ -211,14 +221,14 @@
211221
plural TEXT NOT NULL,
212222
UNIQUE (name)
213223
UNIQUE (plural)
214224
}
215225
state run {
216
- INSERT INTO symtype VALUES (0,'excluded');
217
- INSERT INTO symtype VALUES (1,'tag');
218
- INSERT INTO symtype VALUES (2,'branch');
219
- INSERT INTO symtype VALUES (3,'undefined');
226
+ INSERT INTO symtype VALUES (0,'excluded', 'excluded');
227
+ INSERT INTO symtype VALUES (1,'tag', 'tags');
228
+ INSERT INTO symtype VALUES (2,'branch', 'branches');
229
+ INSERT INTO symtype VALUES (3,'undefined','undefined');
220230
}
221231
222232
state writing meta {
223233
-- Meta data of revisions. See revision.mid for the
224234
-- reference. Many revisions can share meta data. This is
225235
--- tools/cvs2fossil/lib/c2f_pcollrev.tcl
+++ tools/cvs2fossil/lib/c2f_pcollrev.tcl
@@ -132,40 +132,50 @@
132 -- project). The last is encoded as single id, see table
133 -- 'meta'. The date/time is given in seconds since the
134 -- epoch, for easy comparison. The text content is an
135 -- (offset,length) pair into the rcs archive.
136
137 op INTEGER NOT NULL,
138 date INTEGER NOT NULL,
139 state TEXT NOT NULL,
140 mid INTEGER NOT NULL REFERENCES meta,
141 coff INTEGER NOT NULL,
142 clen INTEGER NOT NULL,
143
144 UNIQUE (fid, rev) -- The DTN is unique within the revision's file.
145 }
146
 
 
 
 
 
 
 
 
 
 
 
147 state writing tag {
148 tid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
149 fid INTEGER NOT NULL REFERENCES file, -- File the item belongs to
150 lod INTEGER REFERENCES symbol, -- Line of development (NULL => Trunk)
151
152 sid INTEGER NOT NULL REFERENCES symbol, -- Symbol capturing the tag
153
154 rev INTEGER NOT NULL REFERENCES revision -- The revision being tagged.
155 }
156
157 state writing branch {
158 bid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
159 fid INTEGER NOT NULL REFERENCES file, -- File the item belongs to
160 lod INTEGER REFERENCES symbol, -- Line of development (NULL => Trunk)
161
162 sid INTEGER NOT NULL REFERENCES symbol, -- Symbol capturing the branch
163
164 root INTEGER NOT NULL REFERENCES revision, -- Revision the branch sprouts from
165 first INTEGER REFERENCES revision, -- First revision committed to the branch
166 bra TEXT NOT NULL -- branch number
 
167 }
168
169 # Project level ...
170 # pLineOfDevelopment, pSymbol, pBranch, pTag, pTrunk
171 #
@@ -211,14 +221,14 @@
211 plural TEXT NOT NULL,
212 UNIQUE (name)
213 UNIQUE (plural)
214 }
215 state run {
216 INSERT INTO symtype VALUES (0,'excluded');
217 INSERT INTO symtype VALUES (1,'tag');
218 INSERT INTO symtype VALUES (2,'branch');
219 INSERT INTO symtype VALUES (3,'undefined');
220 }
221
222 state writing meta {
223 -- Meta data of revisions. See revision.mid for the
224 -- reference. Many revisions can share meta data. This is
225
--- tools/cvs2fossil/lib/c2f_pcollrev.tcl
+++ tools/cvs2fossil/lib/c2f_pcollrev.tcl
@@ -132,40 +132,50 @@
132 -- project). The last is encoded as single id, see table
133 -- 'meta'. The date/time is given in seconds since the
134 -- epoch, for easy comparison. The text content is an
135 -- (offset,length) pair into the rcs archive.
136
137 op INTEGER NOT NULL REFERENCES optype,
138 date INTEGER NOT NULL,
139 state TEXT NOT NULL,
140 mid INTEGER NOT NULL REFERENCES meta,
141 coff INTEGER NOT NULL,
142 clen INTEGER NOT NULL,
143
144 UNIQUE (fid, rev) -- The DTN is unique within the revision's file.
145 }
146 state writing optype {
147 oid INTEGER NOT NULL PRIMARY KEY,
148 name TEXT NOT NULL,
149 UNIQUE(text)
150 }
151 # Keep optype in sync with file::rev.myopcode
152 state run {
153 INSERT INTO optype VALUES (-1,'delete');
154 INSERT INTO optype VALUES ( 0,'nothing');
155 INSERT INTO optype VALUES ( 1,'add');
156 INSERT INTO optype VALUES ( 2,'change');
157 }
158 state writing tag {
159 tid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
160 fid INTEGER NOT NULL REFERENCES file, -- File the item belongs to
161 lod INTEGER REFERENCES symbol, -- Line of development (NULL => Trunk)
 
162 sid INTEGER NOT NULL REFERENCES symbol, -- Symbol capturing the tag
163
164 rev INTEGER NOT NULL REFERENCES revision -- The revision being tagged.
165 }
166
167 state writing branch {
168 bid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
169 fid INTEGER NOT NULL REFERENCES file, -- File the item belongs to
170 lod INTEGER REFERENCES symbol, -- Line of development (NULL => Trunk)
 
171 sid INTEGER NOT NULL REFERENCES symbol, -- Symbol capturing the branch
172
173 root INTEGER NOT NULL REFERENCES revision, -- Revision the branch sprouts from
174 first INTEGER REFERENCES revision, -- First revision committed to the branch
175 bra TEXT NOT NULL, -- branch number
176 pos INTEGER NOT NULL -- creation order in root.
177 }
178
179 # Project level ...
180 # pLineOfDevelopment, pSymbol, pBranch, pTag, pTrunk
181 #
@@ -211,14 +221,14 @@
221 plural TEXT NOT NULL,
222 UNIQUE (name)
223 UNIQUE (plural)
224 }
225 state run {
226 INSERT INTO symtype VALUES (0,'excluded', 'excluded');
227 INSERT INTO symtype VALUES (1,'tag', 'tags');
228 INSERT INTO symtype VALUES (2,'branch', 'branches');
229 INSERT INTO symtype VALUES (3,'undefined','undefined');
230 }
231
232 state writing meta {
233 -- Meta data of revisions. See revision.mid for the
234 -- reference. Many revisions can share meta data. This is
235

Keyboard Shortcuts

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