Diff
Not logged in

Differences From:

File tools/cvs2fossil/lib/c2f_pbreakacycle.tcl part of check-in [1f60018119] - Fixed typo in cycle breaker logging. Extended pass 8, wrote the outline with all the relevant custom callbacks. by aku on 2007-11-21 04:44:13. [view]

To:

File tools/cvs2fossil/lib/c2f_pbreakacycle.tcl part of check-in [de4cff4142] - Extended changeset class with in-memory database mapping from changeset ids to the proper object, and extended the objects with position information and associated accessors. Extended pass 8 to load the commit order computed in pass 6, this is stored in the new position slot of changesets, and an inverted index mapping from position to changeset at that position. by aku on 2007-11-22 03:21:43. [view]

@@ -45,8 +45,10 @@
 
     typemethod setup {} {
 	# Define the names and structure of the persistent state of
 	# this pass.
+
+	state reading csorder
 	return
     }
 
     typemethod load {} {
@@ -64,8 +66,9 @@
 	cyclebreaker savecmd  [myproc SaveOrder]
 	cyclebreaker breakcmd [myproc BreakCycle]
 
 	state transaction {
+	    LoadCommitOrder
 	    cyclebreaker run break-all [myproc Changesets]
 	}
 
 	repository printcsetstatistics
@@ -83,8 +86,25 @@
     ## Internal methods
 
     proc Changesets {} { project::rev all }
 
+    proc LoadCommitOrder {} {
+	::variable mycset
+
+	state transaction {
+	    foreach {cid pos} [state run { SELECT cid, pos FROM csorder }] {
+		set cset [project::rev of $cid]
+		$cset setpos $pos
+		set mycset($pos) $cset
+	    }
+	    # Remove the order information now that we have it in
+	    # memory, so that we can save it once more, for all
+	    # changesets, while breaking the remaining cycles.
+	    state run { DELETE FROM csorder }
+	}
+	return
+    }
+
     # # ## ### ##### ######## #############
 
     proc BreakRetrogradeBranches {graph} {
     }
@@ -98,8 +118,14 @@
 
     proc BreakCycle {graph} {
 	cyclebreaker break $graph
     }
+
+    # # ## ### ##### ######## #############
+
+    typevariable mycset -array {} ; # Map from commit positions to the
+				    # changeset (object ref) at that
+				    # position.
 
     # # ## ### ##### ######## #############
     ## Configuration