Fossil

Check-in [1e177a4c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Cycle breaker, API extension. Added a hook to process the graph between setup and regular consummation. This will be used by pass 8.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1e177a4c916004be7d6736f8211ae4cbf87b7ac6
User & Date: aku 2007-11-21 04:11:59
Context
2007-11-21
04:36
Cycle breaker, API change. The changesets are now communicated via a retrieval callback instead of directly. Updated passes 6 and 7. This allowed us to move the start/done graph exports into the cyclebreaker as well. Changeset selection in pass 8 now in separate command too for this. check-in: 2a0ec504 user: aku tags: trunk
04:11
Cycle breaker, API extension. Added a hook to process the graph between setup and regular consummation. This will be used by pass 8. check-in: 1e177a4c user: aku tags: trunk
04:05
Cycle breaker, API change. Routing the core cycle breaking through a callback so that users can choose their own algorithms. Updated passes 6 and 7. Moven changesets selection in pass 7 to separate command. check-in: 2cf0462b user: aku tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tools/cvs2fossil/lib/c2f_cyclebreaker.tcl.

29
30
31
32
33
34
35





36
37
38
39
40
41
42
...
143
144
145
146
147
148
149




150
151
152
153
154
155
156
...
337
338
339
340
341
342
343











344
345
346
347
348
349
350
...
364
365
366
367
368
369
370

371
372
373
374
375
376
377
378
379
380
381
382

383
384
385
386
387
388
389

# # ## ### ##### ######## ############# #####################
## 

snit::type ::vc::fossil::import::cvs::cyclebreaker {
    # # ## ### ##### ######## #############
    ## Public API






    typemethod savecmd {cmd} {
	::variable mysavecmd $cmd
	return
    }
 
    typemethod breakcmd {cmd} {
................................................................................
		# Changesets may have dependencies outside of the
		# chosen set. These are ignored
		if {![$dg node exists $succ]} continue
		$dg arc insert $cset $succ
	    }
	}





	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
    # update it incrementally based on the outgoing neighbours of the
    # node chosen for commit.
................................................................................

	log write 5 cyclebreaker ".dot export $fname"
	return
    }

    # # ## ### ##### ######## #############
    ## 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 $mybreakcmd end $graph]
	return
    }

    proc ClearHooks {} {

	::variable mysavecmd  {}
	::variable mybreakcmd {}
	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 mybreakcmd {} ; # Callback, for each found cycle.

    typevariable mydotdestination {} ; # Destination directory for the
				       # generated .dot files.
    typevariable mydotprefix      {} ; # Prefix for dot files when
				       # exporting the graphs.







>
>
>
>
>







 







>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>







 







>












>







29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
...
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
...
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
...
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411

# # ## ### ##### ######## ############# #####################
## 

snit::type ::vc::fossil::import::cvs::cyclebreaker {
    # # ## ### ##### ######## #############
    ## Public API

    typemethod precmd {cmd} {
	::variable myprecmd $cmd
	return
    }

    typemethod savecmd {cmd} {
	::variable mysavecmd $cmd
	return
    }
 
    typemethod breakcmd {cmd} {
................................................................................
		# Changesets may have dependencies outside of the
		# chosen set. These are ignored
		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
    # update it incrementally based on the outgoing neighbours of the
    # node chosen for commit.
................................................................................

	log write 5 cyclebreaker ".dot export $fname"
	return
    }

    # # ## ### ##### ######## #############
    ## 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
	if {![llength $mysavecmd]} return
................................................................................
	}

	uplevel #0 [linsert $mybreakcmd end $graph]
	return
    }

    proc ClearHooks {} {
	::variable myprecmd   {}
	::variable mysavecmd  {}
	::variable mybreakcmd {}
	return
    }

    # # ## ### ##### ######## #############

    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.
    typevariable mydotprefix      {} ; # Prefix for dot files when
				       # exporting the graphs.