Overview
SHA1 Hash: | 97b4405ecf7ef61e838044ffa5ea5a6754a3d20e |
---|---|
Date: | 2007-11-25 07:35:30 |
User: | aku |
Comment: | Extended cycle breaker with debug facility allowing the user to watch the neighbourhood of specific changesets during the traversal. Extended label information, highlighting of the nodes of interest. Tweaked log output a bit. |
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 [20cdcc5766] to [bc82f06795].
@@ -54,10 +54,15 @@ typemethod dotsto {path} { ::variable mydotdestination $path return } + typemethod watch {id} { + ::variable mywatchids + lappend mywatchids $id + } + typemethod dot {label changesets} { ::variable mydotprefix $label ::variable mydotid 0 set dg [Setup $changesets 0] @@ -98,10 +103,11 @@ log write 3 cyclebreaker {Traverse changesets} InitializeCandidates $dg while {1} { while {[WithoutPredecessor $dg n]} { + MarkWatch $dg ProcessedHook $dg $n $myat $dg node delete $n incr myat ShowPendingNodes } @@ -108,10 +114,11 @@ if {![llength [dg nodes]]} break BreakCycleHook $dg InitializeCandidates $dg + MarkWatch $dg } $dg destroy log write 3 cyclebreaker Done. @@ -160,29 +167,33 @@ # # ## ### ##### ######## ############# ## Internal methods proc Setup {changesets {log 1}} { if {$log} { - log write 3 cyclebreaker "Create changeset graph, [nsp [llength $changesets] node]" + log write 3 cyclebreaker "Creating graph of changesets" } set dg [struct::graph dg] foreach cset $changesets { + set tr [$cset timerange] $dg node insert $cset - $dg node set $cset timerange [$cset timerange] - $dg node set $cset label [$cset str] + $dg node set $cset timerange $tr + $dg node set $cset label "[$cset str]\\n[join [struct::list map $tr {::clock format}] "\\n"]" $dg node set $cset __id__ [$cset id] + $dg node set $cset shape [expr {[$cset bysymbol] + ? "ellipse" + : "box"}] + } + + if {$log} { + log write 3 cyclebreaker "Has [nsp [llength $changesets] changeset]" } # 2. Find for all relevant changeset their revisions and their # dependencies. Map the latter back to changesets and # construct the corresponding arcs. - - if {$log} { - log write 3 cyclebreaker {Setting up node dependencies} - } foreach cset $changesets { foreach succ [$cset successors] { # Changesets may have dependencies outside of the # chosen set. These are ignored @@ -210,15 +221,21 @@ } } } } + if {$log} { + log write 3 cyclebreaker "Has [nsp [llength [$dg arcs]] dependency dependencies]" + } + # Run the user hook to manipulate the graph before # consummation. if {$log} { Mark $dg -start } - PreHook $dg + MarkWatch $dg + PreHook $dg + MarkWatch $dg # This kills the application if loops (see above) were found. trouble abort? return $dg } @@ -395,14 +412,18 @@ set pre [$dg nodes -in $n] $dg node delete $n foreach cset $replacements { + set tr [$cset timerange] $dg node insert $cset - $dg node set $cset timerange [$cset timerange] - $dg node set $cset label [$cset str] + $dg node set $cset timerange $tr + $dg node set $cset label "[$cset str]\\n[join [struct::list map $tr {::clock format}] "\\n"]" $dg node set $cset __id__ [$cset id] + $dg node set $cset shape [expr {[$cset bysymbol] + ? "ellipse" + : "box"}] } foreach cset $replacements { foreach succ [$cset successors] { # The new changesets may have dependencies outside of @@ -476,10 +497,35 @@ return } # # ## ### ##### ######## ############# + proc MarkWatch {graph} { + ::variable mywatchids + set watched [Watched $graph $mywatchids] + if {![llength $watched]} return + set neighbours [eval [linsert $watched 0 $graph nodes -adj]] + #foreach n $neighbours { log write 6 cyclebreaker "Neighbor [$n id] => $n" } + Mark $graph watched [concat $watched $neighbours] + return + } + + proc Watched {graph watchids} { + set res {} + foreach id $watchids { + set nl [$graph nodes -key __id__ -value $id] + if {![llength $nl]} continue + lappend res $nl + #log write 6 breakrcycle "Watching $id => $nl" + $graph node set $nl fontcolor red + } + return $res + } + + # # ## ### ##### ######## ############# + + typevariable myat 0 ; # Counter for commit ids for the # changesets. typevariable mybottom {} ; # List of the candidate nodes for # committing. @@ -491,10 +537,12 @@ # generated .dot files. typevariable mydotprefix {} ; # Prefix for dot files when # exporting the graphs. typevariable mydotid 0 ; # Counter for dot file name # generation. + typevariable mywatchids {} ; # Changesets to watch the + # neighbourhood of. # # ## ### ##### ######## ############# ## Configuration pragma -hasinstances no ; # singleton
Modified tools/cvs2fossil/lib/c2f_option.tcl from [5b894a43fc] to [36ee7e3cab].
@@ -79,10 +79,11 @@ --exclude { project::sym exclude [Value arguments] } --force-tag { project::sym forcetag [Value arguments] } --force-branch { project::sym forcebranch [Value arguments] } --batch { log noprogress } --dots { cyclebreaker dotsto [Value arguments] } + --watch { cyclebreaker watch [Value arguments] } default { Usage $badoption$option\n$gethelp } } }