Diff
Not logged in

Differences From:

File tools/cvs2fossil/lib/c2f_prev.tcl part of check-in [3c0ef2c379] - Removed lots of now dead code. Added a note to the last remaining user of the changeset method 'nextmap'. by aku on 2007-12-05 02:21:00. [view]

To:

File tools/cvs2fossil/lib/c2f_prev.tcl part of check-in [0ee9711e2e] - Went to explicit var-substitution for the dynamic sql queries, makes formatting easier. by aku on 2007-12-05 02:29:48. [view]

@@ -629,13 +629,13 @@
 	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
@@ -830,13 +830,13 @@
 
     # 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} {
@@ -850,9 +850,9 @@
 	# 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
@@ -874,9 +874,9 @@
 	    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) .
@@ -904,13 +904,13 @@
 	# 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 {
@@ -994,9 +994,9 @@
 
 	# 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
@@ -1015,27 +1015,27 @@
 	    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
     }
@@ -1048,9 +1048,9 @@
         # 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
@@ -1091,9 +1091,9 @@
 	    AND    B.root = R.rid
             AND    CI.iid = B.bid
             AND    C.cid = CI.cid
             AND    C.type = 2
-	"]
+	}]]
     }
 }
 
 # # ## ### ##### ######## ############# #####################
@@ -1122,14 +1122,14 @@
 	# 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} {
@@ -1180,14 +1180,14 @@
 	# 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} {
@@ -1213,32 +1213,32 @@
 	# 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
     }
@@ -1251,9 +1251,9 @@
         # 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
@@ -1277,9 +1277,9 @@
 	    AND    T.sid = P.sid
             AND    CI.iid = T.tid
             AND    C.cid = CI.cid
             AND    C.type = 1
-	"]
+	}]]
 	return
     }
 
     typemethod limits {branches} {