Overview
SHA1 Hash: | 3c0ef2c3799a576cd72e0240545289d6e383225e |
---|---|
Date: | 2007-12-05 02:21:00 |
User: | aku |
Comment: | Removed lots of now dead code. Added a note to the last remaining user of the changeset method 'nextmap'. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified tools/cvs2fossil/lib/c2f_prev.tcl from [f2b05566df] to [9958d4b1a2].
@@ -122,62 +122,14 @@ FROM cssuccessor S WHERE S.cid = $myid }] [mytypemethod of]] } - # result = dict (item -> list (changeset)) - method successormap {} { - # NOTE / FUTURE: Definitive bottleneck (can be millions of pairs). - # - # Only user is pass 9, computing the limits of backward - # branches per branch in the changeset. TODO: Fold that into - # the SQL query, i.e. move the crunching from Tcl to C. - - array set tmp {} - foreach {rev children} [$self nextmap] { - foreach child $children { - lappend tmp($rev) $myitemmap($child) - } - set tmp($rev) [lsort -unique $tmp($rev)] - } - return [array get tmp] - } - - # result = dict (item -> list (changeset)) - method predecessormap {} { - # NOTE / FUTURE: Definitive bottleneck (can be millions of pairs). - # - # Only user is pass 9, computing the limits of backward - # branches per branch in the changeset. TODO: Fold that into - # the SQL query, i.e. move the crunching from Tcl to C. - - array set tmp {} - foreach {rev children} [$self premap] { - foreach child $children { - lappend tmp($rev) $myitemmap($child) - } - set tmp($rev) [lsort -unique $tmp($rev)] - } - return [array get tmp] - } - # item -> list (item) method nextmap {} { - #if {[llength $mynextmap]} { return $mynextmap } $mytypeobj successors tmp $myitems return [array get tmp] - #set mynextmap [array get tmp] - #return $mynextmap - } - - # item -> list (item) - method premap {} { - #if {[llength $mypremap]} { return $mypremap } - $mytypeobj predecessors tmp $myitems - return [array get tmp] - #set mypremap [array get tmp] - #return $mypremap } method breakinternaldependencies {} { ## @@ -576,18 +528,10 @@ # is based on. variable myitems {} ; # List of the file level revisions, # tags, or branches in the cset, as # ids. Not tagged. variable mytitems {} ; # As myitems, the tagged form. - variable mypremap {} ; # Dictionary mapping from the items (tagged now) - # to their predecessors, also tagged. A - # cache to avoid loading this from the - # state more than once. - variable mynextmap {} ; # Dictionary mapping from the items (tagged) - # to their successors (also tagged). A - # cache to avoid loading this from the - # state more than once. variable mypos {} ; # Commit position of the changeset, if # known. # # ## ### ##### ######## ############# ## Internal methods @@ -1094,71 +1038,10 @@ lappend dependencies([list rev $rid]) [list sym::branch $child] } return } - # var(dv) = dict (item -> list (item)), item = list (type id) - typemethod predecessors {dv revisions} { - upvar 1 $dv dependencies - set theset ('[join $revisions {','}]') - - # The following cases specify when a revision P is a - # predecessor of a revision R. Each of the cases translates - # into one of the branches of the SQL UNION coming below. - # - # (1) The immediate parent R.parent of R is a predecessor of - # R. NOTE: This is true for R either primary or secondary - # child of P. It not necessary to distinguish the two - # cases, in contrast to the code retrieving the successor - # information. - # - # (2) The complement of successor case (3). The trunk root is - # a predecessor of a NTDB root. REMOVED. See 'successors' - # for the explanation. - # - # (3) The complement of successor case (4). The last NTDB - # revision belonging to the trunk is a predecessor of the - # primary child of the trunk root (The '1.2' revision). - - foreach {rid parent} [state run " - -- (1) Primary parent, can be in different LOD for first in a branch - SELECT R.rid, R.parent - FROM revision R - WHERE R.rid IN $theset -- Restrict to revisions of interest - AND R.parent IS NOT NULL -- Has primary parent - UNION - -- (3) Last NTDB on trunk is predecessor of child of trunk root - SELECT R.rid, RA.dbparent - FROM revision R, revision RA - WHERE R.rid IN $theset -- Restrict to revisions of interest - AND NOT R.isdefault -- not on NTDB - AND R.parent IS NOT NULL -- which are not root - AND RA.rid = R.parent -- go to their parent - AND RA.dbparent IS NOT NULL -- which has to refer to NTDB's root - "] { - # Consider moving this to the integrity module. - integrity assert {$rid != $parent} {Revision $rid depends on itself.} - lappend dependencies([list rev $rid]) [list rev $parent] - } - - # The revisions which are the first on a branch have that - # branch as their predecessor. Note that revisions cannot be - # on tags in the same manner, so tags cannot be predecessors - # of revisions. This complements that they have no successors - # (See sym::tag/successors). - - foreach {rid parent} [state run " - SELECT R.rid, B.bid - FROM revision R, branch B - WHERE R.rid IN $theset - AND B.first = R.rid - "] { - lappend dependencies([list rev $rid]) [list sym::branch $parent] - } - return - } - # result = list (changeset-id) typemethod cs_successors {revisions} { # This is a variant of 'successors' which maps the low-level # data directly to the associated changesets. I.e. instead # millions of dependency pairs (in extreme cases (Example: Tcl @@ -1258,49 +1141,10 @@ typemethod loops {tags} { # Tags have no successors, therefore cannot cause loops return {} } - # var(dv) = dict (item -> list (item)), item = list (type id) - typemethod predecessors {dv tags} { - upvar 1 $dv dependencies - # The predecessors of a tag are all the revisions the tags are - # attached to, as well as all the branches or tags which are - # their prefered parents. - - set theset ('[join $tags {','}]') - foreach {tid parent} [state run " - SELECT T.tid, R.rid - FROM tag T, revision R - WHERE T.tid IN $theset - AND T.rev = R.rid - "] { - lappend dependencies([list sym::tag $tid]) [list rev $parent] - } - - foreach {tid parent} [state run " - SELECT T.tid, B.bid - FROM tag T, preferedparent P, branch B - WHERE T.tid IN $theset - AND T.sid = P.sid - AND P.pid = B.sid - "] { - lappend dependencies([list sym::tag $tid]) [list sym::branch $parent] - } - - foreach {tid parent} [state run " - SELECT T.tid, TX.tid - FROM tag T, preferedparent P, tag TX - WHERE T.tid IN $theset - AND T.sid = P.sid - AND P.pid = TX.sid - "] { - lappend dependencies([list sym::tag $tid]) [list sym::tag $parent] - } - return - } - # result = list (changeset-id) typemethod cs_successors {tags} { # Tags have no successors. return } @@ -1393,47 +1237,10 @@ WHERE B.bid IN $theset AND B.sid = P.pid AND T.sid = P.sid "] { lappend dependencies([list sym::branch $bid]) [list sym::tag $child] - } - return - } - - # var(dv) = dict (item -> list (item)), item = list (type id) - typemethod predecessors {dv branches} { - upvar 1 $dv dependencies - # The predecessors of a branch are all the revisions the - # branches are spawned from, as well as all the branches or - # tags which are their prefered parents. - - set theset ('[join $branches {','}]') - foreach {bid parent} [state run " - SELECT B.Bid, R.rid - FROM branch B, revision R - WHERE B.bid IN $theset - AND B.root = R.rid - "] { - lappend dependencies([list sym::branch $bid]) [list rev $parent] - } - foreach {bid parent} [state run " - SELECT B.bid, BX.bid - FROM branch B, preferedparent P, branch BX - WHERE B.bid IN $theset - AND B.sid = P.sid - AND P.pid = BX.sid - "] { - lappend dependencies([list sym::branch $bid]) [list sym::branch $parent] - } - foreach {bid parent} [state run " - SELECT B.bid, T.tid - FROM branch B, preferedparent P, tag T - WHERE B.bid IN $theset - AND B.sid = P.sid - AND P.pid = T.sid - "] { - lappend dependencies([list sym::branch $bid]) [list sym::tag $parent] } return } # result = list (changeset-id)
Modified tools/cvs2fossil/lib/c2f_prevlink.tcl from [3ad12043d1] to [c7d0900794].
@@ -50,11 +50,11 @@ # 1. Revisions whose predecessors are not in PREV, nor are # their successors found in NEXT. These revisions do not # count, as they did not induce any of the two dependencies # under consideration. They can be ignored. - # 2. Revisions which have predecessors in PREV and sucessors + # 2. Revisions which have predecessors in PREV and successors # in NEXT. They are called 'passthrough' in cvs2svn. They # induce both dependencies under consideration and are thus # critical in the creation of the cycle. As such they are # also unbreakable :( @@ -69,10 +69,14 @@ # If we have no passthrough revisions then splitting the # changeset between categories 3 and 4, with category 1 going # wherever, will break the cycle. If category 2 revisions are # present we can still perform the split, this will however # not break the cycle, only weaken it. + + # NOTE: This is the only remaining user of 'nextmap'. Look + # into the possibility of performing the relevant counting + # within the database. array set csetprevmap [Invert [$myprev nextmap]] array set csetnextmap [$mycset nextmap] set prevrev [$myprev items]