File Annotation
Not logged in
2a01d50430 2007-11-11       aku: ## -*- tcl -*-
2a01d50430 2007-11-11       aku: # # ## ### ##### ######## ############# #####################
2a01d50430 2007-11-11       aku: ## Copyright (c) 2007 Andreas Kupries.
2a01d50430 2007-11-11       aku: #
2a01d50430 2007-11-11       aku: # This software is licensed as described in the file LICENSE, which
2a01d50430 2007-11-11       aku: # you should have received as part of this distribution.
2a01d50430 2007-11-11       aku: #
2a01d50430 2007-11-11       aku: # This software consists of voluntary contributions made by many
2a01d50430 2007-11-11       aku: # individuals.  For exact contribution history, see the revision
2a01d50430 2007-11-11       aku: # history and logs, available at http://fossil-scm.hwaci.com/fossil
2a01d50430 2007-11-11       aku: # # ## ### ##### ######## ############# #####################
2a01d50430 2007-11-11       aku: 
2a01d50430 2007-11-11       aku: ## Pass VI. This pass goes over the set of revision based changesets
2a01d50430 2007-11-11       aku: ## and breaks all dependency cycles they may be in. We need a
770a9b576a 2007-11-16       aku: ## dependency tree. Identical to pass VII, except for the selection of
770a9b576a 2007-11-16       aku: ## the changesets.
2a01d50430 2007-11-11       aku: 
2a01d50430 2007-11-11       aku: # # ## ### ##### ######## ############# #####################
2a01d50430 2007-11-11       aku: ## Requirements
2a01d50430 2007-11-11       aku: 
94c39d6375 2007-11-14       aku: package require Tcl 8.4                                   ; # Required runtime.
94c39d6375 2007-11-14       aku: package require snit                                      ; # OO system.
94c39d6375 2007-11-14       aku: package require struct::list                              ; # Higher order list operations.
94c39d6375 2007-11-14       aku: package require vc::tools::log                            ; # User feedback.
96b7bfb834 2007-11-16       aku: package require vc::fossil::import::cvs::repository       ; # Repository management.
770a9b576a 2007-11-16       aku: package require vc::fossil::import::cvs::cyclebreaker     ; # Breaking dependency cycles.
94c39d6375 2007-11-14       aku: package require vc::fossil::import::cvs::state            ; # State storage.
94c39d6375 2007-11-14       aku: package require vc::fossil::import::cvs::project::rev     ; # Project level changesets
2a01d50430 2007-11-11       aku: 
2a01d50430 2007-11-11       aku: # # ## ### ##### ######## ############# #####################
2a01d50430 2007-11-11       aku: ## Register the pass with the management
2a01d50430 2007-11-11       aku: 
2a01d50430 2007-11-11       aku: vc::fossil::import::cvs::pass define \
2a01d50430 2007-11-11       aku:     BreakRevCsetCycles \
2a01d50430 2007-11-11       aku:     {Break Revision ChangeSet Dependency Cycles} \
2a01d50430 2007-11-11       aku:     ::vc::fossil::import::cvs::pass::breakrcycle
2a01d50430 2007-11-11       aku: 
2a01d50430 2007-11-11       aku: # # ## ### ##### ######## ############# #####################
2a01d50430 2007-11-11       aku: ##
2a01d50430 2007-11-11       aku: 
2a01d50430 2007-11-11       aku: snit::type ::vc::fossil::import::cvs::pass::breakrcycle {
2a01d50430 2007-11-11       aku:     # # ## ### ##### ######## #############
2a01d50430 2007-11-11       aku:     ## Public API
2a01d50430 2007-11-11       aku: 
2a01d50430 2007-11-11       aku:     typemethod setup {} {
2a01d50430 2007-11-11       aku: 	# Define the names and structure of the persistent state of
2a01d50430 2007-11-11       aku: 	# this pass.
85bd219d0b 2007-11-13       aku: 
ce7fb48e8c 2007-11-16       aku: 	state reading revision
ce7fb48e8c 2007-11-16       aku: 	state reading changeset
ce7fb48e8c 2007-11-16       aku: 	state reading csrevision
770a9b576a 2007-11-16       aku: 
85bd219d0b 2007-11-13       aku: 	state writing csorder {
85bd219d0b 2007-11-13       aku: 	    -- Commit order of changesets based on their dependencies
85bd219d0b 2007-11-13       aku: 	    cid INTEGER  NOT NULL  REFERENCES changeset,
85bd219d0b 2007-11-13       aku: 	    pos INTEGER  NOT NULL,
85bd219d0b 2007-11-13       aku: 	    UNIQUE (cid),
85bd219d0b 2007-11-13       aku: 	    UNIQUE (pos)
85bd219d0b 2007-11-13       aku: 	}
2a01d50430 2007-11-11       aku: 	return
2a01d50430 2007-11-11       aku:     }
2a01d50430 2007-11-11       aku: 
2a01d50430 2007-11-11       aku:     typemethod load {} {
2a01d50430 2007-11-11       aku: 	# Pass manager interface. Executed to load data computed by
2a01d50430 2007-11-11       aku: 	# this pass into memory when this pass is skipped instead of
2a01d50430 2007-11-11       aku: 	# executed.
770a9b576a 2007-11-16       aku: 
770a9b576a 2007-11-16       aku: 	state reading changeset
770a9b576a 2007-11-16       aku: 	project::rev loadcounter
2a01d50430 2007-11-11       aku: 	return
2a01d50430 2007-11-11       aku:     }
2a01d50430 2007-11-11       aku: 
2a01d50430 2007-11-11       aku:     typemethod run {} {
2a01d50430 2007-11-11       aku: 	# Pass manager interface. Executed to perform the
2a01d50430 2007-11-11       aku: 	# functionality of the pass.
85bd219d0b 2007-11-13       aku: 
2cf0462b82 2007-11-21       aku: 	cyclebreaker savecmd  [myproc SaveOrder]
2cf0462b82 2007-11-21       aku: 	cyclebreaker breakcmd {::vc::fossil::import::cvs::cyclebreaker break}
85bd219d0b 2007-11-13       aku: 
85bd219d0b 2007-11-13       aku: 	state transaction {
2a0ec504c5 2007-11-21       aku: 	    cyclebreaker run break-rev [myproc Changesets]
85bd219d0b 2007-11-13       aku: 	}
85bd219d0b 2007-11-13       aku: 
96b7bfb834 2007-11-16       aku: 	repository printcsetstatistics
2a01d50430 2007-11-11       aku: 	return
2a01d50430 2007-11-11       aku:     }
2a01d50430 2007-11-11       aku: 
2a01d50430 2007-11-11       aku:     typemethod discard {} {
2a01d50430 2007-11-11       aku: 	# Pass manager interface. Executed for all passes after the
2a01d50430 2007-11-11       aku: 	# run passes, to remove all data of this pass from the state,
2a01d50430 2007-11-11       aku: 	# as being out of date.
85bd219d0b 2007-11-13       aku: 
85bd219d0b 2007-11-13       aku: 	state discard csorder
2a01d50430 2007-11-11       aku: 	return
2a01d50430 2007-11-11       aku:     }
2a01d50430 2007-11-11       aku: 
2a01d50430 2007-11-11       aku:     # # ## ### ##### ######## #############
2a01d50430 2007-11-11       aku:     ## Internal methods
85bd219d0b 2007-11-13       aku: 
d58423cdc4 2007-11-21       aku:     proc Changesets {} {
d58423cdc4 2007-11-21       aku: 	return [struct::list filter [project::rev all] [myproc IsByRevision]]
85bd219d0b 2007-11-13       aku:     }
85bd219d0b 2007-11-13       aku: 
770a9b576a 2007-11-16       aku:     proc IsByRevision {cset} { $cset byrevision }
85bd219d0b 2007-11-13       aku: 
7ed2f29d7a 2007-11-24       aku:     proc SaveOrder {graph at cset} {
770a9b576a 2007-11-16       aku: 	set cid [$cset id]
85bd219d0b 2007-11-13       aku: 
87cf609021 2007-11-24       aku: 	log write 4 breakrcycle "Comitting @ $at: [$cset str]"
85bd219d0b 2007-11-13       aku: 	state run {
85bd219d0b 2007-11-13       aku: 	    INSERT INTO csorder (cid,  pos)
85bd219d0b 2007-11-13       aku: 	    VALUES              ($cid, $at)
85bd219d0b 2007-11-13       aku: 	}
87cf609021 2007-11-24       aku: 	# MAYBE TODO: Write the project level changeset dependencies as well.
85bd219d0b 2007-11-13       aku: 	return
85bd219d0b 2007-11-13       aku:     }
2a01d50430 2007-11-11       aku: 
2a01d50430 2007-11-11       aku:     # # ## ### ##### ######## #############
2a01d50430 2007-11-11       aku:     ## Configuration
2a01d50430 2007-11-11       aku: 
2a01d50430 2007-11-11       aku:     pragma -hasinstances   no ; # singleton
2a01d50430 2007-11-11       aku:     pragma -hastypeinfo    no ; # no introspection
2a01d50430 2007-11-11       aku:     pragma -hastypedestroy no ; # immortal
2a01d50430 2007-11-11       aku: 
2a01d50430 2007-11-11       aku:     # # ## ### ##### ######## #############
2a01d50430 2007-11-11       aku: }
2a01d50430 2007-11-11       aku: 
2a01d50430 2007-11-11       aku: namespace eval ::vc::fossil::import::cvs::pass {
85bd219d0b 2007-11-13       aku:     namespace export breakrcycle
85bd219d0b 2007-11-13       aku:     namespace eval breakrcycle {
770a9b576a 2007-11-16       aku: 	namespace import ::vc::fossil::import::cvs::cyclebreaker
96b7bfb834 2007-11-16       aku: 	namespace import ::vc::fossil::import::cvs::repository
85bd219d0b 2007-11-13       aku: 	namespace import ::vc::fossil::import::cvs::state
85bd219d0b 2007-11-13       aku: 	namespace eval project {
85bd219d0b 2007-11-13       aku: 	    namespace import ::vc::fossil::import::cvs::project::rev
85bd219d0b 2007-11-13       aku: 	}
2a01d50430 2007-11-11       aku: 	namespace import ::vc::tools::log
94c39d6375 2007-11-14       aku: 	log register breakrcycle
2a01d50430 2007-11-11       aku:     }
2a01d50430 2007-11-11       aku: }
2a01d50430 2007-11-11       aku: 
2a01d50430 2007-11-11       aku: # # ## ### ##### ######## ############# #####################
2a01d50430 2007-11-11       aku: ## Ready
2a01d50430 2007-11-11       aku: 
2a01d50430 2007-11-11       aku: package provide vc::fossil::import::cvs::pass::breakrcycle 1.0
2a01d50430 2007-11-11       aku: return