Fossil SCM

Added the pass management, integrated with application and option processor.

aku 2007-10-02 06:48 trunk
Commit 591151532206cdd5d9f72335df2ff1440366bfb9
--- tools/cvs2fossil/lib/c2f_option.tcl
+++ tools/cvs2fossil/lib/c2f_option.tcl
@@ -19,10 +19,11 @@
1919
## Requirements
2020
2121
package require Tcl 8.4 ; # Required runtime.
2222
package require snit ; # OO system.
2323
package require vc::tools::trouble ; # Error reporting.
24
+package require vc::fossil::import::cvs::pass ; # Pass management
2425
2526
# # ## ### ##### ######## ############# #####################
2627
##
2728
2829
snit::type ::vc::fossil::import::cvs::option {
@@ -29,13 +30,14 @@
2930
# # ## ### ##### ######## #############
3031
## Public API, Options.
3132
3233
# --help, --help-passes, -h
3334
# --version
35
+ # -p, --pass, --passes
36
+
3437
# --project
3538
# --cache (conversion status, ala config.cache)
36
-
3739
# -o, --output
3840
# --dry-run
3941
# --trunk-only
4042
# --force-branch RE
4143
# --force-tag RE
@@ -52,13 +54,18 @@
5254
# Syntax of arguments: ?option ?value?...? /path/to/cvs/repository
5355
5456
while {[IsOption arguments -> option]} {
5557
switch -exact -- $option {
5658
-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
+ }
6067
--project {
6168
#cvs::repository addproject [Value arguments]
6269
}
6370
--cache {
6471
# [Value arguments]
@@ -88,41 +95,35 @@
8895
trouble info ""
8996
trouble info " -h, --help Print this message and exit with success"
9097
trouble info " --help-passes Print list of passes and exit with success"
9198
trouble info " --version Print version number of $argv0"
9299
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 ""
93108
# --project, --cache
94109
# ...
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
109111
}
110112
111113
proc PrintVersion {} {
112114
global argv0
113115
set v [package require vc::fossil::import::cvs]
114116
trouble info "$argv0 v$v"
115
- exit 0
117
+ return
116118
}
117119
118120
proc Usage {{text {}}} {
119121
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
124125
}
125126
126127
# # ## ### ##### ######## #############
127128
## Internal methods, command line processing
128129
@@ -149,10 +150,15 @@
149150
150151
# # ## ### ##### ######## #############
151152
## Internal methods, state validation
152153
153154
proc Validate {} {
155
+ # Prevent in-depth validation if the options were already bad.
156
+ trouble abort?
157
+
158
+
159
+ trouble abort?
154160
return
155161
}
156162
157163
# # ## ### ##### ######## #############
158164
## Configuration
@@ -164,12 +170,13 @@
164170
# # ## ### ##### ######## #############
165171
}
166172
167173
namespace eval ::vc::fossil::import::cvs::option {
168174
namespace import ::vc::tools::trouble
175
+ namespace import ::vc::fossil::import::cvs::pass
169176
}
170177
171178
# # ## ### ##### ######## ############# #####################
172179
## Ready
173180
174181
package provide vc::fossil::import::cvs::option 1.0
175182
return
176183
177184
ADDED tools/cvs2fossil/lib/c2f_pass.tcl
--- tools/cvs2fossil/lib/c2f_option.tcl
+++ tools/cvs2fossil/lib/c2f_option.tcl
@@ -19,10 +19,11 @@
19 ## Requirements
20
21 package require Tcl 8.4 ; # Required runtime.
22 package require snit ; # OO system.
23 package require vc::tools::trouble ; # Error reporting.
 
24
25 # # ## ### ##### ######## ############# #####################
26 ##
27
28 snit::type ::vc::fossil::import::cvs::option {
@@ -29,13 +30,14 @@
29 # # ## ### ##### ######## #############
30 ## Public API, Options.
31
32 # --help, --help-passes, -h
33 # --version
 
 
34 # --project
35 # --cache (conversion status, ala config.cache)
36
37 # -o, --output
38 # --dry-run
39 # --trunk-only
40 # --force-branch RE
41 # --force-tag RE
@@ -52,13 +54,18 @@
52 # Syntax of arguments: ?option ?value?...? /path/to/cvs/repository
53
54 while {[IsOption arguments -> option]} {
55 switch -exact -- $option {
56 -h -
57 --help PrintHelp
58 --help-passes PrintHelpPasses
59 --version PrintVersion
 
 
 
 
 
60 --project {
61 #cvs::repository addproject [Value arguments]
62 }
63 --cache {
64 # [Value arguments]
@@ -88,41 +95,35 @@
88 trouble info ""
89 trouble info " -h, --help Print this message and exit with success"
90 trouble info " --help-passes Print list of passes and exit with success"
91 trouble info " --version Print version number of $argv0"
92 trouble info ""
 
 
 
 
 
 
 
 
93 # --project, --cache
94 # ...
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
109 }
110
111 proc PrintVersion {} {
112 global argv0
113 set v [package require vc::fossil::import::cvs]
114 trouble info "$argv0 v$v"
115 exit 0
116 }
117
118 proc Usage {{text {}}} {
119 global argv0
120 if {$text ne ""} {set text \n$text}
121 trouble fatal "Usage: $argv0 $usage$text"
122 # Not reached
123 return
124 }
125
126 # # ## ### ##### ######## #############
127 ## Internal methods, command line processing
128
@@ -149,10 +150,15 @@
149
150 # # ## ### ##### ######## #############
151 ## Internal methods, state validation
152
153 proc Validate {} {
 
 
 
 
 
154 return
155 }
156
157 # # ## ### ##### ######## #############
158 ## Configuration
@@ -164,12 +170,13 @@
164 # # ## ### ##### ######## #############
165 }
166
167 namespace eval ::vc::fossil::import::cvs::option {
168 namespace import ::vc::tools::trouble
 
169 }
170
171 # # ## ### ##### ######## ############# #####################
172 ## Ready
173
174 package provide vc::fossil::import::cvs::option 1.0
175 return
176
177 DDED tools/cvs2fossil/lib/c2f_pass.tcl
--- tools/cvs2fossil/lib/c2f_option.tcl
+++ tools/cvs2fossil/lib/c2f_option.tcl
@@ -19,10 +19,11 @@
19 ## Requirements
20
21 package require Tcl 8.4 ; # Required runtime.
22 package require snit ; # OO system.
23 package require vc::tools::trouble ; # Error reporting.
24 package require vc::fossil::import::cvs::pass ; # Pass management
25
26 # # ## ### ##### ######## ############# #####################
27 ##
28
29 snit::type ::vc::fossil::import::cvs::option {
@@ -29,13 +30,14 @@
30 # # ## ### ##### ######## #############
31 ## Public API, Options.
32
33 # --help, --help-passes, -h
34 # --version
35 # -p, --pass, --passes
36
37 # --project
38 # --cache (conversion status, ala config.cache)
 
39 # -o, --output
40 # --dry-run
41 # --trunk-only
42 # --force-branch RE
43 # --force-tag RE
@@ -52,13 +54,18 @@
54 # Syntax of arguments: ?option ?value?...? /path/to/cvs/repository
55
56 while {[IsOption arguments -> option]} {
57 switch -exact -- $option {
58 -h -
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 }
67 --project {
68 #cvs::repository addproject [Value arguments]
69 }
70 --cache {
71 # [Value arguments]
@@ -88,41 +95,35 @@
95 trouble info ""
96 trouble info " -h, --help Print this message and exit with success"
97 trouble info " --help-passes Print list of passes and exit with success"
98 trouble info " --version Print version number of $argv0"
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 ""
108 # --project, --cache
109 # ...
110 return
 
 
 
 
 
 
 
 
 
 
 
 
 
111 }
112
113 proc PrintVersion {} {
114 global argv0
115 set v [package require vc::fossil::import::cvs]
116 trouble info "$argv0 v$v"
117 return
118 }
119
120 proc Usage {{text {}}} {
121 global argv0
122 trouble fatal "Usage: $argv0 $usage"
123 if {$text ne ""} { trouble fatal "$text" }
124 exit 1
 
125 }
126
127 # # ## ### ##### ######## #############
128 ## Internal methods, command line processing
129
@@ -149,10 +150,15 @@
150
151 # # ## ### ##### ######## #############
152 ## Internal methods, state validation
153
154 proc Validate {} {
155 # Prevent in-depth validation if the options were already bad.
156 trouble abort?
157
158
159 trouble abort?
160 return
161 }
162
163 # # ## ### ##### ######## #############
164 ## Configuration
@@ -164,12 +170,13 @@
170 # # ## ### ##### ######## #############
171 }
172
173 namespace eval ::vc::fossil::import::cvs::option {
174 namespace import ::vc::tools::trouble
175 namespace import ::vc::fossil::import::cvs::pass
176 }
177
178 # # ## ### ##### ######## ############# #####################
179 ## Ready
180
181 package provide vc::fossil::import::cvs::option 1.0
182 return
183
184 DDED tools/cvs2fossil/lib/c2f_pass.tcl
--- a/tools/cvs2fossil/lib/c2f_pass.tcl
+++ b/tools/cvs2fossil/lib/c2f_pass.tcl
@@ -0,0 +1,82 @@
1
+## -*- tcl -*-
2
+# # ## ### ##### ######## ############# #####################
3
+## Copyright (c) 2007 Andreas Kupries.
4
+#
5
+# This software is licensed as described in the file LICENSE, which
6
+# you should have received as part of this distribution.
7
+#
8
+# This software consists of voluntary contributions made by many
9
+# individuals. For exact contribution history, see the revision
10
+# history and logs, available at http://fossil-scm.hwaci.com/fossil
11
+# # ## ### ##### ######## ############# #####################
12
+
13
+## Pass manager. All passes register here, with code, description, and
14
+## callbacks (... setup, run, finalize). Option processing and help
15
+## query this manager to dynamically create the relevant texts.
16
+
17
+# # ## ### ##### ######## ############# #####################
18
+## Requirements
19
+
20
+package require Tcl 8.4 ; # Required runtime.
21
+package require snit ; # Stat## ##### ######## ############# #####################
22
+## Copyrighstruct::listtime.
23
+package requirs part of this distribution.
24
+#
25
+# This software consists of voluntary contributions made by many
26
+# individuals. For exact contribution history, see the revision
27
+# history and logs, available at http://fossil-scm.hwaci.com/fossil
28
+# # ## ### ##### ######## ############# #####################
29
+
30
+## Pass manager. All passes register here, with code, description, and
31
+## callbacks (... setup, run, finalize). Option processing and help
32
+## query this manager to dynamically create the relevant texts.
33
+
34
+# # ## ### ##### ######## ############# #####################
35
+## Requirements
36
+
37
+package require Tcl 8.4 ; # Required runtime.
38
+package require snit ; # State stools::misc s::misc ; # Text formatting.
39
+package require vc::ts::log ; # User feedback.
40
+package require struclist ; # Portable lassign
41
+
42
+# # ## ### ##### ######## ###########
43
+
44
+snit::type ::vc::fossil::import::cvs::pass {
45
+ # # ## ### ##end}
46
+
47
+ set runlistlist map $Public API, Methods (Setup, query)
48
+
49
+ typemethod define {namf {
50
+ integrity assert {
51
+ !} {
52
+ trouble internal "Multiplskippe## -*- tcl -*-
53
+# # ## ### ##### ######## ############# #####################
54
+## Copyright (c) 2007 Andreas Kupries.
55
+#
56
+# This software is licensed as described in the file LICENSE, which
57
+# you should have receive Call $p setup }ory, see the revision
58
+ Call $p run }ically create the recallbacks (... setup, run, finalize). Option processing and help
59
+## query this manager to dynamically create the relevant texts.
60
+
61
+# # ## ### ##### ######## ############# #####################
62
+## Requirements
63
+
64
+package require Tcl 8.4 ; # Required runtime.
65
+package require snit ; # State stools::misc s::misc ; # Text formatting.
66
+package require vc::ts::log ; # User feedback.
67
+package require struclist ; # Portable lassign
68
+
69
+# # ## ### ##### ######## ###########
70
+
71
+snit::type ::vc::fossil::import::cvs::pass {
72
+ # # ## ### ##end}
73
+
74
+ aically create the recallbacks (... setup, run, f {namf {
75
+ integrity assert {
76
+ !} {
77
+ trouble internal "Multiplskippe## -*- tcl -*-
78
+# # ## ### ##### ######## ############# #####################
79
+## Copyright (c) 2007 Andreas Kupries.
80
+#
81
+# This software is licensed as described in the file LICENSE, which
82
+# you should have receive
--- a/tools/cvs2fossil/lib/c2f_pass.tcl
+++ b/tools/cvs2fossil/lib/c2f_pass.tcl
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/tools/cvs2fossil/lib/c2f_pass.tcl
+++ b/tools/cvs2fossil/lib/c2f_pass.tcl
@@ -0,0 +1,82 @@
1 ## -*- tcl -*-
2 # # ## ### ##### ######## ############# #####################
3 ## Copyright (c) 2007 Andreas Kupries.
4 #
5 # This software is licensed as described in the file LICENSE, which
6 # you should have received as part of this distribution.
7 #
8 # This software consists of voluntary contributions made by many
9 # individuals. For exact contribution history, see the revision
10 # history and logs, available at http://fossil-scm.hwaci.com/fossil
11 # # ## ### ##### ######## ############# #####################
12
13 ## Pass manager. All passes register here, with code, description, and
14 ## callbacks (... setup, run, finalize). Option processing and help
15 ## query this manager to dynamically create the relevant texts.
16
17 # # ## ### ##### ######## ############# #####################
18 ## Requirements
19
20 package require Tcl 8.4 ; # Required runtime.
21 package require snit ; # Stat## ##### ######## ############# #####################
22 ## Copyrighstruct::listtime.
23 package requirs part of this distribution.
24 #
25 # This software consists of voluntary contributions made by many
26 # individuals. For exact contribution history, see the revision
27 # history and logs, available at http://fossil-scm.hwaci.com/fossil
28 # # ## ### ##### ######## ############# #####################
29
30 ## Pass manager. All passes register here, with code, description, and
31 ## callbacks (... setup, run, finalize). Option processing and help
32 ## query this manager to dynamically create the relevant texts.
33
34 # # ## ### ##### ######## ############# #####################
35 ## Requirements
36
37 package require Tcl 8.4 ; # Required runtime.
38 package require snit ; # State stools::misc s::misc ; # Text formatting.
39 package require vc::ts::log ; # User feedback.
40 package require struclist ; # Portable lassign
41
42 # # ## ### ##### ######## ###########
43
44 snit::type ::vc::fossil::import::cvs::pass {
45 # # ## ### ##end}
46
47 set runlistlist map $Public API, Methods (Setup, query)
48
49 typemethod define {namf {
50 integrity assert {
51 !} {
52 trouble internal "Multiplskippe## -*- tcl -*-
53 # # ## ### ##### ######## ############# #####################
54 ## Copyright (c) 2007 Andreas Kupries.
55 #
56 # This software is licensed as described in the file LICENSE, which
57 # you should have receive Call $p setup }ory, see the revision
58 Call $p run }ically create the recallbacks (... setup, run, finalize). Option processing and help
59 ## query this manager to dynamically create the relevant texts.
60
61 # # ## ### ##### ######## ############# #####################
62 ## Requirements
63
64 package require Tcl 8.4 ; # Required runtime.
65 package require snit ; # State stools::misc s::misc ; # Text formatting.
66 package require vc::ts::log ; # User feedback.
67 package require struclist ; # Portable lassign
68
69 # # ## ### ##### ######## ###########
70
71 snit::type ::vc::fossil::import::cvs::pass {
72 # # ## ### ##end}
73
74 aically create the recallbacks (... setup, run, f {namf {
75 integrity assert {
76 !} {
77 trouble internal "Multiplskippe## -*- tcl -*-
78 # # ## ### ##### ######## ############# #####################
79 ## Copyright (c) 2007 Andreas Kupries.
80 #
81 # This software is licensed as described in the file LICENSE, which
82 # you should have receive
--- tools/cvs2fossil/lib/cvs2fossil.tcl
+++ tools/cvs2fossil/lib/cvs2fossil.tcl
@@ -17,30 +17,27 @@
1717
## Requirements
1818
1919
package require Tcl 8.4 ; # Required runtime.
2020
package require snit ; # OO system
2121
package require vc::fossil::import::cvs::option ; # Cmd line parsing & database
22
+package require vc::fossil::import::cvs::pass ; # Pass management
2223
2324
# # ## ### ##### ######## ############# #####################
2425
##
2526
2627
snit::type ::vc::fossil::import::cvs {
2728
# # ## ### ##### ######## #############
2829
## Public API, Methods
2930
3031
typemethod run {arguments} {
31
- option process $arguments
32
-
3332
# Run a series of passes over the cvs repository to extract,
3433
# filter, and order its historical information. Which passes
3534
# are actually run is determined through the specified options
3635
# and their defaults.
3736
38
- foreach pass [option passes] {
39
- $pass run
40
- }
41
-
37
+ option process $arguments
38
+ pass run
4239
return
4340
}
4441
4542
# # ## ### ##### ######## #############
4643
## Configuration
4744
--- tools/cvs2fossil/lib/cvs2fossil.tcl
+++ tools/cvs2fossil/lib/cvs2fossil.tcl
@@ -17,30 +17,27 @@
17 ## Requirements
18
19 package require Tcl 8.4 ; # Required runtime.
20 package require snit ; # OO system
21 package require vc::fossil::import::cvs::option ; # Cmd line parsing & database
 
22
23 # # ## ### ##### ######## ############# #####################
24 ##
25
26 snit::type ::vc::fossil::import::cvs {
27 # # ## ### ##### ######## #############
28 ## Public API, Methods
29
30 typemethod run {arguments} {
31 option process $arguments
32
33 # Run a series of passes over the cvs repository to extract,
34 # filter, and order its historical information. Which passes
35 # are actually run is determined through the specified options
36 # and their defaults.
37
38 foreach pass [option passes] {
39 $pass run
40 }
41
42 return
43 }
44
45 # # ## ### ##### ######## #############
46 ## Configuration
47
--- tools/cvs2fossil/lib/cvs2fossil.tcl
+++ tools/cvs2fossil/lib/cvs2fossil.tcl
@@ -17,30 +17,27 @@
17 ## Requirements
18
19 package require Tcl 8.4 ; # Required runtime.
20 package require snit ; # OO system
21 package require vc::fossil::import::cvs::option ; # Cmd line parsing & database
22 package require vc::fossil::import::cvs::pass ; # Pass management
23
24 # # ## ### ##### ######## ############# #####################
25 ##
26
27 snit::type ::vc::fossil::import::cvs {
28 # # ## ### ##### ######## #############
29 ## Public API, Methods
30
31 typemethod run {arguments} {
 
 
32 # Run a series of passes over the cvs repository to extract,
33 # filter, and order its historical information. Which passes
34 # are actually run is determined through the specified options
35 # and their defaults.
36
37 option process $arguments
38 pass run
 
 
39 return
40 }
41
42 # # ## ### ##### ######## #############
43 ## Configuration
44
--- tools/cvs2fossil/lib/pkgIndex.tcl
+++ tools/cvs2fossil/lib/pkgIndex.tcl
@@ -3,7 +3,8 @@
33
## Index of the local packages required by cvs2fossil
44
# # ## ### ##### ######## ############# #####################
55
if {![package vsatisfies [package require Tcl] 8.4]} return
66
package ifneeded vc::fossil::import::cvs 1.0 [list source [file join $dir cvs2fossil.tcl]]
77
package ifneeded vc::fossil::import::cvs::option 1.0 [list source [file join $dir c2f_option.tcl]]
8
+package ifneeded vc::fossil::import::cvs::pass 1.0 [list source [file join $dir c2f_pass.tcl]]
89
package ifneeded vc::tools::trouble 1.0 [list source [file join $dir trouble.tcl]]
910
package ifneeded vc::tools::log 1.0 [list source [file join $dir log.tcl]]
1011
--- tools/cvs2fossil/lib/pkgIndex.tcl
+++ tools/cvs2fossil/lib/pkgIndex.tcl
@@ -3,7 +3,8 @@
3 ## Index of the local packages required by cvs2fossil
4 # # ## ### ##### ######## ############# #####################
5 if {![package vsatisfies [package require Tcl] 8.4]} return
6 package ifneeded vc::fossil::import::cvs 1.0 [list source [file join $dir cvs2fossil.tcl]]
7 package ifneeded vc::fossil::import::cvs::option 1.0 [list source [file join $dir c2f_option.tcl]]
 
8 package ifneeded vc::tools::trouble 1.0 [list source [file join $dir trouble.tcl]]
9 package ifneeded vc::tools::log 1.0 [list source [file join $dir log.tcl]]
10
--- tools/cvs2fossil/lib/pkgIndex.tcl
+++ tools/cvs2fossil/lib/pkgIndex.tcl
@@ -3,7 +3,8 @@
3 ## Index of the local packages required by cvs2fossil
4 # # ## ### ##### ######## ############# #####################
5 if {![package vsatisfies [package require Tcl] 8.4]} return
6 package ifneeded vc::fossil::import::cvs 1.0 [list source [file join $dir cvs2fossil.tcl]]
7 package ifneeded vc::fossil::import::cvs::option 1.0 [list source [file join $dir c2f_option.tcl]]
8 package ifneeded vc::fossil::import::cvs::pass 1.0 [list source [file join $dir c2f_pass.tcl]]
9 package ifneeded vc::tools::trouble 1.0 [list source [file join $dir trouble.tcl]]
10 package ifneeded vc::tools::log 1.0 [list source [file join $dir log.tcl]]
11
--- tools/cvs2fossil/lib/trouble.tcl
+++ tools/cvs2fossil/lib/trouble.tcl
@@ -23,14 +23,19 @@
2323
##
2424
2525
snit::type ::vc::tools::trouble {
2626
# # ## ### ##### ######## #############
2727
## Public API, Methods
28
+
29
+ typemethod internal {text} {
30
+ foreach line [split $text \n] { $type fatal "INTERNAL ERROR! $line" }
31
+ exit 1
32
+ }
2833
2934
typemethod fatal {text} {
3035
lappend myfatal $text
31
- exit 1
36
+ return
3237
}
3338
3439
typemethod warn {text} {
3540
lappend mywarn $text
3641
log write 0 trouble $text
@@ -46,10 +51,20 @@
4651
foreach m $myinfo { log write 0 "" $m }
4752
foreach m $mywarn { log write 0 warning $m }
4853
foreach m $myfatal { log write 0 fatal $m }
4954
return
5055
}
56
+
57
+ typemethod abort? {} {
58
+ if {
59
+ ![llength $myinfo] &&
60
+ ![llength $mywarn] &&
61
+ ![llength $myfatal]
62
+ } return
63
+ # We have error messages to print, so stop.
64
+ exit 1
65
+ }
5166
5267
# # ## ### ##### ######## #############
5368
## Internal, state
5469
5570
typevariable myinfo {}
5671
--- tools/cvs2fossil/lib/trouble.tcl
+++ tools/cvs2fossil/lib/trouble.tcl
@@ -23,14 +23,19 @@
23 ##
24
25 snit::type ::vc::tools::trouble {
26 # # ## ### ##### ######## #############
27 ## Public API, Methods
 
 
 
 
 
28
29 typemethod fatal {text} {
30 lappend myfatal $text
31 exit 1
32 }
33
34 typemethod warn {text} {
35 lappend mywarn $text
36 log write 0 trouble $text
@@ -46,10 +51,20 @@
46 foreach m $myinfo { log write 0 "" $m }
47 foreach m $mywarn { log write 0 warning $m }
48 foreach m $myfatal { log write 0 fatal $m }
49 return
50 }
 
 
 
 
 
 
 
 
 
 
51
52 # # ## ### ##### ######## #############
53 ## Internal, state
54
55 typevariable myinfo {}
56
--- tools/cvs2fossil/lib/trouble.tcl
+++ tools/cvs2fossil/lib/trouble.tcl
@@ -23,14 +23,19 @@
23 ##
24
25 snit::type ::vc::tools::trouble {
26 # # ## ### ##### ######## #############
27 ## Public API, Methods
28
29 typemethod internal {text} {
30 foreach line [split $text \n] { $type fatal "INTERNAL ERROR! $line" }
31 exit 1
32 }
33
34 typemethod fatal {text} {
35 lappend myfatal $text
36 return
37 }
38
39 typemethod warn {text} {
40 lappend mywarn $text
41 log write 0 trouble $text
@@ -46,10 +51,20 @@
51 foreach m $myinfo { log write 0 "" $m }
52 foreach m $mywarn { log write 0 warning $m }
53 foreach m $myfatal { log write 0 fatal $m }
54 return
55 }
56
57 typemethod abort? {} {
58 if {
59 ![llength $myinfo] &&
60 ![llength $mywarn] &&
61 ![llength $myfatal]
62 } return
63 # We have error messages to print, so stop.
64 exit 1
65 }
66
67 # # ## ### ##### ######## #############
68 ## Internal, state
69
70 typevariable myinfo {}
71

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button