Fossil SCM
Bugfix: Sort pending nodes fully deterministic, and moved to separate helper command. Tweaked log output.
Commit
3e18606b5c5bb5aa0c063a62877404b5b59113e0
Parent
1c39e57637d4bfb…
1 file changed
+15
-5
| --- tools/cvs2fossil/lib/c2f_cyclebreaker.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_cyclebreaker.tcl | ||
| @@ -250,11 +250,11 @@ | ||
| 250 | 250 | ::variable mybottom |
| 251 | 251 | foreach n [$dg nodes] { |
| 252 | 252 | if {[$dg node degree -in $n]} continue |
| 253 | 253 | lappend mybottom [linsert [$dg node get $n timerange] 0 $n] |
| 254 | 254 | } |
| 255 | - set mybottom [lsort -index 1 -integer [lsort -index 2 -integer $mybottom]] | |
| 255 | + ScheduleCandidates | |
| 256 | 256 | ShowPendingNodes |
| 257 | 257 | return |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | proc WithoutPredecessor {dg nv} { |
| @@ -277,28 +277,38 @@ | ||
| 277 | 277 | # removal of n. Put on the list. |
| 278 | 278 | lappend mybottom [linsert [$dg node get $out timerange] 0 $out] |
| 279 | 279 | set changed 1 |
| 280 | 280 | } |
| 281 | 281 | if {$changed} { |
| 282 | - set mybottom [lsort -index 1 -integer [lsort -index 2 -integer $mybottom]] | |
| 282 | + ScheduleCandidates | |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | # We do not delete the node immediately, to allow the Save |
| 286 | 286 | # procedure to save the dependencies as well (encoded in the |
| 287 | 287 | # arcs). |
| 288 | 288 | return 1 |
| 289 | 289 | } |
| 290 | + | |
| 291 | + proc ScheduleCandidates {} { | |
| 292 | + ::variable mybottom | |
| 293 | + set mybottom [lsort -index 1 -integer [lsort -index 2 -integer [lsort -index 0 -dict $mybottom]]] | |
| 294 | + return | |
| 295 | + } | |
| 290 | 296 | |
| 291 | 297 | proc ShowPendingNodes {} { |
| 292 | 298 | if {[log verbosity?] < 10} return |
| 293 | 299 | ::variable mybottom |
| 294 | - log write 10 cyclebreaker \ | |
| 295 | - "Pending: [struct::list map $mybottom [myproc FormatPendingItem]]" | |
| 300 | + log write 10 cyclebreaker "Pending..............................." | |
| 301 | + foreach item [struct::list map $mybottom [myproc FormatPendingItem]] { | |
| 302 | + log write 10 cyclebreaker "Pending: $item" | |
| 303 | + } | |
| 296 | 304 | return |
| 297 | 305 | } |
| 298 | 306 | |
| 299 | - proc FormatPendingItem {item} { lreplace $item 0 0 [[lindex $item 0] str] } | |
| 307 | + proc FormatPendingItem {item} { | |
| 308 | + join [list [[lindex $item 0] str] [clock format [lindex $item 1]] [clock format [lindex $item 2]]] | |
| 309 | + } | |
| 300 | 310 | |
| 301 | 311 | proc FindCycle {dg} { |
| 302 | 312 | # This procedure is run if and only the graph is not empty and |
| 303 | 313 | # all nodes have predecessors. This means that each node is |
| 304 | 314 | # either part of a cycle or (indirectly) depending on a node |
| 305 | 315 |
| --- tools/cvs2fossil/lib/c2f_cyclebreaker.tcl | |
| +++ tools/cvs2fossil/lib/c2f_cyclebreaker.tcl | |
| @@ -250,11 +250,11 @@ | |
| 250 | ::variable mybottom |
| 251 | foreach n [$dg nodes] { |
| 252 | if {[$dg node degree -in $n]} continue |
| 253 | lappend mybottom [linsert [$dg node get $n timerange] 0 $n] |
| 254 | } |
| 255 | set mybottom [lsort -index 1 -integer [lsort -index 2 -integer $mybottom]] |
| 256 | ShowPendingNodes |
| 257 | return |
| 258 | } |
| 259 | |
| 260 | proc WithoutPredecessor {dg nv} { |
| @@ -277,28 +277,38 @@ | |
| 277 | # removal of n. Put on the list. |
| 278 | lappend mybottom [linsert [$dg node get $out timerange] 0 $out] |
| 279 | set changed 1 |
| 280 | } |
| 281 | if {$changed} { |
| 282 | set mybottom [lsort -index 1 -integer [lsort -index 2 -integer $mybottom]] |
| 283 | } |
| 284 | |
| 285 | # We do not delete the node immediately, to allow the Save |
| 286 | # procedure to save the dependencies as well (encoded in the |
| 287 | # arcs). |
| 288 | return 1 |
| 289 | } |
| 290 | |
| 291 | proc ShowPendingNodes {} { |
| 292 | if {[log verbosity?] < 10} return |
| 293 | ::variable mybottom |
| 294 | log write 10 cyclebreaker \ |
| 295 | "Pending: [struct::list map $mybottom [myproc FormatPendingItem]]" |
| 296 | return |
| 297 | } |
| 298 | |
| 299 | proc FormatPendingItem {item} { lreplace $item 0 0 [[lindex $item 0] str] } |
| 300 | |
| 301 | proc FindCycle {dg} { |
| 302 | # This procedure is run if and only the graph is not empty and |
| 303 | # all nodes have predecessors. This means that each node is |
| 304 | # either part of a cycle or (indirectly) depending on a node |
| 305 |
| --- tools/cvs2fossil/lib/c2f_cyclebreaker.tcl | |
| +++ tools/cvs2fossil/lib/c2f_cyclebreaker.tcl | |
| @@ -250,11 +250,11 @@ | |
| 250 | ::variable mybottom |
| 251 | foreach n [$dg nodes] { |
| 252 | if {[$dg node degree -in $n]} continue |
| 253 | lappend mybottom [linsert [$dg node get $n timerange] 0 $n] |
| 254 | } |
| 255 | ScheduleCandidates |
| 256 | ShowPendingNodes |
| 257 | return |
| 258 | } |
| 259 | |
| 260 | proc WithoutPredecessor {dg nv} { |
| @@ -277,28 +277,38 @@ | |
| 277 | # removal of n. Put on the list. |
| 278 | lappend mybottom [linsert [$dg node get $out timerange] 0 $out] |
| 279 | set changed 1 |
| 280 | } |
| 281 | if {$changed} { |
| 282 | ScheduleCandidates |
| 283 | } |
| 284 | |
| 285 | # We do not delete the node immediately, to allow the Save |
| 286 | # procedure to save the dependencies as well (encoded in the |
| 287 | # arcs). |
| 288 | return 1 |
| 289 | } |
| 290 | |
| 291 | proc ScheduleCandidates {} { |
| 292 | ::variable mybottom |
| 293 | set mybottom [lsort -index 1 -integer [lsort -index 2 -integer [lsort -index 0 -dict $mybottom]]] |
| 294 | return |
| 295 | } |
| 296 | |
| 297 | proc ShowPendingNodes {} { |
| 298 | if {[log verbosity?] < 10} return |
| 299 | ::variable mybottom |
| 300 | log write 10 cyclebreaker "Pending..............................." |
| 301 | foreach item [struct::list map $mybottom [myproc FormatPendingItem]] { |
| 302 | log write 10 cyclebreaker "Pending: $item" |
| 303 | } |
| 304 | return |
| 305 | } |
| 306 | |
| 307 | proc FormatPendingItem {item} { |
| 308 | join [list [[lindex $item 0] str] [clock format [lindex $item 1]] [clock format [lindex $item 2]]] |
| 309 | } |
| 310 | |
| 311 | proc FindCycle {dg} { |
| 312 | # This procedure is run if and only the graph is not empty and |
| 313 | # all nodes have predecessors. This means that each node is |
| 314 | # either part of a cycle or (indirectly) depending on a node |
| 315 |