| | @@ -122,62 +122,14 @@ |
| 122 | 122 | FROM cssuccessor S |
| 123 | 123 | WHERE S.cid = $myid |
| 124 | 124 | }] [mytypemethod of]] |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | | - # result = dict (item -> list (changeset)) |
| 128 | | - method successormap {} { |
| 129 | | - # NOTE / FUTURE: Definitive bottleneck (can be millions of pairs). |
| 130 | | - # |
| 131 | | - # Only user is pass 9, computing the limits of backward |
| 132 | | - # branches per branch in the changeset. TODO: Fold that into |
| 133 | | - # the SQL query, i.e. move the crunching from Tcl to C. |
| 134 | | - |
| 135 | | - array set tmp {} |
| 136 | | - foreach {rev children} [$self nextmap] { |
| 137 | | - foreach child $children { |
| 138 | | - lappend tmp($rev) $myitemmap($child) |
| 139 | | - } |
| 140 | | - set tmp($rev) [lsort -unique $tmp($rev)] |
| 141 | | - } |
| 142 | | - return [array get tmp] |
| 143 | | - } |
| 144 | | - |
| 145 | | - # result = dict (item -> list (changeset)) |
| 146 | | - method predecessormap {} { |
| 147 | | - # NOTE / FUTURE: Definitive bottleneck (can be millions of pairs). |
| 148 | | - # |
| 149 | | - # Only user is pass 9, computing the limits of backward |
| 150 | | - # branches per branch in the changeset. TODO: Fold that into |
| 151 | | - # the SQL query, i.e. move the crunching from Tcl to C. |
| 152 | | - |
| 153 | | - array set tmp {} |
| 154 | | - foreach {rev children} [$self premap] { |
| 155 | | - foreach child $children { |
| 156 | | - lappend tmp($rev) $myitemmap($child) |
| 157 | | - } |
| 158 | | - set tmp($rev) [lsort -unique $tmp($rev)] |
| 159 | | - } |
| 160 | | - return [array get tmp] |
| 161 | | - } |
| 162 | | - |
| 163 | 127 | # item -> list (item) |
| 164 | 128 | method nextmap {} { |
| 165 | | - #if {[llength $mynextmap]} { return $mynextmap } |
| 166 | 129 | $mytypeobj successors tmp $myitems |
| 167 | 130 | return [array get tmp] |
| 168 | | - #set mynextmap [array get tmp] |
| 169 | | - #return $mynextmap |
| 170 | | - } |
| 171 | | - |
| 172 | | - # item -> list (item) |
| 173 | | - method premap {} { |
| 174 | | - #if {[llength $mypremap]} { return $mypremap } |
| 175 | | - $mytypeobj predecessors tmp $myitems |
| 176 | | - return [array get tmp] |
| 177 | | - #set mypremap [array get tmp] |
| 178 | | - #return $mypremap |
| 179 | 131 | } |
| 180 | 132 | |
| 181 | 133 | method breakinternaldependencies {} { |
| 182 | 134 | |
| 183 | 135 | ## |
| | @@ -576,18 +528,10 @@ |
| 576 | 528 | # is based on. |
| 577 | 529 | variable myitems {} ; # List of the file level revisions, |
| 578 | 530 | # tags, or branches in the cset, as |
| 579 | 531 | # ids. Not tagged. |
| 580 | 532 | variable mytitems {} ; # As myitems, the tagged form. |
| 581 | | - variable mypremap {} ; # Dictionary mapping from the items (tagged now) |
| 582 | | - # to their predecessors, also tagged. A |
| 583 | | - # cache to avoid loading this from the |
| 584 | | - # state more than once. |
| 585 | | - variable mynextmap {} ; # Dictionary mapping from the items (tagged) |
| 586 | | - # to their successors (also tagged). A |
| 587 | | - # cache to avoid loading this from the |
| 588 | | - # state more than once. |
| 589 | 533 | variable mypos {} ; # Commit position of the changeset, if |
| 590 | 534 | # known. |
| 591 | 535 | |
| 592 | 536 | # # ## ### ##### ######## ############# |
| 593 | 537 | ## Internal methods |
| | @@ -1094,71 +1038,10 @@ |
| 1094 | 1038 | lappend dependencies([list rev $rid]) [list sym::branch $child] |
| 1095 | 1039 | } |
| 1096 | 1040 | return |
| 1097 | 1041 | } |
| 1098 | 1042 | |
| 1099 | | - # var(dv) = dict (item -> list (item)), item = list (type id) |
| 1100 | | - typemethod predecessors {dv revisions} { |
| 1101 | | - upvar 1 $dv dependencies |
| 1102 | | - set theset ('[join $revisions {','}]') |
| 1103 | | - |
| 1104 | | - # The following cases specify when a revision P is a |
| 1105 | | - # predecessor of a revision R. Each of the cases translates |
| 1106 | | - # into one of the branches of the SQL UNION coming below. |
| 1107 | | - # |
| 1108 | | - # (1) The immediate parent R.parent of R is a predecessor of |
| 1109 | | - # R. NOTE: This is true for R either primary or secondary |
| 1110 | | - # child of P. It not necessary to distinguish the two |
| 1111 | | - # cases, in contrast to the code retrieving the successor |
| 1112 | | - # information. |
| 1113 | | - # |
| 1114 | | - # (2) The complement of successor case (3). The trunk root is |
| 1115 | | - # a predecessor of a NTDB root. REMOVED. See 'successors' |
| 1116 | | - # for the explanation. |
| 1117 | | - # |
| 1118 | | - # (3) The complement of successor case (4). The last NTDB |
| 1119 | | - # revision belonging to the trunk is a predecessor of the |
| 1120 | | - # primary child of the trunk root (The '1.2' revision). |
| 1121 | | - |
| 1122 | | - foreach {rid parent} [state run " |
| 1123 | | - -- (1) Primary parent, can be in different LOD for first in a branch |
| 1124 | | - SELECT R.rid, R.parent |
| 1125 | | - FROM revision R |
| 1126 | | - WHERE R.rid IN $theset -- Restrict to revisions of interest |
| 1127 | | - AND R.parent IS NOT NULL -- Has primary parent |
| 1128 | | - UNION |
| 1129 | | - -- (3) Last NTDB on trunk is predecessor of child of trunk root |
| 1130 | | - SELECT R.rid, RA.dbparent |
| 1131 | | - FROM revision R, revision RA |
| 1132 | | - WHERE R.rid IN $theset -- Restrict to revisions of interest |
| 1133 | | - AND NOT R.isdefault -- not on NTDB |
| 1134 | | - AND R.parent IS NOT NULL -- which are not root |
| 1135 | | - AND RA.rid = R.parent -- go to their parent |
| 1136 | | - AND RA.dbparent IS NOT NULL -- which has to refer to NTDB's root |
| 1137 | | - "] { |
| 1138 | | - # Consider moving this to the integrity module. |
| 1139 | | - integrity assert {$rid != $parent} {Revision $rid depends on itself.} |
| 1140 | | - lappend dependencies([list rev $rid]) [list rev $parent] |
| 1141 | | - } |
| 1142 | | - |
| 1143 | | - # The revisions which are the first on a branch have that |
| 1144 | | - # branch as their predecessor. Note that revisions cannot be |
| 1145 | | - # on tags in the same manner, so tags cannot be predecessors |
| 1146 | | - # of revisions. This complements that they have no successors |
| 1147 | | - # (See sym::tag/successors). |
| 1148 | | - |
| 1149 | | - foreach {rid parent} [state run " |
| 1150 | | - SELECT R.rid, B.bid |
| 1151 | | - FROM revision R, branch B |
| 1152 | | - WHERE R.rid IN $theset |
| 1153 | | - AND B.first = R.rid |
| 1154 | | - "] { |
| 1155 | | - lappend dependencies([list rev $rid]) [list sym::branch $parent] |
| 1156 | | - } |
| 1157 | | - return |
| 1158 | | - } |
| 1159 | | - |
| 1160 | 1043 | # result = list (changeset-id) |
| 1161 | 1044 | typemethod cs_successors {revisions} { |
| 1162 | 1045 | # This is a variant of 'successors' which maps the low-level |
| 1163 | 1046 | # data directly to the associated changesets. I.e. instead |
| 1164 | 1047 | # millions of dependency pairs (in extreme cases (Example: Tcl |
| | @@ -1258,49 +1141,10 @@ |
| 1258 | 1141 | typemethod loops {tags} { |
| 1259 | 1142 | # Tags have no successors, therefore cannot cause loops |
| 1260 | 1143 | return {} |
| 1261 | 1144 | } |
| 1262 | 1145 | |
| 1263 | | - # var(dv) = dict (item -> list (item)), item = list (type id) |
| 1264 | | - typemethod predecessors {dv tags} { |
| 1265 | | - upvar 1 $dv dependencies |
| 1266 | | - # The predecessors of a tag are all the revisions the tags are |
| 1267 | | - # attached to, as well as all the branches or tags which are |
| 1268 | | - # their prefered parents. |
| 1269 | | - |
| 1270 | | - set theset ('[join $tags {','}]') |
| 1271 | | - foreach {tid parent} [state run " |
| 1272 | | - SELECT T.tid, R.rid |
| 1273 | | - FROM tag T, revision R |
| 1274 | | - WHERE T.tid IN $theset |
| 1275 | | - AND T.rev = R.rid |
| 1276 | | - "] { |
| 1277 | | - lappend dependencies([list sym::tag $tid]) [list rev $parent] |
| 1278 | | - } |
| 1279 | | - |
| 1280 | | - foreach {tid parent} [state run " |
| 1281 | | - SELECT T.tid, B.bid |
| 1282 | | - FROM tag T, preferedparent P, branch B |
| 1283 | | - WHERE T.tid IN $theset |
| 1284 | | - AND T.sid = P.sid |
| 1285 | | - AND P.pid = B.sid |
| 1286 | | - "] { |
| 1287 | | - lappend dependencies([list sym::tag $tid]) [list sym::branch $parent] |
| 1288 | | - } |
| 1289 | | - |
| 1290 | | - foreach {tid parent} [state run " |
| 1291 | | - SELECT T.tid, TX.tid |
| 1292 | | - FROM tag T, preferedparent P, tag TX |
| 1293 | | - WHERE T.tid IN $theset |
| 1294 | | - AND T.sid = P.sid |
| 1295 | | - AND P.pid = TX.sid |
| 1296 | | - "] { |
| 1297 | | - lappend dependencies([list sym::tag $tid]) [list sym::tag $parent] |
| 1298 | | - } |
| 1299 | | - return |
| 1300 | | - } |
| 1301 | | - |
| 1302 | 1146 | # result = list (changeset-id) |
| 1303 | 1147 | typemethod cs_successors {tags} { |
| 1304 | 1148 | # Tags have no successors. |
| 1305 | 1149 | return |
| 1306 | 1150 | } |
| | @@ -1394,47 +1238,10 @@ |
| 1394 | 1238 | AND B.sid = P.pid |
| 1395 | 1239 | AND T.sid = P.sid |
| 1396 | 1240 | "] { |
| 1397 | 1241 | lappend dependencies([list sym::branch $bid]) [list sym::tag $child] |
| 1398 | 1242 | } |
| 1399 | | - return |
| 1400 | | - } |
| 1401 | | - |
| 1402 | | - # var(dv) = dict (item -> list (item)), item = list (type id) |
| 1403 | | - typemethod predecessors {dv branches} { |
| 1404 | | - upvar 1 $dv dependencies |
| 1405 | | - # The predecessors of a branch are all the revisions the |
| 1406 | | - # branches are spawned from, as well as all the branches or |
| 1407 | | - # tags which are their prefered parents. |
| 1408 | | - |
| 1409 | | - set theset ('[join $branches {','}]') |
| 1410 | | - foreach {bid parent} [state run " |
| 1411 | | - SELECT B.Bid, R.rid |
| 1412 | | - FROM branch B, revision R |
| 1413 | | - WHERE B.bid IN $theset |
| 1414 | | - AND B.root = R.rid |
| 1415 | | - "] { |
| 1416 | | - lappend dependencies([list sym::branch $bid]) [list rev $parent] |
| 1417 | | - } |
| 1418 | | - foreach {bid parent} [state run " |
| 1419 | | - SELECT B.bid, BX.bid |
| 1420 | | - FROM branch B, preferedparent P, branch BX |
| 1421 | | - WHERE B.bid IN $theset |
| 1422 | | - AND B.sid = P.sid |
| 1423 | | - AND P.pid = BX.sid |
| 1424 | | - "] { |
| 1425 | | - lappend dependencies([list sym::branch $bid]) [list sym::branch $parent] |
| 1426 | | - } |
| 1427 | | - foreach {bid parent} [state run " |
| 1428 | | - SELECT B.bid, T.tid |
| 1429 | | - FROM branch B, preferedparent P, tag T |
| 1430 | | - WHERE B.bid IN $theset |
| 1431 | | - AND B.sid = P.sid |
| 1432 | | - AND P.pid = T.sid |
| 1433 | | - "] { |
| 1434 | | - lappend dependencies([list sym::branch $bid]) [list sym::tag $parent] |
| 1435 | | - } |
| 1436 | 1243 | return |
| 1437 | 1244 | } |
| 1438 | 1245 | |
| 1439 | 1246 | # result = list (changeset-id) |
| 1440 | 1247 | typemethod cs_successors {branches} { |
| 1441 | 1248 | |