Fossil SCM

More comments on sql statements.

aku 2008-01-19 06:07 trunk
Commit 6809145eb16fb372e2e15f2dbc76b024db4fd095
--- tools/cvs2fossil/lib/c2f_pcollrev.tcl
+++ tools/cvs2fossil/lib/c2f_pcollrev.tcl
@@ -247,14 +247,14 @@
247247
plural TEXT NOT NULL,
248248
UNIQUE (name)
249249
UNIQUE (plural)
250250
}
251251
state run {
252
- INSERT INTO symtype VALUES (0,'excluded', 'excluded');
253
- INSERT INTO symtype VALUES (1,'tag', 'tags');
254
- INSERT INTO symtype VALUES (2,'branch', 'branches');
255
- INSERT INTO symtype VALUES (3,'undefined','undefined');
252
+ INSERT INTO symtype VALUES (0,'excluded', 'excluded'); -- The ids are the fixed
253
+ INSERT INTO symtype VALUES (1,'tag', 'tags'); -- pieces, see project::sym,
254
+ INSERT INTO symtype VALUES (2,'branch', 'branches'); -- getsymtypes and associated
255
+ INSERT INTO symtype VALUES (3,'undefined','undefined'); -- typevariables.
256256
}
257257
258258
state extend meta {
259259
-- Meta data of revisions. See revision.mid for the
260260
-- reference. Many revisions can share meta data. This is
@@ -285,17 +285,17 @@
285285
286286
# Authors and commit messages are fully global, i.e. per
287287
# repository.
288288
289289
state extend author {
290
- aid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
291
- name TEXT NOT NULL UNIQUE
290
+ aid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, -- Pool of the unique
291
+ name TEXT NOT NULL UNIQUE -- author names.
292292
}
293293
294294
state extend cmessage {
295
- cid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
296
- text TEXT NOT NULL UNIQUE
295
+ cid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, -- Pool of the unique
296
+ text TEXT NOT NULL UNIQUE -- log messages
297297
}
298298
299299
project::sym getsymtypes
300300
file::rev getopcodes
301301
return
302302
--- tools/cvs2fossil/lib/c2f_pcollrev.tcl
+++ tools/cvs2fossil/lib/c2f_pcollrev.tcl
@@ -247,14 +247,14 @@
247 plural TEXT NOT NULL,
248 UNIQUE (name)
249 UNIQUE (plural)
250 }
251 state run {
252 INSERT INTO symtype VALUES (0,'excluded', 'excluded');
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
@@ -285,17 +285,17 @@
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 file::rev getopcodes
301 return
302
--- tools/cvs2fossil/lib/c2f_pcollrev.tcl
+++ tools/cvs2fossil/lib/c2f_pcollrev.tcl
@@ -247,14 +247,14 @@
247 plural TEXT NOT NULL,
248 UNIQUE (name)
249 UNIQUE (plural)
250 }
251 state run {
252 INSERT INTO symtype VALUES (0,'excluded', 'excluded'); -- The ids are the fixed
253 INSERT INTO symtype VALUES (1,'tag', 'tags'); -- pieces, see project::sym,
254 INSERT INTO symtype VALUES (2,'branch', 'branches'); -- getsymtypes and associated
255 INSERT INTO symtype VALUES (3,'undefined','undefined'); -- typevariables.
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
@@ -285,17 +285,17 @@
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, -- Pool of the unique
291 name TEXT NOT NULL UNIQUE -- author names.
292 }
293
294 state extend cmessage {
295 cid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, -- Pool of the unique
296 text TEXT NOT NULL UNIQUE -- log messages
297 }
298
299 project::sym getsymtypes
300 file::rev getopcodes
301 return
302
--- tools/cvs2fossil/lib/c2f_pfiltersym.tcl
+++ tools/cvs2fossil/lib/c2f_pfiltersym.tcl
@@ -149,13 +149,13 @@
149149
array set link {}
150150
151151
foreach {id parent transfer} [state run {
152152
SELECT R.rid, R.parent, R.dbchild
153153
FROM revision R, symbol S
154
- WHERE R.lod = S.sid
155
- AND S.sid IN excludedsymbols
156
- AND R.isdefault
154
+ WHERE R.lod = S.sid -- Get symbol of line-of-development of all revisions
155
+ AND S.sid IN excludedsymbols -- Restrict to the excluded symbols
156
+ AND R.isdefault -- Restrict to NTDB revisions
157157
}] {
158158
set ntdb($id) $parent
159159
if {$transfer eq ""} continue
160160
set link($id) $transfer
161161
}
@@ -315,33 +315,33 @@
315315
}] { set fpn($id) [list $fn $pn] }
316316
317317
set tagstoadjust [state run {
318318
SELECT T.tid, T.fid, T.lod, P.pid, S.name, R.rev, R.rid
319319
FROM tag T, preferedparent P, symbol S, revision R
320
- WHERE T.sid = P.sid
321
- AND T.lod != P.pid
322
- AND P.pid = S.sid
323
- AND S.name != ':trunk:'
324
- AND T.rev = R.rid
320
+ WHERE T.sid = P.sid -- For all tags, get left-hand of prefered parent via symbol
321
+ AND T.lod != P.pid -- Restrict to tags whose LOD is not their prefered parent
322
+ AND P.pid = S.sid -- Get symbol of prefered parent
323
+ AND S.name != ':trunk:' -- Exclude trunk parentage
324
+ AND T.rev = R.rid -- Get revision the tag is attached to.
325325
}]
326326
327327
set branchestoadjust [state run {
328328
SELECT B.bid, B.fid, B.lod, B.pos, P.pid, S.name, NULL, NULL
329329
FROM branch B, preferedparent P, symbol S
330
- WHERE B.sid = P.sid
331
- AND B.lod != P.pid
332
- AND P.pid = S.sid
333
- AND S.name != ':trunk:'
334
- AND B.root IS NULL -- Accept free-floating branch
335
- UNION
330
+ WHERE B.sid = P.sid -- For all branches, get left-hand of prefered parent via symbol
331
+ AND B.lod != P.pid -- Restrict to branches whose LOD is not their prefered parent
332
+ AND P.pid = S.sid -- Get symbol of prefered parent
333
+ AND S.name != ':trunk:' -- Exclude trunk parentage
334
+ AND B.root IS NULL -- Accept free-floating branch
335
+ UNION
336336
SELECT B.bid, B.fid, B.lod, B.pos, P.pid, S.name, R.rev, R.rid
337337
FROM branch B, preferedparent P, symbol S, revision R
338
- WHERE B.sid = P.sid
339
- AND B.lod != P.pid
340
- AND P.pid = S.sid
341
- AND S.name != ':trunk:'
342
- AND B.root = R.rid
338
+ WHERE B.sid = P.sid -- For all branches, get left-hand of prefered parent via symbol
339
+ AND B.lod != P.pid -- Restrict to branches whose LOD is not their prefered parent
340
+ AND P.pid = S.sid -- Get symbol of prefered parent
341
+ AND S.name != ':trunk:' -- Exclude trunk parentage
342
+ AND B.root = R.rid -- Get root revision of the branch
343343
}]
344344
345345
set tmax [expr {[llength $tagstoadjust] / 7}]
346346
set bmax [expr {[llength $branchestoadjust] / 8}]
347347
@@ -360,22 +360,22 @@
360360
set n 0
361361
foreach {id fid lod pid preferedname revnr rid} $tagstoadjust {
362362
# BOTTLE-NECK ...
363363
#
364364
# The check if the candidate (pid) is truly viable is
365
- # based finding the branch as possible parent, and done
365
+ # based on finding the branch as possible parent, and done
366366
# now instead of as part of the already complex join.
367367
#
368368
# ... AND P.pid IN (SELECT B.sid
369369
# FROM branch B
370370
# WHERE B.root = R.rid)
371371
372372
if {![state one {
373
- SELECT COUNT(*)
373
+ SELECT COUNT(*) -- Count <=> Check existence.
374374
FROM branch B
375
- WHERE B.sid = $pid
376
- AND B.root = $rid
375
+ WHERE B.sid = $pid -- Restrict to branch for that symbol
376
+ AND B.root = $rid -- attached to that revision
377377
}]} {
378378
incr tmax -1
379379
set mxs [format $fmt $tmax]
380380
continue
381381
}
@@ -432,15 +432,15 @@
432432
# Such a branch can be regrafted without trouble and there
433433
# is no need to look for the new parent in its
434434
# non-existent root.
435435
436436
if {($rid ne "") && ![state one {
437
- SELECT COUNT(*)
437
+ SELECT COUNT(*) -- Count <=> Check existence.
438438
FROM branch B
439
- WHERE B.sid = $pid
440
- AND B.root = $rid
441
- AND B.pos > $pos
439
+ WHERE B.sid = $pid -- Look for branch by symbol
440
+ AND B.root = $rid -- Spawned by the given revision
441
+ AND B.pos > $pos -- And defined before branch to mutate
442442
}]} {
443443
incr bmax -1
444444
set mxs [format $fmt $bmax]
445445
continue
446446
}
@@ -472,10 +472,13 @@
472472
# Tags and branches are marked as normal/noop based on the op
473473
# of their revision.
474474
475475
log write 3 filtersym "Refine symbols (no-op or not?)"
476476
477
+ # Note: The noop information is not used anywhere. Consider
478
+ # disabling this code, and removing the data from the state.
479
+
477480
log write 4 filtersym " Regular tags"
478481
state run {
479482
INSERT INTO noop
480483
SELECT T.tid, 0
481484
FROM tag T, revision R
482485
--- tools/cvs2fossil/lib/c2f_pfiltersym.tcl
+++ tools/cvs2fossil/lib/c2f_pfiltersym.tcl
@@ -149,13 +149,13 @@
149 array set link {}
150
151 foreach {id parent transfer} [state run {
152 SELECT R.rid, R.parent, R.dbchild
153 FROM revision R, symbol S
154 WHERE R.lod = S.sid
155 AND S.sid IN excludedsymbols
156 AND R.isdefault
157 }] {
158 set ntdb($id) $parent
159 if {$transfer eq ""} continue
160 set link($id) $transfer
161 }
@@ -315,33 +315,33 @@
315 }] { set fpn($id) [list $fn $pn] }
316
317 set tagstoadjust [state run {
318 SELECT T.tid, T.fid, T.lod, P.pid, S.name, R.rev, R.rid
319 FROM tag T, preferedparent P, symbol S, revision R
320 WHERE T.sid = P.sid
321 AND T.lod != P.pid
322 AND P.pid = S.sid
323 AND S.name != ':trunk:'
324 AND T.rev = R.rid
325 }]
326
327 set branchestoadjust [state run {
328 SELECT B.bid, B.fid, B.lod, B.pos, P.pid, S.name, NULL, NULL
329 FROM branch B, preferedparent P, symbol S
330 WHERE B.sid = P.sid
331 AND B.lod != P.pid
332 AND P.pid = S.sid
333 AND S.name != ':trunk:'
334 AND B.root IS NULL -- Accept free-floating branch
335 UNION
336 SELECT B.bid, B.fid, B.lod, B.pos, P.pid, S.name, R.rev, R.rid
337 FROM branch B, preferedparent P, symbol S, revision R
338 WHERE B.sid = P.sid
339 AND B.lod != P.pid
340 AND P.pid = S.sid
341 AND S.name != ':trunk:'
342 AND B.root = R.rid
343 }]
344
345 set tmax [expr {[llength $tagstoadjust] / 7}]
346 set bmax [expr {[llength $branchestoadjust] / 8}]
347
@@ -360,22 +360,22 @@
360 set n 0
361 foreach {id fid lod pid preferedname revnr rid} $tagstoadjust {
362 # BOTTLE-NECK ...
363 #
364 # The check if the candidate (pid) is truly viable is
365 # based finding the branch as possible parent, and done
366 # now instead of as part of the already complex join.
367 #
368 # ... AND P.pid IN (SELECT B.sid
369 # FROM branch B
370 # WHERE B.root = R.rid)
371
372 if {![state one {
373 SELECT COUNT(*)
374 FROM branch B
375 WHERE B.sid = $pid
376 AND B.root = $rid
377 }]} {
378 incr tmax -1
379 set mxs [format $fmt $tmax]
380 continue
381 }
@@ -432,15 +432,15 @@
432 # Such a branch can be regrafted without trouble and there
433 # is no need to look for the new parent in its
434 # non-existent root.
435
436 if {($rid ne "") && ![state one {
437 SELECT COUNT(*)
438 FROM branch B
439 WHERE B.sid = $pid
440 AND B.root = $rid
441 AND B.pos > $pos
442 }]} {
443 incr bmax -1
444 set mxs [format $fmt $bmax]
445 continue
446 }
@@ -472,10 +472,13 @@
472 # Tags and branches are marked as normal/noop based on the op
473 # of their revision.
474
475 log write 3 filtersym "Refine symbols (no-op or not?)"
476
 
 
 
477 log write 4 filtersym " Regular tags"
478 state run {
479 INSERT INTO noop
480 SELECT T.tid, 0
481 FROM tag T, revision R
482
--- tools/cvs2fossil/lib/c2f_pfiltersym.tcl
+++ tools/cvs2fossil/lib/c2f_pfiltersym.tcl
@@ -149,13 +149,13 @@
149 array set link {}
150
151 foreach {id parent transfer} [state run {
152 SELECT R.rid, R.parent, R.dbchild
153 FROM revision R, symbol S
154 WHERE R.lod = S.sid -- Get symbol of line-of-development of all revisions
155 AND S.sid IN excludedsymbols -- Restrict to the excluded symbols
156 AND R.isdefault -- Restrict to NTDB revisions
157 }] {
158 set ntdb($id) $parent
159 if {$transfer eq ""} continue
160 set link($id) $transfer
161 }
@@ -315,33 +315,33 @@
315 }] { set fpn($id) [list $fn $pn] }
316
317 set tagstoadjust [state run {
318 SELECT T.tid, T.fid, T.lod, P.pid, S.name, R.rev, R.rid
319 FROM tag T, preferedparent P, symbol S, revision R
320 WHERE T.sid = P.sid -- For all tags, get left-hand of prefered parent via symbol
321 AND T.lod != P.pid -- Restrict to tags whose LOD is not their prefered parent
322 AND P.pid = S.sid -- Get symbol of prefered parent
323 AND S.name != ':trunk:' -- Exclude trunk parentage
324 AND T.rev = R.rid -- Get revision the tag is attached to.
325 }]
326
327 set branchestoadjust [state run {
328 SELECT B.bid, B.fid, B.lod, B.pos, P.pid, S.name, NULL, NULL
329 FROM branch B, preferedparent P, symbol S
330 WHERE B.sid = P.sid -- For all branches, get left-hand of prefered parent via symbol
331 AND B.lod != P.pid -- Restrict to branches whose LOD is not their prefered parent
332 AND P.pid = S.sid -- Get symbol of prefered parent
333 AND S.name != ':trunk:' -- Exclude trunk parentage
334 AND B.root IS NULL -- Accept free-floating branch
335 UNION
336 SELECT B.bid, B.fid, B.lod, B.pos, P.pid, S.name, R.rev, R.rid
337 FROM branch B, preferedparent P, symbol S, revision R
338 WHERE B.sid = P.sid -- For all branches, get left-hand of prefered parent via symbol
339 AND B.lod != P.pid -- Restrict to branches whose LOD is not their prefered parent
340 AND P.pid = S.sid -- Get symbol of prefered parent
341 AND S.name != ':trunk:' -- Exclude trunk parentage
342 AND B.root = R.rid -- Get root revision of the branch
343 }]
344
345 set tmax [expr {[llength $tagstoadjust] / 7}]
346 set bmax [expr {[llength $branchestoadjust] / 8}]
347
@@ -360,22 +360,22 @@
360 set n 0
361 foreach {id fid lod pid preferedname revnr rid} $tagstoadjust {
362 # BOTTLE-NECK ...
363 #
364 # The check if the candidate (pid) is truly viable is
365 # based on finding the branch as possible parent, and done
366 # now instead of as part of the already complex join.
367 #
368 # ... AND P.pid IN (SELECT B.sid
369 # FROM branch B
370 # WHERE B.root = R.rid)
371
372 if {![state one {
373 SELECT COUNT(*) -- Count <=> Check existence.
374 FROM branch B
375 WHERE B.sid = $pid -- Restrict to branch for that symbol
376 AND B.root = $rid -- attached to that revision
377 }]} {
378 incr tmax -1
379 set mxs [format $fmt $tmax]
380 continue
381 }
@@ -432,15 +432,15 @@
432 # Such a branch can be regrafted without trouble and there
433 # is no need to look for the new parent in its
434 # non-existent root.
435
436 if {($rid ne "") && ![state one {
437 SELECT COUNT(*) -- Count <=> Check existence.
438 FROM branch B
439 WHERE B.sid = $pid -- Look for branch by symbol
440 AND B.root = $rid -- Spawned by the given revision
441 AND B.pos > $pos -- And defined before branch to mutate
442 }]} {
443 incr bmax -1
444 set mxs [format $fmt $bmax]
445 continue
446 }
@@ -472,10 +472,13 @@
472 # Tags and branches are marked as normal/noop based on the op
473 # of their revision.
474
475 log write 3 filtersym "Refine symbols (no-op or not?)"
476
477 # Note: The noop information is not used anywhere. Consider
478 # disabling this code, and removing the data from the state.
479
480 log write 4 filtersym " Regular tags"
481 state run {
482 INSERT INTO noop
483 SELECT T.tid, 0
484 FROM tag T, revision R
485
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -742,13 +742,13 @@
742742
743743
proc PD {id} {
744744
foreach {p f r} [state run {
745745
SELECT P.name , F.name, R.rev
746746
FROM revision R, file F, project P
747
- WHERE R.rid = $id
748
- AND F.fid = R.fid
749
- AND P.pid = F.pid
747
+ WHERE R.rid = $id -- Find specified file revision
748
+ AND F.fid = R.fid -- Get file of the revision
749
+ AND P.pid = F.pid -- Get project of the file.
750750
}] break
751751
return "'$p : $f/$r'"
752752
}
753753
754754
# Printing one or more ranges, formatted, and only their border to
@@ -819,13 +819,13 @@
819819
820820
typemethod str {revision} {
821821
struct::list assign [state run {
822822
SELECT R.rev, F.name, P.name
823823
FROM revision R, file F, project P
824
- WHERE R.rid = $revision
825
- AND F.fid = R.fid
826
- AND P.pid = F.pid
824
+ WHERE R.rid = $revision -- Find specified file revision
825
+ AND F.fid = R.fid -- Get file of the revision
826
+ AND P.pid = F.pid -- Get project of the file.
827827
}] revnr fname pname
828828
return "$pname/${revnr}::$fname"
829829
}
830830
831831
# result = list (mintime, maxtime)
@@ -832,11 +832,11 @@
832832
typemethod timerange {items} {
833833
set theset ('[join $items {','}]')
834834
return [state run [subst -nocommands -nobackslashes {
835835
SELECT MIN(R.date), MAX(R.date)
836836
FROM revision R
837
- WHERE R.rid IN $theset
837
+ WHERE R.rid IN $theset -- Restrict to revisions of interest
838838
}]]
839839
}
840840
841841
# var(dv) = dict (revision -> list (revision))
842842
typemethod internalsuccessors {dv revisions} {
@@ -850,11 +850,11 @@
850850
# changeset internal dependencies.
851851
852852
array set dep {}
853853
854854
foreach {rid child} [state run [subst -nocommands -nobackslashes {
855
- -- (1) Primary child
855
+ -- (1) Primary child
856856
SELECT R.rid, R.child
857857
FROM revision R
858858
WHERE R.rid IN $theset -- Restrict to revisions of interest
859859
AND R.child IS NOT NULL -- Has primary child
860860
AND R.child IN $theset -- Which is also of interest
@@ -928,11 +928,11 @@
928928
}
929929
930930
# result = 4-list (itemtype itemid nextitemtype nextitemid ...)
931931
typemethod loops {revisions} {
932932
# Note: Tags and branches cannot cause the loop. Their id's,
933
- # bein of a fundamentally different type than the revisions
933
+ # being of a fundamentally different type than the revisions
934934
# coming in cannot be in the set.
935935
936936
set theset ('[join $revisions {','}]')
937937
return [state run [subst -nocommands -nobackslashes {
938938
-- (1) Primary child
@@ -994,11 +994,11 @@
994994
995995
# Note that the branches spawned from the revisions, and the
996996
# tags associated with them are successors as well.
997997
998998
foreach {rid child} [state run [subst -nocommands -nobackslashes {
999
- -- (1) Primary child
999
+ -- (1) Primary child
10001000
SELECT R.rid, R.child
10011001
FROM revision R
10021002
WHERE R.rid IN $theset -- Restrict to revisions of interest
10031003
AND R.child IS NOT NULL -- Has primary child
10041004
UNION
@@ -1022,20 +1022,20 @@
10221022
lappend dependencies([list rev $rid]) [list rev $child]
10231023
}
10241024
foreach {rid child} [state run [subst -nocommands -nobackslashes {
10251025
SELECT R.rid, T.tid
10261026
FROM revision R, tag T
1027
- WHERE R.rid IN $theset
1028
- AND T.rev = R.rid
1027
+ WHERE R.rid IN $theset -- Restrict to revisions of interest
1028
+ AND T.rev = R.rid -- Select tags attached to them
10291029
}]] {
10301030
lappend dependencies([list rev $rid]) [list sym::tag $child]
10311031
}
10321032
foreach {rid child} [state run [subst -nocommands -nobackslashes {
10331033
SELECT R.rid, B.bid
10341034
FROM revision R, branch B
1035
- WHERE R.rid IN $theset
1036
- AND B.root = R.rid
1035
+ WHERE R.rid IN $theset -- Restrict to revisions of interest
1036
+ AND B.root = R.rid -- Select branches attached to them
10371037
}]] {
10381038
lappend dependencies([list rev $rid]) [list sym::branch $child]
10391039
}
10401040
return
10411041
}
@@ -1048,52 +1048,55 @@
10481048
# CVS)) we return a very short and much more manageable list
10491049
# of changesets.
10501050
10511051
set theset ('[join $revisions {','}]')
10521052
return [state run [subst -nocommands -nobackslashes {
1053
+ -- (1) Primary child
10531054
SELECT C.cid
10541055
FROM revision R, csitem CI, changeset C
10551056
WHERE R.rid IN $theset -- Restrict to revisions of interest
10561057
AND R.child IS NOT NULL -- Has primary child
1057
- AND CI.iid = R.child
1058
- AND C.cid = CI.cid
1059
- AND C.type = 0
1058
+ AND CI.iid = R.child -- Select all changesets
1059
+ AND C.cid = CI.cid -- containing the primary child
1060
+ AND C.type = 0 -- which are revision changesets
10601061
UNION
1062
+ -- (2) Secondary (branch) children
10611063
SELECT C.cid
10621064
FROM revision R, revisionbranchchildren B, csitem CI, changeset C
10631065
WHERE R.rid IN $theset -- Restrict to revisions of interest
10641066
AND R.rid = B.rid -- Select subset of branch children
1065
- AND CI.iid = B.brid
1066
- AND C.cid = CI.cid
1067
- AND C.type = 0
1067
+ AND CI.iid = B.brid -- Select all changesets
1068
+ AND C.cid = CI.cid -- containing the branch
1069
+ AND C.type = 0 -- which are revision changesets
10681070
UNION
1071
+ -- (4) Child of trunk root successor of last NTDB on trunk.
10691072
SELECT C.cid
10701073
FROM revision R, revision RA, csitem CI, changeset C
10711074
WHERE R.rid IN $theset -- Restrict to revisions of interest
10721075
AND R.isdefault -- Restrict to NTDB
10731076
AND R.dbchild IS NOT NULL -- and last NTDB belonging to trunk
10741077
AND RA.rid = R.dbchild -- Go directly to trunk root
10751078
AND RA.child IS NOT NULL -- Has primary child.
1076
- AND CI.iid = RA.child
1077
- AND C.cid = CI.cid
1078
- AND C.type = 0
1079
+ AND CI.iid = RA.child -- Select all changesets
1080
+ AND C.cid = CI.cid -- containing the primary child
1081
+ AND C.type = 0 -- which are revision changesets
10791082
UNION
10801083
SELECT C.cid
10811084
FROM revision R, tag T, csitem CI, changeset C
1082
- WHERE R.rid in $theset
1083
- AND T.rev = R.rid
1084
- AND CI.iid = T.tid
1085
- AND C.cid = CI.cid
1086
- AND C.type = 1
1085
+ WHERE R.rid in $theset -- Restrict to revisions of interest
1086
+ AND T.rev = R.rid -- Select tags attached to them
1087
+ AND CI.iid = T.tid -- Select all changesets
1088
+ AND C.cid = CI.cid -- containing the tags
1089
+ AND C.type = 1 -- which are tag changesets
10871090
UNION
10881091
SELECT C.cid
10891092
FROM revision R, branch B, csitem CI, changeset C
1090
- WHERE R.rid in $theset
1091
- AND B.root = R.rid
1092
- AND CI.iid = B.bid
1093
- AND C.cid = CI.cid
1094
- AND C.type = 2
1093
+ WHERE R.rid in $theset -- Restrict to revisions of interest
1094
+ AND B.root = R.rid -- Select branches attached to them
1095
+ AND CI.iid = B.bid -- Select all changesets
1096
+ AND C.cid = CI.cid -- containing the branches
1097
+ AND C.type = 2 -- which are branch changesets
10951098
}]]
10961099
}
10971100
}
10981101
10991102
# # ## ### ##### ######## ############# #####################
@@ -1107,14 +1110,14 @@
11071110
11081111
typemethod str {tag} {
11091112
struct::list assign [state run {
11101113
SELECT S.name, F.name, P.name
11111114
FROM tag T, symbol S, file F, project P
1112
- WHERE T.tid = $tag
1113
- AND F.fid = T.fid
1114
- AND P.pid = F.pid
1115
- AND S.sid = T.sid
1115
+ WHERE T.tid = $tag -- Find specified tag
1116
+ AND F.fid = T.fid -- Get file of tag
1117
+ AND P.pid = F.pid -- Get project of file
1118
+ AND S.sid = T.sid -- Get symbol of tag
11161119
}] sname fname pname
11171120
return "$pname/T'${sname}'::$fname"
11181121
}
11191122
11201123
# result = list (mintime, maxtime)
@@ -1124,12 +1127,12 @@
11241127
11251128
set theset ('[join $tags {','}]')
11261129
return [state run [subst -nocommands -nobackslashes {
11271130
SELECT MIN(R.date), MAX(R.date)
11281131
FROM tag T, revision R
1129
- WHERE T.tid IN $theset
1130
- AND R.rid = T.rev
1132
+ WHERE T.tid IN $theset -- Restrict to tags of interest
1133
+ AND R.rid = T.rev -- Select tag parent revisions
11311134
}]]
11321135
}
11331136
11341137
# var(dv) = dict (item -> list (item)), item = list (type id)
11351138
typemethod successors {dv tags} {
@@ -1161,14 +1164,14 @@
11611164
11621165
typemethod str {branch} {
11631166
struct::list assign [state run {
11641167
SELECT S.name, F.name, P.name
11651168
FROM branch B, symbol S, file F, project P
1166
- WHERE B.bid = $branch
1167
- AND F.fid = B.fid
1168
- AND P.pid = F.pid
1169
- AND S.sid = B.sid
1169
+ WHERE B.bid = $branch -- Find specified branch
1170
+ AND F.fid = B.fid -- Get file of branch
1171
+ AND P.pid = F.pid -- Get project of file
1172
+ AND S.sid = B.sid -- Get symbol of branch
11701173
}] sname fname pname
11711174
return "$pname/B'${sname}'::$fname"
11721175
}
11731176
11741177
# result = list (mintime, maxtime)
@@ -1182,12 +1185,12 @@
11821185
11831186
set theset ('[join $branches {','}]')
11841187
return [state run [subst -nocommands -nobackslashes {
11851188
SELECT IFNULL(MIN(R.date),0), IFNULL(MAX(R.date),0)
11861189
FROM branch B, revision R
1187
- WHERE B.bid IN $theset
1188
- AND R.rid = B.root
1190
+ WHERE B.bid IN $theset -- Restrict to branches of interest
1191
+ AND R.rid = B.root -- Select branch parent revisions
11891192
}]]
11901193
}
11911194
11921195
# result = 4-list (itemtype itemid nextitemtype nextitemid ...)
11931196
typemethod loops {branches} {
@@ -1197,14 +1200,14 @@
11971200
11981201
set theset ('[join $branches {','}]')
11991202
return [state run [subst -nocommands -nobackslashes {
12001203
SELECT B.bid, BX.bid
12011204
FROM branch B, preferedparent P, branch BX
1202
- WHERE B.bid IN $theset
1203
- AND B.sid = P.pid
1204
- AND BX.sid = P.sid
1205
- AND BX.bid IN $theset
1205
+ WHERE B.bid IN $theset -- Restrict to branches of interest
1206
+ AND B.sid = P.pid -- Get the prefered branches via
1207
+ AND BX.sid = P.sid -- the branch symbols
1208
+ AND BX.bid IN $theset -- Loop
12061209
}]]
12071210
}
12081211
12091212
# var(dv) = dict (item -> list (item)), item = list (type id)
12101213
typemethod successors {dv branches} {
@@ -1215,30 +1218,30 @@
12151218
12161219
set theset ('[join $branches {','}]')
12171220
foreach {bid child} [state run [subst -nocommands -nobackslashes {
12181221
SELECT B.bid, R.rid
12191222
FROM branch B, revision R
1220
- WHERE B.bid IN $theset
1221
- AND B.first = R.rid
1223
+ WHERE B.bid IN $theset -- Restrict to branches of interest
1224
+ AND B.first = R.rid -- Get first revision on the branch
12221225
}]] {
12231226
lappend dependencies([list sym::branch $bid]) [list rev $child]
12241227
}
12251228
foreach {bid child} [state run [subst -nocommands -nobackslashes {
12261229
SELECT B.bid, BX.bid
12271230
FROM branch B, preferedparent P, branch BX
1228
- WHERE B.bid IN $theset
1229
- AND B.sid = P.pid
1230
- AND BX.sid = P.sid
1231
+ WHERE B.bid IN $theset -- Restrict to branches of interest
1232
+ AND B.sid = P.pid -- Get subordinate branches via the
1233
+ AND BX.sid = P.sid -- prefered parents of their symbols
12311234
}]] {
12321235
lappend dependencies([list sym::branch $bid]) [list sym::branch $child]
12331236
}
12341237
foreach {bid child} [state run [subst -nocommands -nobackslashes {
12351238
SELECT B.bid, T.tid
12361239
FROM branch B, preferedparent P, tag T
1237
- WHERE B.bid IN $theset
1238
- AND B.sid = P.pid
1239
- AND T.sid = P.sid
1240
+ WHERE B.bid IN $theset -- Restrict to branches of interest
1241
+ AND B.sid = P.pid -- Get subordinate tags via the
1242
+ AND T.sid = P.sid -- prefered parents of their symbols
12401243
}]] {
12411244
lappend dependencies([list sym::branch $bid]) [list sym::tag $child]
12421245
}
12431246
return
12441247
}
@@ -1253,33 +1256,33 @@
12531256
12541257
set theset ('[join $branches {','}]')
12551258
return [state run [subst -nocommands -nobackslashes {
12561259
SELECT C.cid
12571260
FROM branch B, revision R, csitem CI, changeset C
1258
- WHERE B.bid IN $theset
1259
- AND B.first = R.rid
1260
- AND CI.iid = R.rid
1261
- AND C.cid = CI.cid
1262
- AND C.type = 0
1261
+ WHERE B.bid IN $theset -- Restrict to branches of interest
1262
+ AND B.first = R.rid -- Get first revision on the branch
1263
+ AND CI.iid = R.rid -- Select all changesets
1264
+ AND C.cid = CI.cid -- containing this revision
1265
+ AND C.type = 0 -- which are revision changesets
12631266
UNION
12641267
SELECT C.cid
12651268
FROM branch B, preferedparent P, branch BX, csitem CI, changeset C
1266
- WHERE B.bid IN $theset
1267
- AND B.sid = P.pid
1268
- AND BX.sid = P.sid
1269
- AND CI.iid = BX.bid
1270
- AND C.cid = CI.cid
1271
- AND C.type = 2
1269
+ WHERE B.bid IN $theset -- Restrict to branches of interest
1270
+ AND B.sid = P.pid -- Get subordinate branches via the
1271
+ AND BX.sid = P.sid -- prefered parents of their symbols
1272
+ AND CI.iid = BX.bid -- Select all changesets
1273
+ AND C.cid = CI.cid -- containing the subordinate branches
1274
+ AND C.type = 2 -- which are branch changesets
12721275
UNION
12731276
SELECT C.cid
12741277
FROM branch B, preferedparent P, tag T, csitem CI, changeset C
1275
- WHERE B.bid IN $theset
1276
- AND B.sid = P.pid
1277
- AND T.sid = P.sid
1278
- AND CI.iid = T.tid
1279
- AND C.cid = CI.cid
1280
- AND C.type = 1
1278
+ WHERE B.bid IN $theset -- Restrict to branches of interest
1279
+ AND B.sid = P.pid -- Get subordinate tags via the
1280
+ AND T.sid = P.sid -- prefered parents of their symbols
1281
+ AND CI.iid = T.tid -- Select all changesets
1282
+ AND C.cid = CI.cid -- containing the subordinate tags
1283
+ AND C.type = 1 -- which are tag changesets
12811284
}]]
12821285
return
12831286
}
12841287
12851288
typemethod limits {branches} {
@@ -1294,29 +1297,29 @@
12941297
12951298
set maxp [state run [subst -nocommands -nobackslashes {
12961299
-- maximal predecessor position per branch
12971300
SELECT B.bid, MAX (CO.pos)
12981301
FROM branch B, revision R, csitem CI, changeset C, csorder CO
1299
- WHERE B.bid IN $theset
1300
- AND B.root = R.rid
1301
- AND CI.iid = R.rid
1302
- AND C.cid = CI.cid
1303
- AND C.type = 0
1304
- AND CO.cid = C.cid
1302
+ WHERE B.bid IN $theset -- Restrict to branches of interest
1303
+ AND B.root = R.rid -- Get branch root revisions
1304
+ AND CI.iid = R.rid -- Get changesets containing the
1305
+ AND C.cid = CI.cid -- root revisions, which are
1306
+ AND C.type = 0 -- revision changesets
1307
+ AND CO.cid = C.cid -- Get their topological ordering
13051308
GROUP BY B.bid
13061309
}]]
13071310
13081311
set mins [state run [subst -nocommands -nobackslashes {
13091312
-- minimal successor position per branch
13101313
SELECT B.bid, MIN (CO.pos)
13111314
FROM branch B, revision R, csitem CI, changeset C, csorder CO
1312
- WHERE B.bid IN $theset
1313
- AND B.first = R.rid
1314
- AND CI.iid = R.rid
1315
- AND C.cid = CI.cid
1316
- AND C.type = 0
1317
- AND CO.cid = C.cid
1315
+ WHERE B.bid IN $theset -- Restrict to branches of interest
1316
+ AND B.first = R.rid -- Get the first revisions on the branches
1317
+ AND CI.iid = R.rid -- Get changesets containing the
1318
+ AND C.cid = CI.cid -- first revisions, which are
1319
+ AND C.type = 0 -- revision changesets
1320
+ AND CO.cid = C.cid -- Get their topological ordering
13181321
GROUP BY B.bid
13191322
}]]
13201323
13211324
return [list $maxp $mins]
13221325
}
13231326
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -742,13 +742,13 @@
742
743 proc PD {id} {
744 foreach {p f r} [state run {
745 SELECT P.name , F.name, R.rev
746 FROM revision R, file F, project P
747 WHERE R.rid = $id
748 AND F.fid = R.fid
749 AND P.pid = F.pid
750 }] break
751 return "'$p : $f/$r'"
752 }
753
754 # Printing one or more ranges, formatted, and only their border to
@@ -819,13 +819,13 @@
819
820 typemethod str {revision} {
821 struct::list assign [state run {
822 SELECT R.rev, F.name, P.name
823 FROM revision R, file F, project P
824 WHERE R.rid = $revision
825 AND F.fid = R.fid
826 AND P.pid = F.pid
827 }] revnr fname pname
828 return "$pname/${revnr}::$fname"
829 }
830
831 # result = list (mintime, maxtime)
@@ -832,11 +832,11 @@
832 typemethod timerange {items} {
833 set theset ('[join $items {','}]')
834 return [state run [subst -nocommands -nobackslashes {
835 SELECT MIN(R.date), MAX(R.date)
836 FROM revision R
837 WHERE R.rid IN $theset
838 }]]
839 }
840
841 # var(dv) = dict (revision -> list (revision))
842 typemethod internalsuccessors {dv revisions} {
@@ -850,11 +850,11 @@
850 # changeset internal dependencies.
851
852 array set dep {}
853
854 foreach {rid child} [state run [subst -nocommands -nobackslashes {
855 -- (1) Primary child
856 SELECT R.rid, R.child
857 FROM revision R
858 WHERE R.rid IN $theset -- Restrict to revisions of interest
859 AND R.child IS NOT NULL -- Has primary child
860 AND R.child IN $theset -- Which is also of interest
@@ -928,11 +928,11 @@
928 }
929
930 # result = 4-list (itemtype itemid nextitemtype nextitemid ...)
931 typemethod loops {revisions} {
932 # Note: Tags and branches cannot cause the loop. Their id's,
933 # bein of a fundamentally different type than the revisions
934 # coming in cannot be in the set.
935
936 set theset ('[join $revisions {','}]')
937 return [state run [subst -nocommands -nobackslashes {
938 -- (1) Primary child
@@ -994,11 +994,11 @@
994
995 # Note that the branches spawned from the revisions, and the
996 # tags associated with them are successors as well.
997
998 foreach {rid child} [state run [subst -nocommands -nobackslashes {
999 -- (1) Primary child
1000 SELECT R.rid, R.child
1001 FROM revision R
1002 WHERE R.rid IN $theset -- Restrict to revisions of interest
1003 AND R.child IS NOT NULL -- Has primary child
1004 UNION
@@ -1022,20 +1022,20 @@
1022 lappend dependencies([list rev $rid]) [list rev $child]
1023 }
1024 foreach {rid child} [state run [subst -nocommands -nobackslashes {
1025 SELECT R.rid, T.tid
1026 FROM revision R, tag T
1027 WHERE R.rid IN $theset
1028 AND T.rev = R.rid
1029 }]] {
1030 lappend dependencies([list rev $rid]) [list sym::tag $child]
1031 }
1032 foreach {rid child} [state run [subst -nocommands -nobackslashes {
1033 SELECT R.rid, B.bid
1034 FROM revision R, branch B
1035 WHERE R.rid IN $theset
1036 AND B.root = R.rid
1037 }]] {
1038 lappend dependencies([list rev $rid]) [list sym::branch $child]
1039 }
1040 return
1041 }
@@ -1048,52 +1048,55 @@
1048 # CVS)) we return a very short and much more manageable list
1049 # of changesets.
1050
1051 set theset ('[join $revisions {','}]')
1052 return [state run [subst -nocommands -nobackslashes {
 
1053 SELECT C.cid
1054 FROM revision R, csitem CI, changeset C
1055 WHERE R.rid IN $theset -- Restrict to revisions of interest
1056 AND R.child IS NOT NULL -- Has primary child
1057 AND CI.iid = R.child
1058 AND C.cid = CI.cid
1059 AND C.type = 0
1060 UNION
 
1061 SELECT C.cid
1062 FROM revision R, revisionbranchchildren B, csitem CI, changeset C
1063 WHERE R.rid IN $theset -- Restrict to revisions of interest
1064 AND R.rid = B.rid -- Select subset of branch children
1065 AND CI.iid = B.brid
1066 AND C.cid = CI.cid
1067 AND C.type = 0
1068 UNION
 
1069 SELECT C.cid
1070 FROM revision R, revision RA, csitem CI, changeset C
1071 WHERE R.rid IN $theset -- Restrict to revisions of interest
1072 AND R.isdefault -- Restrict to NTDB
1073 AND R.dbchild IS NOT NULL -- and last NTDB belonging to trunk
1074 AND RA.rid = R.dbchild -- Go directly to trunk root
1075 AND RA.child IS NOT NULL -- Has primary child.
1076 AND CI.iid = RA.child
1077 AND C.cid = CI.cid
1078 AND C.type = 0
1079 UNION
1080 SELECT C.cid
1081 FROM revision R, tag T, csitem CI, changeset C
1082 WHERE R.rid in $theset
1083 AND T.rev = R.rid
1084 AND CI.iid = T.tid
1085 AND C.cid = CI.cid
1086 AND C.type = 1
1087 UNION
1088 SELECT C.cid
1089 FROM revision R, branch B, csitem CI, changeset C
1090 WHERE R.rid in $theset
1091 AND B.root = R.rid
1092 AND CI.iid = B.bid
1093 AND C.cid = CI.cid
1094 AND C.type = 2
1095 }]]
1096 }
1097 }
1098
1099 # # ## ### ##### ######## ############# #####################
@@ -1107,14 +1110,14 @@
1107
1108 typemethod str {tag} {
1109 struct::list assign [state run {
1110 SELECT S.name, F.name, P.name
1111 FROM tag T, symbol S, file F, project P
1112 WHERE T.tid = $tag
1113 AND F.fid = T.fid
1114 AND P.pid = F.pid
1115 AND S.sid = T.sid
1116 }] sname fname pname
1117 return "$pname/T'${sname}'::$fname"
1118 }
1119
1120 # result = list (mintime, maxtime)
@@ -1124,12 +1127,12 @@
1124
1125 set theset ('[join $tags {','}]')
1126 return [state run [subst -nocommands -nobackslashes {
1127 SELECT MIN(R.date), MAX(R.date)
1128 FROM tag T, revision R
1129 WHERE T.tid IN $theset
1130 AND R.rid = T.rev
1131 }]]
1132 }
1133
1134 # var(dv) = dict (item -> list (item)), item = list (type id)
1135 typemethod successors {dv tags} {
@@ -1161,14 +1164,14 @@
1161
1162 typemethod str {branch} {
1163 struct::list assign [state run {
1164 SELECT S.name, F.name, P.name
1165 FROM branch B, symbol S, file F, project P
1166 WHERE B.bid = $branch
1167 AND F.fid = B.fid
1168 AND P.pid = F.pid
1169 AND S.sid = B.sid
1170 }] sname fname pname
1171 return "$pname/B'${sname}'::$fname"
1172 }
1173
1174 # result = list (mintime, maxtime)
@@ -1182,12 +1185,12 @@
1182
1183 set theset ('[join $branches {','}]')
1184 return [state run [subst -nocommands -nobackslashes {
1185 SELECT IFNULL(MIN(R.date),0), IFNULL(MAX(R.date),0)
1186 FROM branch B, revision R
1187 WHERE B.bid IN $theset
1188 AND R.rid = B.root
1189 }]]
1190 }
1191
1192 # result = 4-list (itemtype itemid nextitemtype nextitemid ...)
1193 typemethod loops {branches} {
@@ -1197,14 +1200,14 @@
1197
1198 set theset ('[join $branches {','}]')
1199 return [state run [subst -nocommands -nobackslashes {
1200 SELECT B.bid, BX.bid
1201 FROM branch B, preferedparent P, branch BX
1202 WHERE B.bid IN $theset
1203 AND B.sid = P.pid
1204 AND BX.sid = P.sid
1205 AND BX.bid IN $theset
1206 }]]
1207 }
1208
1209 # var(dv) = dict (item -> list (item)), item = list (type id)
1210 typemethod successors {dv branches} {
@@ -1215,30 +1218,30 @@
1215
1216 set theset ('[join $branches {','}]')
1217 foreach {bid child} [state run [subst -nocommands -nobackslashes {
1218 SELECT B.bid, R.rid
1219 FROM branch B, revision R
1220 WHERE B.bid IN $theset
1221 AND B.first = R.rid
1222 }]] {
1223 lappend dependencies([list sym::branch $bid]) [list rev $child]
1224 }
1225 foreach {bid child} [state run [subst -nocommands -nobackslashes {
1226 SELECT B.bid, BX.bid
1227 FROM branch B, preferedparent P, branch BX
1228 WHERE B.bid IN $theset
1229 AND B.sid = P.pid
1230 AND BX.sid = P.sid
1231 }]] {
1232 lappend dependencies([list sym::branch $bid]) [list sym::branch $child]
1233 }
1234 foreach {bid child} [state run [subst -nocommands -nobackslashes {
1235 SELECT B.bid, T.tid
1236 FROM branch B, preferedparent P, tag T
1237 WHERE B.bid IN $theset
1238 AND B.sid = P.pid
1239 AND T.sid = P.sid
1240 }]] {
1241 lappend dependencies([list sym::branch $bid]) [list sym::tag $child]
1242 }
1243 return
1244 }
@@ -1253,33 +1256,33 @@
1253
1254 set theset ('[join $branches {','}]')
1255 return [state run [subst -nocommands -nobackslashes {
1256 SELECT C.cid
1257 FROM branch B, revision R, csitem CI, changeset C
1258 WHERE B.bid IN $theset
1259 AND B.first = R.rid
1260 AND CI.iid = R.rid
1261 AND C.cid = CI.cid
1262 AND C.type = 0
1263 UNION
1264 SELECT C.cid
1265 FROM branch B, preferedparent P, branch BX, csitem CI, changeset C
1266 WHERE B.bid IN $theset
1267 AND B.sid = P.pid
1268 AND BX.sid = P.sid
1269 AND CI.iid = BX.bid
1270 AND C.cid = CI.cid
1271 AND C.type = 2
1272 UNION
1273 SELECT C.cid
1274 FROM branch B, preferedparent P, tag T, csitem CI, changeset C
1275 WHERE B.bid IN $theset
1276 AND B.sid = P.pid
1277 AND T.sid = P.sid
1278 AND CI.iid = T.tid
1279 AND C.cid = CI.cid
1280 AND C.type = 1
1281 }]]
1282 return
1283 }
1284
1285 typemethod limits {branches} {
@@ -1294,29 +1297,29 @@
1294
1295 set maxp [state run [subst -nocommands -nobackslashes {
1296 -- maximal predecessor position per branch
1297 SELECT B.bid, MAX (CO.pos)
1298 FROM branch B, revision R, csitem CI, changeset C, csorder CO
1299 WHERE B.bid IN $theset
1300 AND B.root = R.rid
1301 AND CI.iid = R.rid
1302 AND C.cid = CI.cid
1303 AND C.type = 0
1304 AND CO.cid = C.cid
1305 GROUP BY B.bid
1306 }]]
1307
1308 set mins [state run [subst -nocommands -nobackslashes {
1309 -- minimal successor position per branch
1310 SELECT B.bid, MIN (CO.pos)
1311 FROM branch B, revision R, csitem CI, changeset C, csorder CO
1312 WHERE B.bid IN $theset
1313 AND B.first = R.rid
1314 AND CI.iid = R.rid
1315 AND C.cid = CI.cid
1316 AND C.type = 0
1317 AND CO.cid = C.cid
1318 GROUP BY B.bid
1319 }]]
1320
1321 return [list $maxp $mins]
1322 }
1323
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -742,13 +742,13 @@
742
743 proc PD {id} {
744 foreach {p f r} [state run {
745 SELECT P.name , F.name, R.rev
746 FROM revision R, file F, project P
747 WHERE R.rid = $id -- Find specified file revision
748 AND F.fid = R.fid -- Get file of the revision
749 AND P.pid = F.pid -- Get project of the file.
750 }] break
751 return "'$p : $f/$r'"
752 }
753
754 # Printing one or more ranges, formatted, and only their border to
@@ -819,13 +819,13 @@
819
820 typemethod str {revision} {
821 struct::list assign [state run {
822 SELECT R.rev, F.name, P.name
823 FROM revision R, file F, project P
824 WHERE R.rid = $revision -- Find specified file revision
825 AND F.fid = R.fid -- Get file of the revision
826 AND P.pid = F.pid -- Get project of the file.
827 }] revnr fname pname
828 return "$pname/${revnr}::$fname"
829 }
830
831 # result = list (mintime, maxtime)
@@ -832,11 +832,11 @@
832 typemethod timerange {items} {
833 set theset ('[join $items {','}]')
834 return [state run [subst -nocommands -nobackslashes {
835 SELECT MIN(R.date), MAX(R.date)
836 FROM revision R
837 WHERE R.rid IN $theset -- Restrict to revisions of interest
838 }]]
839 }
840
841 # var(dv) = dict (revision -> list (revision))
842 typemethod internalsuccessors {dv revisions} {
@@ -850,11 +850,11 @@
850 # changeset internal dependencies.
851
852 array set dep {}
853
854 foreach {rid child} [state run [subst -nocommands -nobackslashes {
855 -- (1) Primary child
856 SELECT R.rid, R.child
857 FROM revision R
858 WHERE R.rid IN $theset -- Restrict to revisions of interest
859 AND R.child IS NOT NULL -- Has primary child
860 AND R.child IN $theset -- Which is also of interest
@@ -928,11 +928,11 @@
928 }
929
930 # result = 4-list (itemtype itemid nextitemtype nextitemid ...)
931 typemethod loops {revisions} {
932 # Note: Tags and branches cannot cause the loop. Their id's,
933 # being of a fundamentally different type than the revisions
934 # coming in cannot be in the set.
935
936 set theset ('[join $revisions {','}]')
937 return [state run [subst -nocommands -nobackslashes {
938 -- (1) Primary child
@@ -994,11 +994,11 @@
994
995 # Note that the branches spawned from the revisions, and the
996 # tags associated with them are successors as well.
997
998 foreach {rid child} [state run [subst -nocommands -nobackslashes {
999 -- (1) Primary child
1000 SELECT R.rid, R.child
1001 FROM revision R
1002 WHERE R.rid IN $theset -- Restrict to revisions of interest
1003 AND R.child IS NOT NULL -- Has primary child
1004 UNION
@@ -1022,20 +1022,20 @@
1022 lappend dependencies([list rev $rid]) [list rev $child]
1023 }
1024 foreach {rid child} [state run [subst -nocommands -nobackslashes {
1025 SELECT R.rid, T.tid
1026 FROM revision R, tag T
1027 WHERE R.rid IN $theset -- Restrict to revisions of interest
1028 AND T.rev = R.rid -- Select tags attached to them
1029 }]] {
1030 lappend dependencies([list rev $rid]) [list sym::tag $child]
1031 }
1032 foreach {rid child} [state run [subst -nocommands -nobackslashes {
1033 SELECT R.rid, B.bid
1034 FROM revision R, branch B
1035 WHERE R.rid IN $theset -- Restrict to revisions of interest
1036 AND B.root = R.rid -- Select branches attached to them
1037 }]] {
1038 lappend dependencies([list rev $rid]) [list sym::branch $child]
1039 }
1040 return
1041 }
@@ -1048,52 +1048,55 @@
1048 # CVS)) we return a very short and much more manageable list
1049 # of changesets.
1050
1051 set theset ('[join $revisions {','}]')
1052 return [state run [subst -nocommands -nobackslashes {
1053 -- (1) Primary child
1054 SELECT C.cid
1055 FROM revision R, csitem CI, changeset C
1056 WHERE R.rid IN $theset -- Restrict to revisions of interest
1057 AND R.child IS NOT NULL -- Has primary child
1058 AND CI.iid = R.child -- Select all changesets
1059 AND C.cid = CI.cid -- containing the primary child
1060 AND C.type = 0 -- which are revision changesets
1061 UNION
1062 -- (2) Secondary (branch) children
1063 SELECT C.cid
1064 FROM revision R, revisionbranchchildren B, csitem CI, changeset C
1065 WHERE R.rid IN $theset -- Restrict to revisions of interest
1066 AND R.rid = B.rid -- Select subset of branch children
1067 AND CI.iid = B.brid -- Select all changesets
1068 AND C.cid = CI.cid -- containing the branch
1069 AND C.type = 0 -- which are revision changesets
1070 UNION
1071 -- (4) Child of trunk root successor of last NTDB on trunk.
1072 SELECT C.cid
1073 FROM revision R, revision RA, csitem CI, changeset C
1074 WHERE R.rid IN $theset -- Restrict to revisions of interest
1075 AND R.isdefault -- Restrict to NTDB
1076 AND R.dbchild IS NOT NULL -- and last NTDB belonging to trunk
1077 AND RA.rid = R.dbchild -- Go directly to trunk root
1078 AND RA.child IS NOT NULL -- Has primary child.
1079 AND CI.iid = RA.child -- Select all changesets
1080 AND C.cid = CI.cid -- containing the primary child
1081 AND C.type = 0 -- which are revision changesets
1082 UNION
1083 SELECT C.cid
1084 FROM revision R, tag T, csitem CI, changeset C
1085 WHERE R.rid in $theset -- Restrict to revisions of interest
1086 AND T.rev = R.rid -- Select tags attached to them
1087 AND CI.iid = T.tid -- Select all changesets
1088 AND C.cid = CI.cid -- containing the tags
1089 AND C.type = 1 -- which are tag changesets
1090 UNION
1091 SELECT C.cid
1092 FROM revision R, branch B, csitem CI, changeset C
1093 WHERE R.rid in $theset -- Restrict to revisions of interest
1094 AND B.root = R.rid -- Select branches attached to them
1095 AND CI.iid = B.bid -- Select all changesets
1096 AND C.cid = CI.cid -- containing the branches
1097 AND C.type = 2 -- which are branch changesets
1098 }]]
1099 }
1100 }
1101
1102 # # ## ### ##### ######## ############# #####################
@@ -1107,14 +1110,14 @@
1110
1111 typemethod str {tag} {
1112 struct::list assign [state run {
1113 SELECT S.name, F.name, P.name
1114 FROM tag T, symbol S, file F, project P
1115 WHERE T.tid = $tag -- Find specified tag
1116 AND F.fid = T.fid -- Get file of tag
1117 AND P.pid = F.pid -- Get project of file
1118 AND S.sid = T.sid -- Get symbol of tag
1119 }] sname fname pname
1120 return "$pname/T'${sname}'::$fname"
1121 }
1122
1123 # result = list (mintime, maxtime)
@@ -1124,12 +1127,12 @@
1127
1128 set theset ('[join $tags {','}]')
1129 return [state run [subst -nocommands -nobackslashes {
1130 SELECT MIN(R.date), MAX(R.date)
1131 FROM tag T, revision R
1132 WHERE T.tid IN $theset -- Restrict to tags of interest
1133 AND R.rid = T.rev -- Select tag parent revisions
1134 }]]
1135 }
1136
1137 # var(dv) = dict (item -> list (item)), item = list (type id)
1138 typemethod successors {dv tags} {
@@ -1161,14 +1164,14 @@
1164
1165 typemethod str {branch} {
1166 struct::list assign [state run {
1167 SELECT S.name, F.name, P.name
1168 FROM branch B, symbol S, file F, project P
1169 WHERE B.bid = $branch -- Find specified branch
1170 AND F.fid = B.fid -- Get file of branch
1171 AND P.pid = F.pid -- Get project of file
1172 AND S.sid = B.sid -- Get symbol of branch
1173 }] sname fname pname
1174 return "$pname/B'${sname}'::$fname"
1175 }
1176
1177 # result = list (mintime, maxtime)
@@ -1182,12 +1185,12 @@
1185
1186 set theset ('[join $branches {','}]')
1187 return [state run [subst -nocommands -nobackslashes {
1188 SELECT IFNULL(MIN(R.date),0), IFNULL(MAX(R.date),0)
1189 FROM branch B, revision R
1190 WHERE B.bid IN $theset -- Restrict to branches of interest
1191 AND R.rid = B.root -- Select branch parent revisions
1192 }]]
1193 }
1194
1195 # result = 4-list (itemtype itemid nextitemtype nextitemid ...)
1196 typemethod loops {branches} {
@@ -1197,14 +1200,14 @@
1200
1201 set theset ('[join $branches {','}]')
1202 return [state run [subst -nocommands -nobackslashes {
1203 SELECT B.bid, BX.bid
1204 FROM branch B, preferedparent P, branch BX
1205 WHERE B.bid IN $theset -- Restrict to branches of interest
1206 AND B.sid = P.pid -- Get the prefered branches via
1207 AND BX.sid = P.sid -- the branch symbols
1208 AND BX.bid IN $theset -- Loop
1209 }]]
1210 }
1211
1212 # var(dv) = dict (item -> list (item)), item = list (type id)
1213 typemethod successors {dv branches} {
@@ -1215,30 +1218,30 @@
1218
1219 set theset ('[join $branches {','}]')
1220 foreach {bid child} [state run [subst -nocommands -nobackslashes {
1221 SELECT B.bid, R.rid
1222 FROM branch B, revision R
1223 WHERE B.bid IN $theset -- Restrict to branches of interest
1224 AND B.first = R.rid -- Get first revision on the branch
1225 }]] {
1226 lappend dependencies([list sym::branch $bid]) [list rev $child]
1227 }
1228 foreach {bid child} [state run [subst -nocommands -nobackslashes {
1229 SELECT B.bid, BX.bid
1230 FROM branch B, preferedparent P, branch BX
1231 WHERE B.bid IN $theset -- Restrict to branches of interest
1232 AND B.sid = P.pid -- Get subordinate branches via the
1233 AND BX.sid = P.sid -- prefered parents of their symbols
1234 }]] {
1235 lappend dependencies([list sym::branch $bid]) [list sym::branch $child]
1236 }
1237 foreach {bid child} [state run [subst -nocommands -nobackslashes {
1238 SELECT B.bid, T.tid
1239 FROM branch B, preferedparent P, tag T
1240 WHERE B.bid IN $theset -- Restrict to branches of interest
1241 AND B.sid = P.pid -- Get subordinate tags via the
1242 AND T.sid = P.sid -- prefered parents of their symbols
1243 }]] {
1244 lappend dependencies([list sym::branch $bid]) [list sym::tag $child]
1245 }
1246 return
1247 }
@@ -1253,33 +1256,33 @@
1256
1257 set theset ('[join $branches {','}]')
1258 return [state run [subst -nocommands -nobackslashes {
1259 SELECT C.cid
1260 FROM branch B, revision R, csitem CI, changeset C
1261 WHERE B.bid IN $theset -- Restrict to branches of interest
1262 AND B.first = R.rid -- Get first revision on the branch
1263 AND CI.iid = R.rid -- Select all changesets
1264 AND C.cid = CI.cid -- containing this revision
1265 AND C.type = 0 -- which are revision changesets
1266 UNION
1267 SELECT C.cid
1268 FROM branch B, preferedparent P, branch BX, csitem CI, changeset C
1269 WHERE B.bid IN $theset -- Restrict to branches of interest
1270 AND B.sid = P.pid -- Get subordinate branches via the
1271 AND BX.sid = P.sid -- prefered parents of their symbols
1272 AND CI.iid = BX.bid -- Select all changesets
1273 AND C.cid = CI.cid -- containing the subordinate branches
1274 AND C.type = 2 -- which are branch changesets
1275 UNION
1276 SELECT C.cid
1277 FROM branch B, preferedparent P, tag T, csitem CI, changeset C
1278 WHERE B.bid IN $theset -- Restrict to branches of interest
1279 AND B.sid = P.pid -- Get subordinate tags via the
1280 AND T.sid = P.sid -- prefered parents of their symbols
1281 AND CI.iid = T.tid -- Select all changesets
1282 AND C.cid = CI.cid -- containing the subordinate tags
1283 AND C.type = 1 -- which are tag changesets
1284 }]]
1285 return
1286 }
1287
1288 typemethod limits {branches} {
@@ -1294,29 +1297,29 @@
1297
1298 set maxp [state run [subst -nocommands -nobackslashes {
1299 -- maximal predecessor position per branch
1300 SELECT B.bid, MAX (CO.pos)
1301 FROM branch B, revision R, csitem CI, changeset C, csorder CO
1302 WHERE B.bid IN $theset -- Restrict to branches of interest
1303 AND B.root = R.rid -- Get branch root revisions
1304 AND CI.iid = R.rid -- Get changesets containing the
1305 AND C.cid = CI.cid -- root revisions, which are
1306 AND C.type = 0 -- revision changesets
1307 AND CO.cid = C.cid -- Get their topological ordering
1308 GROUP BY B.bid
1309 }]]
1310
1311 set mins [state run [subst -nocommands -nobackslashes {
1312 -- minimal successor position per branch
1313 SELECT B.bid, MIN (CO.pos)
1314 FROM branch B, revision R, csitem CI, changeset C, csorder CO
1315 WHERE B.bid IN $theset -- Restrict to branches of interest
1316 AND B.first = R.rid -- Get the first revisions on the branches
1317 AND CI.iid = R.rid -- Get changesets containing the
1318 AND C.cid = CI.cid -- first revisions, which are
1319 AND C.type = 0 -- revision changesets
1320 AND CO.cid = C.cid -- Get their topological ordering
1321 GROUP BY B.bid
1322 }]]
1323
1324 return [list $maxp $mins]
1325 }
1326
--- tools/cvs2fossil/lib/c2f_repository.tcl
+++ tools/cvs2fossil/lib/c2f_repository.tcl
@@ -279,11 +279,11 @@
279279
# pass IV+ results
280280
typemethod printcsetstatistics {} {
281281
log write 2 repository "Changeset statistics"
282282
# number of revisions, symbols, repository wide, and per project ...
283283
284
- set ccount [state one { SELECT COUNT (*) FROM changeset }]
284
+ set ccount [state one { SELECT COUNT (*) FROM changeset }]
285285
set rcount [state one { SELECT COUNT (*) FROM changeset WHERE type = 0 }]
286286
set tcount [state one { SELECT COUNT (*) FROM changeset WHERE type = 1 }]
287287
set bcount [state one { SELECT COUNT (*) FROM changeset WHERE type = 2 }]
288288
set fmt %[string length [max [list $ccount $rcount $tcount $bcount]]]s
289289
290290
--- tools/cvs2fossil/lib/c2f_repository.tcl
+++ tools/cvs2fossil/lib/c2f_repository.tcl
@@ -279,11 +279,11 @@
279 # pass IV+ results
280 typemethod printcsetstatistics {} {
281 log write 2 repository "Changeset statistics"
282 # number of revisions, symbols, repository wide, and per project ...
283
284 set ccount [state one { SELECT COUNT (*) FROM changeset }]
285 set rcount [state one { SELECT COUNT (*) FROM changeset WHERE type = 0 }]
286 set tcount [state one { SELECT COUNT (*) FROM changeset WHERE type = 1 }]
287 set bcount [state one { SELECT COUNT (*) FROM changeset WHERE type = 2 }]
288 set fmt %[string length [max [list $ccount $rcount $tcount $bcount]]]s
289
290
--- tools/cvs2fossil/lib/c2f_repository.tcl
+++ tools/cvs2fossil/lib/c2f_repository.tcl
@@ -279,11 +279,11 @@
279 # pass IV+ results
280 typemethod printcsetstatistics {} {
281 log write 2 repository "Changeset statistics"
282 # number of revisions, symbols, repository wide, and per project ...
283
284 set ccount [state one { SELECT COUNT (*) FROM changeset }]
285 set rcount [state one { SELECT COUNT (*) FROM changeset WHERE type = 0 }]
286 set tcount [state one { SELECT COUNT (*) FROM changeset WHERE type = 1 }]
287 set bcount [state one { SELECT COUNT (*) FROM changeset WHERE type = 2 }]
288 set fmt %[string length [max [list $ccount $rcount $tcount $bcount]]]s
289
290

Keyboard Shortcuts

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