Not logged in
Diff

Differences From Artifact [fc9f62797d]:

  • File tools/cvs2fossil/lib/c2f_option.tcl — part of check-in [d57b7b4a05] at 2007-10-02 05:33:09 on branch trunk — Re-added the user feedback and error reporting utilities, with modifications, and completed the handling of the informational options. (user: aku size: 4624)

To Artifact [87e6ea6315]:

  • File tools/cvs2fossil/lib/c2f_option.tcl — part of check-in [5911515322] at 2007-10-02 06:48:55 on branch trunk — Added the pass management, integrated with application and option processor. (user: aku size: 5103)

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
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







+










+
+


-




















-
-
-
+
+
+
+
+
+
+
+








# # ## ### ##### ######## ############# #####################
## Requirements

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

# # ## ### ##### ######## ############# #####################
## 

snit::type ::vc::fossil::import::cvs::option {
    # # ## ### ##### ######## #############
    ## 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
    # --force-tag RE
    # --symbol-transform RE:XX
    # --exclude
    # -p, --passes
    # -v, --verbose
    # -q, --quiet

    # # ## ### ##### ######## #############
    ## 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
		--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       {
		    # [Value arguments]
		}
		default {
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
128
129
130
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
128
129
130
131







-
-
-
-
-
+
-

+
+
-
+

-
-
-
-
-
+

+
-
+
+






-
+




-
-
-
+
+
+
-







	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 ""
	# --project, --cache
	# ...
	exit 0
    }

	trouble info "  Conversion control options"
    proc PrintHelpPasses {} {
	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 "Conversion passes:"
	trouble info "                               inclusive."
	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 "                               Passes are specified by name."
	trouble info ""
	# --project, --cache
	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
	trouble fatal "Usage: $argv0 $usage"
	if {$text ne ""} { trouble fatal "$text" }
	exit 1
	return
    }

    # # ## ### ##### ######## #############
    ## Internal methods, command line processing

    typevariable usage     "?option ?value?...? cvs-repository-path"
    typevariable nocvs     "       The cvs-repository-path is missing."
147
148
149
150
151
152
153





154
155
156
157
158
159
160
161
162
163
164
165
166
167
168

169
170
171
172
173
174
175
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182







+
+
+
+
+















+







	return $v
    }

    # # ## ### ##### ######## #############
    ## Internal methods, state validation

    proc Validate {} {
	# Prevent in-depth validation if the options were already bad.
	trouble abort?


	trouble abort?
	return
    }

    # # ## ### ##### ######## #############
    ## Configuration

    pragma -hasinstances   no ; # singleton
    pragma -hastypeinfo    no ; # no introspection
    pragma -hastypedestroy no ; # immortal

    # # ## ### ##### ######## #############
}

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