| | @@ -19,10 +19,11 @@ |
| 19 | 19 | ## Requirements |
| 20 | 20 | |
| 21 | 21 | package require Tcl 8.4 ; # Required runtime. |
| 22 | 22 | package require snit ; # OO system. |
| 23 | 23 | package require vc::tools::trouble ; # Error reporting. |
| 24 | +package require vc::fossil::import::cvs::pass ; # Pass management |
| 24 | 25 | |
| 25 | 26 | # # ## ### ##### ######## ############# ##################### |
| 26 | 27 | ## |
| 27 | 28 | |
| 28 | 29 | snit::type ::vc::fossil::import::cvs::option { |
| | @@ -29,13 +30,14 @@ |
| 29 | 30 | # # ## ### ##### ######## ############# |
| 30 | 31 | ## Public API, Options. |
| 31 | 32 | |
| 32 | 33 | # --help, --help-passes, -h |
| 33 | 34 | # --version |
| 35 | + # -p, --pass, --passes |
| 36 | + |
| 34 | 37 | # --project |
| 35 | 38 | # --cache (conversion status, ala config.cache) |
| 36 | | - |
| 37 | 39 | # -o, --output |
| 38 | 40 | # --dry-run |
| 39 | 41 | # --trunk-only |
| 40 | 42 | # --force-branch RE |
| 41 | 43 | # --force-tag RE |
| | @@ -52,13 +54,18 @@ |
| 52 | 54 | # Syntax of arguments: ?option ?value?...? /path/to/cvs/repository |
| 53 | 55 | |
| 54 | 56 | while {[IsOption arguments -> option]} { |
| 55 | 57 | switch -exact -- $option { |
| 56 | 58 | -h - |
| 57 | | - --help PrintHelp |
| 58 | | - --help-passes PrintHelpPasses |
| 59 | | - --version PrintVersion |
| 59 | + --help { PrintHelp ; exit 0 } |
| 60 | + --help-passes { pass help ; exit 0 } |
| 61 | + --version { PrintVersion ; exit 0 } |
| 62 | + -p - |
| 63 | + --pass - |
| 64 | + --passes { |
| 65 | + pass select [Value arguments] |
| 66 | + } |
| 60 | 67 | --project { |
| 61 | 68 | #cvs::repository addproject [Value arguments] |
| 62 | 69 | } |
| 63 | 70 | --cache { |
| 64 | 71 | # [Value arguments] |
| | @@ -88,41 +95,35 @@ |
| 88 | 95 | trouble info "" |
| 89 | 96 | trouble info " -h, --help Print this message and exit with success" |
| 90 | 97 | trouble info " --help-passes Print list of passes and exit with success" |
| 91 | 98 | trouble info " --version Print version number of $argv0" |
| 92 | 99 | trouble info "" |
| 100 | + trouble info " Conversion control options" |
| 101 | + trouble info "" |
| 102 | + trouble info " -p, --pass PASS Run only the specified conversion pass" |
| 103 | + trouble info " -p, --passes ?START?:?END? Run only the passes START through END," |
| 104 | + trouble info " inclusive." |
| 105 | + trouble info "" |
| 106 | + trouble info " Passes are specified by name." |
| 107 | + trouble info "" |
| 93 | 108 | # --project, --cache |
| 94 | 109 | # ... |
| 95 | | - exit 0 |
| 96 | | - } |
| 97 | | - |
| 98 | | - proc PrintHelpPasses {} { |
| 99 | | - trouble info "" |
| 100 | | - trouble info "Conversion passes:" |
| 101 | | - trouble info "" |
| 102 | | - set n 0 |
| 103 | | - foreach {p desc} { |
| 104 | | - CollectAr {Collect archives} |
| 105 | | - CollectRev {Collect revisions} |
| 106 | | - } { trouble info " [format %2d $n]: $p $desc" ; incr n } |
| 107 | | - trouble info "" |
| 108 | | - exit 0 |
| 110 | + return |
| 109 | 111 | } |
| 110 | 112 | |
| 111 | 113 | proc PrintVersion {} { |
| 112 | 114 | global argv0 |
| 113 | 115 | set v [package require vc::fossil::import::cvs] |
| 114 | 116 | trouble info "$argv0 v$v" |
| 115 | | - exit 0 |
| 117 | + return |
| 116 | 118 | } |
| 117 | 119 | |
| 118 | 120 | proc Usage {{text {}}} { |
| 119 | 121 | global argv0 |
| 120 | | - if {$text ne ""} {set text \n$text} |
| 121 | | - trouble fatal "Usage: $argv0 $usage$text" |
| 122 | | - # Not reached |
| 123 | | - return |
| 122 | + trouble fatal "Usage: $argv0 $usage" |
| 123 | + if {$text ne ""} { trouble fatal "$text" } |
| 124 | + exit 1 |
| 124 | 125 | } |
| 125 | 126 | |
| 126 | 127 | # # ## ### ##### ######## ############# |
| 127 | 128 | ## Internal methods, command line processing |
| 128 | 129 | |
| | @@ -149,10 +150,15 @@ |
| 149 | 150 | |
| 150 | 151 | # # ## ### ##### ######## ############# |
| 151 | 152 | ## Internal methods, state validation |
| 152 | 153 | |
| 153 | 154 | proc Validate {} { |
| 155 | + # Prevent in-depth validation if the options were already bad. |
| 156 | + trouble abort? |
| 157 | + |
| 158 | + |
| 159 | + trouble abort? |
| 154 | 160 | return |
| 155 | 161 | } |
| 156 | 162 | |
| 157 | 163 | # # ## ### ##### ######## ############# |
| 158 | 164 | ## Configuration |
| | @@ -164,12 +170,13 @@ |
| 164 | 170 | # # ## ### ##### ######## ############# |
| 165 | 171 | } |
| 166 | 172 | |
| 167 | 173 | namespace eval ::vc::fossil::import::cvs::option { |
| 168 | 174 | namespace import ::vc::tools::trouble |
| 175 | + namespace import ::vc::fossil::import::cvs::pass |
| 169 | 176 | } |
| 170 | 177 | |
| 171 | 178 | # # ## ### ##### ######## ############# ##################### |
| 172 | 179 | ## Ready |
| 173 | 180 | |
| 174 | 181 | package provide vc::fossil::import::cvs::option 1.0 |
| 175 | 182 | return |
| 176 | 183 | |
| 177 | 184 | ADDED tools/cvs2fossil/lib/c2f_pass.tcl |