Differences From:
File
tools/cvs2fossil/lib/c2f_option.tcl
part of check-in
[d57b7b4a05]
- Re-added the user feedback and error reporting utilities, with modifications, and completed the handling of the informational options.
by
aku on
2007-10-02 05:33:09.
[view]
To:
File
tools/cvs2fossil/lib/c2f_option.tcl
part of check-in
[591151532206c]
- Added the pass management, integrated with application and option processor.
by
aku on
2007-10-02 06:48:55.
[view]
@@ -20,8 +20,9 @@
package require Tcl 8.4 ; # Required runtime.
package require snit ; # OO system.
package require vc::tools::trouble ; # Error reporting.
+package require vc::fossil::import::cvs::pass ; # Pass management
# # ## ### ##### ######## ############# #####################
##
@@ -30,11 +31,12 @@
## Public API, Options.
# --help, --help-passes, -h
# --version
+ # -p, --pass, --passes
+
# --project
# --cache (conversion status, ala config.cache)
-
# -o, --output
# --dry-run
# --trunk-only
# --force-branch RE
@@ -53,11 +55,16 @@
while {[IsOption arguments -> option]} {
switch -exact -- $option {
-h -
- --help PrintHelp
- --help-passes PrintHelpPasses
- --version PrintVersion
+ --help { PrintHelp ; exit 0 }
+ --help-passes { pass help ; exit 0 }
+ --version { PrintVersion ; exit 0 }
+ -p -
+ --pass -
+ --passes {
+ pass select [Value arguments]
+ }
--project {
#cvs::repository addproject [Value arguments]
}
--cache {
@@ -89,39 +96,33 @@
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 ""
# --project, --cache
# ...
- exit 0
- }
-
- proc PrintHelpPasses {} {
- trouble info ""
- trouble info "Conversion passes:"
- trouble info ""
- set n 0
- foreach {p desc} {
- CollectAr {Collect archives}
- CollectRev {Collect revisions}
- } { trouble info " [format %2d $n]: $p $desc" ; incr n }
- trouble info ""
- exit 0
+ return
}
proc PrintVersion {} {
global argv0
set v [package require vc::fossil::import::cvs]
trouble info "$argv0 v$v"
- exit 0
+ return
}
proc Usage {{text {}}} {
global argv0
- if {$text ne ""} {set text \n$text}
- trouble fatal "Usage: $argv0 $usage$text"
- # Not reached
- return
+ trouble fatal "Usage: $argv0 $usage"
+ if {$text ne ""} { trouble fatal "$text" }
+ exit 1
}
# # ## ### ##### ######## #############
## Internal methods, command line processing
@@ -150,8 +151,13 @@
# # ## ### ##### ######## #############
## Internal methods, state validation
proc Validate {} {
+ # Prevent in-depth validation if the options were already bad.
+ trouble abort?
+
+
+ trouble abort?
return
}
# # ## ### ##### ######## #############
@@ -165,11 +171,12 @@
}
namespace eval ::vc::fossil::import::cvs::option {
namespace import ::vc::tools::trouble
+ namespace import ::vc::fossil::import::cvs::pass
}
# # ## ### ##### ######## ############# #####################
## Ready
package provide vc::fossil::import::cvs::option 1.0
return