Overview
SHA1 Hash: | d9fc75e58714bc3006917ddd5383d7224761b734 |
---|---|
Date: | 2007-12-05 07:57:50 |
User: | aku |
Comment: | Created new pass for the import of files and changesets. Uses the new file method and fossil accessor class to handle the file import. Changeset -> manifest conversion is _not_ covered yet. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Added tools/cvs2fossil/lib/c2f_pimport.tcl version [1601bf3ce0]
@@ -1,1 +1,148 @@ +## -*- tcl -*- +# # ## ### ##### ######## ############# ##################### +## Copyright (c) 2007 Andreas Kupries. +# +# This software is licensed as described in the file LICENSE, which +# you should have received as part of this distribution. +# +# This software consists of voluntary contributions made by many +# individuals. For exact contribution history, see the revision +# history and logs, available at http://fossil-scm.hwaci.com/fossil +# # ## ### ##### ######## ############# ##################### + +## Pass XII. This is the first of the backend passes. It imports the +## changesets constructed by the previous passes, and all file +## revisions they refer to into one or more fossil repositories, one +## per project. + +# # ## ### ##### ######## ############# ##################### +## Requirements + +package require Tcl 8.4 ; # Required runtime. +package require snit ; # OO system. +package require vc::tools::log ; # User feedback. +package require vc::fossil::import::cvs::repository ; # Repository management. +package require vc::fossil::import::cvs::state ; # State storage. +package require vc::fossil::import::cvs::fossil ; # Access to fossil repositories. + +# # ## ### ##### ######## ############# ##################### +## Register the pass with the management + +vc::fossil::import::cvs::pass define \ + Import \ + {Import the changesets and file revisions into fossil repositories} \ + ::vc::fossil::import::cvs::pass::import + +# # ## ### ##### ######## ############# ##################### +## + +snit::type ::vc::fossil::import::cvs::pass::import { + # # ## ### ##### ######## ############# + ## Public API + + typemethod setup {} { + # Define the names and structure of the persistent state of + # this pass. + + state use project + state use file + state use revision + + # This data is actually transient, confined to this pass. We + # use the state storage only to keep the RAM usage low. + state extend revuuid { + rid INTEGER NOT NULL REFERENCES revision UNIQUE, + uuid INTEGER NOT NULL -- fossil id of the revision + -- unique within the project + } + + # This information is truly non-transient, needed by the next + # pass adding the tags. + + state extend csuuid { + cid INTEGER NOT NULL REFERENCES changeset UNIQUE, + uuid INTEGER NOT NULL -- fossil id of the changeset + -- unique within the project + } + return + } + + typemethod load {} { + # Pass manager interface. Executed to load data computed by + # this pass into memory when this pass is skipped instead of + # executed. + return + } + + typemethod run {} { + # Pass manager interface. Executed to perform the + # functionality of the pass. + + foreach project [repository projects] { + log write 1 import {Importing project "[$project base]"} + + set fossil [fossil %AUTO%] + + state transaction { + foreach file [$project files] { + set path [$file path] + log write 2 import {Importing file "$path"} + $file pushto $fossil + } + + # TODO: Generate manifests for the changesets in the + # project and import them. This needs + # topological traversal. And the creation of + # empty helper baselines for stuff like the root + # of ntdb and such. + } + + # At last copy the temporary repository file to its final + # destination and release the associated memory. + + $fossil finalize [$project base].fsl + } + + # This does not live beyond the pass. We use the state for the + # data despite its transient nature to keep the memory + # requirements down. + #state discard revuuid + return + } + + typemethod discard {} { + # Pass manager interface. Executed for all passes after the + # run passes, to remove all data of this pass from the state, + # as being out of date. + return + } + + # # ## ### ##### ######## ############# + ## Internal methods + + # # ## ### ##### ######## ############# + ## Configuration + + pragma -hasinstances no ; # singleton + pragma -hastypeinfo no ; # no introspection + pragma -hastypedestroy no ; # immortal + + # # ## ### ##### ######## ############# +} + +namespace eval ::vc::fossil::import::cvs::pass { + namespace export import + namespace eval import { + namespace import ::vc::fossil::import::cvs::repository + namespace import ::vc::fossil::import::cvs::state + namespace import ::vc::fossil::import::cvs::fossil + namespace import ::vc::tools::log + log register import + } +} + +# # ## ### ##### ######## ############# ##################### +## Ready +package provide vc::fossil::import::cvs::pass::import 1.0 +return
Modified tools/cvs2fossil/lib/cvs2fossil.tcl from [fb15e077e1] to [5ff9bfc147].
@@ -39,10 +39,11 @@ package require vc::fossil::import::cvs::pass::breakrcycle ; # Break' R'evision Cycle's package require vc::fossil::import::cvs::pass::rtopsort ; # R'evision Top'ological Sort' package require vc::fossil::import::cvs::pass::breakscycle ; # Break' S'ymbol Cycle's package require vc::fossil::import::cvs::pass::breakacycle ; # Break' A'll Cycle's package require vc::fossil::import::cvs::pass::atopsort ; # A'll Top'ological Sort' +package require vc::fossil::import::cvs::pass::import ; # Import' Files and Changesets # # ## ### ##### ######## ############# ##################### ## Support for passes etc. package require vc::fossil::import::cvs::option ; # Cmd line parsing & database
Modified tools/cvs2fossil/lib/pkgIndex.tcl from [c5fb9baccf] to [fde79c6697].
@@ -22,10 +22,11 @@ package ifneeded vc::fossil::import::cvs::pass::breakrcycle 1.0 [list source [file join $dir c2f_pbreakrcycle.tcl]] package ifneeded vc::fossil::import::cvs::pass::rtopsort 1.0 [list source [file join $dir c2f_prtopsort.tcl]] package ifneeded vc::fossil::import::cvs::pass::breakscycle 1.0 [list source [file join $dir c2f_pbreakscycle.tcl]] package ifneeded vc::fossil::import::cvs::pass::breakacycle 1.0 [list source [file join $dir c2f_pbreakacycle.tcl]] package ifneeded vc::fossil::import::cvs::pass::atopsort 1.0 [list source [file join $dir c2f_patopsort.tcl]] +package ifneeded vc::fossil::import::cvs::pass::import 1.0 [list source [file join $dir c2f_pimport.tcl]] package ifneeded vc::fossil::import::cvs::gtcore 1.0 [list source [file join $dir c2f_gtcore.tcl]] package ifneeded vc::fossil::import::cvs::cyclebreaker 1.0 [list source [file join $dir c2f_cyclebreaker.tcl]] package ifneeded vc::fossil::import::cvs::project 1.0 [list source [file join $dir c2f_project.tcl]] package ifneeded vc::fossil::import::cvs::project::lodmgr 1.0 [list source [file join $dir c2f_plodmgr.tcl]] package ifneeded vc::fossil::import::cvs::project::rev 1.0 [list source [file join $dir c2f_prev.tcl]]