Overview
SHA1 Hash: | d58423cdc4a7801f94f0e5fbe07c4a16df39599e |
---|---|
Date: | 2007-11-21 03:46:22 |
User: | aku |
Comment: | API change cycle breaker. The save callback command is now specified through a separate configuration command. Moved callback invokation to helper command. Updated pass 6. Moved changeset selection to helper command. |
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 [7d4b849665] to [9c7c517526].
@@ -31,10 +31,15 @@ snit::type ::vc::fossil::import::cvs::cyclebreaker { # # ## ### ##### ######## ############# ## Public API + typemethod savecmd {cmd} { + ::variable mysavecmd $cmd + return + } + typemethod dotsto {path} { ::variable mydotdestination $path return } @@ -46,12 +51,11 @@ Mark $dg $dg destroy return } - typemethod run {label changesets {savecmd {}}} { - ::variable mysave $savecmd + typemethod run {label changesets} { ::variable myat 0 ::variable mydotprefix $label ::variable mydotid 0 # We create a graph of the revision changesets, using the file @@ -83,10 +87,12 @@ } dg destroy log write 3 cyclebreaker Done. + + ClearHooks return } # # ## ### ##### ######## ############# ## Internal methods @@ -171,21 +177,13 @@ return 1 } proc SaveAndRemove {dg n} { ::variable myat - ::variable mysave - - # Give the user of the cycle breaker the opportunity to work - # with the changeset before it is removed from the graph. - - if {[llength $mysave]} { - uplevel #0 [linsert $mysave end $myat $n] - } - - incr myat + ProcessedHook $n $myat $dg node delete $n + incr myat return } proc FindCycle {dg} { # This procedure is run if and only the graph is not empty and @@ -327,17 +325,44 @@ log write 5 cyclebreaker ".dot export $fname" return } - typevariable myat 0 ; # Counter for commit ids for the changesets. - typevariable mybottom {} ; # List of candidate nodes for committing. - typevariable mysave {} ; # The command to call for each processed node + # # ## ### ##### ######## ############# + ## Callback invokation ... + + 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 + if {![llength $mysavecmd]} return + + uplevel #0 [linsert $mysavecmd end $pos $cset] + return + } + + proc ClearHooks {} { + ::variable mysavecmd {} + return + } + + # # ## ### ##### ######## ############# + + typevariable myat 0 ; # Counter for commit ids for the + # changesets. + typevariable mybottom {} ; # List of the candidate nodes for + # committing. + + typevariable mysavecmd {} ; # Callback, for each processed node. - typevariable mydotdestination {} ; # Destination directory for .dot files. - typevariable mydotprefix {} ; # Prefix for dot files when exporting the graphs. - typevariable mydotid 0 ; # Counter for dot file name generation. + typevariable mydotdestination {} ; # Destination directory for the + # generated .dot files. + typevariable mydotprefix {} ; # Prefix for dot files when + # exporting the graphs. + typevariable mydotid 0 ; # Counter for dot file name + # generation. # # ## ### ##### ######## ############# ## Configuration pragma -hasinstances no ; # singleton
Modified tools/cvs2fossil/lib/c2f_pbreakrcycle.tcl from [4f907e0102] to [d4b18e168b].
@@ -72,19 +72,20 @@ typemethod run {} { # Pass manager interface. Executed to perform the # functionality of the pass. - set changesets [struct::list filter [project::rev all] [myproc IsByRevision]] + set changesets [Changesets] cyclebreaker dot break-rev-start $changesets + cyclebreaker savecmd [myproc SaveOrder] + state transaction { - cyclebreaker run break-rev $changesets [myproc SaveOrder] + cyclebreaker run break-rev $changesets } - set changesets [struct::list filter [project::rev all] [myproc IsByRevision]] - cyclebreaker dot break-rev-done $changesets + cyclebreaker dot break-rev-done [Changesets] repository printcsetstatistics return } @@ -97,10 +98,14 @@ return } # # ## ### ##### ######## ############# ## Internal methods + + proc Changesets {} { + return [struct::list filter [project::rev all] [myproc IsByRevision]] + } proc IsByRevision {cset} { $cset byrevision } proc SaveOrder {at cset} { set cid [$cset id]