Check-in [49dd66f64f]
Not logged in
Overview

SHA1 Hash:49dd66f64fc236df7de37abbee1888f352aab46d
Date: 2008-01-30 03:23:02
User: aku
Comment:Moved the code loading changesets from state to its proper class.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified tools/cvs2fossil/lib/c2f_pinitcsets.tcl from [87cc4829ad] to [0ab46f96ec].

@@ -110,33 +110,15 @@
 
 	state use changeset
 	state use csitem
 	state use cstype
 
-	# Need the types first, the constructor in the loop below uses
-	# them to assert the correctness of type names.
+	# Need the types first, the constructor used inside of the
+	# 'load' below uses them to assert the correctness of type
+	# names.
 	project::rev getcstypes
-
-	# TODO: Move to project::rev
-	set n 0
-	log write 2 initcsets {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 initcsets $n {}
-	    set r [project::rev %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
-	}
-
+	project::rev load
 	project::rev loadcounter
 	return
     }
 
     typemethod run {} {

Modified tools/cvs2fossil/lib/c2f_prev.tcl from [08cfcb0706] to [6bd4e14405].

@@ -20,10 +20,11 @@
 package require snit                                  ; # OO system.
 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.
 
 # # ## ### ##### ######## ############# #####################
 ##
@@ -549,13 +550,34 @@
 	    SELECT tid, name FROM cstype;
 	}] { 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
     }
 
     typemethod num {} { return $mycounter }
@@ -1336,10 +1358,11 @@
 ##
 
 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
 	namespace import ::vc::tools::log