Overview
SHA1 Hash: | 5f5620fbd25ccc50fac7757fc38abfcb072270a5 |
---|---|
Date: | 2007-11-23 05:43:25 |
User: | aku |
Comment: | 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. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified tools/cvs2fossil/lib/c2f_cyclebreaker.tcl from [00c265ebb6] to [0d5893505c].
@@ -64,10 +64,15 @@ Mark $dg $dg destroy return } + typemethod mark {graph suffix {subgraph {}}} { + Mark $graph $suffix $subgraph + return + } + # # ## ### ##### ######## ############# typemethod run {label changesetcmd} { ::variable myat 0 ::variable mydotprefix $label @@ -93,11 +98,11 @@ log write 3 cyclebreaker {Now sorting the changesets, breaking cycles} InitializeCandidates $dg while {1} { while {[WithoutPredecessor $dg n]} { - ProcessedHook $n $myat + ProcessedHook $dg $n $myat $dg node delete $n incr myat ShowPendingNodes } @@ -149,10 +154,11 @@ 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 # construct the corresponding arcs. @@ -329,18 +335,18 @@ #8.5: return [expr {$b in [$dg nodes -out $a]}] 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 } @@ -397,18 +403,18 @@ uplevel #0 [linsert $myprecmd end $graph] 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} { # Call out to the chosen algorithm for cycle breaking. Finding