Overview
SHA1 Hash: | 0ee9711e2e4cc2bf754951a1f4ab156f927be865 |
---|---|
Date: | 2007-12-05 02:29:48 |
User: | aku |
Comment: | Went to explicit var-substitution for the dynamic sql queries, makes formatting easier. |
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 [9958d4b1a2] to [28af7570f1].
@@ -628,15 +628,15 @@ array set delta {} array set stamp {} set theset ('[join $revisions {','}]') - foreach {rid time} [state run " + foreach {rid time} [state run [subst -nocommands -nobackslashes { SELECT R.rid, R.date FROM revision R WHERE R.rid IN $theset - "] { + }]] { set stamp($rid) $time } set n 0 foreach rid [lrange $revisions 0 end-1] rnext [lrange $revisions 1 end] { @@ -829,15 +829,15 @@ } # result = list (mintime, maxtime) typemethod timerange {items} { set theset ('[join $items {','}]') - return [state run " + return [state run [subst -nocommands -nobackslashes { SELECT MIN(R.date), MAX(R.date) FROM revision R WHERE R.rid IN $theset - "] + }]] } # var(dv) = dict (revision -> list (revision)) typemethod internalsuccessors {dv revisions} { upvar 1 $dv dependencies @@ -849,11 +849,11 @@ # revisions we start from. Sensible as we are looking for # changeset internal dependencies. array set dep {} - foreach {rid child} [state run " + foreach {rid child} [state run [subst -nocommands -nobackslashes { -- (1) Primary child SELECT R.rid, R.child FROM revision R WHERE R.rid IN $theset -- Restrict to revisions of interest AND R.child IS NOT NULL -- Has primary child @@ -873,11 +873,11 @@ AND R.isdefault -- Restrict to NTDB AND R.dbchild IS NOT NULL -- and last NTDB belonging to trunk AND RA.rid = R.dbchild -- Go directly to trunk root AND RA.child IS NOT NULL -- Has primary child. AND RA.child IN $theset -- Which is also of interest - "] { + }]] { # Consider moving this to the integrity module. integrity assert {$rid != $child} {Revision $rid depends on itself.} lappend dependencies($rid) $child set dep($rid,$child) . } @@ -903,15 +903,15 @@ # We allow revisions to be far apart in time in the same # changeset, but in turn need the pseudo-dependencies to # handle this. array set fids {} - foreach {rid fid} [state run " + foreach {rid fid} [state run [subst -nocommands -nobackslashes { SELECT R.rid, R.fid FROM revision R WHERE R.rid IN $theset - "] { lappend fids($fid) $rid } + }]] { lappend fids($fid) $rid } foreach {fid rids} [array get fids] { if {[llength $rids] < 2} continue foreach a $rids { foreach b $rids { @@ -993,11 +993,11 @@ # '1.2' revision) is a successor, if it exists. # Note that the branches spawned from the revisions, and the # tags associated with them are successors as well. - foreach {rid child} [state run " + foreach {rid child} [state run [subst -nocommands -nobackslashes { -- (1) Primary child SELECT R.rid, R.child FROM revision R WHERE R.rid IN $theset -- Restrict to revisions of interest AND R.child IS NOT NULL -- Has primary child @@ -1014,29 +1014,29 @@ WHERE R.rid IN $theset -- Restrict to revisions of interest AND R.isdefault -- Restrict to NTDB AND R.dbchild IS NOT NULL -- and last NTDB belonging to trunk AND RA.rid = R.dbchild -- Go directly to trunk root AND RA.child IS NOT NULL -- Has primary child. - "] { + }]] { # Consider moving this to the integrity module. integrity assert {$rid != $child} {Revision $rid depends on itself.} lappend dependencies([list rev $rid]) [list rev $child] } - foreach {rid child} [state run " + foreach {rid child} [state run [subst -nocommands -nobackslashes { SELECT R.rid, T.tid FROM revision R, tag T WHERE R.rid IN $theset AND T.rev = R.rid - "] { + }]] { lappend dependencies([list rev $rid]) [list sym::tag $child] } - foreach {rid child} [state run " + foreach {rid child} [state run [subst -nocommands -nobackslashes { SELECT R.rid, B.bid FROM revision R, branch B WHERE R.rid IN $theset AND B.root = R.rid - "] { + }]] { lappend dependencies([list rev $rid]) [list sym::branch $child] } return } @@ -1047,11 +1047,11 @@ # millions of dependency pairs (in extreme cases (Example: Tcl # CVS)) we return a very short and much more manageable list # of changesets. set theset ('[join $revisions {','}]') - return [state run " + return [state run [subst -nocommands -nobackslashes { SELECT C.cid FROM revision R, csitem CI, changeset C WHERE R.rid IN $theset -- Restrict to revisions of interest AND R.child IS NOT NULL -- Has primary child AND CI.iid = R.child @@ -1090,11 +1090,11 @@ WHERE R.rid in $theset AND B.root = R.rid AND CI.iid = B.bid AND C.cid = CI.cid AND C.type = 2 - "] + }]] } } # # ## ### ##### ######## ############# ##################### ## Helper singleton. Commands for tag symbol changesets. @@ -1121,16 +1121,16 @@ typemethod timerange {tags} { # The range is defined as the range of the revisions the tags # are attached to. set theset ('[join $tags {','}]') - return [state run " + return [state run [subst -nocommands -nobackslashes { SELECT MIN(R.date), MAX(R.date) FROM tag T, revision R WHERE T.tid IN $theset AND R.rid = T.rev - "] + }]] } # var(dv) = dict (item -> list (item)), item = list (type id) typemethod successors {dv tags} { # Tags have no successors. @@ -1179,16 +1179,16 @@ # spawning them, hence they have no real timerange any # longer. By using 0 we put them in front of everything else, # as they logically are. set theset ('[join $branches {','}]') - return [state run " + return [state run [subst -nocommands -nobackslashes { SELECT IFNULL(MIN(R.date),0), IFNULL(MAX(R.date),0) FROM branch B, revision R WHERE B.bid IN $theset AND R.rid = B.root - "] + }]] } # result = 4-list (itemtype itemid nextitemtype nextitemid ...) typemethod loops {branches} { # Note: Revisions and tags cannot cause the loop. Being of a @@ -1212,34 +1212,34 @@ # The first revision committed on a branch, and all branches # and tags which have it as their prefered parent are the # successors of a branch. set theset ('[join $branches {','}]') - foreach {bid child} [state run " + foreach {bid child} [state run [subst -nocommands -nobackslashes { SELECT B.bid, R.rid FROM branch B, revision R WHERE B.bid IN $theset AND B.first = R.rid - "] { + }]] { lappend dependencies([list sym::branch $bid]) [list rev $child] } - foreach {bid child} [state run " + foreach {bid child} [state run [subst -nocommands -nobackslashes { SELECT B.bid, BX.bid FROM branch B, preferedparent P, branch BX WHERE B.bid IN $theset AND B.sid = P.pid AND BX.sid = P.sid - "] { + }]] { lappend dependencies([list sym::branch $bid]) [list sym::branch $child] } - foreach {bid child} [state run " + foreach {bid child} [state run [subst -nocommands -nobackslashes { SELECT B.bid, T.tid FROM branch B, preferedparent P, tag T 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 } @@ -1250,11 +1250,11 @@ # millions of dependency pairs (in extreme cases (Example: Tcl # CVS)) we return a very short and much more manageable list # of changesets. set theset ('[join $branches {','}]') - return [state run " + return [state run [subst -nocommands -nobackslashes { SELECT C.cid FROM branch B, revision R, csitem CI, changeset C WHERE B.bid IN $theset AND B.first = R.rid AND CI.iid = R.rid @@ -1276,11 +1276,11 @@ AND B.sid = P.pid AND T.sid = P.sid AND CI.iid = T.tid AND C.cid = CI.cid AND C.type = 1 - "] + }]] return } typemethod limits {branches} { # Notes. This method exists only for branches. It is needed to