060513f2a9 2007-12-02 aku: ## -*- tcl -*- 060513f2a9 2007-12-02 aku: # # ## ### ##### ######## ############# ##################### 060513f2a9 2007-12-02 aku: ## Copyright (c) 2007 Andreas Kupries. 060513f2a9 2007-12-02 aku: # 060513f2a9 2007-12-02 aku: # This software is licensed as described in the file LICENSE, which 060513f2a9 2007-12-02 aku: # you should have received as part of this distribution. 060513f2a9 2007-12-02 aku: # 060513f2a9 2007-12-02 aku: # This software consists of voluntary contributions made by many 060513f2a9 2007-12-02 aku: # individuals. For exact contribution history, see the revision 060513f2a9 2007-12-02 aku: # history and logs, available at http://fossil-scm.hwaci.com/fossil 060513f2a9 2007-12-02 aku: # # ## ### ##### ######## ############# ##################### 060513f2a9 2007-12-02 aku: 060513f2a9 2007-12-02 aku: ## Pass VI. This pass computes the dependencies between the changeset 060513f2a9 2007-12-02 aku: ## from the file level dependencies and stores them in the state for 060513f2a9 2007-12-02 aku: ## use by the cycle breaker and topological sorting passes. 060513f2a9 2007-12-02 aku: 060513f2a9 2007-12-02 aku: # # ## ### ##### ######## ############# ##################### 060513f2a9 2007-12-02 aku: ## Requirements 060513f2a9 2007-12-02 aku: 060513f2a9 2007-12-02 aku: package require Tcl 8.4 ; # Required runtime. 060513f2a9 2007-12-02 aku: package require snit ; # OO system. 060513f2a9 2007-12-02 aku: package require vc::tools::misc ; # Text formatting. 060513f2a9 2007-12-02 aku: package require vc::tools::log ; # User feedback. 060513f2a9 2007-12-02 aku: package require vc::fossil::import::cvs::state ; # State storage. 060513f2a9 2007-12-02 aku: package require vc::fossil::import::cvs::project::rev ; # Project level changesets 060513f2a9 2007-12-02 aku: 060513f2a9 2007-12-02 aku: # # ## ### ##### ######## ############# ##################### 060513f2a9 2007-12-02 aku: ## Register the pass with the management 060513f2a9 2007-12-02 aku: 060513f2a9 2007-12-02 aku: vc::fossil::import::cvs::pass define \ 060513f2a9 2007-12-02 aku: CsetDeps \ 060513f2a9 2007-12-02 aku: {ChangeSet Dependencies} \ 060513f2a9 2007-12-02 aku: ::vc::fossil::import::cvs::pass::csetdeps 060513f2a9 2007-12-02 aku: 060513f2a9 2007-12-02 aku: # # ## ### ##### ######## ############# ##################### 060513f2a9 2007-12-02 aku: ## 060513f2a9 2007-12-02 aku: 060513f2a9 2007-12-02 aku: snit::type ::vc::fossil::import::cvs::pass::csetdeps { 060513f2a9 2007-12-02 aku: # # ## ### ##### ######## ############# 060513f2a9 2007-12-02 aku: ## Public API 060513f2a9 2007-12-02 aku: 060513f2a9 2007-12-02 aku: typemethod setup {} { 060513f2a9 2007-12-02 aku: # Define the names and structure of the persistent state of 060513f2a9 2007-12-02 aku: # this pass. 060513f2a9 2007-12-02 aku: 060513f2a9 2007-12-02 aku: state use project 060513f2a9 2007-12-02 aku: state use file 060513f2a9 2007-12-02 aku: state use revision 060513f2a9 2007-12-02 aku: state use revisionbranchchildren 060513f2a9 2007-12-02 aku: state use branch 060513f2a9 2007-12-02 aku: state use tag 060513f2a9 2007-12-02 aku: state use symbol 060513f2a9 2007-12-02 aku: state use preferedparent 060513f2a9 2007-12-02 aku: state use changeset 060513f2a9 2007-12-02 aku: state use csitem 060513f2a9 2007-12-02 aku: 060513f2a9 2007-12-02 aku: # A table listing for each changeset the set of successor 060513f2a9 2007-12-02 aku: # changesets. The predecessor information is implied. 060513f2a9 2007-12-02 aku: 060513f2a9 2007-12-02 aku: state extend cssuccessor { 060513f2a9 2007-12-02 aku: cid INTEGER NOT NULL REFERENCES changeset, 060513f2a9 2007-12-02 aku: nid INTEGER NOT NULL REFERENCES changeset, 060513f2a9 2007-12-02 aku: UNIQUE (cid,nid) 060513f2a9 2007-12-02 aku: } {cid nid} 060513f2a9 2007-12-02 aku: # Index on both columns for fast forward and back retrieval. 060513f2a9 2007-12-02 aku: return 060513f2a9 2007-12-02 aku: } 060513f2a9 2007-12-02 aku: 060513f2a9 2007-12-02 aku: typemethod load {} { 060513f2a9 2007-12-02 aku: # Pass manager interface. Executed to load data computed by 060513f2a9 2007-12-02 aku: # this pass into memory when this pass is skipped instead of 060513f2a9 2007-12-02 aku: # executed. 060513f2a9 2007-12-02 aku: 060513f2a9 2007-12-02 aku: state use cssuccessor 060513f2a9 2007-12-02 aku: return 060513f2a9 2007-12-02 aku: } 060513f2a9 2007-12-02 aku: 060513f2a9 2007-12-02 aku: typemethod run {} { 060513f2a9 2007-12-02 aku: # Pass manager interface. Executed to perform the 060513f2a9 2007-12-02 aku: # functionality of the pass. 060513f2a9 2007-12-02 aku: 060513f2a9 2007-12-02 aku: set n 0 060513f2a9 2007-12-02 aku: set max [llength [project::rev all]] 060513f2a9 2007-12-02 aku: 060513f2a9 2007-12-02 aku: foreach cset [project::rev all] { 060513f2a9 2007-12-02 aku: log progress 2 csetdeps $n $max 060513f2a9 2007-12-02 aku: # NOTE: Consider to commit only every N calls. 060513f2a9 2007-12-02 aku: state transaction { 060513f2a9 2007-12-02 aku: $cset determinesuccessors 060513f2a9 2007-12-02 aku: } 060513f2a9 2007-12-02 aku: incr n 060513f2a9 2007-12-02 aku: } 060513f2a9 2007-12-02 aku: return 060513f2a9 2007-12-02 aku: } 060513f2a9 2007-12-02 aku: 060513f2a9 2007-12-02 aku: typemethod discard {} { 060513f2a9 2007-12-02 aku: # Pass manager interface. Executed for all passes after the 060513f2a9 2007-12-02 aku: # run passes, to remove all data of this pass from the state, 060513f2a9 2007-12-02 aku: # as being out of date. 060513f2a9 2007-12-02 aku: 060513f2a9 2007-12-02 aku: state discard cssuccessor 060513f2a9 2007-12-02 aku: return 060513f2a9 2007-12-02 aku: } 060513f2a9 2007-12-02 aku: 060513f2a9 2007-12-02 aku: # # ## ### ##### ######## ############# 060513f2a9 2007-12-02 aku: ## Internal methods 060513f2a9 2007-12-02 aku: 060513f2a9 2007-12-02 aku: # # ## ### ##### ######## ############# 060513f2a9 2007-12-02 aku: ## Configuration 060513f2a9 2007-12-02 aku: 060513f2a9 2007-12-02 aku: pragma -hasinstances no ; # singleton 060513f2a9 2007-12-02 aku: pragma -hastypeinfo no ; # no introspection 060513f2a9 2007-12-02 aku: pragma -hastypedestroy no ; # immortal 060513f2a9 2007-12-02 aku: 060513f2a9 2007-12-02 aku: # # ## ### ##### ######## ############# 060513f2a9 2007-12-02 aku: } 060513f2a9 2007-12-02 aku: 060513f2a9 2007-12-02 aku: namespace eval ::vc::fossil::import::cvs::pass { 060513f2a9 2007-12-02 aku: namespace export csetdeps 060513f2a9 2007-12-02 aku: namespace eval csetdeps { 060513f2a9 2007-12-02 aku: namespace import ::vc::fossil::import::cvs::state 060513f2a9 2007-12-02 aku: namespace eval project { 060513f2a9 2007-12-02 aku: namespace import ::vc::fossil::import::cvs::project::rev 060513f2a9 2007-12-02 aku: } 060513f2a9 2007-12-02 aku: namespace import ::vc::tools::misc::* 060513f2a9 2007-12-02 aku: namespace import ::vc::tools::log 060513f2a9 2007-12-02 aku: log register csetdeps 060513f2a9 2007-12-02 aku: } 060513f2a9 2007-12-02 aku: } 060513f2a9 2007-12-02 aku: 060513f2a9 2007-12-02 aku: # # ## ### ##### ######## ############# ##################### 060513f2a9 2007-12-02 aku: ## Ready 060513f2a9 2007-12-02 aku: 060513f2a9 2007-12-02 aku: package provide vc::fossil::import::cvs::pass::csetdeps 1.0 060513f2a9 2007-12-02 aku: return