Fossil SCM

Brought knowledge of the new types to the state definition, changed the creation of the initial changesets to use tags and branches.

aku 2007-11-29 06:21 trunk
Commit 215d2f1ad99b8705e7fe961fa169cf76430c7864
--- tools/cvs2fossil/lib/c2f_pinitcsets.tcl
+++ tools/cvs2fossil/lib/c2f_pinitcsets.tcl
@@ -67,30 +67,34 @@
6767
state writing cstype {
6868
tid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
6969
name TEXT NOT NULL,
7070
UNIQUE (name)
7171
}
72
+ # Note: Keep the labels used here in sync with the names for
73
+ # singleton helper classes for 'project::rev'. They are
74
+ # the valid type names for changesets and also hardwired
75
+ # in some code.
7276
state run {
7377
INSERT INTO cstype VALUES (0,'rev');
74
- INSERT INTO cstype VALUES (1,'sym');
78
+ INSERT INTO cstype VALUES (1,'sym::tag');
79
+ INSERT INTO cstype VALUES (2,'sym::branch');
7580
}
7681
77
- # Map from changesets to the (file level) revisions they
78
- # contain. The pos'ition provides an order of the revisions
79
- # within a changeset. They are unique within the changeset.
80
- # The revisions are in principle unique, if we were looking
81
- # only at revision changesets. However a revision can appear
82
- # in both revision and symbol changesets, and in multiple
83
- # symbol changesets as well. So we can only say that it is
84
- # unique within the changeset.
85
- #
86
- # TODO: Check if integrity checks are possible.
82
+ # Map from changesets to the (file level) revisions, tags, or
83
+ # branches they contain. The pos'ition provides an order of
84
+ # the items within a changeset. They are unique within the
85
+ # changeset. The items are in principle unique, if we were
86
+ # looking only at relevant changesets. However as they come
87
+ # from disparate sources the same id may have different
88
+ # meaning, be in different changesets and so is formally not
89
+ # unique. So we can only say that it is unique within the
90
+ # changeset. The integrity module has stronger checks.
8791
8892
state writing csrevision {
8993
cid INTEGER NOT NULL REFERENCES changeset,
9094
pos INTEGER NOT NULL,
91
- rid INTEGER NOT NULL REFERENCES revision,
95
+ rid INTEGER NOT NULL, -- REFERENCES revision|tag|branch
9296
UNIQUE (cid, pos),
9397
UNIQUE (cid, rid)
9498
}
9599
96100
project::rev getcstypes
@@ -103,10 +107,14 @@
103107
# executed.
104108
105109
state reading changeset
106110
state reading csrevision
107111
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
108116
109117
foreach {id pid cstype srcid} [state run {
110118
SELECT C.cid, C.pid, CS.name, C.src
111119
FROM changeset C, cstype CS
112120
WHERE C.type = CS.tid
@@ -118,11 +126,10 @@
118126
WHERE C.cid = $id
119127
ORDER BY C.pos
120128
}] $id]
121129
}
122130
123
- project::rev getcstypes
124131
project::rev loadcounter
125132
return
126133
}
127134
128135
typemethod run {} {
@@ -225,71 +232,65 @@
225232
226233
# First process the tags, then the branches. We know that
227234
# their ids do not overlap with each other.
228235
229236
set lastsymbol {}
230
- set lastlod {}
231237
set lastproject {}
232238
set revisions {}
233239
234
- foreach {sid rid lod pid} [state run {
235
- SELECT S.sid, R.rid, R.lod, S.pid
236
- FROM tag T, revision R, symbol S -- T ==> R/S, using PK indices of R, S.
237
- WHERE T.rev = R.rid
238
- AND T.sid = S.sid
239
- ORDER BY S.sid, R.lod, R.date
240
+ foreach {sid rid pid} [state run {
241
+ SELECT S.sid, T.tid, S.pid
242
+ FROM tag T, symbol S -- T ==> R/S, using PK indices of R, S.
243
+ WHERE T.sid = S.sid
244
+ ORDER BY S.sid, T.tid
240245
}] {
241
- if {($lastlod != $lod) || ($lastsymbol != $sid)} {
246
+ if {$lastsymbol != $sid} {
242247
if {[llength $revisions]} {
243248
incr n
244249
set p [repository projectof $lastproject]
245
- project::rev %AUTO% $p sym $lastsymbol $revisions
250
+ project::rev %AUTO% $p sym::tag $lastsymbol $revisions
246251
set revisions {}
247252
}
248253
set lastsymbol $sid
249
- set lastlod $lod
254
+ set lastproject $pid
255
+ }
256
+ lappend revisions $rid
257
+ }
258
+
259
+ if {[llength $revisions]} {
260
+ incr n
261
+ set p [repository projectof $lastproject]
262
+ project::rev %AUTO% $p sym::tag $lastsymbol $revisions
263
+ }
264
+
265
+ set lastsymbol {}
266
+ set lasproject {}
267
+ set revisions {}
268
+
269
+ foreach {sid rid pid} [state run {
270
+ SELECT S.sid, B.bid, S.pid
271
+ FROM branch B, symbol S -- B ==> R/S, using PK indices of R, S.
272
+ WHERE B.sid = S.sid
273
+ ORDER BY S.sid, B.bid
274
+ }] {
275
+ if {$lastsymbol != $sid} {
276
+ if {[llength $revisions]} {
277
+ incr n
278
+ set p [repository projectof $lastproject]
279
+ project::rev %AUTO% $p sym::branch $lastsymbol $revisions
280
+ set revisions {}
281
+ }
282
+ set lastsymbol $sid
250283
set lastproject $pid
251284
}
252285
lappend revisions $rid
253286
}
254287
255288
if {[llength $revisions]} {
256289
incr n
257290
set p [repository projectof $lastproject]
258
- project::rev %AUTO% $p sym $lastsymbol $revisions
259
- }
260
-
261
- set lastsymbol {}
262
- set lastlod {}
263
- set lasproject {}
264
- set revisions {}
265
-
266
- foreach {sid rid lod pid} [state run {
267
- SELECT S.sid, R.rid, R.lod, S.pid
268
- FROM branch B, revision R, symbol S -- B ==> R/S, using PK indices of R, S.
269
- WHERE B.root = R.rid
270
- AND B.sid = S.sid
271
- ORDER BY S.sid, R.lod, R.date
272
- }] {
273
- if {($lastlod != $lod) || ($lastsymbol != $sid)} {
274
- if {[llength $revisions]} {
275
- incr n
276
- set p [repository projectof $lastproject]
277
- project::rev %AUTO% $p sym $lastsymbol $revisions
278
- set revisions {}
279
- }
280
- set lastsymbol $sid
281
- set lastlod $lod
282
- set lastproject $pid
283
- }
284
- lappend revisions $rid
285
- }
286
-
287
- if {[llength $revisions]} {
288
- incr n
289
- set p [repository projectof $lastproject]
290
- project::rev %AUTO% $p sym $lastsymbol $revisions
291
+ project::rev %AUTO% $p sym::branch $lastsymbol $revisions
291292
}
292293
293294
log write 4 initcsets "Created [nsp $n {symbol changeset}]"
294295
return
295296
}
296297
--- tools/cvs2fossil/lib/c2f_pinitcsets.tcl
+++ tools/cvs2fossil/lib/c2f_pinitcsets.tcl
@@ -67,30 +67,34 @@
67 state writing cstype {
68 tid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
69 name TEXT NOT NULL,
70 UNIQUE (name)
71 }
 
 
 
 
72 state run {
73 INSERT INTO cstype VALUES (0,'rev');
74 INSERT INTO cstype VALUES (1,'sym');
 
75 }
76
77 # Map from changesets to the (file level) revisions they
78 # contain. The pos'ition provides an order of the revisions
79 # within a changeset. They are unique within the changeset.
80 # The revisions are in principle unique, if we were looking
81 # only at revision changesets. However a revision can appear
82 # in both revision and symbol changesets, and in multiple
83 # symbol changesets as well. So we can only say that it is
84 # unique within the changeset.
85 #
86 # TODO: Check if integrity checks are possible.
87
88 state writing csrevision {
89 cid INTEGER NOT NULL REFERENCES changeset,
90 pos INTEGER NOT NULL,
91 rid INTEGER NOT NULL REFERENCES revision,
92 UNIQUE (cid, pos),
93 UNIQUE (cid, rid)
94 }
95
96 project::rev getcstypes
@@ -103,10 +107,14 @@
103 # executed.
104
105 state reading changeset
106 state reading csrevision
107 state reading cstype
 
 
 
 
108
109 foreach {id pid cstype srcid} [state run {
110 SELECT C.cid, C.pid, CS.name, C.src
111 FROM changeset C, cstype CS
112 WHERE C.type = CS.tid
@@ -118,11 +126,10 @@
118 WHERE C.cid = $id
119 ORDER BY C.pos
120 }] $id]
121 }
122
123 project::rev getcstypes
124 project::rev loadcounter
125 return
126 }
127
128 typemethod run {} {
@@ -225,71 +232,65 @@
225
226 # First process the tags, then the branches. We know that
227 # their ids do not overlap with each other.
228
229 set lastsymbol {}
230 set lastlod {}
231 set lastproject {}
232 set revisions {}
233
234 foreach {sid rid lod pid} [state run {
235 SELECT S.sid, R.rid, R.lod, S.pid
236 FROM tag T, revision R, symbol S -- T ==> R/S, using PK indices of R, S.
237 WHERE T.rev = R.rid
238 AND T.sid = S.sid
239 ORDER BY S.sid, R.lod, R.date
240 }] {
241 if {($lastlod != $lod) || ($lastsymbol != $sid)} {
242 if {[llength $revisions]} {
243 incr n
244 set p [repository projectof $lastproject]
245 project::rev %AUTO% $p sym $lastsymbol $revisions
246 set revisions {}
247 }
248 set lastsymbol $sid
249 set lastlod $lod
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
250 set lastproject $pid
251 }
252 lappend revisions $rid
253 }
254
255 if {[llength $revisions]} {
256 incr n
257 set p [repository projectof $lastproject]
258 project::rev %AUTO% $p sym $lastsymbol $revisions
259 }
260
261 set lastsymbol {}
262 set lastlod {}
263 set lasproject {}
264 set revisions {}
265
266 foreach {sid rid lod pid} [state run {
267 SELECT S.sid, R.rid, R.lod, S.pid
268 FROM branch B, revision R, symbol S -- B ==> R/S, using PK indices of R, S.
269 WHERE B.root = R.rid
270 AND B.sid = S.sid
271 ORDER BY S.sid, R.lod, R.date
272 }] {
273 if {($lastlod != $lod) || ($lastsymbol != $sid)} {
274 if {[llength $revisions]} {
275 incr n
276 set p [repository projectof $lastproject]
277 project::rev %AUTO% $p sym $lastsymbol $revisions
278 set revisions {}
279 }
280 set lastsymbol $sid
281 set lastlod $lod
282 set lastproject $pid
283 }
284 lappend revisions $rid
285 }
286
287 if {[llength $revisions]} {
288 incr n
289 set p [repository projectof $lastproject]
290 project::rev %AUTO% $p sym $lastsymbol $revisions
291 }
292
293 log write 4 initcsets "Created [nsp $n {symbol changeset}]"
294 return
295 }
296
--- tools/cvs2fossil/lib/c2f_pinitcsets.tcl
+++ tools/cvs2fossil/lib/c2f_pinitcsets.tcl
@@ -67,30 +67,34 @@
67 state writing cstype {
68 tid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
69 name TEXT NOT NULL,
70 UNIQUE (name)
71 }
72 # Note: Keep the labels used here in sync with the names for
73 # singleton helper classes for 'project::rev'. They are
74 # the valid type names for changesets and also hardwired
75 # in some code.
76 state run {
77 INSERT INTO cstype VALUES (0,'rev');
78 INSERT INTO cstype VALUES (1,'sym::tag');
79 INSERT INTO cstype VALUES (2,'sym::branch');
80 }
81
82 # Map from changesets to the (file level) revisions, tags, or
83 # branches they contain. The pos'ition provides an order of
84 # the items within a changeset. They are unique within the
85 # changeset. The items are in principle unique, if we were
86 # looking only at relevant changesets. However as they come
87 # from disparate sources the same id may have different
88 # meaning, be in different changesets and so is formally not
89 # unique. So we can only say that it is unique within the
90 # changeset. The integrity module has stronger checks.
 
91
92 state writing csrevision {
93 cid INTEGER NOT NULL REFERENCES changeset,
94 pos INTEGER NOT NULL,
95 rid INTEGER NOT NULL, -- REFERENCES revision|tag|branch
96 UNIQUE (cid, pos),
97 UNIQUE (cid, rid)
98 }
99
100 project::rev getcstypes
@@ -103,10 +107,14 @@
107 # executed.
108
109 state reading changeset
110 state reading csrevision
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 foreach {id pid cstype srcid} [state run {
118 SELECT C.cid, C.pid, CS.name, C.src
119 FROM changeset C, cstype CS
120 WHERE C.type = CS.tid
@@ -118,11 +126,10 @@
126 WHERE C.cid = $id
127 ORDER BY C.pos
128 }] $id]
129 }
130
 
131 project::rev loadcounter
132 return
133 }
134
135 typemethod run {} {
@@ -225,71 +232,65 @@
232
233 # First process the tags, then the branches. We know that
234 # their ids do not overlap with each other.
235
236 set lastsymbol {}
 
237 set lastproject {}
238 set revisions {}
239
240 foreach {sid rid pid} [state run {
241 SELECT S.sid, T.tid, S.pid
242 FROM tag T, symbol S -- T ==> R/S, using PK indices of R, S.
243 WHERE T.sid = S.sid
244 ORDER BY S.sid, T.tid
 
245 }] {
246 if {$lastsymbol != $sid} {
247 if {[llength $revisions]} {
248 incr n
249 set p [repository projectof $lastproject]
250 project::rev %AUTO% $p sym::tag $lastsymbol $revisions
251 set revisions {}
252 }
253 set lastsymbol $sid
254 set lastproject $pid
255 }
256 lappend revisions $rid
257 }
258
259 if {[llength $revisions]} {
260 incr n
261 set p [repository projectof $lastproject]
262 project::rev %AUTO% $p sym::tag $lastsymbol $revisions
263 }
264
265 set lastsymbol {}
266 set lasproject {}
267 set revisions {}
268
269 foreach {sid rid pid} [state run {
270 SELECT S.sid, B.bid, S.pid
271 FROM branch B, symbol S -- B ==> R/S, using PK indices of R, S.
272 WHERE B.sid = S.sid
273 ORDER BY S.sid, B.bid
274 }] {
275 if {$lastsymbol != $sid} {
276 if {[llength $revisions]} {
277 incr n
278 set p [repository projectof $lastproject]
279 project::rev %AUTO% $p sym::branch $lastsymbol $revisions
280 set revisions {}
281 }
282 set lastsymbol $sid
283 set lastproject $pid
284 }
285 lappend revisions $rid
286 }
287
288 if {[llength $revisions]} {
289 incr n
290 set p [repository projectof $lastproject]
291 project::rev %AUTO% $p sym::branch $lastsymbol $revisions
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292 }
293
294 log write 4 initcsets "Created [nsp $n {symbol changeset}]"
295 return
296 }
297

Keyboard Shortcuts

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