Fossil SCM

Added the basic parts of the state manager and integrated it with option processor and pass manager.

aku 2007-10-05 05:33 trunk
Commit eb656de7d9a95af6a040f307c0b1d5c253b4d246
--- tools/cvs2fossil/lib/c2f_option.tcl
+++ tools/cvs2fossil/lib/c2f_option.tcl
@@ -23,10 +23,11 @@
2323
package require vc::tools::trouble ; # Error reporting.
2424
package require vc::tools::log ; # User feedback.
2525
package require vc::fossil::import::cvs::pass ; # Pass management
2626
package require vc::fossil::import::cvs::pass::collar ; # Pass I.
2727
package require vc::fossil::import::cvs::repository ; # Repository management
28
+package require vc::fossil::import::cvs::state ; # State storage
2829
2930
# # ## ### ##### ######## ############# #####################
3031
##
3132
3233
snit::type ::vc::fossil::import::cvs::option {
@@ -38,50 +39,45 @@
3839
# -p, --pass, --passes
3940
# --ignore-conflicting-attics
4041
# --project
4142
# -v, --verbose
4243
# -q, --quiet
44
+ # --state (conversion status, ala config.cache)
4345
44
- # --cache (conversion status, ala config.cache)
4546
# -o, --output
4647
# --dry-run
4748
# --trunk-only
4849
# --force-branch RE
4950
# --force-tag RE
5051
# --symbol-transform RE:XX
5152
# --exclude
52
- # -p, --passes
5353
5454
# # ## ### ##### ######## #############
5555
## Public API, Methods
5656
5757
typemethod process {arguments} {
5858
# Syntax of arguments: ?option ?value?...? /path/to/cvs/repository
5959
6060
while {[IsOption arguments -> option]} {
6161
switch -exact -- $option {
62
- -h -
63
- --help { PrintHelp ; exit 0 }
64
- --help-passes { pass help ; exit 0 }
65
- --version { PrintVersion ; exit 0 }
66
-
62
+ -h -
63
+ --help { PrintHelp ; exit 0 }
64
+ --help-passes { pass help ; exit 0 }
65
+ --version { PrintVersion ; exit 0 }
6766
-p -
6867
--pass -
6968
--passes { pass select [Value arguments] }
70
-
7169
--ignore-conflicting-attics { collar ignore_conflicting_attics }
72
-
73
- --project { repository add [Value arguments] }
74
- -v -
75
- --verbose { log verbose }
76
- -q -
77
- --quiet { log quiet }
78
-
79
- --cache {
80
- # [Value arguments]
81
- }
82
- default { Usage $badoption$option\n$gethelp }
70
+ --project { repository add [Value arguments] }
71
+ -v -
72
+ --verbose { log verbose }
73
+ -q -
74
+ --quiet { log quiet }
75
+ --state { state use [Value arguments] }
76
+ default {
77
+ Usage $badoption$option\n$gethelp
78
+ }
8379
}
8480
}
8581
8682
if {[llength $arguments] > 1} Usage
8783
if {[llength $arguments] < 1} { Usage $nocvs }
@@ -101,10 +97,12 @@
10197
trouble info " Information options"
10298
trouble info ""
10399
trouble info " -h, --help Print this message and exit with success"
104100
trouble info " --help-passes Print list of passes and exit with success"
105101
trouble info " --version Print version number of $argv0"
102
+ trouble info " -v, --verbose Increase application's verbosity"
103
+ trouble info " -q, --quiet Decrease application's verbosity"
106104
trouble info ""
107105
trouble info " Conversion control options"
108106
trouble info ""
109107
trouble info " -p, --pass PASS Run only the specified conversion pass"
110108
trouble info " -p, --passes ?START?:?END? Run only the passes START through END,"
@@ -114,10 +112,13 @@
114112
trouble info ""
115113
trouble info " --ignore-conflicting-attics"
116114
trouble info " Prevent abort when conflicting archives"
117115
trouble info " were found in both regular and Attic."
118116
trouble info ""
117
+ trouble info " --state PATH Save state to the specified file, and"
118
+ trouble info " load state of previous runs from it too."
119
+ trouble info ""
119120
120121
# --project, --cache
121122
# ...
122123
return
123124
}
@@ -166,10 +167,11 @@
166167
proc Validate {} {
167168
# Prevent in-depth validation if the options were already bad.
168169
trouble abort?
169170
170171
repository validate
172
+ state setup
171173
172174
trouble abort?
173175
return
174176
}
175177
@@ -189,13 +191,14 @@
189191
namespace import ::vc::tools::trouble
190192
namespace import ::vc::tools::log
191193
namespace import ::vc::fossil::import::cvs::pass
192194
namespace import ::vc::fossil::import::cvs::pass::collar
193195
namespace import ::vc::fossil::import::cvs::repository
196
+ namespace import ::vc::fossil::import::cvs::state
194197
}
195198
}
196199
197200
# # ## ### ##### ######## ############# #####################
198201
## Ready
199202
200203
package provide vc::fossil::import::cvs::option 1.0
201204
return
202205
--- tools/cvs2fossil/lib/c2f_option.tcl
+++ tools/cvs2fossil/lib/c2f_option.tcl
@@ -23,10 +23,11 @@
23 package require vc::tools::trouble ; # Error reporting.
24 package require vc::tools::log ; # User feedback.
25 package require vc::fossil::import::cvs::pass ; # Pass management
26 package require vc::fossil::import::cvs::pass::collar ; # Pass I.
27 package require vc::fossil::import::cvs::repository ; # Repository management
 
28
29 # # ## ### ##### ######## ############# #####################
30 ##
31
32 snit::type ::vc::fossil::import::cvs::option {
@@ -38,50 +39,45 @@
38 # -p, --pass, --passes
39 # --ignore-conflicting-attics
40 # --project
41 # -v, --verbose
42 # -q, --quiet
 
43
44 # --cache (conversion status, ala config.cache)
45 # -o, --output
46 # --dry-run
47 # --trunk-only
48 # --force-branch RE
49 # --force-tag RE
50 # --symbol-transform RE:XX
51 # --exclude
52 # -p, --passes
53
54 # # ## ### ##### ######## #############
55 ## Public API, Methods
56
57 typemethod process {arguments} {
58 # Syntax of arguments: ?option ?value?...? /path/to/cvs/repository
59
60 while {[IsOption arguments -> option]} {
61 switch -exact -- $option {
62 -h -
63 --help { PrintHelp ; exit 0 }
64 --help-passes { pass help ; exit 0 }
65 --version { PrintVersion ; exit 0 }
66
67 -p -
68 --pass -
69 --passes { pass select [Value arguments] }
70
71 --ignore-conflicting-attics { collar ignore_conflicting_attics }
72
73 --project { repository add [Value arguments] }
74 -v -
75 --verbose { log verbose }
76 -q -
77 --quiet { log quiet }
78
79 --cache {
80 # [Value arguments]
81 }
82 default { Usage $badoption$option\n$gethelp }
83 }
84 }
85
86 if {[llength $arguments] > 1} Usage
87 if {[llength $arguments] < 1} { Usage $nocvs }
@@ -101,10 +97,12 @@
101 trouble info " Information options"
102 trouble info ""
103 trouble info " -h, --help Print this message and exit with success"
104 trouble info " --help-passes Print list of passes and exit with success"
105 trouble info " --version Print version number of $argv0"
 
 
106 trouble info ""
107 trouble info " Conversion control options"
108 trouble info ""
109 trouble info " -p, --pass PASS Run only the specified conversion pass"
110 trouble info " -p, --passes ?START?:?END? Run only the passes START through END,"
@@ -114,10 +112,13 @@
114 trouble info ""
115 trouble info " --ignore-conflicting-attics"
116 trouble info " Prevent abort when conflicting archives"
117 trouble info " were found in both regular and Attic."
118 trouble info ""
 
 
 
119
120 # --project, --cache
121 # ...
122 return
123 }
@@ -166,10 +167,11 @@
166 proc Validate {} {
167 # Prevent in-depth validation if the options were already bad.
168 trouble abort?
169
170 repository validate
 
171
172 trouble abort?
173 return
174 }
175
@@ -189,13 +191,14 @@
189 namespace import ::vc::tools::trouble
190 namespace import ::vc::tools::log
191 namespace import ::vc::fossil::import::cvs::pass
192 namespace import ::vc::fossil::import::cvs::pass::collar
193 namespace import ::vc::fossil::import::cvs::repository
 
194 }
195 }
196
197 # # ## ### ##### ######## ############# #####################
198 ## Ready
199
200 package provide vc::fossil::import::cvs::option 1.0
201 return
202
--- tools/cvs2fossil/lib/c2f_option.tcl
+++ tools/cvs2fossil/lib/c2f_option.tcl
@@ -23,10 +23,11 @@
23 package require vc::tools::trouble ; # Error reporting.
24 package require vc::tools::log ; # User feedback.
25 package require vc::fossil::import::cvs::pass ; # Pass management
26 package require vc::fossil::import::cvs::pass::collar ; # Pass I.
27 package require vc::fossil::import::cvs::repository ; # Repository management
28 package require vc::fossil::import::cvs::state ; # State storage
29
30 # # ## ### ##### ######## ############# #####################
31 ##
32
33 snit::type ::vc::fossil::import::cvs::option {
@@ -38,50 +39,45 @@
39 # -p, --pass, --passes
40 # --ignore-conflicting-attics
41 # --project
42 # -v, --verbose
43 # -q, --quiet
44 # --state (conversion status, ala config.cache)
45
 
46 # -o, --output
47 # --dry-run
48 # --trunk-only
49 # --force-branch RE
50 # --force-tag RE
51 # --symbol-transform RE:XX
52 # --exclude
 
53
54 # # ## ### ##### ######## #############
55 ## Public API, Methods
56
57 typemethod process {arguments} {
58 # Syntax of arguments: ?option ?value?...? /path/to/cvs/repository
59
60 while {[IsOption arguments -> option]} {
61 switch -exact -- $option {
62 -h -
63 --help { PrintHelp ; exit 0 }
64 --help-passes { pass help ; exit 0 }
65 --version { PrintVersion ; exit 0 }
 
66 -p -
67 --pass -
68 --passes { pass select [Value arguments] }
 
69 --ignore-conflicting-attics { collar ignore_conflicting_attics }
70 --project { repository add [Value arguments] }
71 -v -
72 --verbose { log verbose }
73 -q -
74 --quiet { log quiet }
75 --state { state use [Value arguments] }
76 default {
77 Usage $badoption$option\n$gethelp
78 }
 
 
79 }
80 }
81
82 if {[llength $arguments] > 1} Usage
83 if {[llength $arguments] < 1} { Usage $nocvs }
@@ -101,10 +97,12 @@
97 trouble info " Information options"
98 trouble info ""
99 trouble info " -h, --help Print this message and exit with success"
100 trouble info " --help-passes Print list of passes and exit with success"
101 trouble info " --version Print version number of $argv0"
102 trouble info " -v, --verbose Increase application's verbosity"
103 trouble info " -q, --quiet Decrease application's verbosity"
104 trouble info ""
105 trouble info " Conversion control options"
106 trouble info ""
107 trouble info " -p, --pass PASS Run only the specified conversion pass"
108 trouble info " -p, --passes ?START?:?END? Run only the passes START through END,"
@@ -114,10 +112,13 @@
112 trouble info ""
113 trouble info " --ignore-conflicting-attics"
114 trouble info " Prevent abort when conflicting archives"
115 trouble info " were found in both regular and Attic."
116 trouble info ""
117 trouble info " --state PATH Save state to the specified file, and"
118 trouble info " load state of previous runs from it too."
119 trouble info ""
120
121 # --project, --cache
122 # ...
123 return
124 }
@@ -166,10 +167,11 @@
167 proc Validate {} {
168 # Prevent in-depth validation if the options were already bad.
169 trouble abort?
170
171 repository validate
172 state setup
173
174 trouble abort?
175 return
176 }
177
@@ -189,13 +191,14 @@
191 namespace import ::vc::tools::trouble
192 namespace import ::vc::tools::log
193 namespace import ::vc::fossil::import::cvs::pass
194 namespace import ::vc::fossil::import::cvs::pass::collar
195 namespace import ::vc::fossil::import::cvs::repository
196 namespace import ::vc::fossil::import::cvs::state
197 }
198 }
199
200 # # ## ### ##### ######## ############# #####################
201 ## Ready
202
203 package provide vc::fossil::import::cvs::option 1.0
204 return
205
--- tools/cvs2fossil/lib/c2f_pass.tcl
+++ tools/cvs2fossil/lib/c2f_pass.tcl
@@ -17,10 +17,11 @@
1717
# # ## ### ##### ######## ############# #####################
1818
## Requirements
1919
2020
package require Tcl 8.4 ; # Required runtime.
2121
package require snit ; # OO system.
22
+package require vc::fossil::import::cvs::state ; # State storage
2223
package require vc::tools::trouble ; # Error reporting.
2324
package require vc::tools::log ; # User feedback.
2425
package require struct::list ; # Portable lassign
2526
2627
# # ## ### ##### ######## ############# #####################
@@ -106,10 +107,12 @@
106107
log write 0 pass "Begin $p"
107108
Call $p run
108109
log write 0 pass "Done $p"
109110
trouble abort?
110111
}
112
+
113
+ state release
111114
return
112115
}
113116
114117
# # ## ### ##### ######## #############
115118
## Internal methods
@@ -163,10 +166,11 @@
163166
}
164167
165168
namespace eval ::vc::fossil::import::cvs {
166169
namespace export pass
167170
namespace eval pass {
171
+ namespace import ::vc::fossil::import::cvs::state
168172
namespace import ::vc::tools::trouble
169173
namespace import ::vc::tools::log
170174
log register pass
171175
}
172176
}
173177
--- tools/cvs2fossil/lib/c2f_pass.tcl
+++ tools/cvs2fossil/lib/c2f_pass.tcl
@@ -17,10 +17,11 @@
17 # # ## ### ##### ######## ############# #####################
18 ## Requirements
19
20 package require Tcl 8.4 ; # Required runtime.
21 package require snit ; # OO system.
 
22 package require vc::tools::trouble ; # Error reporting.
23 package require vc::tools::log ; # User feedback.
24 package require struct::list ; # Portable lassign
25
26 # # ## ### ##### ######## ############# #####################
@@ -106,10 +107,12 @@
106 log write 0 pass "Begin $p"
107 Call $p run
108 log write 0 pass "Done $p"
109 trouble abort?
110 }
 
 
111 return
112 }
113
114 # # ## ### ##### ######## #############
115 ## Internal methods
@@ -163,10 +166,11 @@
163 }
164
165 namespace eval ::vc::fossil::import::cvs {
166 namespace export pass
167 namespace eval pass {
 
168 namespace import ::vc::tools::trouble
169 namespace import ::vc::tools::log
170 log register pass
171 }
172 }
173
--- tools/cvs2fossil/lib/c2f_pass.tcl
+++ tools/cvs2fossil/lib/c2f_pass.tcl
@@ -17,10 +17,11 @@
17 # # ## ### ##### ######## ############# #####################
18 ## Requirements
19
20 package require Tcl 8.4 ; # Required runtime.
21 package require snit ; # OO system.
22 package require vc::fossil::import::cvs::state ; # State storage
23 package require vc::tools::trouble ; # Error reporting.
24 package require vc::tools::log ; # User feedback.
25 package require struct::list ; # Portable lassign
26
27 # # ## ### ##### ######## ############# #####################
@@ -106,10 +107,12 @@
107 log write 0 pass "Begin $p"
108 Call $p run
109 log write 0 pass "Done $p"
110 trouble abort?
111 }
112
113 state release
114 return
115 }
116
117 # # ## ### ##### ######## #############
118 ## Internal methods
@@ -163,10 +166,11 @@
166 }
167
168 namespace eval ::vc::fossil::import::cvs {
169 namespace export pass
170 namespace eval pass {
171 namespace import ::vc::fossil::import::cvs::state
172 namespace import ::vc::tools::trouble
173 namespace import ::vc::tools::log
174 log register pass
175 }
176 }
177
--- tools/cvs2fossil/lib/c2f_repository.tcl
+++ tools/cvs2fossil/lib/c2f_repository.tcl
@@ -20,10 +20,11 @@
2020
package require vc::tools::trouble ; # Error reporting.
2121
package require vc::tools::log ; # User feedback.
2222
package require vc::tools::misc ; # Text formatting
2323
package require vc::fossil::import::cvs::project ; # CVS projects
2424
package require struct::list ; # List operations.
25
+package require fileutil ; # File operations.
2526
2627
# # ## ### ##### ######## ############# #####################
2728
##
2829
2930
snit::type ::vc::fossil::import::cvs::repository {
3031
3132
ADDED tools/cvs2fossil/lib/c2f_state.tcl
--- tools/cvs2fossil/lib/c2f_repository.tcl
+++ tools/cvs2fossil/lib/c2f_repository.tcl
@@ -20,10 +20,11 @@
20 package require vc::tools::trouble ; # Error reporting.
21 package require vc::tools::log ; # User feedback.
22 package require vc::tools::misc ; # Text formatting
23 package require vc::fossil::import::cvs::project ; # CVS projects
24 package require struct::list ; # List operations.
 
25
26 # # ## ### ##### ######## ############# #####################
27 ##
28
29 snit::type ::vc::fossil::import::cvs::repository {
30
31 DDED tools/cvs2fossil/lib/c2f_state.tcl
--- tools/cvs2fossil/lib/c2f_repository.tcl
+++ tools/cvs2fossil/lib/c2f_repository.tcl
@@ -20,10 +20,11 @@
20 package require vc::tools::trouble ; # Error reporting.
21 package require vc::tools::log ; # User feedback.
22 package require vc::tools::misc ; # Text formatting
23 package require vc::fossil::import::cvs::project ; # CVS projects
24 package require struct::list ; # List operations.
25 package require fileutil ; # File operations.
26
27 # # ## ### ##### ######## ############# #####################
28 ##
29
30 snit::type ::vc::fossil::import::cvs::repository {
31
32 DDED tools/cvs2fossil/lib/c2f_state.tcl
--- a/tools/cvs2fossil/lib/c2f_state.tcl
+++ b/tools/cvs2fossil/lib/c2f_state.tcl
@@ -0,0 +1,3 @@
1
+it, acatch { ${type}::STATE{type}::STATE
2
+
3
+ set mypath {[llength [infqlite3 ${type}::STATE
--- a/tools/cvs2fossil/lib/c2f_state.tcl
+++ b/tools/cvs2fossil/lib/c2f_state.tcl
@@ -0,0 +1,3 @@
 
 
 
--- a/tools/cvs2fossil/lib/c2f_state.tcl
+++ b/tools/cvs2fossil/lib/c2f_state.tcl
@@ -0,0 +1,3 @@
1 it, acatch { ${type}::STATE{type}::STATE
2
3 set mypath {[llength [infqlite3 ${type}::STATE
--- tools/cvs2fossil/lib/pkgIndex.tcl
+++ tools/cvs2fossil/lib/pkgIndex.tcl
@@ -7,9 +7,10 @@
77
package ifneeded vc::fossil::import::cvs::option 1.0 [list source [file join $dir c2f_option.tcl]]
88
package ifneeded vc::fossil::import::cvs::pass 1.0 [list source [file join $dir c2f_pass.tcl]]
99
package ifneeded vc::fossil::import::cvs::pass::collar 1.0 [list source [file join $dir c2f_pcollar.tcl]]
1010
package ifneeded vc::fossil::import::cvs::repository 1.0 [list source [file join $dir c2f_repository.tcl]]
1111
package ifneeded vc::fossil::import::cvs::project 1.0 [list source [file join $dir c2f_project.tcl]]
12
+package ifneeded vc::fossil::import::cvs::state 1.0 [list source [file join $dir c2f_state.tcl]]
1213
package ifneeded vc::tools::trouble 1.0 [list source [file join $dir trouble.tcl]]
1314
package ifneeded vc::tools::log 1.0 [list source [file join $dir log.tcl]]
1415
package ifneeded vc::tools::misc 1.0 [list source [file join $dir misc.tcl]]
1516
1617
--- tools/cvs2fossil/lib/pkgIndex.tcl
+++ tools/cvs2fossil/lib/pkgIndex.tcl
@@ -7,9 +7,10 @@
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::fossil::import::cvs::pass::collar 1.0 [list source [file join $dir c2f_pcollar.tcl]]
10 package ifneeded vc::fossil::import::cvs::repository 1.0 [list source [file join $dir c2f_repository.tcl]]
11 package ifneeded vc::fossil::import::cvs::project 1.0 [list source [file join $dir c2f_project.tcl]]
 
12 package ifneeded vc::tools::trouble 1.0 [list source [file join $dir trouble.tcl]]
13 package ifneeded vc::tools::log 1.0 [list source [file join $dir log.tcl]]
14 package ifneeded vc::tools::misc 1.0 [list source [file join $dir misc.tcl]]
15
16
--- tools/cvs2fossil/lib/pkgIndex.tcl
+++ tools/cvs2fossil/lib/pkgIndex.tcl
@@ -7,9 +7,10 @@
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::fossil::import::cvs::pass::collar 1.0 [list source [file join $dir c2f_pcollar.tcl]]
10 package ifneeded vc::fossil::import::cvs::repository 1.0 [list source [file join $dir c2f_repository.tcl]]
11 package ifneeded vc::fossil::import::cvs::project 1.0 [list source [file join $dir c2f_project.tcl]]
12 package ifneeded vc::fossil::import::cvs::state 1.0 [list source [file join $dir c2f_state.tcl]]
13 package ifneeded vc::tools::trouble 1.0 [list source [file join $dir trouble.tcl]]
14 package ifneeded vc::tools::log 1.0 [list source [file join $dir log.tcl]]
15 package ifneeded vc::tools::misc 1.0 [list source [file join $dir misc.tcl]]
16
17

Keyboard Shortcuts

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