Overview
SHA1 Hash: | 1e177a4c916004be7d6736f8211ae4cbf87b7ac6 |
---|---|
Date: | 2007-11-21 04:11:59 |
User: | aku |
Comment: | Cycle breaker, API extension. Added a hook to process the graph between setup and regular consummation. This will be used by pass 8. |
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 [af14f4e127] to [674bdc4eb4].
@@ -32,10 +32,15 @@ snit::type ::vc::fossil::import::cvs::cyclebreaker { # # ## ### ##### ######## ############# ## Public API + typemethod precmd {cmd} { + ::variable myprecmd $cmd + return + } + typemethod savecmd {cmd} { ::variable mysavecmd $cmd return } @@ -145,10 +150,14 @@ if {![$dg node exists $succ]} continue $dg arc insert $cset $succ } } + # Run the user hook to manipulate the graph before + # consummation. + + PreHook $dg return $dg } # Instead of searching the whole graph for the degree-0 nodes in # each iteration we compute the list once to start, and then only @@ -340,10 +349,21 @@ } # # ## ### ##### ######## ############# ## Callback invokation ... + proc PreHook {graph} { + # Give the user of the cycle breaker the opportunity to work + # with the graph between setup and consummation. + + ::variable myprecmd + if {![llength $myprecmd]} return + + uplevel #0 [linsert $myprecmd end $graph] + return + } + proc ProcessedHook {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 @@ -366,10 +386,11 @@ uplevel #0 [linsert $mybreakcmd end $graph] return } proc ClearHooks {} { + ::variable myprecmd {} ::variable mysavecmd {} ::variable mybreakcmd {} return } @@ -378,10 +399,11 @@ typevariable myat 0 ; # Counter for commit ids for the # changesets. typevariable mybottom {} ; # List of the candidate nodes for # committing. + typevariable myprecmd {} ; # Callback, change graph before walk. typevariable mysavecmd {} ; # Callback, for each processed node. typevariable mybreakcmd {} ; # Callback, for each found cycle. typevariable mydotdestination {} ; # Destination directory for the # generated .dot files.