File Annotation
Not logged in
31b15fcf30 2008-03-05       aku: ## -*- tcl -*-
31b15fcf30 2008-03-05       aku: # # ## ### ##### ######## ############# #####################
31b15fcf30 2008-03-05       aku: ## Copyright (c) 2007-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 XII. This is the first of the backend passes. It imports the
31b15fcf30 2008-03-05       aku: ## revisions of all files into one or more fossil repositories, one
31b15fcf30 2008-03-05       aku: ## 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: 
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:     ImportFiles \
31b15fcf30 2008-03-05       aku:     {Import the file revisions into fossil repositories} \
31b15fcf30 2008-03-05       aku:     ::vc::fossil::import::cvs::pass::importfiles
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::importfiles {
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: 
31b15fcf30 2008-03-05       aku: 	# Discard on setup. Do not discard on deferal.
31b15fcf30 2008-03-05       aku: 	state discard revuuid
31b15fcf30 2008-03-05       aku: 	state extend  revuuid {
31b15fcf30 2008-03-05       aku: 	    rid   INTEGER NOT NULL  REFERENCES revision UNIQUE,
31b15fcf30 2008-03-05       aku: 	    uuid  INTEGER NOT NULL  -- fossil id of the revision
31b15fcf30 2008-03-05       aku: 	    --                         unique within the project
31b15fcf30 2008-03-05       aku: 	}
31b15fcf30 2008-03-05       aku: 
31b15fcf30 2008-03-05       aku: 	# Remember the locations of the scratch data createdby this
31b15fcf30 2008-03-05       aku: 	# pass, for use by the next (importing changesets).
31b15fcf30 2008-03-05       aku: 	state discard space
31b15fcf30 2008-03-05       aku: 	state extend  space {
31b15fcf30 2008-03-05       aku: 	    pid        INTEGER  NOT NULL  REFERENCES project,
31b15fcf30 2008-03-05       aku: 	    repository TEXT     NOT NULL,
31b15fcf30 2008-03-05       aku: 	    workspace  TEXT     NOT NULL
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 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 importfiles {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: 	    $fossil initialize
31b15fcf30 2008-03-05       aku: 
31b15fcf30 2008-03-05       aku: 	    state transaction {
31b15fcf30 2008-03-05       aku: 		# Layer I: Files and their revisions
31b15fcf30 2008-03-05       aku: 		foreach file [$project files] {
31b15fcf30 2008-03-05       aku: 		    $file pushto $fossil
31b15fcf30 2008-03-05       aku: 		}
31b15fcf30 2008-03-05       aku: 
31b15fcf30 2008-03-05       aku: 		# Save the scratch locations, needed by the next pass.
31b15fcf30 2008-03-05       aku: 		struct::list assign [$fossil space] r w
31b15fcf30 2008-03-05       aku: 		state run {
31b15fcf30 2008-03-05       aku: 		    DELETE FROM space
31b15fcf30 2008-03-05       aku: 		    WHERE pid = $pid
31b15fcf30 2008-03-05       aku: 		    ;
31b15fcf30 2008-03-05       aku: 		    INSERT INTO space (pid, repository, workspace)
31b15fcf30 2008-03-05       aku: 		    VALUES            ($pid, $r, $w);
31b15fcf30 2008-03-05       aku: 		}
31b15fcf30 2008-03-05       aku: 	    }
31b15fcf30 2008-03-05       aku: 
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: 
31b15fcf30 2008-03-05       aku: 	# Not discarding revuuid/space here, allow us to keep the info
31b15fcf30 2008-03-05       aku: 	# for the next pass even if the revisions are recomputed.
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 importfiles
31b15fcf30 2008-03-05       aku:     namespace eval importfiles {
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 importfiles
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::importfiles 1.0
31b15fcf30 2008-03-05       aku: return