| | @@ -742,13 +742,13 @@ |
| 742 | 742 | |
| 743 | 743 | proc PD {id} { |
| 744 | 744 | foreach {p f r} [state run { |
| 745 | 745 | SELECT P.name , F.name, R.rev |
| 746 | 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 |
| 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 | 750 | }] break |
| 751 | 751 | return "'$p : $f/$r'" |
| 752 | 752 | } |
| 753 | 753 | |
| 754 | 754 | # Printing one or more ranges, formatted, and only their border to |
| | @@ -819,13 +819,13 @@ |
| 819 | 819 | |
| 820 | 820 | typemethod str {revision} { |
| 821 | 821 | struct::list assign [state run { |
| 822 | 822 | SELECT R.rev, F.name, P.name |
| 823 | 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 |
| 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 | 827 | }] revnr fname pname |
| 828 | 828 | return "$pname/${revnr}::$fname" |
| 829 | 829 | } |
| 830 | 830 | |
| 831 | 831 | # result = list (mintime, maxtime) |
| | @@ -832,11 +832,11 @@ |
| 832 | 832 | typemethod timerange {items} { |
| 833 | 833 | set theset ('[join $items {','}]') |
| 834 | 834 | return [state run [subst -nocommands -nobackslashes { |
| 835 | 835 | SELECT MIN(R.date), MAX(R.date) |
| 836 | 836 | FROM revision R |
| 837 | | - WHERE R.rid IN $theset |
| 837 | + WHERE R.rid IN $theset -- Restrict to revisions of interest |
| 838 | 838 | }]] |
| 839 | 839 | } |
| 840 | 840 | |
| 841 | 841 | # var(dv) = dict (revision -> list (revision)) |
| 842 | 842 | typemethod internalsuccessors {dv revisions} { |
| | @@ -850,11 +850,11 @@ |
| 850 | 850 | # changeset internal dependencies. |
| 851 | 851 | |
| 852 | 852 | array set dep {} |
| 853 | 853 | |
| 854 | 854 | foreach {rid child} [state run [subst -nocommands -nobackslashes { |
| 855 | | - -- (1) Primary child |
| 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 |
| 860 | 860 | AND R.child IN $theset -- Which is also of interest |
| | @@ -928,11 +928,11 @@ |
| 928 | 928 | } |
| 929 | 929 | |
| 930 | 930 | # result = 4-list (itemtype itemid nextitemtype nextitemid ...) |
| 931 | 931 | typemethod loops {revisions} { |
| 932 | 932 | # 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 |
| 934 | 934 | # coming in cannot be in the set. |
| 935 | 935 | |
| 936 | 936 | set theset ('[join $revisions {','}]') |
| 937 | 937 | return [state run [subst -nocommands -nobackslashes { |
| 938 | 938 | -- (1) Primary child |
| | @@ -994,11 +994,11 @@ |
| 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 | 998 | foreach {rid child} [state run [subst -nocommands -nobackslashes { |
| 999 | | - -- (1) Primary child |
| 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 |
| 1004 | 1004 | UNION |
| | @@ -1022,20 +1022,20 @@ |
| 1022 | 1022 | lappend dependencies([list rev $rid]) [list rev $child] |
| 1023 | 1023 | } |
| 1024 | 1024 | foreach {rid child} [state run [subst -nocommands -nobackslashes { |
| 1025 | 1025 | SELECT R.rid, T.tid |
| 1026 | 1026 | 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 |
| 1029 | 1029 | }]] { |
| 1030 | 1030 | lappend dependencies([list rev $rid]) [list sym::tag $child] |
| 1031 | 1031 | } |
| 1032 | 1032 | foreach {rid child} [state run [subst -nocommands -nobackslashes { |
| 1033 | 1033 | SELECT R.rid, B.bid |
| 1034 | 1034 | 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 |
| 1037 | 1037 | }]] { |
| 1038 | 1038 | lappend dependencies([list rev $rid]) [list sym::branch $child] |
| 1039 | 1039 | } |
| 1040 | 1040 | return |
| 1041 | 1041 | } |
| | @@ -1048,52 +1048,55 @@ |
| 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 | 1052 | return [state run [subst -nocommands -nobackslashes { |
| 1053 | + -- (1) Primary child |
| 1053 | 1054 | SELECT C.cid |
| 1054 | 1055 | FROM revision R, csitem CI, changeset C |
| 1055 | 1056 | WHERE R.rid IN $theset -- Restrict to revisions of interest |
| 1056 | 1057 | 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 |
| 1060 | 1061 | UNION |
| 1062 | + -- (2) Secondary (branch) children |
| 1061 | 1063 | SELECT C.cid |
| 1062 | 1064 | FROM revision R, revisionbranchchildren B, csitem CI, changeset C |
| 1063 | 1065 | WHERE R.rid IN $theset -- Restrict to revisions of interest |
| 1064 | 1066 | 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 |
| 1068 | 1070 | UNION |
| 1071 | + -- (4) Child of trunk root successor of last NTDB on trunk. |
| 1069 | 1072 | SELECT C.cid |
| 1070 | 1073 | FROM revision R, revision RA, csitem CI, changeset C |
| 1071 | 1074 | WHERE R.rid IN $theset -- Restrict to revisions of interest |
| 1072 | 1075 | AND R.isdefault -- Restrict to NTDB |
| 1073 | 1076 | AND R.dbchild IS NOT NULL -- and last NTDB belonging to trunk |
| 1074 | 1077 | AND RA.rid = R.dbchild -- Go directly to trunk root |
| 1075 | 1078 | 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 |
| 1079 | 1082 | UNION |
| 1080 | 1083 | SELECT C.cid |
| 1081 | 1084 | 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 |
| 1087 | 1090 | UNION |
| 1088 | 1091 | SELECT C.cid |
| 1089 | 1092 | 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 |
| 1095 | 1098 | }]] |
| 1096 | 1099 | } |
| 1097 | 1100 | } |
| 1098 | 1101 | |
| 1099 | 1102 | # # ## ### ##### ######## ############# ##################### |
| | @@ -1107,14 +1110,14 @@ |
| 1107 | 1110 | |
| 1108 | 1111 | typemethod str {tag} { |
| 1109 | 1112 | struct::list assign [state run { |
| 1110 | 1113 | SELECT S.name, F.name, P.name |
| 1111 | 1114 | 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 |
| 1116 | 1119 | }] sname fname pname |
| 1117 | 1120 | return "$pname/T'${sname}'::$fname" |
| 1118 | 1121 | } |
| 1119 | 1122 | |
| 1120 | 1123 | # result = list (mintime, maxtime) |
| | @@ -1124,12 +1127,12 @@ |
| 1124 | 1127 | |
| 1125 | 1128 | set theset ('[join $tags {','}]') |
| 1126 | 1129 | return [state run [subst -nocommands -nobackslashes { |
| 1127 | 1130 | SELECT MIN(R.date), MAX(R.date) |
| 1128 | 1131 | 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 |
| 1131 | 1134 | }]] |
| 1132 | 1135 | } |
| 1133 | 1136 | |
| 1134 | 1137 | # var(dv) = dict (item -> list (item)), item = list (type id) |
| 1135 | 1138 | typemethod successors {dv tags} { |
| | @@ -1161,14 +1164,14 @@ |
| 1161 | 1164 | |
| 1162 | 1165 | typemethod str {branch} { |
| 1163 | 1166 | struct::list assign [state run { |
| 1164 | 1167 | SELECT S.name, F.name, P.name |
| 1165 | 1168 | 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 |
| 1170 | 1173 | }] sname fname pname |
| 1171 | 1174 | return "$pname/B'${sname}'::$fname" |
| 1172 | 1175 | } |
| 1173 | 1176 | |
| 1174 | 1177 | # result = list (mintime, maxtime) |
| | @@ -1182,12 +1185,12 @@ |
| 1182 | 1185 | |
| 1183 | 1186 | set theset ('[join $branches {','}]') |
| 1184 | 1187 | return [state run [subst -nocommands -nobackslashes { |
| 1185 | 1188 | SELECT IFNULL(MIN(R.date),0), IFNULL(MAX(R.date),0) |
| 1186 | 1189 | 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 |
| 1189 | 1192 | }]] |
| 1190 | 1193 | } |
| 1191 | 1194 | |
| 1192 | 1195 | # result = 4-list (itemtype itemid nextitemtype nextitemid ...) |
| 1193 | 1196 | typemethod loops {branches} { |
| | @@ -1197,14 +1200,14 @@ |
| 1197 | 1200 | |
| 1198 | 1201 | set theset ('[join $branches {','}]') |
| 1199 | 1202 | return [state run [subst -nocommands -nobackslashes { |
| 1200 | 1203 | SELECT B.bid, BX.bid |
| 1201 | 1204 | 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 |
| 1206 | 1209 | }]] |
| 1207 | 1210 | } |
| 1208 | 1211 | |
| 1209 | 1212 | # var(dv) = dict (item -> list (item)), item = list (type id) |
| 1210 | 1213 | typemethod successors {dv branches} { |
| | @@ -1215,30 +1218,30 @@ |
| 1215 | 1218 | |
| 1216 | 1219 | set theset ('[join $branches {','}]') |
| 1217 | 1220 | foreach {bid child} [state run [subst -nocommands -nobackslashes { |
| 1218 | 1221 | SELECT B.bid, R.rid |
| 1219 | 1222 | 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 |
| 1222 | 1225 | }]] { |
| 1223 | 1226 | lappend dependencies([list sym::branch $bid]) [list rev $child] |
| 1224 | 1227 | } |
| 1225 | 1228 | foreach {bid child} [state run [subst -nocommands -nobackslashes { |
| 1226 | 1229 | SELECT B.bid, BX.bid |
| 1227 | 1230 | 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 |
| 1231 | 1234 | }]] { |
| 1232 | 1235 | lappend dependencies([list sym::branch $bid]) [list sym::branch $child] |
| 1233 | 1236 | } |
| 1234 | 1237 | foreach {bid child} [state run [subst -nocommands -nobackslashes { |
| 1235 | 1238 | SELECT B.bid, T.tid |
| 1236 | 1239 | 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 |
| 1240 | 1243 | }]] { |
| 1241 | 1244 | lappend dependencies([list sym::branch $bid]) [list sym::tag $child] |
| 1242 | 1245 | } |
| 1243 | 1246 | return |
| 1244 | 1247 | } |
| | @@ -1253,33 +1256,33 @@ |
| 1253 | 1256 | |
| 1254 | 1257 | set theset ('[join $branches {','}]') |
| 1255 | 1258 | return [state run [subst -nocommands -nobackslashes { |
| 1256 | 1259 | SELECT C.cid |
| 1257 | 1260 | 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 |
| 1263 | 1266 | UNION |
| 1264 | 1267 | SELECT C.cid |
| 1265 | 1268 | 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 |
| 1272 | 1275 | UNION |
| 1273 | 1276 | SELECT C.cid |
| 1274 | 1277 | 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 |
| 1281 | 1284 | }]] |
| 1282 | 1285 | return |
| 1283 | 1286 | } |
| 1284 | 1287 | |
| 1285 | 1288 | typemethod limits {branches} { |
| | @@ -1294,29 +1297,29 @@ |
| 1294 | 1297 | |
| 1295 | 1298 | set maxp [state run [subst -nocommands -nobackslashes { |
| 1296 | 1299 | -- maximal predecessor position per branch |
| 1297 | 1300 | SELECT B.bid, MAX (CO.pos) |
| 1298 | 1301 | 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 |
| 1305 | 1308 | GROUP BY B.bid |
| 1306 | 1309 | }]] |
| 1307 | 1310 | |
| 1308 | 1311 | set mins [state run [subst -nocommands -nobackslashes { |
| 1309 | 1312 | -- minimal successor position per branch |
| 1310 | 1313 | SELECT B.bid, MIN (CO.pos) |
| 1311 | 1314 | 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 |
| 1318 | 1321 | GROUP BY B.bid |
| 1319 | 1322 | }]] |
| 1320 | 1323 | |
| 1321 | 1324 | return [list $maxp $mins] |
| 1322 | 1325 | } |
| 1323 | 1326 | |