Fossil SCM
Went to explicit var-substitution for the dynamic sql queries, makes formatting easier.
Commit
0ee9711e2e4cc2bf754951a1f4ab156f927be865
Parent
5b2d15f18356351…
1 file changed
+28
-28
+28
-28
| --- tools/cvs2fossil/lib/c2f_prev.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_prev.tcl | ||
| @@ -628,15 +628,15 @@ | ||
| 628 | 628 | |
| 629 | 629 | array set delta {} |
| 630 | 630 | array set stamp {} |
| 631 | 631 | |
| 632 | 632 | set theset ('[join $revisions {','}]') |
| 633 | - foreach {rid time} [state run " | |
| 633 | + foreach {rid time} [state run [subst -nocommands -nobackslashes { | |
| 634 | 634 | SELECT R.rid, R.date |
| 635 | 635 | FROM revision R |
| 636 | 636 | WHERE R.rid IN $theset |
| 637 | - "] { | |
| 637 | + }]] { | |
| 638 | 638 | set stamp($rid) $time |
| 639 | 639 | } |
| 640 | 640 | |
| 641 | 641 | set n 0 |
| 642 | 642 | foreach rid [lrange $revisions 0 end-1] rnext [lrange $revisions 1 end] { |
| @@ -829,15 +829,15 @@ | ||
| 829 | 829 | } |
| 830 | 830 | |
| 831 | 831 | # result = list (mintime, maxtime) |
| 832 | 832 | typemethod timerange {items} { |
| 833 | 833 | set theset ('[join $items {','}]') |
| 834 | - return [state run " | |
| 834 | + return [state run [subst -nocommands -nobackslashes { | |
| 835 | 835 | SELECT MIN(R.date), MAX(R.date) |
| 836 | 836 | FROM revision R |
| 837 | 837 | WHERE R.rid IN $theset |
| 838 | - "] | |
| 838 | + }]] | |
| 839 | 839 | } |
| 840 | 840 | |
| 841 | 841 | # var(dv) = dict (revision -> list (revision)) |
| 842 | 842 | typemethod internalsuccessors {dv revisions} { |
| 843 | 843 | upvar 1 $dv dependencies |
| @@ -849,11 +849,11 @@ | ||
| 849 | 849 | # revisions we start from. Sensible as we are looking for |
| 850 | 850 | # changeset internal dependencies. |
| 851 | 851 | |
| 852 | 852 | array set dep {} |
| 853 | 853 | |
| 854 | - foreach {rid child} [state run " | |
| 854 | + foreach {rid child} [state run [subst -nocommands -nobackslashes { | |
| 855 | 855 | -- (1) Primary child |
| 856 | 856 | SELECT R.rid, R.child |
| 857 | 857 | FROM revision R |
| 858 | 858 | WHERE R.rid IN $theset -- Restrict to revisions of interest |
| 859 | 859 | AND R.child IS NOT NULL -- Has primary child |
| @@ -873,11 +873,11 @@ | ||
| 873 | 873 | AND R.isdefault -- Restrict to NTDB |
| 874 | 874 | AND R.dbchild IS NOT NULL -- and last NTDB belonging to trunk |
| 875 | 875 | AND RA.rid = R.dbchild -- Go directly to trunk root |
| 876 | 876 | AND RA.child IS NOT NULL -- Has primary child. |
| 877 | 877 | AND RA.child IN $theset -- Which is also of interest |
| 878 | - "] { | |
| 878 | + }]] { | |
| 879 | 879 | # Consider moving this to the integrity module. |
| 880 | 880 | integrity assert {$rid != $child} {Revision $rid depends on itself.} |
| 881 | 881 | lappend dependencies($rid) $child |
| 882 | 882 | set dep($rid,$child) . |
| 883 | 883 | } |
| @@ -903,15 +903,15 @@ | ||
| 903 | 903 | # We allow revisions to be far apart in time in the same |
| 904 | 904 | # changeset, but in turn need the pseudo-dependencies to |
| 905 | 905 | # handle this. |
| 906 | 906 | |
| 907 | 907 | array set fids {} |
| 908 | - foreach {rid fid} [state run " | |
| 908 | + foreach {rid fid} [state run [subst -nocommands -nobackslashes { | |
| 909 | 909 | SELECT R.rid, R.fid |
| 910 | 910 | FROM revision R |
| 911 | 911 | WHERE R.rid IN $theset |
| 912 | - "] { lappend fids($fid) $rid } | |
| 912 | + }]] { lappend fids($fid) $rid } | |
| 913 | 913 | |
| 914 | 914 | foreach {fid rids} [array get fids] { |
| 915 | 915 | if {[llength $rids] < 2} continue |
| 916 | 916 | foreach a $rids { |
| 917 | 917 | foreach b $rids { |
| @@ -993,11 +993,11 @@ | ||
| 993 | 993 | # '1.2' revision) is a successor, if it exists. |
| 994 | 994 | |
| 995 | 995 | # Note that the branches spawned from the revisions, and the |
| 996 | 996 | # tags associated with them are successors as well. |
| 997 | 997 | |
| 998 | - foreach {rid child} [state run " | |
| 998 | + foreach {rid child} [state run [subst -nocommands -nobackslashes { | |
| 999 | 999 | -- (1) Primary child |
| 1000 | 1000 | SELECT R.rid, R.child |
| 1001 | 1001 | FROM revision R |
| 1002 | 1002 | WHERE R.rid IN $theset -- Restrict to revisions of interest |
| 1003 | 1003 | AND R.child IS NOT NULL -- Has primary child |
| @@ -1014,29 +1014,29 @@ | ||
| 1014 | 1014 | WHERE R.rid IN $theset -- Restrict to revisions of interest |
| 1015 | 1015 | AND R.isdefault -- Restrict to NTDB |
| 1016 | 1016 | AND R.dbchild IS NOT NULL -- and last NTDB belonging to trunk |
| 1017 | 1017 | AND RA.rid = R.dbchild -- Go directly to trunk root |
| 1018 | 1018 | AND RA.child IS NOT NULL -- Has primary child. |
| 1019 | - "] { | |
| 1019 | + }]] { | |
| 1020 | 1020 | # Consider moving this to the integrity module. |
| 1021 | 1021 | integrity assert {$rid != $child} {Revision $rid depends on itself.} |
| 1022 | 1022 | lappend dependencies([list rev $rid]) [list rev $child] |
| 1023 | 1023 | } |
| 1024 | - foreach {rid child} [state run " | |
| 1024 | + foreach {rid child} [state run [subst -nocommands -nobackslashes { | |
| 1025 | 1025 | SELECT R.rid, T.tid |
| 1026 | 1026 | FROM revision R, tag T |
| 1027 | 1027 | WHERE R.rid IN $theset |
| 1028 | 1028 | AND T.rev = R.rid |
| 1029 | - "] { | |
| 1029 | + }]] { | |
| 1030 | 1030 | lappend dependencies([list rev $rid]) [list sym::tag $child] |
| 1031 | 1031 | } |
| 1032 | - foreach {rid child} [state run " | |
| 1032 | + foreach {rid child} [state run [subst -nocommands -nobackslashes { | |
| 1033 | 1033 | SELECT R.rid, B.bid |
| 1034 | 1034 | FROM revision R, branch B |
| 1035 | 1035 | WHERE R.rid IN $theset |
| 1036 | 1036 | AND B.root = R.rid |
| 1037 | - "] { | |
| 1037 | + }]] { | |
| 1038 | 1038 | lappend dependencies([list rev $rid]) [list sym::branch $child] |
| 1039 | 1039 | } |
| 1040 | 1040 | return |
| 1041 | 1041 | } |
| 1042 | 1042 | |
| @@ -1047,11 +1047,11 @@ | ||
| 1047 | 1047 | # millions of dependency pairs (in extreme cases (Example: Tcl |
| 1048 | 1048 | # CVS)) we return a very short and much more manageable list |
| 1049 | 1049 | # of changesets. |
| 1050 | 1050 | |
| 1051 | 1051 | set theset ('[join $revisions {','}]') |
| 1052 | - return [state run " | |
| 1052 | + return [state run [subst -nocommands -nobackslashes { | |
| 1053 | 1053 | SELECT C.cid |
| 1054 | 1054 | FROM revision R, csitem CI, changeset C |
| 1055 | 1055 | WHERE R.rid IN $theset -- Restrict to revisions of interest |
| 1056 | 1056 | AND R.child IS NOT NULL -- Has primary child |
| 1057 | 1057 | AND CI.iid = R.child |
| @@ -1090,11 +1090,11 @@ | ||
| 1090 | 1090 | WHERE R.rid in $theset |
| 1091 | 1091 | AND B.root = R.rid |
| 1092 | 1092 | AND CI.iid = B.bid |
| 1093 | 1093 | AND C.cid = CI.cid |
| 1094 | 1094 | AND C.type = 2 |
| 1095 | - "] | |
| 1095 | + }]] | |
| 1096 | 1096 | } |
| 1097 | 1097 | } |
| 1098 | 1098 | |
| 1099 | 1099 | # # ## ### ##### ######## ############# ##################### |
| 1100 | 1100 | ## Helper singleton. Commands for tag symbol changesets. |
| @@ -1121,16 +1121,16 @@ | ||
| 1121 | 1121 | typemethod timerange {tags} { |
| 1122 | 1122 | # The range is defined as the range of the revisions the tags |
| 1123 | 1123 | # are attached to. |
| 1124 | 1124 | |
| 1125 | 1125 | set theset ('[join $tags {','}]') |
| 1126 | - return [state run " | |
| 1126 | + return [state run [subst -nocommands -nobackslashes { | |
| 1127 | 1127 | SELECT MIN(R.date), MAX(R.date) |
| 1128 | 1128 | FROM tag T, revision R |
| 1129 | 1129 | WHERE T.tid IN $theset |
| 1130 | 1130 | AND R.rid = T.rev |
| 1131 | - "] | |
| 1131 | + }]] | |
| 1132 | 1132 | } |
| 1133 | 1133 | |
| 1134 | 1134 | # var(dv) = dict (item -> list (item)), item = list (type id) |
| 1135 | 1135 | typemethod successors {dv tags} { |
| 1136 | 1136 | # Tags have no successors. |
| @@ -1179,16 +1179,16 @@ | ||
| 1179 | 1179 | # spawning them, hence they have no real timerange any |
| 1180 | 1180 | # longer. By using 0 we put them in front of everything else, |
| 1181 | 1181 | # as they logically are. |
| 1182 | 1182 | |
| 1183 | 1183 | set theset ('[join $branches {','}]') |
| 1184 | - return [state run " | |
| 1184 | + return [state run [subst -nocommands -nobackslashes { | |
| 1185 | 1185 | SELECT IFNULL(MIN(R.date),0), IFNULL(MAX(R.date),0) |
| 1186 | 1186 | FROM branch B, revision R |
| 1187 | 1187 | WHERE B.bid IN $theset |
| 1188 | 1188 | AND R.rid = B.root |
| 1189 | - "] | |
| 1189 | + }]] | |
| 1190 | 1190 | } |
| 1191 | 1191 | |
| 1192 | 1192 | # result = 4-list (itemtype itemid nextitemtype nextitemid ...) |
| 1193 | 1193 | typemethod loops {branches} { |
| 1194 | 1194 | # Note: Revisions and tags cannot cause the loop. Being of a |
| @@ -1212,34 +1212,34 @@ | ||
| 1212 | 1212 | # The first revision committed on a branch, and all branches |
| 1213 | 1213 | # and tags which have it as their prefered parent are the |
| 1214 | 1214 | # successors of a branch. |
| 1215 | 1215 | |
| 1216 | 1216 | set theset ('[join $branches {','}]') |
| 1217 | - foreach {bid child} [state run " | |
| 1217 | + foreach {bid child} [state run [subst -nocommands -nobackslashes { | |
| 1218 | 1218 | SELECT B.bid, R.rid |
| 1219 | 1219 | FROM branch B, revision R |
| 1220 | 1220 | WHERE B.bid IN $theset |
| 1221 | 1221 | AND B.first = R.rid |
| 1222 | - "] { | |
| 1222 | + }]] { | |
| 1223 | 1223 | lappend dependencies([list sym::branch $bid]) [list rev $child] |
| 1224 | 1224 | } |
| 1225 | - foreach {bid child} [state run " | |
| 1225 | + foreach {bid child} [state run [subst -nocommands -nobackslashes { | |
| 1226 | 1226 | SELECT B.bid, BX.bid |
| 1227 | 1227 | FROM branch B, preferedparent P, branch BX |
| 1228 | 1228 | WHERE B.bid IN $theset |
| 1229 | 1229 | AND B.sid = P.pid |
| 1230 | 1230 | AND BX.sid = P.sid |
| 1231 | - "] { | |
| 1231 | + }]] { | |
| 1232 | 1232 | lappend dependencies([list sym::branch $bid]) [list sym::branch $child] |
| 1233 | 1233 | } |
| 1234 | - foreach {bid child} [state run " | |
| 1234 | + foreach {bid child} [state run [subst -nocommands -nobackslashes { | |
| 1235 | 1235 | SELECT B.bid, T.tid |
| 1236 | 1236 | FROM branch B, preferedparent P, tag T |
| 1237 | 1237 | WHERE B.bid IN $theset |
| 1238 | 1238 | AND B.sid = P.pid |
| 1239 | 1239 | AND T.sid = P.sid |
| 1240 | - "] { | |
| 1240 | + }]] { | |
| 1241 | 1241 | lappend dependencies([list sym::branch $bid]) [list sym::tag $child] |
| 1242 | 1242 | } |
| 1243 | 1243 | return |
| 1244 | 1244 | } |
| 1245 | 1245 | |
| @@ -1250,11 +1250,11 @@ | ||
| 1250 | 1250 | # millions of dependency pairs (in extreme cases (Example: Tcl |
| 1251 | 1251 | # CVS)) we return a very short and much more manageable list |
| 1252 | 1252 | # of changesets. |
| 1253 | 1253 | |
| 1254 | 1254 | set theset ('[join $branches {','}]') |
| 1255 | - return [state run " | |
| 1255 | + return [state run [subst -nocommands -nobackslashes { | |
| 1256 | 1256 | SELECT C.cid |
| 1257 | 1257 | FROM branch B, revision R, csitem CI, changeset C |
| 1258 | 1258 | WHERE B.bid IN $theset |
| 1259 | 1259 | AND B.first = R.rid |
| 1260 | 1260 | AND CI.iid = R.rid |
| @@ -1276,11 +1276,11 @@ | ||
| 1276 | 1276 | AND B.sid = P.pid |
| 1277 | 1277 | AND T.sid = P.sid |
| 1278 | 1278 | AND CI.iid = T.tid |
| 1279 | 1279 | AND C.cid = CI.cid |
| 1280 | 1280 | AND C.type = 1 |
| 1281 | - "] | |
| 1281 | + }]] | |
| 1282 | 1282 | return |
| 1283 | 1283 | } |
| 1284 | 1284 | |
| 1285 | 1285 | typemethod limits {branches} { |
| 1286 | 1286 | # Notes. This method exists only for branches. It is needed to |
| 1287 | 1287 |
| --- tools/cvs2fossil/lib/c2f_prev.tcl | |
| +++ tools/cvs2fossil/lib/c2f_prev.tcl | |
| @@ -628,15 +628,15 @@ | |
| 628 | |
| 629 | array set delta {} |
| 630 | array set stamp {} |
| 631 | |
| 632 | set theset ('[join $revisions {','}]') |
| 633 | foreach {rid time} [state run " |
| 634 | SELECT R.rid, R.date |
| 635 | FROM revision R |
| 636 | WHERE R.rid IN $theset |
| 637 | "] { |
| 638 | set stamp($rid) $time |
| 639 | } |
| 640 | |
| 641 | set n 0 |
| 642 | foreach rid [lrange $revisions 0 end-1] rnext [lrange $revisions 1 end] { |
| @@ -829,15 +829,15 @@ | |
| 829 | } |
| 830 | |
| 831 | # result = list (mintime, maxtime) |
| 832 | typemethod timerange {items} { |
| 833 | set theset ('[join $items {','}]') |
| 834 | return [state run " |
| 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} { |
| 843 | upvar 1 $dv dependencies |
| @@ -849,11 +849,11 @@ | |
| 849 | # revisions we start from. Sensible as we are looking for |
| 850 | # changeset internal dependencies. |
| 851 | |
| 852 | array set dep {} |
| 853 | |
| 854 | foreach {rid child} [state run " |
| 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 |
| @@ -873,11 +873,11 @@ | |
| 873 | AND R.isdefault -- Restrict to NTDB |
| 874 | AND R.dbchild IS NOT NULL -- and last NTDB belonging to trunk |
| 875 | AND RA.rid = R.dbchild -- Go directly to trunk root |
| 876 | AND RA.child IS NOT NULL -- Has primary child. |
| 877 | AND RA.child IN $theset -- Which is also of interest |
| 878 | "] { |
| 879 | # Consider moving this to the integrity module. |
| 880 | integrity assert {$rid != $child} {Revision $rid depends on itself.} |
| 881 | lappend dependencies($rid) $child |
| 882 | set dep($rid,$child) . |
| 883 | } |
| @@ -903,15 +903,15 @@ | |
| 903 | # We allow revisions to be far apart in time in the same |
| 904 | # changeset, but in turn need the pseudo-dependencies to |
| 905 | # handle this. |
| 906 | |
| 907 | array set fids {} |
| 908 | foreach {rid fid} [state run " |
| 909 | SELECT R.rid, R.fid |
| 910 | FROM revision R |
| 911 | WHERE R.rid IN $theset |
| 912 | "] { lappend fids($fid) $rid } |
| 913 | |
| 914 | foreach {fid rids} [array get fids] { |
| 915 | if {[llength $rids] < 2} continue |
| 916 | foreach a $rids { |
| 917 | foreach b $rids { |
| @@ -993,11 +993,11 @@ | |
| 993 | # '1.2' revision) is a successor, if it exists. |
| 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 " |
| 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 |
| @@ -1014,29 +1014,29 @@ | |
| 1014 | WHERE R.rid IN $theset -- Restrict to revisions of interest |
| 1015 | AND R.isdefault -- Restrict to NTDB |
| 1016 | AND R.dbchild IS NOT NULL -- and last NTDB belonging to trunk |
| 1017 | AND RA.rid = R.dbchild -- Go directly to trunk root |
| 1018 | AND RA.child IS NOT NULL -- Has primary child. |
| 1019 | "] { |
| 1020 | # Consider moving this to the integrity module. |
| 1021 | integrity assert {$rid != $child} {Revision $rid depends on itself.} |
| 1022 | lappend dependencies([list rev $rid]) [list rev $child] |
| 1023 | } |
| 1024 | foreach {rid child} [state run " |
| 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 " |
| 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 | } |
| 1042 | |
| @@ -1047,11 +1047,11 @@ | |
| 1047 | # millions of dependency pairs (in extreme cases (Example: Tcl |
| 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 " |
| 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 |
| @@ -1090,11 +1090,11 @@ | |
| 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 | # # ## ### ##### ######## ############# ##################### |
| 1100 | ## Helper singleton. Commands for tag symbol changesets. |
| @@ -1121,16 +1121,16 @@ | |
| 1121 | typemethod timerange {tags} { |
| 1122 | # The range is defined as the range of the revisions the tags |
| 1123 | # are attached to. |
| 1124 | |
| 1125 | set theset ('[join $tags {','}]') |
| 1126 | return [state run " |
| 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} { |
| 1136 | # Tags have no successors. |
| @@ -1179,16 +1179,16 @@ | |
| 1179 | # spawning them, hence they have no real timerange any |
| 1180 | # longer. By using 0 we put them in front of everything else, |
| 1181 | # as they logically are. |
| 1182 | |
| 1183 | set theset ('[join $branches {','}]') |
| 1184 | return [state run " |
| 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} { |
| 1194 | # Note: Revisions and tags cannot cause the loop. Being of a |
| @@ -1212,34 +1212,34 @@ | |
| 1212 | # The first revision committed on a branch, and all branches |
| 1213 | # and tags which have it as their prefered parent are the |
| 1214 | # successors of a branch. |
| 1215 | |
| 1216 | set theset ('[join $branches {','}]') |
| 1217 | foreach {bid child} [state run " |
| 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 " |
| 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 " |
| 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 | } |
| 1245 | |
| @@ -1250,11 +1250,11 @@ | |
| 1250 | # millions of dependency pairs (in extreme cases (Example: Tcl |
| 1251 | # CVS)) we return a very short and much more manageable list |
| 1252 | # of changesets. |
| 1253 | |
| 1254 | set theset ('[join $branches {','}]') |
| 1255 | return [state run " |
| 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 |
| @@ -1276,11 +1276,11 @@ | |
| 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} { |
| 1286 | # Notes. This method exists only for branches. It is needed to |
| 1287 |
| --- tools/cvs2fossil/lib/c2f_prev.tcl | |
| +++ tools/cvs2fossil/lib/c2f_prev.tcl | |
| @@ -628,15 +628,15 @@ | |
| 628 | |
| 629 | array set delta {} |
| 630 | array set stamp {} |
| 631 | |
| 632 | set theset ('[join $revisions {','}]') |
| 633 | foreach {rid time} [state run [subst -nocommands -nobackslashes { |
| 634 | SELECT R.rid, R.date |
| 635 | FROM revision R |
| 636 | WHERE R.rid IN $theset |
| 637 | }]] { |
| 638 | set stamp($rid) $time |
| 639 | } |
| 640 | |
| 641 | set n 0 |
| 642 | foreach rid [lrange $revisions 0 end-1] rnext [lrange $revisions 1 end] { |
| @@ -829,15 +829,15 @@ | |
| 829 | } |
| 830 | |
| 831 | # result = list (mintime, maxtime) |
| 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} { |
| 843 | upvar 1 $dv dependencies |
| @@ -849,11 +849,11 @@ | |
| 849 | # revisions we start from. Sensible as we are looking for |
| 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 |
| @@ -873,11 +873,11 @@ | |
| 873 | AND R.isdefault -- Restrict to NTDB |
| 874 | AND R.dbchild IS NOT NULL -- and last NTDB belonging to trunk |
| 875 | AND RA.rid = R.dbchild -- Go directly to trunk root |
| 876 | AND RA.child IS NOT NULL -- Has primary child. |
| 877 | AND RA.child IN $theset -- Which is also of interest |
| 878 | }]] { |
| 879 | # Consider moving this to the integrity module. |
| 880 | integrity assert {$rid != $child} {Revision $rid depends on itself.} |
| 881 | lappend dependencies($rid) $child |
| 882 | set dep($rid,$child) . |
| 883 | } |
| @@ -903,15 +903,15 @@ | |
| 903 | # We allow revisions to be far apart in time in the same |
| 904 | # changeset, but in turn need the pseudo-dependencies to |
| 905 | # handle this. |
| 906 | |
| 907 | array set fids {} |
| 908 | foreach {rid fid} [state run [subst -nocommands -nobackslashes { |
| 909 | SELECT R.rid, R.fid |
| 910 | FROM revision R |
| 911 | WHERE R.rid IN $theset |
| 912 | }]] { lappend fids($fid) $rid } |
| 913 | |
| 914 | foreach {fid rids} [array get fids] { |
| 915 | if {[llength $rids] < 2} continue |
| 916 | foreach a $rids { |
| 917 | foreach b $rids { |
| @@ -993,11 +993,11 @@ | |
| 993 | # '1.2' revision) is a successor, if it exists. |
| 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 |
| @@ -1014,29 +1014,29 @@ | |
| 1014 | WHERE R.rid IN $theset -- Restrict to revisions of interest |
| 1015 | AND R.isdefault -- Restrict to NTDB |
| 1016 | AND R.dbchild IS NOT NULL -- and last NTDB belonging to trunk |
| 1017 | AND RA.rid = R.dbchild -- Go directly to trunk root |
| 1018 | AND RA.child IS NOT NULL -- Has primary child. |
| 1019 | }]] { |
| 1020 | # Consider moving this to the integrity module. |
| 1021 | integrity assert {$rid != $child} {Revision $rid depends on itself.} |
| 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 | } |
| 1042 | |
| @@ -1047,11 +1047,11 @@ | |
| 1047 | # millions of dependency pairs (in extreme cases (Example: Tcl |
| 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 |
| @@ -1090,11 +1090,11 @@ | |
| 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 | # # ## ### ##### ######## ############# ##################### |
| 1100 | ## Helper singleton. Commands for tag symbol changesets. |
| @@ -1121,16 +1121,16 @@ | |
| 1121 | typemethod timerange {tags} { |
| 1122 | # The range is defined as the range of the revisions the tags |
| 1123 | # are attached to. |
| 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} { |
| 1136 | # Tags have no successors. |
| @@ -1179,16 +1179,16 @@ | |
| 1179 | # spawning them, hence they have no real timerange any |
| 1180 | # longer. By using 0 we put them in front of everything else, |
| 1181 | # as they logically are. |
| 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} { |
| 1194 | # Note: Revisions and tags cannot cause the loop. Being of a |
| @@ -1212,34 +1212,34 @@ | |
| 1212 | # The first revision committed on a branch, and all branches |
| 1213 | # and tags which have it as their prefered parent are the |
| 1214 | # successors of a branch. |
| 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 | } |
| 1245 | |
| @@ -1250,11 +1250,11 @@ | |
| 1250 | # millions of dependency pairs (in extreme cases (Example: Tcl |
| 1251 | # CVS)) we return a very short and much more manageable list |
| 1252 | # of changesets. |
| 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 |
| @@ -1276,11 +1276,11 @@ | |
| 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} { |
| 1286 | # Notes. This method exists only for branches. It is needed to |
| 1287 |