Check-in [3e18606b5c]
Not logged in
Overview

SHA1 Hash:3e18606b5c5bb5aa0c063a62877404b5b59113e0
Date: 2007-11-27 09:05:45
User: aku
Comment:Bugfix: Sort pending nodes fully deterministic, and moved to separate helper command. Tweaked log output.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified tools/cvs2fossil/lib/c2f_cyclebreaker.tcl from [6387ad3ed8] to [be1a345cb2].

@@ -250,11 +250,11 @@
 	::variable mybottom
 	foreach n [$dg nodes] {
 	    if {[$dg node degree -in $n]} continue
 	    lappend mybottom [linsert [$dg node get $n timerange] 0 $n]
 	}
-	set mybottom [lsort -index 1 -integer [lsort -index 2 -integer $mybottom]]
+	ScheduleCandidates
 	ShowPendingNodes
 	return
     }
 
     proc WithoutPredecessor {dg nv} {
@@ -277,28 +277,38 @@
 	    # removal of n. Put on the list.
 	    lappend mybottom [linsert [$dg node get $out timerange] 0 $out]
 	    set changed 1
 	}
 	if {$changed} {
-	    set mybottom [lsort -index 1 -integer [lsort -index 2 -integer $mybottom]]
+	    ScheduleCandidates
 	}
 
 	# We do not delete the node immediately, to allow the Save
 	# procedure to save the dependencies as well (encoded in the
 	# arcs).
 	return 1
     }
 
+    proc ScheduleCandidates {} {
+	::variable mybottom
+	set mybottom [lsort -index 1 -integer [lsort -index 2 -integer [lsort -index 0 -dict $mybottom]]]
+	return
+    }
+
     proc ShowPendingNodes {} {
 	if {[log verbosity?] < 10} return
 	::variable mybottom
-	log write 10 cyclebreaker \
-	    "Pending: [struct::list map $mybottom [myproc FormatPendingItem]]"
+	log write 10 cyclebreaker "Pending..............................."
+	foreach item [struct::list map $mybottom [myproc FormatPendingItem]] {
+	    log write 10 cyclebreaker "Pending:     $item"
+	}
 	return
     }
 
-    proc FormatPendingItem {item} { lreplace $item 0 0 [[lindex $item 0] str] }
+    proc FormatPendingItem {item} {
+	join [list [[lindex $item 0] str] [clock format [lindex $item 1]] [clock format [lindex $item 2]]]
+    }
 
     proc FindCycle {dg} {
 	# This procedure is run if and only the graph is not empty and
 	# all nodes have predecessors. This means that each node is
 	# either part of a cycle or (indirectly) depending on a node