31b15fcf30 2008-03-05 aku: ## -*- tcl -*- 31b15fcf30 2008-03-05 aku: # # ## ### ##### ######## ############# ##################### 31b15fcf30 2008-03-05 aku: ## Copyright (c) 2008 Andreas Kupries. 31b15fcf30 2008-03-05 aku: # 31b15fcf30 2008-03-05 aku: # This software is licensed as described in the file LICENSE, which 31b15fcf30 2008-03-05 aku: # you should have received as part of this distribution. 31b15fcf30 2008-03-05 aku: # 31b15fcf30 2008-03-05 aku: # This software consists of voluntary contributions made by many 31b15fcf30 2008-03-05 aku: # individuals. For exact contribution history, see the revision 31b15fcf30 2008-03-05 aku: # history and logs, available at http://fossil-scm.hwaci.com/fossil 31b15fcf30 2008-03-05 aku: # # ## ### ##### ######## ############# ##################### 31b15fcf30 2008-03-05 aku: 31b15fcf30 2008-03-05 aku: ## Pass XIV. This is the third and last of the backend passes. It 31b15fcf30 2008-03-05 aku: ## finalizes the fossil repositories we have constructed in the 31b15fcf30 2008-03-05 aku: ## previous import passes. 31b15fcf30 2008-03-05 aku: 31b15fcf30 2008-03-05 aku: # # ## ### ##### ######## ############# ##################### 31b15fcf30 2008-03-05 aku: ## Requirements 31b15fcf30 2008-03-05 aku: 31b15fcf30 2008-03-05 aku: package require Tcl 8.4 ; # Required runtime. 31b15fcf30 2008-03-05 aku: package require snit ; # OO system. 31b15fcf30 2008-03-05 aku: package require vc::tools::log ; # User feedback. 31b15fcf30 2008-03-05 aku: package require vc::fossil::import::cvs::repository ; # Repository management. 31b15fcf30 2008-03-05 aku: package require vc::fossil::import::cvs::state ; # State storage. 31b15fcf30 2008-03-05 aku: package require vc::fossil::import::cvs::fossil ; # Access to fossil repositories. 31b15fcf30 2008-03-05 aku: 31b15fcf30 2008-03-05 aku: # # ## ### ##### ######## ############# ##################### 31b15fcf30 2008-03-05 aku: ## Register the pass with the management 31b15fcf30 2008-03-05 aku: 31b15fcf30 2008-03-05 aku: vc::fossil::import::cvs::pass define \ 31b15fcf30 2008-03-05 aku: ImportFinal \ 31b15fcf30 2008-03-05 aku: {Finalize the import into fossil repositories} \ 31b15fcf30 2008-03-05 aku: ::vc::fossil::import::cvs::pass::importfinal 31b15fcf30 2008-03-05 aku: 31b15fcf30 2008-03-05 aku: # # ## ### ##### ######## ############# ##################### 31b15fcf30 2008-03-05 aku: ## 31b15fcf30 2008-03-05 aku: 31b15fcf30 2008-03-05 aku: snit::type ::vc::fossil::import::cvs::pass::importfinal { 31b15fcf30 2008-03-05 aku: # # ## ### ##### ######## ############# 31b15fcf30 2008-03-05 aku: ## Public API 31b15fcf30 2008-03-05 aku: 31b15fcf30 2008-03-05 aku: typemethod setup {} { 31b15fcf30 2008-03-05 aku: # Define the names and structure of the persistent state of 31b15fcf30 2008-03-05 aku: # this pass. 31b15fcf30 2008-03-05 aku: 31b15fcf30 2008-03-05 aku: state use space 31b15fcf30 2008-03-05 aku: return 31b15fcf30 2008-03-05 aku: } 31b15fcf30 2008-03-05 aku: 31b15fcf30 2008-03-05 aku: typemethod load {} { 31b15fcf30 2008-03-05 aku: # Pass manager interface. Executed to load data computed by 31b15fcf30 2008-03-05 aku: # this pass into memory when this pass is skipped instead of 31b15fcf30 2008-03-05 aku: # executed. 31b15fcf30 2008-03-05 aku: return 31b15fcf30 2008-03-05 aku: } 31b15fcf30 2008-03-05 aku: 31b15fcf30 2008-03-05 aku: typemethod run {} { 31b15fcf30 2008-03-05 aku: # Pass manager interface. Executed to perform the 31b15fcf30 2008-03-05 aku: # functionality of the pass. 31b15fcf30 2008-03-05 aku: 31b15fcf30 2008-03-05 aku: foreach project [repository projects] { 31b15fcf30 2008-03-05 aku: log write 1 importfinal {Finalize project "[$project base]"} 31b15fcf30 2008-03-05 aku: 31b15fcf30 2008-03-05 aku: set pid [$project id] 31b15fcf30 2008-03-05 aku: set fossil [fossil %AUTO%] 31b15fcf30 2008-03-05 aku: struct::list assign [state run { 31b15fcf30 2008-03-05 aku: SELECT repository, workspace 31b15fcf30 2008-03-05 aku: FROM space 31b15fcf30 2008-03-05 aku: WHERE pid = $pid 31b15fcf30 2008-03-05 aku: }] r w 31b15fcf30 2008-03-05 aku: $fossil load $r $w 31b15fcf30 2008-03-05 aku: 31b15fcf30 2008-03-05 aku: # At last copy the temporary repository file to its final 31b15fcf30 2008-03-05 aku: # destination and release the associated memory. 31b15fcf30 2008-03-05 aku: 31b15fcf30 2008-03-05 aku: set destination [$project base] 31b15fcf30 2008-03-05 aku: if {$destination eq ""} { 31b15fcf30 2008-03-05 aku: set destination [file tail [repository base?]] 31b15fcf30 2008-03-05 aku: } 31b15fcf30 2008-03-05 aku: append destination .fsl 31b15fcf30 2008-03-05 aku: 31b15fcf30 2008-03-05 aku: $fossil finalize $destination ; # implies destroy 31b15fcf30 2008-03-05 aku: } 31b15fcf30 2008-03-05 aku: return 31b15fcf30 2008-03-05 aku: } 31b15fcf30 2008-03-05 aku: 31b15fcf30 2008-03-05 aku: typemethod discard {} { 31b15fcf30 2008-03-05 aku: # Pass manager interface. Executed for all passes after the 31b15fcf30 2008-03-05 aku: # run passes, to remove all data of this pass from the state, 31b15fcf30 2008-03-05 aku: # as being out of date. 31b15fcf30 2008-03-05 aku: return 31b15fcf30 2008-03-05 aku: } 31b15fcf30 2008-03-05 aku: 31b15fcf30 2008-03-05 aku: # # ## ### ##### ######## ############# 31b15fcf30 2008-03-05 aku: ## Internal methods 31b15fcf30 2008-03-05 aku: 31b15fcf30 2008-03-05 aku: # # ## ### ##### ######## ############# 31b15fcf30 2008-03-05 aku: ## Configuration 31b15fcf30 2008-03-05 aku: 31b15fcf30 2008-03-05 aku: pragma -hasinstances no ; # singleton 31b15fcf30 2008-03-05 aku: pragma -hastypeinfo no ; # no introspection 31b15fcf30 2008-03-05 aku: pragma -hastypedestroy no ; # immortal 31b15fcf30 2008-03-05 aku: 31b15fcf30 2008-03-05 aku: # # ## ### ##### ######## ############# 31b15fcf30 2008-03-05 aku: } 31b15fcf30 2008-03-05 aku: 31b15fcf30 2008-03-05 aku: namespace eval ::vc::fossil::import::cvs::pass { 31b15fcf30 2008-03-05 aku: namespace export importfinal 31b15fcf30 2008-03-05 aku: namespace eval importfinal { 31b15fcf30 2008-03-05 aku: namespace import ::vc::fossil::import::cvs::repository 31b15fcf30 2008-03-05 aku: namespace import ::vc::fossil::import::cvs::state 31b15fcf30 2008-03-05 aku: namespace import ::vc::fossil::import::cvs::fossil 31b15fcf30 2008-03-05 aku: namespace import ::vc::tools::log 31b15fcf30 2008-03-05 aku: log register importfinal 31b15fcf30 2008-03-05 aku: } 31b15fcf30 2008-03-05 aku: } 31b15fcf30 2008-03-05 aku: 31b15fcf30 2008-03-05 aku: # # ## ### ##### ######## ############# ##################### 31b15fcf30 2008-03-05 aku: ## Ready 31b15fcf30 2008-03-05 aku: 31b15fcf30 2008-03-05 aku: package provide vc::fossil::import::cvs::pass::importfinal 1.0 31b15fcf30 2008-03-05 aku: return