Fossil SCM

Bugfix: Sort pending nodes fully deterministic, and moved to separate helper command. Tweaked log output.

aku 2007-11-27 09:05 trunk
Commit 3e18606b5c5bb5aa0c063a62877404b5b59113e0
--- tools/cvs2fossil/lib/c2f_cyclebreaker.tcl
+++ tools/cvs2fossil/lib/c2f_cyclebreaker.tcl
@@ -250,11 +250,11 @@
250250
::variable mybottom
251251
foreach n [$dg nodes] {
252252
if {[$dg node degree -in $n]} continue
253253
lappend mybottom [linsert [$dg node get $n timerange] 0 $n]
254254
}
255
- set mybottom [lsort -index 1 -integer [lsort -index 2 -integer $mybottom]]
255
+ ScheduleCandidates
256256
ShowPendingNodes
257257
return
258258
}
259259
260260
proc WithoutPredecessor {dg nv} {
@@ -277,28 +277,38 @@
277277
# removal of n. Put on the list.
278278
lappend mybottom [linsert [$dg node get $out timerange] 0 $out]
279279
set changed 1
280280
}
281281
if {$changed} {
282
- set mybottom [lsort -index 1 -integer [lsort -index 2 -integer $mybottom]]
282
+ ScheduleCandidates
283283
}
284284
285285
# We do not delete the node immediately, to allow the Save
286286
# procedure to save the dependencies as well (encoded in the
287287
# arcs).
288288
return 1
289289
}
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
+ }
290296
291297
proc ShowPendingNodes {} {
292298
if {[log verbosity?] < 10} return
293299
::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
+ }
296304
return
297305
}
298306
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
+ }
300310
301311
proc FindCycle {dg} {
302312
# This procedure is run if and only the graph is not empty and
303313
# all nodes have predecessors. This means that each node is
304314
# either part of a cycle or (indirectly) depending on a node
305315
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button