File Annotation
Not logged in
d9fc75e587 2007-12-05       aku: ## -*- tcl -*-
d9fc75e587 2007-12-05       aku: # # ## ### ##### ######## ############# #####################
d9fc75e587 2007-12-05       aku: ## Copyright (c) 2007 Andreas Kupries.
d9fc75e587 2007-12-05       aku: #
d9fc75e587 2007-12-05       aku: # This software is licensed as described in the file LICENSE, which
d9fc75e587 2007-12-05       aku: # you should have received as part of this distribution.
d9fc75e587 2007-12-05       aku: #
d9fc75e587 2007-12-05       aku: # This software consists of voluntary contributions made by many
d9fc75e587 2007-12-05       aku: # individuals.  For exact contribution history, see the revision
d9fc75e587 2007-12-05       aku: # history and logs, available at http://fossil-scm.hwaci.com/fossil
d9fc75e587 2007-12-05       aku: # # ## ### ##### ######## ############# #####################
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku: ## Pass XII. This is the first of the backend passes. It imports the
d9fc75e587 2007-12-05       aku: ## changesets constructed by the previous passes, and all file
d9fc75e587 2007-12-05       aku: ## revisions they refer to into one or more fossil repositories, one
d9fc75e587 2007-12-05       aku: ## per project.
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku: # # ## ### ##### ######## ############# #####################
d9fc75e587 2007-12-05       aku: ## Requirements
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku: package require Tcl 8.4                                   ; # Required runtime.
d9fc75e587 2007-12-05       aku: package require snit                                      ; # OO system.
d9fc75e587 2007-12-05       aku: package require vc::tools::log                            ; # User feedback.
d9fc75e587 2007-12-05       aku: package require vc::fossil::import::cvs::repository       ; # Repository management.
d9fc75e587 2007-12-05       aku: package require vc::fossil::import::cvs::state            ; # State storage.
d9fc75e587 2007-12-05       aku: package require vc::fossil::import::cvs::fossil           ; # Access to fossil repositories.
e1dbf3186d 2008-02-04       aku: package require vc::fossil::import::cvs::ristate          ; # Import state (revisions)
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku: # # ## ### ##### ######## ############# #####################
d9fc75e587 2007-12-05       aku: ## Register the pass with the management
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku: vc::fossil::import::cvs::pass define \
d9fc75e587 2007-12-05       aku:     Import \
d9fc75e587 2007-12-05       aku:     {Import the changesets and file revisions into fossil repositories} \
d9fc75e587 2007-12-05       aku:     ::vc::fossil::import::cvs::pass::import
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku: # # ## ### ##### ######## ############# #####################
d9fc75e587 2007-12-05       aku: ##
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku: snit::type ::vc::fossil::import::cvs::pass::import {
d9fc75e587 2007-12-05       aku:     # # ## ### ##### ######## #############
d9fc75e587 2007-12-05       aku:     ## Public API
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku:     typemethod setup {} {
d9fc75e587 2007-12-05       aku: 	# Define the names and structure of the persistent state of
d9fc75e587 2007-12-05       aku: 	# this pass.
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku: 	state use project
d9fc75e587 2007-12-05       aku: 	state use file
d9fc75e587 2007-12-05       aku: 	state use revision
348e45b0d6 2008-01-30       aku: 	state use meta
348e45b0d6 2008-01-30       aku: 	state use author
348e45b0d6 2008-01-30       aku: 	state use cmessage
348e45b0d6 2008-01-30       aku: 	state use symbol
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku: 	# This data is actually transient, confined to this pass. We
d9fc75e587 2007-12-05       aku: 	# use the state storage only to keep the RAM usage low.
d9fc75e587 2007-12-05       aku: 	state extend revuuid {
d9fc75e587 2007-12-05       aku: 	    rid   INTEGER NOT NULL  REFERENCES revision UNIQUE,
d9fc75e587 2007-12-05       aku: 	    uuid  INTEGER NOT NULL  -- fossil id of the revision
d9fc75e587 2007-12-05       aku: 	    --                         unique within the project
d9fc75e587 2007-12-05       aku: 	}
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku: 	# This information is truly non-transient, needed by the next
d9fc75e587 2007-12-05       aku: 	# pass adding the tags.
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku: 	state extend csuuid {
d9fc75e587 2007-12-05       aku: 	    cid   INTEGER NOT NULL  REFERENCES changeset UNIQUE,
d9fc75e587 2007-12-05       aku: 	    uuid  INTEGER NOT NULL  -- fossil id of the changeset
d9fc75e587 2007-12-05       aku: 	    --                         unique within the project
d9fc75e587 2007-12-05       aku: 	}
d9fc75e587 2007-12-05       aku: 	return
d9fc75e587 2007-12-05       aku:     }
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku:     typemethod load {} {
d9fc75e587 2007-12-05       aku: 	# Pass manager interface. Executed to load data computed by
d9fc75e587 2007-12-05       aku: 	# this pass into memory when this pass is skipped instead of
d9fc75e587 2007-12-05       aku: 	# executed.
d9fc75e587 2007-12-05       aku: 	return
d9fc75e587 2007-12-05       aku:     }
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku:     typemethod run {} {
d9fc75e587 2007-12-05       aku: 	# Pass manager interface. Executed to perform the
d9fc75e587 2007-12-05       aku: 	# functionality of the pass.
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku: 	foreach project [repository projects] {
d9fc75e587 2007-12-05       aku: 	    log write 1 import {Importing project "[$project base]"}
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku: 	    set fossil [fossil %AUTO%]
e1dbf3186d 2008-02-04       aku: 	    set rstate [ristate %AUTO%]
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku: 	    state transaction {
348e45b0d6 2008-01-30       aku: 		# Layer I: Files and their revisions
348e45b0d6 2008-01-30       aku: 		foreach file [$project files] {
d9fc75e587 2007-12-05       aku: 		    $file pushto $fossil
d9fc75e587 2007-12-05       aku: 		}
348e45b0d6 2008-01-30       aku: 		# Layer II: Changesets
348e45b0d6 2008-01-30       aku: 		foreach {revision date} [$project revisionsinorder] {
e1dbf3186d 2008-02-04       aku: 		    $revision pushto $fossil $date $rstate
348e45b0d6 2008-01-30       aku: 		}
348e45b0d6 2008-01-30       aku: 		unset rstate
d9fc75e587 2007-12-05       aku: 	    }
e1dbf3186d 2008-02-04       aku: 
e1dbf3186d 2008-02-04       aku: 	    $rstate destroy
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku: 	    # At last copy the temporary repository file to its final
d9fc75e587 2007-12-05       aku: 	    # destination and release the associated memory.
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku: 	    $fossil finalize [$project base].fsl
d9fc75e587 2007-12-05       aku: 	}
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku: 	# This does not live beyond the pass. We use the state for the
d9fc75e587 2007-12-05       aku: 	# data despite its transient nature to keep the memory
d9fc75e587 2007-12-05       aku: 	# requirements down.
d9fc75e587 2007-12-05       aku: 	#state discard revuuid
d9fc75e587 2007-12-05       aku: 	return
d9fc75e587 2007-12-05       aku:     }
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku:     typemethod discard {} {
d9fc75e587 2007-12-05       aku: 	# Pass manager interface. Executed for all passes after the
d9fc75e587 2007-12-05       aku: 	# run passes, to remove all data of this pass from the state,
d9fc75e587 2007-12-05       aku: 	# as being out of date.
d9fc75e587 2007-12-05       aku: 	return
d9fc75e587 2007-12-05       aku:     }
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku:     # # ## ### ##### ######## #############
d9fc75e587 2007-12-05       aku:     ## Internal methods
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku:     # # ## ### ##### ######## #############
d9fc75e587 2007-12-05       aku:     ## Configuration
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku:     pragma -hasinstances   no ; # singleton
d9fc75e587 2007-12-05       aku:     pragma -hastypeinfo    no ; # no introspection
d9fc75e587 2007-12-05       aku:     pragma -hastypedestroy no ; # immortal
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku:     # # ## ### ##### ######## #############
d9fc75e587 2007-12-05       aku: }
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku: namespace eval ::vc::fossil::import::cvs::pass {
d9fc75e587 2007-12-05       aku:     namespace export import
d9fc75e587 2007-12-05       aku:     namespace eval import {
d9fc75e587 2007-12-05       aku: 	namespace import ::vc::fossil::import::cvs::repository
d9fc75e587 2007-12-05       aku: 	namespace import ::vc::fossil::import::cvs::state
d9fc75e587 2007-12-05       aku: 	namespace import ::vc::fossil::import::cvs::fossil
e1dbf3186d 2008-02-04       aku: 	namespace import ::vc::fossil::import::cvs::ristate
d9fc75e587 2007-12-05       aku: 	namespace import ::vc::tools::log
d9fc75e587 2007-12-05       aku: 	log register import
d9fc75e587 2007-12-05       aku:     }
d9fc75e587 2007-12-05       aku: }
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku: # # ## ### ##### ######## ############# #####################
d9fc75e587 2007-12-05       aku: ## Ready
d9fc75e587 2007-12-05       aku: 
d9fc75e587 2007-12-05       aku: package provide vc::fossil::import::cvs::pass::import 1.0
d9fc75e587 2007-12-05       aku: return