Fossil SCM

Bugfix in ValidateFragments, tweaked comment a bit, bugfix in SQL, reordered tables in the successor/predecessor queries a bit to show the actual progression of their use.

aku 2007-12-02 03:46 trunk
Commit fbfb53186811bd65b69ae5368c2d8f713995a63c
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -469,11 +469,11 @@
469469
# changeset.
470470
# * The fragment must not overlap, i.e. their pairwise
471471
# intersections have to be empty.
472472
473473
set cover {}
474
- foreach fragmentitems $args {
474
+ foreach fragmentitems $fragments {
475475
log write 8 csets {NEW: [lsort $fragmentitems]}
476476
477477
integrity assert {
478478
![struct::set empty $fragmentitems]
479479
} {changeset fragment is empty}
@@ -487,12 +487,12 @@
487487
integrity assert {
488488
[struct::set equal $cover [$cset items]]
489489
} {The fragments do not cover the original changeset}
490490
491491
set i 1
492
- foreach fia $args {
493
- foreach fib [lrange $args $i end] {
492
+ foreach fia $fragments {
493
+ foreach fib [lrange $fragments $i end] {
494494
integrity assert {
495495
[struct::set empty [struct::set intersect $fia $fib]]
496496
} {The fragments <$fia> and <$fib> overlap}
497497
}
498498
incr i
@@ -891,15 +891,18 @@
891891
# COMMIT_THRESHOLD, a time interval commits should fall. This
892892
# will greatly reduces the risk of getting far separated
893893
# revisions of the same file into one changeset.
894894
895895
# We allow revisions to be far apart in time in the same
896
- # changeset, but need the pseudo-dependencies for this.
896
+ # changeset, but in turn need the pseudo-dependencies to
897
+ # handle this.
897898
898899
array set fids {}
899900
foreach {rid fid} [state run "
900
- SELECT R.rid, R.fid FROM revision R WHERE R.rid IN $theset
901
+ SELECT R.rid, R.fid
902
+ FROM revision R
903
+ WHERE R.rid IN $theset
901904
"] { lappend fids($fid) $rid }
902905
903906
foreach {fid rids} [array get fids] {
904907
if {[llength $rids] < 2} continue
905908
foreach a $rids {
@@ -1042,11 +1045,11 @@
10421045
# on tags in the same manner, so tags cannot be predecessors
10431046
# of revisions. This complements that they have no successors
10441047
# (See sym::tag/successors).
10451048
10461049
foreach {rid parent} [state run "
1047
- SELECT R.rid B.bid
1050
+ SELECT R.rid, B.bid
10481051
FROM revision R, branch B
10491052
WHERE R.rid IN $theset
10501053
AND B.first = R.rid
10511054
"] {
10521055
lappend dependencies([list rev $rid]) [list sym::branch $parent]
@@ -1082,13 +1085,13 @@
10821085
# are attached to.
10831086
10841087
set theset ('[join $tags {','}]')
10851088
return [state run "
10861089
SELECT MIN(R.date), MAX(R.date)
1087
- FROM revision R, tag T
1088
- WHERE T.tid IN $theset
1089
- AND R.rid = T.rev
1090
+ FROM tag T, revision R
1091
+ WHERE T.tid IN $theset
1092
+ AND R.rid = T.rev
10901093
"]
10911094
}
10921095
10931096
# var(dv) = dict (item -> list (item)), item = list (type id)
10941097
typemethod successors {dv tags} {
@@ -1103,30 +1106,30 @@
11031106
# their prefered parents.
11041107
11051108
set theset ('[join $tags {','}]')
11061109
foreach {tid parent} [state run "
11071110
SELECT T.tid, R.rid
1108
- FROM revision R, tag T
1111
+ FROM tag T, revision R
11091112
WHERE T.tid IN $theset
11101113
AND T.rev = R.rid
11111114
"] {
11121115
lappend dependencies([list sym::tag $tid]) [list rev $parent]
11131116
}
11141117
11151118
foreach {tid parent} [state run "
11161119
SELECT T.tid, B.bid
1117
- FROM tag T, branch B, preferedparent P
1120
+ FROM tag T, preferedparent P, branch B
11181121
WHERE T.tid IN $theset
11191122
AND T.sid = P.sid
11201123
AND P.pid = B.sid
11211124
"] {
11221125
lappend dependencies([list sym::tag $tid]) [list sym::branch $parent]
11231126
}
11241127
11251128
foreach {tid parent} [state run "
11261129
SELECT T.tid, TX.tid
1127
- FROM tag T, tag TX, preferedparent P
1130
+ FROM tag T, preferedparent P, tag TX
11281131
WHERE T.tid IN $theset
11291132
AND T.sid = P.sid
11301133
AND P.pid = TX.sid
11311134
"] {
11321135
lappend dependencies([list sym::tag $tid]) [list sym::tag $parent]
@@ -1166,11 +1169,11 @@
11661169
# as they logically are.
11671170
11681171
set theset ('[join $branches {','}]')
11691172
return [state run "
11701173
SELECT IFNULL(MIN(R.date),0), IFNULL(MAX(R.date),0)
1171
- FROM revision R, branch B
1174
+ FROM branch B, revision R
11721175
WHERE B.bid IN $theset
11731176
AND R.rid = B.root
11741177
"]
11751178
}
11761179
@@ -1181,28 +1184,28 @@
11811184
# successors of a branch.
11821185
11831186
set theset ('[join $branches {','}]')
11841187
foreach {bid child} [state run "
11851188
SELECT B.bid, R.rid
1186
- FROM revision R, branch B
1189
+ FROM branch B, revision R
11871190
WHERE B.bid IN $theset
11881191
AND B.first = R.rid
11891192
"] {
11901193
lappend dependencies([list sym::tag $bid]) [list rev $child]
11911194
}
11921195
foreach {bid child} [state run "
11931196
SELECT B.bid, BX.bid
1194
- FROM branch B, branch BX, preferedparent P
1197
+ FROM branch B, preferedparent P, branch BX
11951198
WHERE B.bid IN $theset
11961199
AND B.sid = P.pid
11971200
AND BX.sid = P.sid
11981201
"] {
11991202
lappend dependencies([list sym::tag $bid]) [list sym::branch $child]
12001203
}
12011204
foreach {bid child} [state run "
12021205
SELECT B.bid, T.tid
1203
- FROM branch B, tag T, preferedparent P
1206
+ FROM branch B, preferedparent P, tag T
12041207
WHERE B.bid IN $theset
12051208
AND B.sid = P.pid
12061209
AND T.sid = P.sid
12071210
"] {
12081211
lappend dependencies([list sym::tag $bid]) [list sym::tag $child]
@@ -1217,29 +1220,29 @@
12171220
# tags which are their prefered parents.
12181221
12191222
set theset ('[join $tags {','}]')
12201223
foreach {bid parent} [state run "
12211224
SELECT B.Bid, R.rid
1222
- FROM revision R, branch B
1225
+ FROM branch B, revision R
12231226
WHERE B.bid IN $theset
12241227
AND B.root = R.rid
12251228
"] {
12261229
lappend dependencies([list sym::branch $bid]) [list rev $parent]
12271230
}
12281231
foreach {bid parent} [state run "
12291232
SELECT B.bid, BX.bid
1230
- FROM branch B, branch BX, preferedparent P
1233
+ FROM branch B, preferedparent P, branch BX
12311234
WHERE B.bid IN $theset
12321235
AND B.sid = P.sid
12331236
AND P.pid = BX.sid
12341237
"] {
12351238
lappend dependencies([list sym::branch $bid]) [list sym::branch $parent]
12361239
}
12371240
foreach {bid parent} [state run "
12381241
SELECT B.bid, T.tid
1239
- FROM branch B, tag T, preferedparent P
1240
- WHERE B.tid IN $theset
1242
+ FROM branch B, preferedparent P, tag T
1243
+ WHERE B.bid IN $theset
12411244
AND B.sid = P.sid
12421245
AND P.pid = T.sid
12431246
"] {
12441247
lappend dependencies([list sym::branch $bid]) [list sym::tag $parent]
12451248
}
12461249
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -469,11 +469,11 @@
469 # changeset.
470 # * The fragment must not overlap, i.e. their pairwise
471 # intersections have to be empty.
472
473 set cover {}
474 foreach fragmentitems $args {
475 log write 8 csets {NEW: [lsort $fragmentitems]}
476
477 integrity assert {
478 ![struct::set empty $fragmentitems]
479 } {changeset fragment is empty}
@@ -487,12 +487,12 @@
487 integrity assert {
488 [struct::set equal $cover [$cset items]]
489 } {The fragments do not cover the original changeset}
490
491 set i 1
492 foreach fia $args {
493 foreach fib [lrange $args $i end] {
494 integrity assert {
495 [struct::set empty [struct::set intersect $fia $fib]]
496 } {The fragments <$fia> and <$fib> overlap}
497 }
498 incr i
@@ -891,15 +891,18 @@
891 # COMMIT_THRESHOLD, a time interval commits should fall. This
892 # will greatly reduces the risk of getting far separated
893 # revisions of the same file into one changeset.
894
895 # We allow revisions to be far apart in time in the same
896 # changeset, but need the pseudo-dependencies for this.
 
897
898 array set fids {}
899 foreach {rid fid} [state run "
900 SELECT R.rid, R.fid FROM revision R WHERE R.rid IN $theset
 
 
901 "] { lappend fids($fid) $rid }
902
903 foreach {fid rids} [array get fids] {
904 if {[llength $rids] < 2} continue
905 foreach a $rids {
@@ -1042,11 +1045,11 @@
1042 # on tags in the same manner, so tags cannot be predecessors
1043 # of revisions. This complements that they have no successors
1044 # (See sym::tag/successors).
1045
1046 foreach {rid parent} [state run "
1047 SELECT R.rid B.bid
1048 FROM revision R, branch B
1049 WHERE R.rid IN $theset
1050 AND B.first = R.rid
1051 "] {
1052 lappend dependencies([list rev $rid]) [list sym::branch $parent]
@@ -1082,13 +1085,13 @@
1082 # are attached to.
1083
1084 set theset ('[join $tags {','}]')
1085 return [state run "
1086 SELECT MIN(R.date), MAX(R.date)
1087 FROM revision R, tag T
1088 WHERE T.tid IN $theset
1089 AND R.rid = T.rev
1090 "]
1091 }
1092
1093 # var(dv) = dict (item -> list (item)), item = list (type id)
1094 typemethod successors {dv tags} {
@@ -1103,30 +1106,30 @@
1103 # their prefered parents.
1104
1105 set theset ('[join $tags {','}]')
1106 foreach {tid parent} [state run "
1107 SELECT T.tid, R.rid
1108 FROM revision R, tag T
1109 WHERE T.tid IN $theset
1110 AND T.rev = R.rid
1111 "] {
1112 lappend dependencies([list sym::tag $tid]) [list rev $parent]
1113 }
1114
1115 foreach {tid parent} [state run "
1116 SELECT T.tid, B.bid
1117 FROM tag T, branch B, preferedparent P
1118 WHERE T.tid IN $theset
1119 AND T.sid = P.sid
1120 AND P.pid = B.sid
1121 "] {
1122 lappend dependencies([list sym::tag $tid]) [list sym::branch $parent]
1123 }
1124
1125 foreach {tid parent} [state run "
1126 SELECT T.tid, TX.tid
1127 FROM tag T, tag TX, preferedparent P
1128 WHERE T.tid IN $theset
1129 AND T.sid = P.sid
1130 AND P.pid = TX.sid
1131 "] {
1132 lappend dependencies([list sym::tag $tid]) [list sym::tag $parent]
@@ -1166,11 +1169,11 @@
1166 # as they logically are.
1167
1168 set theset ('[join $branches {','}]')
1169 return [state run "
1170 SELECT IFNULL(MIN(R.date),0), IFNULL(MAX(R.date),0)
1171 FROM revision R, branch B
1172 WHERE B.bid IN $theset
1173 AND R.rid = B.root
1174 "]
1175 }
1176
@@ -1181,28 +1184,28 @@
1181 # successors of a branch.
1182
1183 set theset ('[join $branches {','}]')
1184 foreach {bid child} [state run "
1185 SELECT B.bid, R.rid
1186 FROM revision R, branch B
1187 WHERE B.bid IN $theset
1188 AND B.first = R.rid
1189 "] {
1190 lappend dependencies([list sym::tag $bid]) [list rev $child]
1191 }
1192 foreach {bid child} [state run "
1193 SELECT B.bid, BX.bid
1194 FROM branch B, branch BX, preferedparent P
1195 WHERE B.bid IN $theset
1196 AND B.sid = P.pid
1197 AND BX.sid = P.sid
1198 "] {
1199 lappend dependencies([list sym::tag $bid]) [list sym::branch $child]
1200 }
1201 foreach {bid child} [state run "
1202 SELECT B.bid, T.tid
1203 FROM branch B, tag T, preferedparent P
1204 WHERE B.bid IN $theset
1205 AND B.sid = P.pid
1206 AND T.sid = P.sid
1207 "] {
1208 lappend dependencies([list sym::tag $bid]) [list sym::tag $child]
@@ -1217,29 +1220,29 @@
1217 # tags which are their prefered parents.
1218
1219 set theset ('[join $tags {','}]')
1220 foreach {bid parent} [state run "
1221 SELECT B.Bid, R.rid
1222 FROM revision R, branch B
1223 WHERE B.bid IN $theset
1224 AND B.root = R.rid
1225 "] {
1226 lappend dependencies([list sym::branch $bid]) [list rev $parent]
1227 }
1228 foreach {bid parent} [state run "
1229 SELECT B.bid, BX.bid
1230 FROM branch B, branch BX, preferedparent P
1231 WHERE B.bid IN $theset
1232 AND B.sid = P.sid
1233 AND P.pid = BX.sid
1234 "] {
1235 lappend dependencies([list sym::branch $bid]) [list sym::branch $parent]
1236 }
1237 foreach {bid parent} [state run "
1238 SELECT B.bid, T.tid
1239 FROM branch B, tag T, preferedparent P
1240 WHERE B.tid IN $theset
1241 AND B.sid = P.sid
1242 AND P.pid = T.sid
1243 "] {
1244 lappend dependencies([list sym::branch $bid]) [list sym::tag $parent]
1245 }
1246
--- tools/cvs2fossil/lib/c2f_prev.tcl
+++ tools/cvs2fossil/lib/c2f_prev.tcl
@@ -469,11 +469,11 @@
469 # changeset.
470 # * The fragment must not overlap, i.e. their pairwise
471 # intersections have to be empty.
472
473 set cover {}
474 foreach fragmentitems $fragments {
475 log write 8 csets {NEW: [lsort $fragmentitems]}
476
477 integrity assert {
478 ![struct::set empty $fragmentitems]
479 } {changeset fragment is empty}
@@ -487,12 +487,12 @@
487 integrity assert {
488 [struct::set equal $cover [$cset items]]
489 } {The fragments do not cover the original changeset}
490
491 set i 1
492 foreach fia $fragments {
493 foreach fib [lrange $fragments $i end] {
494 integrity assert {
495 [struct::set empty [struct::set intersect $fia $fib]]
496 } {The fragments <$fia> and <$fib> overlap}
497 }
498 incr i
@@ -891,15 +891,18 @@
891 # COMMIT_THRESHOLD, a time interval commits should fall. This
892 # will greatly reduces the risk of getting far separated
893 # revisions of the same file into one changeset.
894
895 # We allow revisions to be far apart in time in the same
896 # changeset, but in turn need the pseudo-dependencies to
897 # handle this.
898
899 array set fids {}
900 foreach {rid fid} [state run "
901 SELECT R.rid, R.fid
902 FROM revision R
903 WHERE R.rid IN $theset
904 "] { lappend fids($fid) $rid }
905
906 foreach {fid rids} [array get fids] {
907 if {[llength $rids] < 2} continue
908 foreach a $rids {
@@ -1042,11 +1045,11 @@
1045 # on tags in the same manner, so tags cannot be predecessors
1046 # of revisions. This complements that they have no successors
1047 # (See sym::tag/successors).
1048
1049 foreach {rid parent} [state run "
1050 SELECT R.rid, B.bid
1051 FROM revision R, branch B
1052 WHERE R.rid IN $theset
1053 AND B.first = R.rid
1054 "] {
1055 lappend dependencies([list rev $rid]) [list sym::branch $parent]
@@ -1082,13 +1085,13 @@
1085 # are attached to.
1086
1087 set theset ('[join $tags {','}]')
1088 return [state run "
1089 SELECT MIN(R.date), MAX(R.date)
1090 FROM tag T, revision R
1091 WHERE T.tid IN $theset
1092 AND R.rid = T.rev
1093 "]
1094 }
1095
1096 # var(dv) = dict (item -> list (item)), item = list (type id)
1097 typemethod successors {dv tags} {
@@ -1103,30 +1106,30 @@
1106 # their prefered parents.
1107
1108 set theset ('[join $tags {','}]')
1109 foreach {tid parent} [state run "
1110 SELECT T.tid, R.rid
1111 FROM tag T, revision R
1112 WHERE T.tid IN $theset
1113 AND T.rev = R.rid
1114 "] {
1115 lappend dependencies([list sym::tag $tid]) [list rev $parent]
1116 }
1117
1118 foreach {tid parent} [state run "
1119 SELECT T.tid, B.bid
1120 FROM tag T, preferedparent P, branch B
1121 WHERE T.tid IN $theset
1122 AND T.sid = P.sid
1123 AND P.pid = B.sid
1124 "] {
1125 lappend dependencies([list sym::tag $tid]) [list sym::branch $parent]
1126 }
1127
1128 foreach {tid parent} [state run "
1129 SELECT T.tid, TX.tid
1130 FROM tag T, preferedparent P, tag TX
1131 WHERE T.tid IN $theset
1132 AND T.sid = P.sid
1133 AND P.pid = TX.sid
1134 "] {
1135 lappend dependencies([list sym::tag $tid]) [list sym::tag $parent]
@@ -1166,11 +1169,11 @@
1169 # as they logically are.
1170
1171 set theset ('[join $branches {','}]')
1172 return [state run "
1173 SELECT IFNULL(MIN(R.date),0), IFNULL(MAX(R.date),0)
1174 FROM branch B, revision R
1175 WHERE B.bid IN $theset
1176 AND R.rid = B.root
1177 "]
1178 }
1179
@@ -1181,28 +1184,28 @@
1184 # successors of a branch.
1185
1186 set theset ('[join $branches {','}]')
1187 foreach {bid child} [state run "
1188 SELECT B.bid, R.rid
1189 FROM branch B, revision R
1190 WHERE B.bid IN $theset
1191 AND B.first = R.rid
1192 "] {
1193 lappend dependencies([list sym::tag $bid]) [list rev $child]
1194 }
1195 foreach {bid child} [state run "
1196 SELECT B.bid, BX.bid
1197 FROM branch B, preferedparent P, branch BX
1198 WHERE B.bid IN $theset
1199 AND B.sid = P.pid
1200 AND BX.sid = P.sid
1201 "] {
1202 lappend dependencies([list sym::tag $bid]) [list sym::branch $child]
1203 }
1204 foreach {bid child} [state run "
1205 SELECT B.bid, T.tid
1206 FROM branch B, preferedparent P, tag T
1207 WHERE B.bid IN $theset
1208 AND B.sid = P.pid
1209 AND T.sid = P.sid
1210 "] {
1211 lappend dependencies([list sym::tag $bid]) [list sym::tag $child]
@@ -1217,29 +1220,29 @@
1220 # tags which are their prefered parents.
1221
1222 set theset ('[join $tags {','}]')
1223 foreach {bid parent} [state run "
1224 SELECT B.Bid, R.rid
1225 FROM branch B, revision R
1226 WHERE B.bid IN $theset
1227 AND B.root = R.rid
1228 "] {
1229 lappend dependencies([list sym::branch $bid]) [list rev $parent]
1230 }
1231 foreach {bid parent} [state run "
1232 SELECT B.bid, BX.bid
1233 FROM branch B, preferedparent P, branch BX
1234 WHERE B.bid IN $theset
1235 AND B.sid = P.sid
1236 AND P.pid = BX.sid
1237 "] {
1238 lappend dependencies([list sym::branch $bid]) [list sym::branch $parent]
1239 }
1240 foreach {bid parent} [state run "
1241 SELECT B.bid, T.tid
1242 FROM branch B, preferedparent P, tag T
1243 WHERE B.bid IN $theset
1244 AND B.sid = P.sid
1245 AND P.pid = T.sid
1246 "] {
1247 lappend dependencies([list sym::branch $bid]) [list sym::tag $parent]
1248 }
1249

Keyboard Shortcuts

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