Differences From:
File
tools/cvs2fossil/lib/c2f_cyclebreaker.tcl
part of check-in
[7f15be9078]
- Added the ability to export the changeset graphs processed by the passes 6 to 8 using GraphViz's dot-format. This is activated by using the switch '--dots'. Bugfixes in the cycle breaker. First corrected variable names, I forgot to use the standard 'myXXX' format for the typevariables. Second, fixed a bug uncovered by looking at the exported graphs, which caused the system to loose arcs, possibly breaking cycles without actually breaking them, leaving them in the dependencies.
by
aku on
2007-11-20 06:59:03.
[view]
To:
File
tools/cvs2fossil/lib/c2f_cyclebreaker.tcl
part of check-in
[d58423cdc4]
- 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.
by
aku on
2007-11-21 03:46:22.
[view]
@@ -32,8 +32,13 @@
snit::type ::vc::fossil::import::cvs::cyclebreaker {
# # ## ### ##### ######## #############
## Public API
+ typemethod savecmd {cmd} {
+ ::variable mysavecmd $cmd
+ return
+ }
+
typemethod dotsto {path} {
::variable mydotdestination $path
return
}
@@ -47,10 +52,9 @@
$dg destroy
return
}
- typemethod run {label changesets {savecmd {}}} {
- ::variable mysave $savecmd
+ typemethod run {label changesets} {
::variable myat 0
::variable mydotprefix $label
::variable mydotid 0
@@ -84,8 +88,10 @@
dg destroy
log write 3 cyclebreaker Done.
+
+ ClearHooks
return
}
# # ## ### ##### ######## #############
@@ -172,19 +178,11 @@
}
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} {
@@ -328,15 +326,42 @@
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