Fossil SCM

Cycle breaker, API extension. Added a hook to process the graph between setup and regular consummation. This will be used by pass 8.

aku 2007-11-21 04:11 trunk
Commit 1e177a4c916004be7d6736f8211ae4cbf87b7ac6
--- tools/cvs2fossil/lib/c2f_cyclebreaker.tcl
+++ tools/cvs2fossil/lib/c2f_cyclebreaker.tcl
@@ -31,10 +31,15 @@
3131
##
3232
3333
snit::type ::vc::fossil::import::cvs::cyclebreaker {
3434
# # ## ### ##### ######## #############
3535
## Public API
36
+
37
+ typemethod precmd {cmd} {
38
+ ::variable myprecmd $cmd
39
+ return
40
+ }
3641
3742
typemethod savecmd {cmd} {
3843
::variable mysavecmd $cmd
3944
return
4045
}
@@ -145,10 +150,14 @@
145150
if {![$dg node exists $succ]} continue
146151
$dg arc insert $cset $succ
147152
}
148153
}
149154
155
+ # Run the user hook to manipulate the graph before
156
+ # consummation.
157
+
158
+ PreHook $dg
150159
return $dg
151160
}
152161
153162
# Instead of searching the whole graph for the degree-0 nodes in
154163
# each iteration we compute the list once to start, and then only
@@ -339,10 +348,21 @@
339348
return
340349
}
341350
342351
# # ## ### ##### ######## #############
343352
## Callback invokation ...
353
+
354
+ proc PreHook {graph} {
355
+ # Give the user of the cycle breaker the opportunity to work
356
+ # with the graph between setup and consummation.
357
+
358
+ ::variable myprecmd
359
+ if {![llength $myprecmd]} return
360
+
361
+ uplevel #0 [linsert $myprecmd end $graph]
362
+ return
363
+ }
344364
345365
proc ProcessedHook {cset pos} {
346366
# Give the user of the cycle breaker the opportunity to work
347367
# with the changeset before it is removed from the graph.
348368
@@ -366,10 +386,11 @@
366386
uplevel #0 [linsert $mybreakcmd end $graph]
367387
return
368388
}
369389
370390
proc ClearHooks {} {
391
+ ::variable myprecmd {}
371392
::variable mysavecmd {}
372393
::variable mybreakcmd {}
373394
return
374395
}
375396
@@ -378,10 +399,11 @@
378399
typevariable myat 0 ; # Counter for commit ids for the
379400
# changesets.
380401
typevariable mybottom {} ; # List of the candidate nodes for
381402
# committing.
382403
404
+ typevariable myprecmd {} ; # Callback, change graph before walk.
383405
typevariable mysavecmd {} ; # Callback, for each processed node.
384406
typevariable mybreakcmd {} ; # Callback, for each found cycle.
385407
386408
typevariable mydotdestination {} ; # Destination directory for the
387409
# generated .dot files.
388410
--- tools/cvs2fossil/lib/c2f_cyclebreaker.tcl
+++ tools/cvs2fossil/lib/c2f_cyclebreaker.tcl
@@ -31,10 +31,15 @@
31 ##
32
33 snit::type ::vc::fossil::import::cvs::cyclebreaker {
34 # # ## ### ##### ######## #############
35 ## Public API
 
 
 
 
 
36
37 typemethod savecmd {cmd} {
38 ::variable mysavecmd $cmd
39 return
40 }
@@ -145,10 +150,14 @@
145 if {![$dg node exists $succ]} continue
146 $dg arc insert $cset $succ
147 }
148 }
149
 
 
 
 
150 return $dg
151 }
152
153 # Instead of searching the whole graph for the degree-0 nodes in
154 # each iteration we compute the list once to start, and then only
@@ -339,10 +348,21 @@
339 return
340 }
341
342 # # ## ### ##### ######## #############
343 ## Callback invokation ...
 
 
 
 
 
 
 
 
 
 
 
344
345 proc ProcessedHook {cset pos} {
346 # Give the user of the cycle breaker the opportunity to work
347 # with the changeset before it is removed from the graph.
348
@@ -366,10 +386,11 @@
366 uplevel #0 [linsert $mybreakcmd end $graph]
367 return
368 }
369
370 proc ClearHooks {} {
 
371 ::variable mysavecmd {}
372 ::variable mybreakcmd {}
373 return
374 }
375
@@ -378,10 +399,11 @@
378 typevariable myat 0 ; # Counter for commit ids for the
379 # changesets.
380 typevariable mybottom {} ; # List of the candidate nodes for
381 # committing.
382
 
383 typevariable mysavecmd {} ; # Callback, for each processed node.
384 typevariable mybreakcmd {} ; # Callback, for each found cycle.
385
386 typevariable mydotdestination {} ; # Destination directory for the
387 # generated .dot files.
388
--- tools/cvs2fossil/lib/c2f_cyclebreaker.tcl
+++ tools/cvs2fossil/lib/c2f_cyclebreaker.tcl
@@ -31,10 +31,15 @@
31 ##
32
33 snit::type ::vc::fossil::import::cvs::cyclebreaker {
34 # # ## ### ##### ######## #############
35 ## Public API
36
37 typemethod precmd {cmd} {
38 ::variable myprecmd $cmd
39 return
40 }
41
42 typemethod savecmd {cmd} {
43 ::variable mysavecmd $cmd
44 return
45 }
@@ -145,10 +150,14 @@
150 if {![$dg node exists $succ]} continue
151 $dg arc insert $cset $succ
152 }
153 }
154
155 # Run the user hook to manipulate the graph before
156 # consummation.
157
158 PreHook $dg
159 return $dg
160 }
161
162 # Instead of searching the whole graph for the degree-0 nodes in
163 # each iteration we compute the list once to start, and then only
@@ -339,10 +348,21 @@
348 return
349 }
350
351 # # ## ### ##### ######## #############
352 ## Callback invokation ...
353
354 proc PreHook {graph} {
355 # Give the user of the cycle breaker the opportunity to work
356 # with the graph between setup and consummation.
357
358 ::variable myprecmd
359 if {![llength $myprecmd]} return
360
361 uplevel #0 [linsert $myprecmd end $graph]
362 return
363 }
364
365 proc ProcessedHook {cset pos} {
366 # Give the user of the cycle breaker the opportunity to work
367 # with the changeset before it is removed from the graph.
368
@@ -366,10 +386,11 @@
386 uplevel #0 [linsert $mybreakcmd end $graph]
387 return
388 }
389
390 proc ClearHooks {} {
391 ::variable myprecmd {}
392 ::variable mysavecmd {}
393 ::variable mybreakcmd {}
394 return
395 }
396
@@ -378,10 +399,11 @@
399 typevariable myat 0 ; # Counter for commit ids for the
400 # changesets.
401 typevariable mybottom {} ; # List of the candidate nodes for
402 # committing.
403
404 typevariable myprecmd {} ; # Callback, change graph before walk.
405 typevariable mysavecmd {} ; # Callback, for each processed node.
406 typevariable mybreakcmd {} ; # Callback, for each found cycle.
407
408 typevariable mydotdestination {} ; # Destination directory for the
409 # generated .dot files.
410

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button