Diff
Not logged in

Differences From:

File tools/cvs2fossil/lib/c2f_project.tcl part of check-in [ec053168a8] - Nicer parser integration into pass II, and sort files for easier filesystem traversal during parsing. by aku on 2007-10-06 20:58:24. [view]

To:

File tools/cvs2fossil/lib/c2f_project.tcl part of check-in [6d1811d61e] - Continued work on pass II, skeleton of it completed by adding outline of code for persistence. by aku on 2007-10-06 21:19:26. [view]

@@ -49,15 +49,12 @@
     }
 
     method files {} {
 	# TODO: Loading from state
-	set res {}
-	foreach f [lsort -dict [array names myfiles]] {
-	    lappend res [file %AUTO% $f $self]
-	}
-	return $res
+	return [TheFiles]
     }
 
+    # pass I persistence
     method persist {} {
 	state transaction {
 	    # Project data first. Required so that we have its id
 	    # ready for the files.
@@ -80,16 +77,48 @@
 	}
 	return
     }
 
+    # pass II persistence
+    method persistrev {} {
+	state transaction {
+	    # TODO: per project persistence (symbols, meta data)
+	    foreach f [TheFiles] {
+		$f persist
+	    }
+	}
+	return
+    }
+
     # # ## ### ##### ######## #############
     ## State
 
     variable mybase         {} ; # Project directory
     variable myfiles -array {} ; # Maps rcs archive to their user files.
+    variable myfobj         {} ; # File objects for the rcs archives
 
     # # ## ### ##### ######## #############
     ## Internal methods
+
+    proc TheFiles {} {
+	upvar 1 myfiles myfiles myfobj myfobj self self
+	if {![llength $myfobj]} {
+	    set myfobj [EmptyFiles myfiles]
+	}
+	return $myfobj
+    }
+
+    proc EmptyFiles {fv} {
+	upvar 1 $fv myfiles self self
+	set res {}
+	foreach f [lsort -dict [array names myfiles]] {
+	    lappend res [file %AUTO% $f $self]
+	}
+	return $res
+    }
+
+    # # ## ### ##### ######## #############
+    ## Configuration
 
     pragma -hastypeinfo    no  ; # no type introspection
     pragma -hasinfo        no  ; # no object introspection
     pragma -hastypemethods no  ; # type is not relevant.