Diff
Not logged in

Differences From:

File tools/cvs2fossil/lib/c2f_prev.tcl part of check-in [6809145eb1] - More comments on sql statements. by aku on 2008-01-19 06:07:49. [view]

To:

File tools/cvs2fossil/lib/c2f_prev.tcl part of check-in [49dd66f64f] - Moved the code loading changesets from state to its proper class. by aku on 2008-01-30 03:23:02. [view]

@@ -21,8 +21,9 @@
 package require struct::set                           ; # Set operations.
 package require vc::tools::misc                       ; # Text formatting
 package require vc::tools::trouble                    ; # Error reporting.
 package require vc::tools::log                        ; # User feedback.
+package require vc::fossil::import::cvs::repository   ; # Repository management.
 package require vc::fossil::import::cvs::state        ; # State storage.
 package require vc::fossil::import::cvs::integrity    ; # State integrity checks.
 
 # # ## ### ##### ######## ############# #####################
@@ -550,11 +551,32 @@
 	}] { set mycstype($name) $tid }
 	return
     }
 
+    typemethod load {} {
+	set n 0
+	log write 2 csets {Loading the changesets}
+	foreach {id pid cstype srcid} [state run {
+	    SELECT C.cid, C.pid, CS.name, C.src
+	    FROM   changeset C, cstype CS
+	    WHERE  C.type = CS.tid
+	    ORDER BY C.cid
+	}] {
+	    log progress 2 csets $n {}
+	    set r [$type %AUTO% [repository projectof $pid] $cstype $srcid [state run {
+		SELECT C.iid
+		FROM   csitem C
+		WHERE  C.cid = $id
+		ORDER BY C.pos
+	    }] $id]
+	    incr n
+	}
+	return
+    }
+
     typemethod loadcounter {} {
 	# Initialize the counter from the state
-	log write 2 initcsets {Loading changeset counter}
+	log write 2 csets {Loading changeset counter}
 	set mycounter [state one { SELECT MAX(cid) FROM changeset }]
 	return
     }
 
@@ -1337,8 +1359,9 @@
 
 namespace eval ::vc::fossil::import::cvs::project {
     namespace export rev
     namespace eval rev {
+	namespace import ::vc::fossil::import::cvs::repository
 	namespace import ::vc::fossil::import::cvs::state
 	namespace import ::vc::fossil::import::cvs::integrity
 	namespace import ::vc::tools::misc::*
 	namespace import ::vc::tools::trouble