Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Added the basic parts of the state manager and integrated it with option processor and pass manager. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
eb656de7d9a95af6a040f307c0b1d5c2 |
| User & Date: | aku 2007-10-05 05:33:14.000 |
Context
|
2007-10-05
| ||
| 06:50 | Extended state handling with methods to declare usage and structure of state, started integration of state with pass I, collection of projects and files. ... (check-in: fb1e36d290 user: aku tags: trunk) | |
| 05:33 | Added the basic parts of the state manager and integrated it with option processor and pass manager. ... (check-in: eb656de7d9 user: aku tags: trunk) | |
|
2007-10-04
| ||
| 04:34 | Continued work on pass I. Filled in the repository management, and basic implementation of project objects. Missing are persistence and the foundation for that (cache database). ... (check-in: 52f2254007 user: aku tags: trunk) | |
Changes
Changes to tools/cvs2fossil/lib/c2f_option.tcl.
| ︙ | ︙ | |||
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
package require Tcl 8.4 ; # Required runtime.
package require snit ; # OO system.
package require vc::tools::trouble ; # Error reporting.
package require vc::tools::log ; # User feedback.
package require vc::fossil::import::cvs::pass ; # Pass management
package require vc::fossil::import::cvs::pass::collar ; # Pass I.
package require vc::fossil::import::cvs::repository ; # Repository management
# # ## ### ##### ######## ############# #####################
##
snit::type ::vc::fossil::import::cvs::option {
# # ## ### ##### ######## #############
## Public API, Options.
# --help, --help-passes, -h
# --version
# -p, --pass, --passes
# --ignore-conflicting-attics
# --project
# -v, --verbose
# -q, --quiet
| > > < < | | | | < < < | | | | | < < | > > < | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
package require Tcl 8.4 ; # Required runtime.
package require snit ; # OO system.
package require vc::tools::trouble ; # Error reporting.
package require vc::tools::log ; # User feedback.
package require vc::fossil::import::cvs::pass ; # Pass management
package require vc::fossil::import::cvs::pass::collar ; # Pass I.
package require vc::fossil::import::cvs::repository ; # Repository management
package require vc::fossil::import::cvs::state ; # State storage
# # ## ### ##### ######## ############# #####################
##
snit::type ::vc::fossil::import::cvs::option {
# # ## ### ##### ######## #############
## Public API, Options.
# --help, --help-passes, -h
# --version
# -p, --pass, --passes
# --ignore-conflicting-attics
# --project
# -v, --verbose
# -q, --quiet
# --state (conversion status, ala config.cache)
# -o, --output
# --dry-run
# --trunk-only
# --force-branch RE
# --force-tag RE
# --symbol-transform RE:XX
# --exclude
# # ## ### ##### ######## #############
## Public API, Methods
typemethod process {arguments} {
# Syntax of arguments: ?option ?value?...? /path/to/cvs/repository
while {[IsOption arguments -> option]} {
switch -exact -- $option {
-h -
--help { PrintHelp ; exit 0 }
--help-passes { pass help ; exit 0 }
--version { PrintVersion ; exit 0 }
-p -
--pass -
--passes { pass select [Value arguments] }
--ignore-conflicting-attics { collar ignore_conflicting_attics }
--project { repository add [Value arguments] }
-v -
--verbose { log verbose }
-q -
--quiet { log quiet }
--state { state use [Value arguments] }
default {
Usage $badoption$option\n$gethelp
}
}
}
if {[llength $arguments] > 1} Usage
if {[llength $arguments] < 1} { Usage $nocvs }
repository base [lindex $arguments 0]
|
| ︙ | ︙ | |||
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
trouble info "Usage: $argv0 $usage"
trouble info ""
trouble info " Information options"
trouble info ""
trouble info " -h, --help Print this message and exit with success"
trouble info " --help-passes Print list of passes and exit with success"
trouble info " --version Print version number of $argv0"
trouble info ""
trouble info " Conversion control options"
trouble info ""
trouble info " -p, --pass PASS Run only the specified conversion pass"
trouble info " -p, --passes ?START?:?END? Run only the passes START through END,"
trouble info " inclusive."
trouble info ""
trouble info " Passes are specified by name."
trouble info ""
trouble info " --ignore-conflicting-attics"
trouble info " Prevent abort when conflicting archives"
trouble info " were found in both regular and Attic."
trouble info ""
# --project, --cache
# ...
return
}
proc PrintVersion {} {
| > > > > > | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
trouble info "Usage: $argv0 $usage"
trouble info ""
trouble info " Information options"
trouble info ""
trouble info " -h, --help Print this message and exit with success"
trouble info " --help-passes Print list of passes and exit with success"
trouble info " --version Print version number of $argv0"
trouble info " -v, --verbose Increase application's verbosity"
trouble info " -q, --quiet Decrease application's verbosity"
trouble info ""
trouble info " Conversion control options"
trouble info ""
trouble info " -p, --pass PASS Run only the specified conversion pass"
trouble info " -p, --passes ?START?:?END? Run only the passes START through END,"
trouble info " inclusive."
trouble info ""
trouble info " Passes are specified by name."
trouble info ""
trouble info " --ignore-conflicting-attics"
trouble info " Prevent abort when conflicting archives"
trouble info " were found in both regular and Attic."
trouble info ""
trouble info " --state PATH Save state to the specified file, and"
trouble info " load state of previous runs from it too."
trouble info ""
# --project, --cache
# ...
return
}
proc PrintVersion {} {
|
| ︙ | ︙ | |||
164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
## Internal methods, state validation
proc Validate {} {
# Prevent in-depth validation if the options were already bad.
trouble abort?
repository validate
trouble abort?
return
}
# # ## ### ##### ######## #############
## Configuration
| > | 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
## Internal methods, state validation
proc Validate {} {
# Prevent in-depth validation if the options were already bad.
trouble abort?
repository validate
state setup
trouble abort?
return
}
# # ## ### ##### ######## #############
## Configuration
|
| ︙ | ︙ | |||
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
namespace export option
namespace eval option {
namespace import ::vc::tools::trouble
namespace import ::vc::tools::log
namespace import ::vc::fossil::import::cvs::pass
namespace import ::vc::fossil::import::cvs::pass::collar
namespace import ::vc::fossil::import::cvs::repository
}
}
# # ## ### ##### ######## ############# #####################
## Ready
package provide vc::fossil::import::cvs::option 1.0
return
| > | 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
namespace export option
namespace eval option {
namespace import ::vc::tools::trouble
namespace import ::vc::tools::log
namespace import ::vc::fossil::import::cvs::pass
namespace import ::vc::fossil::import::cvs::pass::collar
namespace import ::vc::fossil::import::cvs::repository
namespace import ::vc::fossil::import::cvs::state
}
}
# # ## ### ##### ######## ############# #####################
## Ready
package provide vc::fossil::import::cvs::option 1.0
return
|
Changes to tools/cvs2fossil/lib/c2f_pass.tcl.
| ︙ | ︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ## query this manager to dynamically create the relevant texts. # # ## ### ##### ######## ############# ##################### ## Requirements package require Tcl 8.4 ; # Required runtime. package require snit ; # OO system. package require vc::tools::trouble ; # Error reporting. package require vc::tools::log ; # User feedback. package require struct::list ; # Portable lassign # # ## ### ##### ######## ############# ##################### ## | > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | ## query this manager to dynamically create the relevant texts. # # ## ### ##### ######## ############# ##################### ## Requirements package require Tcl 8.4 ; # Required runtime. package require snit ; # OO system. package require vc::fossil::import::cvs::state ; # State storage package require vc::tools::trouble ; # Error reporting. package require vc::tools::log ; # User feedback. package require struct::list ; # Portable lassign # # ## ### ##### ######## ############# ##################### ## |
| ︙ | ︙ | |||
104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
}
foreach p $runlist {
log write 0 pass "Begin $p"
Call $p run
log write 0 pass "Done $p"
trouble abort?
}
return
}
# # ## ### ##### ######## #############
## Internal methods
proc Ok? {code label ov {emptyok 1}} {
| > > | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
}
foreach p $runlist {
log write 0 pass "Begin $p"
Call $p run
log write 0 pass "Done $p"
trouble abort?
}
state release
return
}
# # ## ### ##### ######## #############
## Internal methods
proc Ok? {code label ov {emptyok 1}} {
|
| ︙ | ︙ | |||
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# # ## ### ##### ######## #############
}
namespace eval ::vc::fossil::import::cvs {
namespace export pass
namespace eval pass {
namespace import ::vc::tools::trouble
namespace import ::vc::tools::log
log register pass
}
}
# # ## ### ##### ######## ############# #####################
## Ready
package provide vc::fossil::import::cvs::pass 1.0
return
| > | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# # ## ### ##### ######## #############
}
namespace eval ::vc::fossil::import::cvs {
namespace export pass
namespace eval pass {
namespace import ::vc::fossil::import::cvs::state
namespace import ::vc::tools::trouble
namespace import ::vc::tools::log
log register pass
}
}
# # ## ### ##### ######## ############# #####################
## Ready
package provide vc::fossil::import::cvs::pass 1.0
return
|
Changes to tools/cvs2fossil/lib/c2f_repository.tcl.
| ︙ | ︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
package require Tcl 8.4 ; # Required runtime.
package require snit ; # OO system.
package require vc::tools::trouble ; # Error reporting.
package require vc::tools::log ; # User feedback.
package require vc::tools::misc ; # Text formatting
package require vc::fossil::import::cvs::project ; # CVS projects
package require struct::list ; # List operations.
# # ## ### ##### ######## ############# #####################
##
snit::type ::vc::fossil::import::cvs::repository {
# # ## ### ##### ######## #############
## Public API
| > | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
package require Tcl 8.4 ; # Required runtime.
package require snit ; # OO system.
package require vc::tools::trouble ; # Error reporting.
package require vc::tools::log ; # User feedback.
package require vc::tools::misc ; # Text formatting
package require vc::fossil::import::cvs::project ; # CVS projects
package require struct::list ; # List operations.
package require fileutil ; # File operations.
# # ## ### ##### ######## ############# #####################
##
snit::type ::vc::fossil::import::cvs::repository {
# # ## ### ##### ######## #############
## Public API
|
| ︙ | ︙ |
Added tools/cvs2fossil/lib/c2f_state.tcl.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
## -*- 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
# # ## ### ##### ######## ############# #####################
## State manager. Maintains the sqlite database used by all the other
## parts of the system, especially the passes and their support code,
## to persist and restore their state across invokations.
# # ## ### ##### ######## ############# #####################
## Requirements
package require Tcl 8.4 ; # Required runtime.
package require snit ; # OO system.
package require fileutil ; # File operations.
package require sqlite3 ; # Database access.
package require vc::tools::trouble ; # Error reporting.
package require vc::tools::log ; # User feedback.
# # ## ### ##### ######## ############# #####################
##
snit::type ::vc::fossil::import::cvs::state {
# # ## ### ##### ######## #############
## Public API
typemethod use {path} {
# Immediate validation. There are are two possibilities to
# consider. The path exists or it doesn't.
# In the first case it has to be a readable and writable file,
# and it has to be a proper sqlite database. Further checks
# regarding the required tables will be done later, by the
# passes, during their setup.
# In the second case we have to be able to create the file,
# and check that. This is done by opening it, sqlite will then
# try to create it, and may fail.
if {[file exists $path]} {
if {![fileutil::test $path frw msg {cvs2fossil state}]} {
trouble fatal $msg
return
}
}
if {[catch {
sqlite3 ${type}::TEMP $path
} res]} {
trouble fatal $res
return
}
# A previously defined state database is closed before
# committing to the new definition. We do not store the path
# itself, this ensures that the file is _not_ cleaned up after
# a run.
catch { ${type}::STATE close }
rename ${type}::TEMP ${type}::STATE
set mypath {}
return
}
typemethod setup {} {
# If, and only if no state database was defined by the user
# then it is now the time to create our own using a tempfile.
if {[llength [info commands ${type}::STATE]]} return
set mypath [fileutil::tempfile cvs2fossil_state_]
sqlite3 ${type}::STATE $mypath
log write 2 state "using $mypath"
return
}
typemethod release {} {
log write 2 state release
${type}::STATE close
if {$mypath eq ""} return
file delete $mypath
return
}
# # ## ### ##### ######## #############
## State
typevariable mystate {} ; # Sqlite database (command) holding the converter state.
typevariable mypath {} ; # Path to the database, for cleanup of a temp database.
# # ## ### ##### ######## #############
## Internal methods
# # ## ### ##### ######## #############
## Configuration
pragma -hasinstances no ; # singleton
pragma -hastypeinfo no ; # no introspection
pragma -hastypedestroy no ; # immortal
# # ## ### ##### ######## #############
}
namespace eval ::vc::fossil::import::cvs {
namespace export state
namespace eval state {
namespace import ::vc::tools::trouble
namespace import ::vc::tools::log
log register state
}
}
# # ## ### ##### ######## ############# #####################
## Ready
package provide vc::fossil::import::cvs::state 1.0
return
|
Changes to tools/cvs2fossil/lib/pkgIndex.tcl.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# # ## ### ##### ######## ############# #####################
## Package management.
## Index of the local packages required by cvs2fossil
# # ## ### ##### ######## ############# #####################
if {![package vsatisfies [package require Tcl] 8.4]} return
package ifneeded vc::fossil::import::cvs 1.0 [list source [file join $dir cvs2fossil.tcl]]
package ifneeded vc::fossil::import::cvs::option 1.0 [list source [file join $dir c2f_option.tcl]]
package ifneeded vc::fossil::import::cvs::pass 1.0 [list source [file join $dir c2f_pass.tcl]]
package ifneeded vc::fossil::import::cvs::pass::collar 1.0 [list source [file join $dir c2f_pcollar.tcl]]
package ifneeded vc::fossil::import::cvs::repository 1.0 [list source [file join $dir c2f_repository.tcl]]
package ifneeded vc::fossil::import::cvs::project 1.0 [list source [file join $dir c2f_project.tcl]]
package ifneeded vc::tools::trouble 1.0 [list source [file join $dir trouble.tcl]]
package ifneeded vc::tools::log 1.0 [list source [file join $dir log.tcl]]
package ifneeded vc::tools::misc 1.0 [list source [file join $dir misc.tcl]]
| > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# # ## ### ##### ######## ############# #####################
## Package management.
## Index of the local packages required by cvs2fossil
# # ## ### ##### ######## ############# #####################
if {![package vsatisfies [package require Tcl] 8.4]} return
package ifneeded vc::fossil::import::cvs 1.0 [list source [file join $dir cvs2fossil.tcl]]
package ifneeded vc::fossil::import::cvs::option 1.0 [list source [file join $dir c2f_option.tcl]]
package ifneeded vc::fossil::import::cvs::pass 1.0 [list source [file join $dir c2f_pass.tcl]]
package ifneeded vc::fossil::import::cvs::pass::collar 1.0 [list source [file join $dir c2f_pcollar.tcl]]
package ifneeded vc::fossil::import::cvs::repository 1.0 [list source [file join $dir c2f_repository.tcl]]
package ifneeded vc::fossil::import::cvs::project 1.0 [list source [file join $dir c2f_project.tcl]]
package ifneeded vc::fossil::import::cvs::state 1.0 [list source [file join $dir c2f_state.tcl]]
package ifneeded vc::tools::trouble 1.0 [list source [file join $dir trouble.tcl]]
package ifneeded vc::tools::log 1.0 [list source [file join $dir log.tcl]]
package ifneeded vc::tools::misc 1.0 [list source [file join $dir misc.tcl]]
|