File Annotation
Not logged in
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 XIII. This is the second of the backend passes. It imports the
31b15fcf30 2008-03-05       aku: ## changesets constructed by the previous passes into one or more
31b15fcf30 2008-03-05       aku: ## fossil repositories, one per project.
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: package require vc::fossil::import::cvs::ristate          ; # Import state (revisions)
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:     ImportCSets \
31b15fcf30 2008-03-05       aku:     {Import the changesets into fossil repositories} \
31b15fcf30 2008-03-05       aku:     ::vc::fossil::import::cvs::pass::importcsets
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::importcsets {
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 project
31b15fcf30 2008-03-05       aku: 	state use file
31b15fcf30 2008-03-05       aku: 	state use revision
31b15fcf30 2008-03-05       aku: 	state use meta
31b15fcf30 2008-03-05       aku: 	state use author
31b15fcf30 2008-03-05       aku: 	state use cmessage
31b15fcf30 2008-03-05       aku: 	state use symbol
31b15fcf30 2008-03-05       aku: 	state use space
31b15fcf30 2008-03-05       aku: 	state use revuuid
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 importcsets {Importing 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: 	    set rstate [ristate %AUTO%]
31b15fcf30 2008-03-05       aku: 
31b15fcf30 2008-03-05       aku: 	    state transaction {
31b15fcf30 2008-03-05       aku: 		# Layer II: Changesets
31b15fcf30 2008-03-05       aku: 		foreach {cset date} [$project changesetsinorder] {
31b15fcf30 2008-03-05       aku: 		    $cset pushto $fossil $date $rstate
31b15fcf30 2008-03-05       aku: 		}
31b15fcf30 2008-03-05       aku: 	    }
31b15fcf30 2008-03-05       aku: 
31b15fcf30 2008-03-05       aku: 	    $rstate destroy
31b15fcf30 2008-03-05       aku: 	    $fossil 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 importcsets
31b15fcf30 2008-03-05       aku:     namespace eval importcsets {
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::fossil::import::cvs::ristate
31b15fcf30 2008-03-05       aku: 	namespace import ::vc::tools::log
31b15fcf30 2008-03-05       aku: 	log register importcsets
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::importcsets 1.0
31b15fcf30 2008-03-05       aku: return