Check-in [31b15fcf30]
Not logged in
Overview

SHA1 Hash:31b15fcf3070b5032cb009e251e1418016bde013
Date: 2008-03-05 03:42:50
User: aku
Comment:Split the current import pass into three, for files, changesets, and finalization (fossil rebuild).
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Added tools/cvs2fossil/lib/c2f_pimportcsets.tcl version [69adaad9d5]

@@ -1,1 +1,133 @@
+## -*- tcl -*-
+# # ## ### ##### ######## ############# #####################
+## Copyright (c) 2008 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 XIII. This is the second of the backend passes. It imports the
+## changesets constructed by the previous passes 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.
+package require vc::fossil::import::cvs::ristate          ; # Import state (revisions)
+
+# # ## ### ##### ######## ############# #####################
+## Register the pass with the management
+
+vc::fossil::import::cvs::pass define \
+    ImportCSets \
+    {Import the changesets into fossil repositories} \
+    ::vc::fossil::import::cvs::pass::importcsets
+
+# # ## ### ##### ######## ############# #####################
+##
+
+snit::type ::vc::fossil::import::cvs::pass::importcsets {
+    # # ## ### ##### ######## #############
+    ## 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
+	state use meta
+	state use author
+	state use cmessage
+	state use symbol
+	state use space
+	state use revuuid
+	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 importcsets {Importing project "[$project base]"}
+
+	    set pid    [$project id]
+	    set fossil [fossil %AUTO%]
+	    struct::list assign [state run {
+		SELECT repository, workspace
+		FROM space
+		WHERE pid = $pid
+	    }] r w
+	    $fossil load $r $w
+
+	    set rstate [ristate %AUTO%]
+
+	    state transaction {
+		# Layer II: Changesets
+		foreach {cset date} [$project changesetsinorder] {
+		    $cset pushto $fossil $date $rstate
+		}
+	    }
+
+	    $rstate destroy
+	    $fossil destroy
+	}
+	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 importcsets
+    namespace eval importcsets {
+	namespace import ::vc::fossil::import::cvs::repository
+	namespace import ::vc::fossil::import::cvs::state
+	namespace import ::vc::fossil::import::cvs::fossil
+	namespace import ::vc::fossil::import::cvs::ristate
+	namespace import ::vc::tools::log
+	log register importcsets
+    }
+}
+
+# # ## ### ##### ######## ############# #####################
+## Ready
 
+package provide vc::fossil::import::cvs::pass::importcsets 1.0
+return

Added tools/cvs2fossil/lib/c2f_pimportfiles.tcl version [6318a84484]

@@ -1,1 +1,151 @@
+## -*- tcl -*-
+# # ## ### ##### ######## ############# #####################
+## Copyright (c) 2007-2008 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
+## revisions of all files 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 \
+    ImportFiles \
+    {Import the file revisions into fossil repositories} \
+    ::vc::fossil::import::cvs::pass::importfiles
+
+# # ## ### ##### ######## ############# #####################
+##
+
+snit::type ::vc::fossil::import::cvs::pass::importfiles {
+    # # ## ### ##### ######## #############
+    ## 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
+	state use meta
+	state use author
+	state use cmessage
+	state use symbol
+
+	# Discard on setup. Do not discard on deferal.
+	state discard revuuid
+	state extend  revuuid {
+	    rid   INTEGER NOT NULL  REFERENCES revision UNIQUE,
+	    uuid  INTEGER NOT NULL  -- fossil id of the revision
+	    --                         unique within the project
+	}
+
+	# Remember the locations of the scratch data createdby this
+	# pass, for use by the next (importing changesets).
+	state discard space
+	state extend  space {
+	    pid        INTEGER  NOT NULL  REFERENCES project,
+	    repository TEXT     NOT NULL,
+	    workspace  TEXT     NOT NULL
+	}
+	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 importfiles {Importing project "[$project base]"}
+
+	    set pid    [$project id]
+	    set fossil [fossil %AUTO%]
+	    $fossil initialize
+
+	    state transaction {
+		# Layer I: Files and their revisions
+		foreach file [$project files] {
+		    $file pushto $fossil
+		}
+
+		# Save the scratch locations, needed by the next pass.
+		struct::list assign [$fossil space] r w
+		state run {
+		    DELETE FROM space
+		    WHERE pid = $pid
+		    ;
+		    INSERT INTO space (pid, repository, workspace)
+		    VALUES            ($pid, $r, $w);
+		}
+	    }
+
+	    $fossil destroy
+	}
+	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.
+
+	# Not discarding revuuid/space here, allow us to keep the info
+	# for the next pass even if the revisions are recomputed.
+	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 importfiles
+    namespace eval importfiles {
+	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 importfiles
+    }
+}
+
+# # ## ### ##### ######## ############# #####################
+## Ready
 
+package provide vc::fossil::import::cvs::pass::importfiles 1.0
+return

Added tools/cvs2fossil/lib/c2f_pimportfinal.tcl version [47b2c14f53]

@@ -1,1 +1,122 @@
+## -*- tcl -*-
+# # ## ### ##### ######## ############# #####################
+## Copyright (c) 2008 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 XIV. This is the third and last of the backend passes. It
+## finalizes the fossil repositories we have constructed in the
+## previous import passes.
+
+# # ## ### ##### ######## ############# #####################
+## 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 \
+    ImportFinal \
+    {Finalize the import into fossil repositories} \
+    ::vc::fossil::import::cvs::pass::importfinal
+
+# # ## ### ##### ######## ############# #####################
+##
+
+snit::type ::vc::fossil::import::cvs::pass::importfinal {
+    # # ## ### ##### ######## #############
+    ## Public API
+
+    typemethod setup {} {
+	# Define the names and structure of the persistent state of
+	# this pass.
+
+	state use space
+	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 importfinal {Finalize project "[$project base]"}
+
+	    set pid    [$project id]
+	    set fossil [fossil %AUTO%]
+	    struct::list assign [state run {
+		SELECT repository, workspace
+		FROM space
+		WHERE pid = $pid
+	    }] r w
+	    $fossil load $r $w
+
+	    # At last copy the temporary repository file to its final
+	    # destination and release the associated memory.
+
+	    set destination [$project base]
+	    if {$destination eq ""} {
+		set destination [file tail [repository base?]]
+	    }
+	    append destination .fsl
+
+	    $fossil finalize $destination ; # implies destroy
+	}
+	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 importfinal
+    namespace eval importfinal {
+	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 importfinal
+    }
+}
+
+# # ## ### ##### ######## ############# #####################
+## Ready
 
+package provide vc::fossil::import::cvs::pass::importfinal 1.0
+return

Modified tools/cvs2fossil/lib/cvs2fossil.tcl from [5ff9bfc147] to [d530eb4100].

@@ -39,11 +39,13 @@
 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
+package require vc::fossil::import::cvs::pass::importfiles ; # Import' Files
+package require vc::fossil::import::cvs::pass::importcsets ; # Import' Changesets
+package require vc::fossil::import::cvs::pass::importfinal ; # Import' Finalization
 
 # # ## ### ##### ######## ############# #####################
 ## Support for passes etc.
 
 package require vc::fossil::import::cvs::option ; # Cmd line parsing & database

Modified tools/cvs2fossil/lib/pkgIndex.tcl from [73c4287bf5] to [b810fde760].

@@ -22,11 +22,13 @@
 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::pass::importfiles 1.0 [list source [file join $dir c2f_pimportfiles.tcl]]
+package ifneeded vc::fossil::import::cvs::pass::importcsets 1.0 [list source [file join $dir c2f_pimportcsets.tcl]]
+package ifneeded vc::fossil::import::cvs::pass::importfinal 1.0 [list source [file join $dir c2f_pimportfinal.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::rev      1.0 [list source [file join $dir c2f_prev.tcl]]
 package ifneeded vc::fossil::import::cvs::project::revlink  1.0 [list source [file join $dir c2f_prevlink.tcl]]