Differences From:
File
tools/cvs2fossil/lib/c2f_cyclebreaker.tcl
part of check-in
[f284847134]
- Reworked the dot export internals a bit to be more general regarding labeling and attribute writing. Updated the cycle breaker to define proper labels.
by
aku on
2007-11-22 07:22:38.
[view]
To:
File
tools/cvs2fossil/lib/c2f_cyclebreaker.tcl
part of check-in
[5f5620fbd2]
- Modified cycle breaker API. Hook for processed nodes now takes the graph as new first argument. Extended API, exposed method for dumping the current state of the graph, including ability to dump a sub graph.
by
aku on
2007-11-23 05:43:25.
[view]
@@ -65,8 +65,13 @@
$dg destroy
return
}
+ typemethod mark {graph suffix {subgraph {}}} {
+ Mark $graph $suffix $subgraph
+ return
+ }
+
# # ## ### ##### ######## #############
typemethod run {label changesetcmd} {
::variable myat 0
@@ -94,9 +99,9 @@
InitializeCandidates $dg
while {1} {
while {[WithoutPredecessor $dg n]} {
- ProcessedHook $n $myat
+ ProcessedHook $dg $n $myat
$dg node delete $n
incr myat
ShowPendingNodes
}
@@ -150,8 +155,9 @@
foreach cset $changesets {
$dg node insert $cset
$dg node set $cset timerange [$cset timerange]
$dg node set $cset label [ID $cset]
+ $dg node set $cset __id__ [$cset id]
}
# 2. Find for all relevant changeset their revisions and their
# dependencies. Map the latter back to changesets and
@@ -330,16 +336,16 @@
if {[lsearch -exact [$dg nodes -out $a] $b] < 0} { return 0 }
return 1
}
- proc Mark {dg {suffix {}}} {
+ proc Mark {dg {suffix {}} {subgraph {}}} {
::variable mydotdestination
if {$mydotdestination eq ""} return
::variable mydotprefix
::variable mydotid
set fname $mydotdestination/${mydotprefix}${mydotid}${suffix}.dot
file mkdir [file dirname $fname]
- dot write $dg $mydotprefix$suffix $fname
+ dot write $dg $mydotprefix$suffix $fname $subgraph
incr mydotid
log write 5 cyclebreaker ".dot export $fname"
return
@@ -398,16 +404,16 @@
Mark $graph -pre-done
return
}
- proc ProcessedHook {cset pos} {
+ proc ProcessedHook {dg cset pos} {
# Give the user of the cycle breaker the opportunity to work
# with the changeset before it is removed from the graph.
::variable mysavecmd
if {![llength $mysavecmd]} return
- uplevel #0 [linsert $mysavecmd end $pos $cset]
+ uplevel #0 [linsert $mysavecmd end $dg $pos $cset]
return
}
proc BreakCycleHook {graph} {