File Annotation
Not logged in
2a98ac44bd 2007-10-02       aku: ## -*- tcl -*-
2a98ac44bd 2007-10-02       aku: # # ## ### ##### ######## ############# #####################
2a98ac44bd 2007-10-02       aku: ## Copyright (c) 2007 Andreas Kupries.
2a98ac44bd 2007-10-02       aku: #
2a98ac44bd 2007-10-02       aku: # This software is licensed as described in the file LICENSE, which
2a98ac44bd 2007-10-02       aku: # you should have received as part of this distribution.
2a98ac44bd 2007-10-02       aku: #
2a98ac44bd 2007-10-02       aku: # This software consists of voluntary contributions made by many
2a98ac44bd 2007-10-02       aku: # individuals.  For exact contribution history, see the revision
2a98ac44bd 2007-10-02       aku: # history and logs, available at http://fossil-scm.hwaci.com/fossil
2a98ac44bd 2007-10-02       aku: # # ## ### ##### ######## ############# #####################
2a98ac44bd 2007-10-02       aku: 
2a98ac44bd 2007-10-02       aku: ## Option database, processes the command line. Note that not all of
2a98ac44bd 2007-10-02       aku: ## the option information is stored here. Parts are propagated to
2a98ac44bd 2007-10-02       aku: ## other pieces of the system and handled there, via option
2a98ac44bd 2007-10-02       aku: ## delegation
2a98ac44bd 2007-10-02       aku: 
2a98ac44bd 2007-10-02       aku: # # ## ### ##### ######## ############# #####################
2a98ac44bd 2007-10-02       aku: ## Requirements
2a98ac44bd 2007-10-02       aku: 
47740cc1f6 2007-10-03       aku: package require Tcl 8.4                               ; # Required runtime.
47740cc1f6 2007-10-03       aku: package require snit                                  ; # OO system.
47740cc1f6 2007-10-03       aku: package require vc::tools::trouble                    ; # Error reporting.
2929a438ef 2007-10-04       aku: package require vc::tools::log                        ; # User feedback.
9f3fd3ec4b 2007-10-23       aku: package require vc::tools::misc                       ; # Misc. path reformatting.
1a20a81f33 2007-12-05       aku: package require vc::fossil::import::cvs::fossil       ; # Fossil repository access
47740cc1f6 2007-10-03       aku: package require vc::fossil::import::cvs::pass         ; # Pass management
47740cc1f6 2007-10-03       aku: package require vc::fossil::import::cvs::pass::collar ; # Pass I.
47740cc1f6 2007-10-03       aku: package require vc::fossil::import::cvs::repository   ; # Repository management
eb656de7d9 2007-10-05       aku: package require vc::fossil::import::cvs::state        ; # State storage
0af7a3c8ac 2007-11-30       aku: package require vc::fossil::import::cvs::integrity    ; # State integrity checks.
7eaa420a23 2007-11-05       aku: package require vc::fossil::import::cvs::project::sym ; # Project level symbols
7f15be9078 2007-11-20       aku: package require vc::fossil::import::cvs::cyclebreaker ; # Breaking dependency cycles.
2a98ac44bd 2007-10-02       aku: 
2a98ac44bd 2007-10-02       aku: # # ## ### ##### ######## ############# #####################
2a98ac44bd 2007-10-02       aku: ##
2a98ac44bd 2007-10-02       aku: 
2a98ac44bd 2007-10-02       aku: snit::type ::vc::fossil::import::cvs::option {
2a98ac44bd 2007-10-02       aku:     # # ## ### ##### ######## #############
2a98ac44bd 2007-10-02       aku:     ## Public API, Options.
2a98ac44bd 2007-10-02       aku: 
2a98ac44bd 2007-10-02       aku:     # --help, --help-passes, -h
2a98ac44bd 2007-10-02       aku:     # --version
5911515322 2007-10-02       aku:     # -p, --pass, --passes
47740cc1f6 2007-10-03       aku:     # --ignore-conflicting-attics
c1dc8701ef 2008-02-12       aku:     # --convert-dotfiles
2a98ac44bd 2007-10-02       aku:     # --project
2929a438ef 2007-10-04       aku:     # -v, --verbose
2929a438ef 2007-10-04       aku:     # -q, --quiet
eb656de7d9 2007-10-05       aku:     # --state (conversion status, ala config.cache)
3bde1a2e2f 2007-10-17       aku:     # --trunk-only
7eaa420a23 2007-11-05       aku:     # --exclude, --force-tag, --force-branch
4e7dd05fc6 2007-11-17       aku:     # --batch
1a20a81f33 2007-12-05       aku:     # --fossil PATH
2a98ac44bd 2007-10-02       aku: 
2a98ac44bd 2007-10-02       aku:     # -o, --output
2a98ac44bd 2007-10-02       aku:     # --dry-run
7eaa420a23 2007-11-05       aku:     # --symbol-transform RE:XX
2a98ac44bd 2007-10-02       aku: 
2a98ac44bd 2007-10-02       aku:     # # ## ### ##### ######## #############
2a98ac44bd 2007-10-02       aku:     ## Public API, Methods
2a98ac44bd 2007-10-02       aku: 
2a98ac44bd 2007-10-02       aku:     typemethod process {arguments} {
2a98ac44bd 2007-10-02       aku: 	# Syntax of arguments: ?option ?value?...? /path/to/cvs/repository
2a98ac44bd 2007-10-02       aku: 
2a98ac44bd 2007-10-02       aku: 	while {[IsOption arguments -> option]} {
2a98ac44bd 2007-10-02       aku: 	    switch -exact -- $option {
eb656de7d9 2007-10-05       aku: 		-h                          -
eb656de7d9 2007-10-05       aku: 		--help                      { PrintHelp    ; exit 0 }
eb656de7d9 2007-10-05       aku: 		--help-passes               { pass help    ; exit 0 }
eb656de7d9 2007-10-05       aku: 		--version                   { PrintVersion ; exit 0 }
2929a438ef 2007-10-04       aku: 		-p                          -
2929a438ef 2007-10-04       aku: 		--pass                      -
2929a438ef 2007-10-04       aku: 		--passes                    { pass select [Value arguments] }
2929a438ef 2007-10-04       aku: 		--ignore-conflicting-attics { collar ignore_conflicting_attics }
c1dc8701ef 2008-02-12       aku: 		--convert-dotfiles          { collar accept_and_convert_dotfiles }
eb656de7d9 2007-10-05       aku: 		--project                   { repository add [Value arguments] }
eb656de7d9 2007-10-05       aku: 		-v                          -
eb656de7d9 2007-10-05       aku: 		--verbose                   { log verbose }
eb656de7d9 2007-10-05       aku: 		-q                          -
eb656de7d9 2007-10-05       aku: 		--quiet                     { log quiet }
e288af3995 2007-12-02       aku: 		--state                     { state usedb [Value arguments] }
3bde1a2e2f 2007-10-17       aku: 		--trunk-only                { repository trunkonly! }
7eaa420a23 2007-11-05       aku: 		--exclude                   { project::sym exclude     [Value arguments] }
7eaa420a23 2007-11-05       aku: 		--force-tag                 { project::sym forcetag    [Value arguments] }
7eaa420a23 2007-11-05       aku: 		--force-branch              { project::sym forcebranch [Value arguments] }
4e7dd05fc6 2007-11-17       aku: 		--batch                     { log noprogress }
7f15be9078 2007-11-20       aku: 		--dots                      { cyclebreaker dotsto [Value arguments] }
97b4405ecf 2007-11-25       aku: 		--watch                     { cyclebreaker watch  [Value arguments] }
e288af3995 2007-12-02       aku: 		--statesavequeriesto        { state savequeriesto [Value arguments] }
1a20a81f33 2007-12-05       aku: 		--fossil                    { fossil setlocation  [Value arguments] }
2a98ac44bd 2007-10-02       aku: 		default {
2a98ac44bd 2007-10-02       aku: 		    Usage $badoption$option\n$gethelp
2a98ac44bd 2007-10-02       aku: 		}
2a98ac44bd 2007-10-02       aku: 	    }
2a98ac44bd 2007-10-02       aku: 	}
2a98ac44bd 2007-10-02       aku: 
2a98ac44bd 2007-10-02       aku: 	if {[llength $arguments] > 1} Usage
2a98ac44bd 2007-10-02       aku: 	if {[llength $arguments] < 1} { Usage $nocvs }
9f3fd3ec4b 2007-10-23       aku: 	repository base [striptrailingslash [lindex $arguments 0]]
2a98ac44bd 2007-10-02       aku: 
2a98ac44bd 2007-10-02       aku: 	Validate
2a98ac44bd 2007-10-02       aku: 	return
2a98ac44bd 2007-10-02       aku:     }
2a98ac44bd 2007-10-02       aku: 
2a98ac44bd 2007-10-02       aku:     # # ## ### ##### ######## #############
d57b7b4a05 2007-10-02       aku:     ## Internal methods, printing information.
d57b7b4a05 2007-10-02       aku: 
d57b7b4a05 2007-10-02       aku:     proc PrintHelp {} {
d57b7b4a05 2007-10-02       aku: 	global argv0
d57b7b4a05 2007-10-02       aku: 	trouble info "Usage: $argv0 $usage"
d57b7b4a05 2007-10-02       aku: 	trouble info ""
d57b7b4a05 2007-10-02       aku: 	trouble info "  Information options"
d57b7b4a05 2007-10-02       aku: 	trouble info ""
d57b7b4a05 2007-10-02       aku: 	trouble info "    -h, --help    Print this message and exit with success"
d57b7b4a05 2007-10-02       aku: 	trouble info "    --help-passes Print list of passes and exit with success"
d57b7b4a05 2007-10-02       aku: 	trouble info "    --version     Print version number of $argv0"
eb656de7d9 2007-10-05       aku: 	trouble info "    -v, --verbose Increase application's verbosity"
eb656de7d9 2007-10-05       aku: 	trouble info "    -q, --quiet   Decrease application's verbosity"
4e7dd05fc6 2007-11-17       aku: 	trouble info "    --batch       Disable the progress feedback standard to"
4e7dd05fc6 2007-11-17       aku: 	trouble info "                  interactive use."
5911515322 2007-10-02       aku: 	trouble info ""
5911515322 2007-10-02       aku: 	trouble info "  Conversion control options"
5911515322 2007-10-02       aku: 	trouble info ""
5911515322 2007-10-02       aku: 	trouble info "    -p, --pass PASS            Run only the specified conversion pass"
5911515322 2007-10-02       aku: 	trouble info "    -p, --passes ?START?:?END? Run only the passes START through END,"
5911515322 2007-10-02       aku: 	trouble info "                               inclusive."
5911515322 2007-10-02       aku: 	trouble info ""
5911515322 2007-10-02       aku: 	trouble info "                               Passes are specified by name."
5911515322 2007-10-02       aku: 	trouble info ""
47740cc1f6 2007-10-03       aku: 	trouble info "    --ignore-conflicting-attics"
47740cc1f6 2007-10-03       aku: 	trouble info "                               Prevent abort when conflicting archives"
47740cc1f6 2007-10-03       aku: 	trouble info "                               were found in both regular and Attic."
eb656de7d9 2007-10-05       aku: 	trouble info ""
c1dc8701ef 2008-02-12       aku: 	trouble info "    --convert-dotfiles"
c1dc8701ef 2008-02-12       aku: 	trouble info "                               Prevent abort when dot-files were found,"
c1dc8701ef 2008-02-12       aku: 	trouble info "                               causing their conversion to nondot-form"
c1dc8701ef 2008-02-12       aku: 	trouble info "                               instead."
7eaa420a23 2007-11-05       aku: 	trouble info ""
eb656de7d9 2007-10-05       aku: 	trouble info "    --state PATH               Save state to the specified file, and"
eb656de7d9 2007-10-05       aku: 	trouble info "                               load state of previous runs from it too."
7eaa420a23 2007-11-05       aku: 	trouble info ""
7eaa420a23 2007-11-05       aku: 	trouble info "    --exclude ?PROJECT:?SYMBOL Exclude the named symbol from all or"
7eaa420a23 2007-11-05       aku: 	trouble info "                               just the specified project. Both project"
7eaa420a23 2007-11-05       aku: 	trouble info "                               and symbol names are glob patterns."
7eaa420a23 2007-11-05       aku: 	trouble info ""
7eaa420a23 2007-11-05       aku: 	trouble info "    --force-tag ?PROJECT:?SYMBOL"
7eaa420a23 2007-11-05       aku: 	trouble info "                               Force the named symbol from all or just"
7eaa420a23 2007-11-05       aku: 	trouble info "                               the specified project to be converted as"
7eaa420a23 2007-11-05       aku: 	trouble info "                               tag. Both project and symbol names are"
7eaa420a23 2007-11-05       aku: 	trouble info "                               glob patterns."
7eaa420a23 2007-11-05       aku: 	trouble info ""
7eaa420a23 2007-11-05       aku: 	trouble info "    --force-branch ?PROJECT:?SYMBOL"
7eaa420a23 2007-11-05       aku: 	trouble info "                               Force the named symbol from all or just"
7eaa420a23 2007-11-05       aku: 	trouble info "                               the specified project to be converted as"
7eaa420a23 2007-11-05       aku: 	trouble info "                               branch. Both project and symbol names"
7eaa420a23 2007-11-05       aku: 	trouble info "                               are glob patterns."
0af7a3c8ac 2007-11-30       aku: 	trouble info ""
1a20a81f33 2007-12-05       aku: 	trouble info "  Output control options"
1a20a81f33 2007-12-05       aku: 	trouble info ""
1a20a81f33 2007-12-05       aku: 	trouble info "    --fossil PATH              Specify where to find the fossil execu-"
1a20a81f33 2007-12-05       aku: 	trouble info "                               table if cv2fossil could not find it in"
1a20a81f33 2007-12-05       aku: 	trouble info "                               the PATH."
e288af3995 2007-12-02       aku: 	trouble info ""
e288af3995 2007-12-02       aku: 	trouble info "  Debug options"
7f15be9078 2007-11-20       aku: 	trouble info ""
7f15be9078 2007-11-20       aku: 	trouble info "    --dots PATH                Write the changeset graphs before, after,"
7f15be9078 2007-11-20       aku: 	trouble info "                               and during breaking the of cycles to the"
7f15be9078 2007-11-20       aku: 	trouble info "                               direcotry PATH, using GraphViz's dot format"
d57b7b4a05 2007-10-02       aku: 	trouble info ""
47740cc1f6 2007-10-03       aku: 
d57b7b4a05 2007-10-02       aku: 	# --project, --cache
d57b7b4a05 2007-10-02       aku: 	# ...
5911515322 2007-10-02       aku: 	return
d57b7b4a05 2007-10-02       aku:     }
d57b7b4a05 2007-10-02       aku: 
d57b7b4a05 2007-10-02       aku:     proc PrintVersion {} {
d57b7b4a05 2007-10-02       aku: 	global argv0
d57b7b4a05 2007-10-02       aku: 	set v [package require vc::fossil::import::cvs]
d57b7b4a05 2007-10-02       aku: 	trouble info "$argv0 v$v"
5911515322 2007-10-02       aku: 	return
d57b7b4a05 2007-10-02       aku:     }
d57b7b4a05 2007-10-02       aku: 
d57b7b4a05 2007-10-02       aku:     proc Usage {{text {}}} {
d57b7b4a05 2007-10-02       aku: 	global argv0
5911515322 2007-10-02       aku: 	trouble fatal "Usage: $argv0 $usage"
5911515322 2007-10-02       aku: 	if {$text ne ""} { trouble fatal "$text" }
5911515322 2007-10-02       aku: 	exit 1
d57b7b4a05 2007-10-02       aku:     }
d57b7b4a05 2007-10-02       aku: 
d57b7b4a05 2007-10-02       aku:     # # ## ### ##### ######## #############
d57b7b4a05 2007-10-02       aku:     ## Internal methods, command line processing
d57b7b4a05 2007-10-02       aku: 
d57b7b4a05 2007-10-02       aku:     typevariable usage     "?option ?value?...? cvs-repository-path"
2a98ac44bd 2007-10-02       aku:     typevariable nocvs     "       The cvs-repository-path is missing."
2a98ac44bd 2007-10-02       aku:     typevariable badoption "       Bad option "
2a98ac44bd 2007-10-02       aku:     typevariable gethelp   "       Use --help to get help."
2a98ac44bd 2007-10-02       aku: 
2a98ac44bd 2007-10-02       aku:     proc IsOption {av _ ov} {
2a98ac44bd 2007-10-02       aku: 	upvar 1 $av arguments $ov option
2a98ac44bd 2007-10-02       aku: 	set candidate [lindex $arguments 0]
2a98ac44bd 2007-10-02       aku: 	if {![string match -* $candidate]} {return 0}
2a98ac44bd 2007-10-02       aku: 	set option    $candidate
2a98ac44bd 2007-10-02       aku: 	set arguments [lrange $arguments 1 end]
2a98ac44bd 2007-10-02       aku: 	return 1
2a98ac44bd 2007-10-02       aku:     }
2a98ac44bd 2007-10-02       aku: 
2a98ac44bd 2007-10-02       aku:     proc Value {av} {
2a98ac44bd 2007-10-02       aku: 	upvar 1 $av arguments
2a98ac44bd 2007-10-02       aku: 	set v         [lindex $arguments 0]
2a98ac44bd 2007-10-02       aku: 	set arguments [lrange $arguments 1 end]
2a98ac44bd 2007-10-02       aku: 	return $v
2a98ac44bd 2007-10-02       aku:     }
2a98ac44bd 2007-10-02       aku: 
d57b7b4a05 2007-10-02       aku:     # # ## ### ##### ######## #############
d57b7b4a05 2007-10-02       aku:     ## Internal methods, state validation
d57b7b4a05 2007-10-02       aku: 
2a98ac44bd 2007-10-02       aku:     proc Validate {} {
5911515322 2007-10-02       aku: 	# Prevent in-depth validation if the options were already bad.
5911515322 2007-10-02       aku: 	trouble abort?
5911515322 2007-10-02       aku: 
1a20a81f33 2007-12-05       aku: 	fossil     validate
47740cc1f6 2007-10-03       aku: 	repository validate
eb656de7d9 2007-10-05       aku: 	state      setup
2a98ac44bd 2007-10-02       aku: 
5911515322 2007-10-02       aku: 	trouble abort?
d57b7b4a05 2007-10-02       aku: 	return
2a98ac44bd 2007-10-02       aku:     }
2a98ac44bd 2007-10-02       aku: 
2a98ac44bd 2007-10-02       aku:     # # ## ### ##### ######## #############
2a98ac44bd 2007-10-02       aku:     ## Configuration
2a98ac44bd 2007-10-02       aku: 
2a98ac44bd 2007-10-02       aku:     pragma -hasinstances   no ; # singleton
2a98ac44bd 2007-10-02       aku:     pragma -hastypeinfo    no ; # no introspection
2a98ac44bd 2007-10-02       aku:     pragma -hastypedestroy no ; # immortal
2a98ac44bd 2007-10-02       aku: 
2a98ac44bd 2007-10-02       aku:     # # ## ### ##### ######## #############
d57b7b4a05 2007-10-02       aku: }
d57b7b4a05 2007-10-02       aku: 
47740cc1f6 2007-10-03       aku: namespace eval ::vc::fossil::import::cvs {
47740cc1f6 2007-10-03       aku:     namespace export option
47740cc1f6 2007-10-03       aku:     namespace eval option {
9f3fd3ec4b 2007-10-23       aku: 	namespace import ::vc::tools::misc::striptrailingslash
1a20a81f33 2007-12-05       aku: 	namespace import ::vc::fossil::import::cvs::fossil
47740cc1f6 2007-10-03       aku: 	namespace import ::vc::fossil::import::cvs::pass
47740cc1f6 2007-10-03       aku: 	namespace import ::vc::fossil::import::cvs::pass::collar
7f15be9078 2007-11-20       aku: 	namespace import ::vc::fossil::import::cvs::cyclebreaker
47740cc1f6 2007-10-03       aku: 	namespace import ::vc::fossil::import::cvs::repository
eb656de7d9 2007-10-05       aku: 	namespace import ::vc::fossil::import::cvs::state
0af7a3c8ac 2007-11-30       aku: 	namespace import ::vc::fossil::import::cvs::integrity
7eaa420a23 2007-11-05       aku: 	namespace eval project {
7eaa420a23 2007-11-05       aku: 	    namespace import ::vc::fossil::import::cvs::project::sym
7eaa420a23 2007-11-05       aku: 	}
7eaa420a23 2007-11-05       aku: 	namespace import ::vc::tools::trouble
7eaa420a23 2007-11-05       aku: 	namespace import ::vc::tools::log
47740cc1f6 2007-10-03       aku:     }
2a98ac44bd 2007-10-02       aku: }
2a98ac44bd 2007-10-02       aku: 
2a98ac44bd 2007-10-02       aku: # # ## ### ##### ######## ############# #####################
2a98ac44bd 2007-10-02       aku: ## Ready
2a98ac44bd 2007-10-02       aku: 
2a98ac44bd 2007-10-02       aku: package provide vc::fossil::import::cvs::option 1.0
2a98ac44bd 2007-10-02       aku: return