File Annotation
Not logged in
66c85b4db4 2007-11-25       aku: ## -*- tcl -*-
66c85b4db4 2007-11-25       aku: # # ## ### ##### ######## ############# #####################
66c85b4db4 2007-11-25       aku: ## Copyright (c) 2007 Andreas Kupries.
66c85b4db4 2007-11-25       aku: #
66c85b4db4 2007-11-25       aku: # This software is licensed as described in the file LICENSE, which
66c85b4db4 2007-11-25       aku: # you should have received as part of this distribution.
66c85b4db4 2007-11-25       aku: #
66c85b4db4 2007-11-25       aku: # This software consists of voluntary contributions made by many
66c85b4db4 2007-11-25       aku: # individuals.  For exact contribution history, see the revision
66c85b4db4 2007-11-25       aku: # history and logs, available at http://fossil-scm.hwaci.com/fossil
66c85b4db4 2007-11-25       aku: # # ## ### ##### ######## ############# #####################
66c85b4db4 2007-11-25       aku: 
00bf8c198e 2007-12-02       aku: ## Pass VIII. This pass goes over the set of revision based changesets
66c85b4db4 2007-11-25       aku: ## and sorts them topologically. It assumes that there are no cycles
66c85b4db4 2007-11-25       aku: ## which could impede it, any having been broken by the previous pass,
66c85b4db4 2007-11-25       aku: ## and aborts if that condition doesn't hold.
66c85b4db4 2007-11-25       aku: 
66c85b4db4 2007-11-25       aku: # # ## ### ##### ######## ############# #####################
66c85b4db4 2007-11-25       aku: ## Requirements
66c85b4db4 2007-11-25       aku: 
66c85b4db4 2007-11-25       aku: package require Tcl 8.4                                   ; # Required runtime.
66c85b4db4 2007-11-25       aku: package require snit                                      ; # OO system.
66c85b4db4 2007-11-25       aku: package require struct::list                              ; # Higher order list operations.
66c85b4db4 2007-11-25       aku: package require vc::tools::log                            ; # User feedback.
66c85b4db4 2007-11-25       aku: package require vc::fossil::import::cvs::cyclebreaker     ; # Breaking dependency cycles.
66c85b4db4 2007-11-25       aku: package require vc::fossil::import::cvs::state            ; # State storage.
66c85b4db4 2007-11-25       aku: package require vc::fossil::import::cvs::project::rev     ; # Project level changesets
66c85b4db4 2007-11-25       aku: 
66c85b4db4 2007-11-25       aku: # # ## ### ##### ######## ############# #####################
66c85b4db4 2007-11-25       aku: ## Register the pass with the management
66c85b4db4 2007-11-25       aku: 
66c85b4db4 2007-11-25       aku: vc::fossil::import::cvs::pass define \
66c85b4db4 2007-11-25       aku:     RevTopologicalSort \
66c85b4db4 2007-11-25       aku:     {Topologically Sort Revision ChangeSets} \
66c85b4db4 2007-11-25       aku:     ::vc::fossil::import::cvs::pass::rtopsort
66c85b4db4 2007-11-25       aku: 
66c85b4db4 2007-11-25       aku: # # ## ### ##### ######## ############# #####################
66c85b4db4 2007-11-25       aku: ##
66c85b4db4 2007-11-25       aku: 
66c85b4db4 2007-11-25       aku: snit::type ::vc::fossil::import::cvs::pass::rtopsort {
66c85b4db4 2007-11-25       aku:     # # ## ### ##### ######## #############
66c85b4db4 2007-11-25       aku:     ## Public API
66c85b4db4 2007-11-25       aku: 
66c85b4db4 2007-11-25       aku:     typemethod setup {} {
66c85b4db4 2007-11-25       aku: 	# Define the names and structure of the persistent state of
66c85b4db4 2007-11-25       aku: 	# this pass.
66c85b4db4 2007-11-25       aku: 
e288af3995 2007-12-02       aku: 	state use revision
e288af3995 2007-12-02       aku: 	state use symbol
e288af3995 2007-12-02       aku: 	state use changeset
e288af3995 2007-12-02       aku: 	state use csitem
e288af3995 2007-12-02       aku: 	state use cstype
e288af3995 2007-12-02       aku: 	state use cssuccessor
e288af3995 2007-12-02       aku: 
e288af3995 2007-12-02       aku: 	state extend csorder {
66c85b4db4 2007-11-25       aku: 	    -- Commit order of the revision changesets based on their
66c85b4db4 2007-11-25       aku: 	    -- dependencies
66c85b4db4 2007-11-25       aku: 
66c85b4db4 2007-11-25       aku: 	    cid INTEGER  NOT NULL  REFERENCES changeset,
66c85b4db4 2007-11-25       aku: 	    pos INTEGER  NOT NULL,
66c85b4db4 2007-11-25       aku: 	    UNIQUE (cid),
66c85b4db4 2007-11-25       aku: 	    UNIQUE (pos)
66c85b4db4 2007-11-25       aku: 	}
66c85b4db4 2007-11-25       aku: 	return
66c85b4db4 2007-11-25       aku:     }
66c85b4db4 2007-11-25       aku: 
66c85b4db4 2007-11-25       aku:     typemethod load {} {
66c85b4db4 2007-11-25       aku: 	# Pass manager interface. Executed to load data computed by
66c85b4db4 2007-11-25       aku: 	# this pass into memory when this pass is skipped instead of
66c85b4db4 2007-11-25       aku: 	# executed.
66c85b4db4 2007-11-25       aku: 
e288af3995 2007-12-02       aku: 	state use changeset
66c85b4db4 2007-11-25       aku: 	project::rev loadcounter
66c85b4db4 2007-11-25       aku: 	return
66c85b4db4 2007-11-25       aku:     }
66c85b4db4 2007-11-25       aku: 
66c85b4db4 2007-11-25       aku:     typemethod run {} {
66c85b4db4 2007-11-25       aku: 	# Pass manager interface. Executed to perform the
66c85b4db4 2007-11-25       aku: 	# functionality of the pass.
66c85b4db4 2007-11-25       aku: 
bcc630d3f5 2007-11-25       aku: 	set len [string length [project::rev num]]
bcc630d3f5 2007-11-25       aku: 	set myatfmt %${len}s
1c39e57637 2007-11-27       aku: 	incr len 12
bcc630d3f5 2007-11-25       aku: 	set mycsfmt %${len}s
bcc630d3f5 2007-11-25       aku: 
66c85b4db4 2007-11-25       aku: 	cyclebreaker savecmd  [myproc SaveOrder]
bcc630d3f5 2007-11-25       aku: 
66c85b4db4 2007-11-25       aku: 	state transaction {
bcc630d3f5 2007-11-25       aku: 	    cyclebreaker run tsort-rev [myproc Changesets]
66c85b4db4 2007-11-25       aku: 	}
66c85b4db4 2007-11-25       aku: 	return
66c85b4db4 2007-11-25       aku:     }
66c85b4db4 2007-11-25       aku: 
66c85b4db4 2007-11-25       aku:     typemethod discard {} {
66c85b4db4 2007-11-25       aku: 	# Pass manager interface. Executed for all passes after the
66c85b4db4 2007-11-25       aku: 	# run passes, to remove all data of this pass from the state,
66c85b4db4 2007-11-25       aku: 	# as being out of date.
66c85b4db4 2007-11-25       aku: 
66c85b4db4 2007-11-25       aku: 	state discard csorder
66c85b4db4 2007-11-25       aku: 	return
66c85b4db4 2007-11-25       aku:     }
66c85b4db4 2007-11-25       aku: 
66c85b4db4 2007-11-25       aku:     # # ## ### ##### ######## #############
66c85b4db4 2007-11-25       aku:     ## Internal methods
66c85b4db4 2007-11-25       aku: 
66c85b4db4 2007-11-25       aku:     proc Changesets {} {
00bf8c198e 2007-12-02       aku: 	log write 2 breakscycle {Selecting the revision changesets}
00bf8c198e 2007-12-02       aku: 	return [project::rev rev]
00bf8c198e 2007-12-02       aku:     }
66c85b4db4 2007-11-25       aku: 
66c85b4db4 2007-11-25       aku:     proc SaveOrder {graph at cset} {
bcc630d3f5 2007-11-25       aku: 	::variable myatfmt
bcc630d3f5 2007-11-25       aku: 	::variable mycsfmt
bcc630d3f5 2007-11-25       aku: 
66c85b4db4 2007-11-25       aku: 	set cid [$cset id]
66c85b4db4 2007-11-25       aku: 
bcc630d3f5 2007-11-25       aku: 	log write 4 rtopsort "Changeset @ [format $myatfmt $at]: [format $mycsfmt [$cset str]] <<[FormatTR $graph $cset]>>"
66c85b4db4 2007-11-25       aku: 	state run {
66c85b4db4 2007-11-25       aku: 	    INSERT INTO csorder (cid,  pos)
66c85b4db4 2007-11-25       aku: 	    VALUES              ($cid, $at)
66c85b4db4 2007-11-25       aku: 	}
66c85b4db4 2007-11-25       aku: 	return
66c85b4db4 2007-11-25       aku:     }
bcc630d3f5 2007-11-25       aku: 
bcc630d3f5 2007-11-25       aku:     proc FormatTR {graph cset} {
bcc630d3f5 2007-11-25       aku: 	return [join [struct::list map [$graph node set $cset timerange] {clock format}] { -- }]
bcc630d3f5 2007-11-25       aku:     }
bcc630d3f5 2007-11-25       aku: 
bcc630d3f5 2007-11-25       aku:     typevariable myatfmt ; # Format for log output to gain better alignment of the various columns.
bcc630d3f5 2007-11-25       aku:     typevariable mycsfmt ; # Ditto for the changesets.
66c85b4db4 2007-11-25       aku: 
66c85b4db4 2007-11-25       aku:     # # ## ### ##### ######## #############
66c85b4db4 2007-11-25       aku:     ## Configuration
66c85b4db4 2007-11-25       aku: 
66c85b4db4 2007-11-25       aku:     pragma -hasinstances   no ; # singleton
66c85b4db4 2007-11-25       aku:     pragma -hastypeinfo    no ; # no introspection
66c85b4db4 2007-11-25       aku:     pragma -hastypedestroy no ; # immortal
66c85b4db4 2007-11-25       aku: 
66c85b4db4 2007-11-25       aku:     # # ## ### ##### ######## #############
66c85b4db4 2007-11-25       aku: }
66c85b4db4 2007-11-25       aku: 
66c85b4db4 2007-11-25       aku: namespace eval ::vc::fossil::import::cvs::pass {
66c85b4db4 2007-11-25       aku:     namespace export rtopsort
66c85b4db4 2007-11-25       aku:     namespace eval rtopsort {
66c85b4db4 2007-11-25       aku: 	namespace import ::vc::fossil::import::cvs::cyclebreaker
66c85b4db4 2007-11-25       aku: 	namespace import ::vc::fossil::import::cvs::state
66c85b4db4 2007-11-25       aku: 	namespace eval project {
66c85b4db4 2007-11-25       aku: 	    namespace import ::vc::fossil::import::cvs::project::rev
66c85b4db4 2007-11-25       aku: 	}
66c85b4db4 2007-11-25       aku: 	namespace import ::vc::tools::log
66c85b4db4 2007-11-25       aku: 	log register rtopsort
66c85b4db4 2007-11-25       aku:     }
66c85b4db4 2007-11-25       aku: }
66c85b4db4 2007-11-25       aku: 
66c85b4db4 2007-11-25       aku: # # ## ### ##### ######## ############# #####################
66c85b4db4 2007-11-25       aku: ## Ready
66c85b4db4 2007-11-25       aku: 
66c85b4db4 2007-11-25       aku: package provide vc::fossil::import::cvs::pass::rtopsort 1.0
66c85b4db4 2007-11-25       aku: return