Check-in [ae19c0fcb4]
Not logged in
Overview

SHA1 Hash:ae19c0fcb4c72ed82a4bb6354cbbbced11aeed74
Date: 2007-10-13 23:29:17
User: aku
Comment:Extended pass manager to handle the skipped and defered passes coming before and after the actually executed passes. Extended passes I and II to have the required methods. Implemented loading (for skipped passes) as skeletons, implemented discarding (for defered passes) completely. Extended state manager with ability to discard state.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified tools/cvs2fossil/lib/c2f_pass.tcl from [9bb3590160] to [ddf979344e].

@@ -95,27 +95,38 @@
 	}
     }
 
     typemethod run {} {
 	if {$mystart < 0} {set mystart 0}
-	if {$myend   < 0} {set myend end}
-
-	set runlist [lrange $mypasses $mystart $myend]
+	if {$myend   < 0} {set myend [expr {[llength $mypasses] - 1}]}
+
 	# TODO: Timing statistics for the passes.
 	# TODO: Artifact manager (clean after pass?. need to know skipped/defered passes ?)
 	# TODO:
 	# TODO:
 
-	foreach p $runlist {
+	set skipped [lrange $mypasses 0 [expr {$mystart - 1}]]
+	set run     [lrange $mypasses $mystart $myend]
+	set defered [lrange $mypasses [expr {$myend + 1}] end]
+
+	foreach p $skipped {
+	    log write 0 pass "Skip  $p"
+	    Call $p load
+	}
+	foreach p $run {
 	    log write 0 pass "Setup $p"
 	    Call $p setup
 	}
-	foreach p $runlist {
+	foreach p $run {
 	    log write 0 pass "Begin $p"
 	    Call $p run
 	    log write 0 pass "Done  $p"
 	    trouble abort?
+	}
+	foreach p $defered {
+	    log write 0 pass "Defer $p"
+	    Call $p discard
 	}
 
 	state release
 	return
     }

Modified tools/cvs2fossil/lib/c2f_pcollar.tcl from [5368abc30d] to [2af84157bc].

@@ -78,11 +78,24 @@
 	    UNIQUE (pid, name)         -- file names are unique within a project
 	}
 	return
     }
 
+    typemethod load {} {
+	# Pass manager interface. Executed for all passes before the
+	# run passes, to load all data of their pass from the state,
+	# as if it had been computed by the pass itself.
+
+	state reading project
+	state reading file
+	return
+    }
+
     typemethod run {} {
+	# Pass manager interface. Executed to perform the
+	# functionality of the pass.
+
 	set rbase [repository base?]
 	foreach project [repository projects] {
 	    set base [file join $rbase [$project base]]
 	    log write 1 collar "Scan $base"
 
@@ -124,10 +137,20 @@
 
 	repository printstatistics
 	repository persist
 
 	log write 1 collar "Scan completed"
+	return
+    }
+
+    typemethod discard {} {
+	# Pass manager interface. Executed for all passes after the
+	# run passes, to remove all data of this pass from the state,
+	# as being out of date.
+
+	state discard project
+	state discard file
 	return
     }
 
     typemethod ignore_conflicting_attics {} {
 	set myignore 1

Modified tools/cvs2fossil/lib/c2f_pcollrev.tcl from [c79989ff1b] to [7b2a655d25].

@@ -181,11 +181,19 @@
 	# belong to a different project than their own.
 
 	return
     }
 
+    typemethod load {} {
+	# TODO
+	return
+    }
+
     typemethod run {} {
+	# Pass manager interface. Executed to perform the
+	# functionality of the pass.
+
 	set rbase [repository base?]
 	foreach project [repository projects] {
 	    set base [file join $rbase [$project base]]
 	    log write 1 collrev "Processing $base"
 
@@ -208,10 +216,29 @@
 
 	repository printrevstatistics
 	repository persistrev
 
 	log write 1 collrev "Scan completed"
+	return
+    }
+
+    typemethod discard {} {
+	# Pass manager interface. Executed for all passes after the
+	# run passes, to remove all data of this pass from the state,
+	# as being out of date.
+
+	state discard rcs
+	state discard item
+	state discard revision
+	state discard tag
+	state discard branch
+	state discard symbol
+	state discard blocker
+	state discard parent
+	state discard meta
+	state discard author
+	state discard cmessage
 	return
     }
 
     # # ## ### ##### ######## #############
     ## Internal methods

Modified tools/cvs2fossil/lib/c2f_state.tcl from [e652a4a126] to [03d1122d66].

@@ -126,10 +126,22 @@
 
 	if {$found} return
 
 	trouble internal "The required table \"$name\" is not defined."
 	# Not reached
+	return
+    }
+
+    typemethod discard {name} {
+	# Method for a user to remove outdated information from the
+	# persistent state, table by table.
+
+	log write 0 state "discard $name" ; # TODO move to level 5 or so
+
+	$mystate transaction {
+	    catch { $mystate eval "DROP TABLE $name" }
+	}
 	return
     }
 
     typemethod run {args} {
 	return [uplevel 1 [linsert $args 0 $mystate eval]]