Fossil SCM

Extended options processing to handle --exclude, --force-tag, and --force-branch options. Extended project::sym class with in-memkory databases to hold the option information and replaced the 'UserConfig' placeholder with the actual code using the new databases to determine symbol types based on user-requests. Extended the pass itself with code performing various checks on the results of type determination, partially paranoia, partially to find genuine bad requests (excluding symbols with unexcluded blockers, making a symbol with commits on it a tag, ...). NYI: Computation of the prefered parent for all symbols.

aku 2007-11-05 09:04 trunk
Commit 7eaa420a232a7aac94bb11455a40ef6cec0321c0
--- tools/cvs2fossil/lib/c2f_option.tcl
+++ tools/cvs2fossil/lib/c2f_option.tcl
@@ -25,10 +25,11 @@
2525
package require vc::tools::misc ; # Misc. path reformatting.
2626
package require vc::fossil::import::cvs::pass ; # Pass management
2727
package require vc::fossil::import::cvs::pass::collar ; # Pass I.
2828
package require vc::fossil::import::cvs::repository ; # Repository management
2929
package require vc::fossil::import::cvs::state ; # State storage
30
+package require vc::fossil::import::cvs::project::sym ; # Project level symbols
3031
3132
# # ## ### ##### ######## ############# #####################
3233
##
3334
3435
snit::type ::vc::fossil::import::cvs::option {
@@ -42,17 +43,17 @@
4243
# --project
4344
# -v, --verbose
4445
# -q, --quiet
4546
# --state (conversion status, ala config.cache)
4647
# --trunk-only
48
+ # --exclude, --force-tag, --force-branch
4749
4850
# -o, --output
4951
# --dry-run
5052
# --force-branch RE
5153
# --force-tag RE
5254
# --symbol-transform RE:XX
53
- # --exclude
5455
5556
# # ## ### ##### ######## #############
5657
## Public API, Methods
5758
5859
typemethod process {arguments} {
@@ -73,10 +74,13 @@
7374
--verbose { log verbose }
7475
-q -
7576
--quiet { log quiet }
7677
--state { state use [Value arguments] }
7778
--trunk-only { repository trunkonly! }
79
+ --exclude { project::sym exclude [Value arguments] }
80
+ --force-tag { project::sym forcetag [Value arguments] }
81
+ --force-branch { project::sym forcebranch [Value arguments] }
7882
default {
7983
Usage $badoption$option\n$gethelp
8084
}
8185
}
8286
}
@@ -116,10 +120,26 @@
116120
trouble info " Prevent abort when conflicting archives"
117121
trouble info " were found in both regular and Attic."
118122
trouble info ""
119123
trouble info " --state PATH Save state to the specified file, and"
120124
trouble info " load state of previous runs from it too."
125
+ trouble info ""
126
+ trouble info " --exclude ?PROJECT:?SYMBOL Exclude the named symbol from all or"
127
+ trouble info " just the specified project. Both project"
128
+ trouble info " and symbol names are glob patterns."
129
+ trouble info ""
130
+ trouble info " --force-tag ?PROJECT:?SYMBOL"
131
+ trouble info " Force the named symbol from all or just"
132
+ trouble info " the specified project to be converted as"
133
+ trouble info " tag. Both project and symbol names are"
134
+ trouble info " glob patterns."
135
+ trouble info ""
136
+ trouble info " --force-branch ?PROJECT:?SYMBOL"
137
+ trouble info " Force the named symbol from all or just"
138
+ trouble info " the specified project to be converted as"
139
+ trouble info " branch. Both project and symbol names"
140
+ trouble info " are glob patterns."
121141
trouble info ""
122142
123143
# --project, --cache
124144
# ...
125145
return
@@ -188,20 +208,23 @@
188208
}
189209
190210
namespace eval ::vc::fossil::import::cvs {
191211
namespace export option
192212
namespace eval option {
193
- namespace import ::vc::tools::trouble
194
- namespace import ::vc::tools::log
195213
namespace import ::vc::tools::misc::striptrailingslash
196214
namespace import ::vc::fossil::import::cvs::pass
197215
namespace import ::vc::fossil::import::cvs::pass::collar
198216
namespace import ::vc::fossil::import::cvs::repository
199217
namespace import ::vc::fossil::import::cvs::state
218
+ namespace eval project {
219
+ namespace import ::vc::fossil::import::cvs::project::sym
220
+ }
221
+ namespace import ::vc::tools::trouble
222
+ namespace import ::vc::tools::log
200223
}
201224
}
202225
203226
# # ## ### ##### ######## ############# #####################
204227
## Ready
205228
206229
package provide vc::fossil::import::cvs::option 1.0
207230
return
208231
--- tools/cvs2fossil/lib/c2f_option.tcl
+++ tools/cvs2fossil/lib/c2f_option.tcl
@@ -25,10 +25,11 @@
25 package require vc::tools::misc ; # Misc. path reformatting.
26 package require vc::fossil::import::cvs::pass ; # Pass management
27 package require vc::fossil::import::cvs::pass::collar ; # Pass I.
28 package require vc::fossil::import::cvs::repository ; # Repository management
29 package require vc::fossil::import::cvs::state ; # State storage
 
30
31 # # ## ### ##### ######## ############# #####################
32 ##
33
34 snit::type ::vc::fossil::import::cvs::option {
@@ -42,17 +43,17 @@
42 # --project
43 # -v, --verbose
44 # -q, --quiet
45 # --state (conversion status, ala config.cache)
46 # --trunk-only
 
47
48 # -o, --output
49 # --dry-run
50 # --force-branch RE
51 # --force-tag RE
52 # --symbol-transform RE:XX
53 # --exclude
54
55 # # ## ### ##### ######## #############
56 ## Public API, Methods
57
58 typemethod process {arguments} {
@@ -73,10 +74,13 @@
73 --verbose { log verbose }
74 -q -
75 --quiet { log quiet }
76 --state { state use [Value arguments] }
77 --trunk-only { repository trunkonly! }
 
 
 
78 default {
79 Usage $badoption$option\n$gethelp
80 }
81 }
82 }
@@ -116,10 +120,26 @@
116 trouble info " Prevent abort when conflicting archives"
117 trouble info " were found in both regular and Attic."
118 trouble info ""
119 trouble info " --state PATH Save state to the specified file, and"
120 trouble info " load state of previous runs from it too."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121 trouble info ""
122
123 # --project, --cache
124 # ...
125 return
@@ -188,20 +208,23 @@
188 }
189
190 namespace eval ::vc::fossil::import::cvs {
191 namespace export option
192 namespace eval option {
193 namespace import ::vc::tools::trouble
194 namespace import ::vc::tools::log
195 namespace import ::vc::tools::misc::striptrailingslash
196 namespace import ::vc::fossil::import::cvs::pass
197 namespace import ::vc::fossil::import::cvs::pass::collar
198 namespace import ::vc::fossil::import::cvs::repository
199 namespace import ::vc::fossil::import::cvs::state
 
 
 
 
 
200 }
201 }
202
203 # # ## ### ##### ######## ############# #####################
204 ## Ready
205
206 package provide vc::fossil::import::cvs::option 1.0
207 return
208
--- tools/cvs2fossil/lib/c2f_option.tcl
+++ tools/cvs2fossil/lib/c2f_option.tcl
@@ -25,10 +25,11 @@
25 package require vc::tools::misc ; # Misc. path reformatting.
26 package require vc::fossil::import::cvs::pass ; # Pass management
27 package require vc::fossil::import::cvs::pass::collar ; # Pass I.
28 package require vc::fossil::import::cvs::repository ; # Repository management
29 package require vc::fossil::import::cvs::state ; # State storage
30 package require vc::fossil::import::cvs::project::sym ; # Project level symbols
31
32 # # ## ### ##### ######## ############# #####################
33 ##
34
35 snit::type ::vc::fossil::import::cvs::option {
@@ -42,17 +43,17 @@
43 # --project
44 # -v, --verbose
45 # -q, --quiet
46 # --state (conversion status, ala config.cache)
47 # --trunk-only
48 # --exclude, --force-tag, --force-branch
49
50 # -o, --output
51 # --dry-run
52 # --force-branch RE
53 # --force-tag RE
54 # --symbol-transform RE:XX
 
55
56 # # ## ### ##### ######## #############
57 ## Public API, Methods
58
59 typemethod process {arguments} {
@@ -73,10 +74,13 @@
74 --verbose { log verbose }
75 -q -
76 --quiet { log quiet }
77 --state { state use [Value arguments] }
78 --trunk-only { repository trunkonly! }
79 --exclude { project::sym exclude [Value arguments] }
80 --force-tag { project::sym forcetag [Value arguments] }
81 --force-branch { project::sym forcebranch [Value arguments] }
82 default {
83 Usage $badoption$option\n$gethelp
84 }
85 }
86 }
@@ -116,10 +120,26 @@
120 trouble info " Prevent abort when conflicting archives"
121 trouble info " were found in both regular and Attic."
122 trouble info ""
123 trouble info " --state PATH Save state to the specified file, and"
124 trouble info " load state of previous runs from it too."
125 trouble info ""
126 trouble info " --exclude ?PROJECT:?SYMBOL Exclude the named symbol from all or"
127 trouble info " just the specified project. Both project"
128 trouble info " and symbol names are glob patterns."
129 trouble info ""
130 trouble info " --force-tag ?PROJECT:?SYMBOL"
131 trouble info " Force the named symbol from all or just"
132 trouble info " the specified project to be converted as"
133 trouble info " tag. Both project and symbol names are"
134 trouble info " glob patterns."
135 trouble info ""
136 trouble info " --force-branch ?PROJECT:?SYMBOL"
137 trouble info " Force the named symbol from all or just"
138 trouble info " the specified project to be converted as"
139 trouble info " branch. Both project and symbol names"
140 trouble info " are glob patterns."
141 trouble info ""
142
143 # --project, --cache
144 # ...
145 return
@@ -188,20 +208,23 @@
208 }
209
210 namespace eval ::vc::fossil::import::cvs {
211 namespace export option
212 namespace eval option {
 
 
213 namespace import ::vc::tools::misc::striptrailingslash
214 namespace import ::vc::fossil::import::cvs::pass
215 namespace import ::vc::fossil::import::cvs::pass::collar
216 namespace import ::vc::fossil::import::cvs::repository
217 namespace import ::vc::fossil::import::cvs::state
218 namespace eval project {
219 namespace import ::vc::fossil::import::cvs::project::sym
220 }
221 namespace import ::vc::tools::trouble
222 namespace import ::vc::tools::log
223 }
224 }
225
226 # # ## ### ##### ######## ############# #####################
227 ## Ready
228
229 package provide vc::fossil::import::cvs::option 1.0
230 return
231
--- tools/cvs2fossil/lib/c2f_pcollrev.tcl
+++ tools/cvs2fossil/lib/c2f_pcollrev.tcl
@@ -315,12 +315,12 @@
315315
}
316316
317317
repository printrevstatistics
318318
repository persistrev
319319
320
- log write 1 collrev "Scan completed"
321320
Paranoia
321
+ log write 1 collrev "Scan completed"
322322
return
323323
}
324324
325325
typemethod discard {} {
326326
# Pass manager interface. Executed for all passes after the
327327
--- tools/cvs2fossil/lib/c2f_pcollrev.tcl
+++ tools/cvs2fossil/lib/c2f_pcollrev.tcl
@@ -315,12 +315,12 @@
315 }
316
317 repository printrevstatistics
318 repository persistrev
319
320 log write 1 collrev "Scan completed"
321 Paranoia
 
322 return
323 }
324
325 typemethod discard {} {
326 # Pass manager interface. Executed for all passes after the
327
--- tools/cvs2fossil/lib/c2f_pcollrev.tcl
+++ tools/cvs2fossil/lib/c2f_pcollrev.tcl
@@ -315,12 +315,12 @@
315 }
316
317 repository printrevstatistics
318 repository persistrev
319
 
320 Paranoia
321 log write 1 collrev "Scan completed"
322 return
323 }
324
325 typemethod discard {} {
326 # Pass manager interface. Executed for all passes after the
327
--- tools/cvs2fossil/lib/c2f_pcollsym.tcl
+++ tools/cvs2fossil/lib/c2f_pcollsym.tcl
@@ -9,24 +9,21 @@
99
# individuals. For exact contribution history, see the revision
1010
# history and logs, available at http://fossil-scm.hwaci.com/fossil
1111
# # ## ### ##### ######## ############# #####################
1212
1313
## Pass III. This pass divides the symbols collected by the previous
14
-## pass into branches, tags, and excludes. The latter are __not__
15
-## deleted by this pass, only marked. It is the next pass,
16
-## 'FilterSym', which performs the actual deletion.
14
+## pass into branches, tags, and excludes. The latter are also
15
+## partially deleted by this pass, not only marked. It is the next
16
+## pass however, 'FilterSym', which performs the full deletion.
1717
1818
# # ## ### ##### ######## ############# #####################
1919
## Requirements
2020
2121
package require Tcl 8.4 ; # Required runtime.
2222
package require snit ; # OO system.
23
-#package require fileutil::traverse ; # Directory traversal.
24
-#package require fileutil ; # File & path utilities.
25
-#package require vc::tools::trouble ; # Error reporting.
23
+package require vc::tools::trouble ; # Error reporting.
2624
package require vc::tools::log ; # User feedback.
27
-#package require vc::fossil::import::cvs::pass ; # Pass management.
2825
package require vc::fossil::import::cvs::repository ; # Repository management.
2926
package require vc::fossil::import::cvs::state ; # State storage.
3027
package require vc::fossil::import::cvs::project::sym ; # Project level symbols
3128
3229
# # ## ### ##### ######## ############# #####################
@@ -49,11 +46,10 @@
4946
# pass.
5047
5148
state reading symbol
5249
state reading blocker
5350
state reading parent
54
-
5551
return
5652
}
5753
5854
typemethod load {} {
5955
# TODO
@@ -68,25 +64,132 @@
6864
repository determinesymboltypes
6965
7066
project::sym printrulestatistics
7167
project::sym printtypestatistics
7268
}
69
+
70
+ if {![trouble ?]} {
71
+ UnconvertedSymbols
72
+ BadSymbolTypes
73
+ BlockedExcludes
74
+ InvalidTags
75
+ }
76
+
77
+ if {![trouble ?]} {
78
+ DropExcludedSymbolsFromReferences
79
+ }
7380
7481
log write 1 collsym "Collation completed"
7582
return
7683
}
7784
7885
typemethod discard {} {
7986
# Pass manager interface. Executed for all passes after the
8087
# run passes, to remove all data of this pass from the state,
8188
# as being out of date.
82
-
8389
return
8490
}
8591
8692
# # ## ### ##### ######## #############
8793
## Internal methods
94
+
95
+ proc UnconvertedSymbols {} {
96
+ # Paranoia - Have we left symbols without conversion
97
+ # information (i.e. with type 'undefined') ?
98
+
99
+ set undef [project::sym undef]
100
+
101
+ foreach {pname sname} [state run {
102
+ SELECT P.name, S.name
103
+ FROM project P, symbol S
104
+ WHERE P.pid = S.pid
105
+ AND S.type = $undef
106
+ }] {
107
+ trouble fatal "$pname : The symbol '$sname' was left undefined"
108
+ }
109
+ return
110
+ }
111
+
112
+ proc BadSymbolTypes {} {
113
+ # Paranoia - Have we left symbols with bogus conversion
114
+ # information (type out of the valid range (excluded, branch,
115
+ # tag)) ?
116
+
117
+ foreach {pname sname} [state run {
118
+ SELECT P.name, S.name
119
+ FROM project P, symbol S
120
+ WHERE P.pid = S.pid
121
+ AND S.type NOT IN (0,1,2)
122
+ }] {
123
+ trouble fatal "$pname : The symbol '$sname' has no proper conversion type"
124
+ }
125
+ return
126
+ }
127
+
128
+ proc BlockedExcludes {} {
129
+ # Paranoia - Have we scheduled symbols for exclusion without
130
+ # also excluding their dependent symbols ?
131
+
132
+ set excl [project::sym excluded]
133
+
134
+ foreach {pname sname bname} [state run {
135
+ SELECT P.name, S.name, SB.name
136
+ FROM project P, symbol S, blocker B, symbol SB
137
+ WHERE P.pid = S.pid
138
+ AND S.type = $excl
139
+ AND S.sid = B.sid
140
+ AND B.bid = SB.sid
141
+ AND SB.type != $excl
142
+ }] {
143
+ trouble fatal "$pname : The symbol '$sname' cannot be excluded as the unexcluded symbol '$bname' depends on it."
144
+ }
145
+ return
146
+ }
147
+
148
+ proc InvalidTags {} {
149
+ # Paranoia - Have we scheduled symbols for conversion as tags
150
+ # which absolutely cannot be converted as tags due to commits
151
+ # made on them ?
152
+
153
+ # In other words, this checks finds out if the user has asked
154
+ # nonsensical conversions of symbols, which should have been
155
+ # left to the heuristics, most specifically
156
+ # 'project::sym.HasCommits()'.
157
+
158
+ set tag [project::sym tag]
159
+
160
+ foreach {pname sname} [state run {
161
+ SELECT P.name, S.name
162
+ FROM project P, symbol S
163
+ WHERE P.pid = S.pid
164
+ AND S.type = $tag
165
+ AND S.commit_count > 0
166
+ }] {
167
+ trouble fatal "$pname : The symbol '$sname' cannot be forced to be converted as tag because it has commits."
168
+ }
169
+ return
170
+ }
171
+
172
+ proc DropExcludedSymbolsFromReferences {} {
173
+ # The excluded symbols cann be used as blockers nor as
174
+ # possible parent for other symbols. We now drop the relevant
175
+ # entries to prevent them from causing confusion later on.
176
+
177
+ set excl [project::sym excluded]
178
+
179
+ state run {
180
+ DELETE FROM blocker
181
+ WHERE bid IN (SELECT sid
182
+ FROM symbol
183
+ WhERE type = $excl);
184
+ DELETE FROM parent
185
+ WHERE pid IN (SELECT sid
186
+ FROM symbol
187
+ WhERE type = $excl);
188
+ }
189
+ return
190
+ }
88191
89192
# # ## ### ##### ######## #############
90193
## Configuration
91194
92195
pragma -hasinstances no ; # singleton
@@ -102,11 +205,11 @@
102205
namespace import ::vc::fossil::import::cvs::repository
103206
namespace import ::vc::fossil::import::cvs::state
104207
namespace eval project {
105208
namespace import ::vc::fossil::import::cvs::project::sym
106209
}
107
- #namespace import ::vc::tools::trouble
210
+ namespace import ::vc::tools::trouble
108211
namespace import ::vc::tools::log
109212
log register collsym
110213
}
111214
}
112215
113216
--- tools/cvs2fossil/lib/c2f_pcollsym.tcl
+++ tools/cvs2fossil/lib/c2f_pcollsym.tcl
@@ -9,24 +9,21 @@
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 III. This pass divides the symbols collected by the previous
14 ## pass into branches, tags, and excludes. The latter are __not__
15 ## deleted by this pass, only marked. It is the next pass,
16 ## 'FilterSym', which performs the actual deletion.
17
18 # # ## ### ##### ######## ############# #####################
19 ## Requirements
20
21 package require Tcl 8.4 ; # Required runtime.
22 package require snit ; # OO system.
23 #package require fileutil::traverse ; # Directory traversal.
24 #package require fileutil ; # File & path utilities.
25 #package require vc::tools::trouble ; # Error reporting.
26 package require vc::tools::log ; # User feedback.
27 #package require vc::fossil::import::cvs::pass ; # Pass management.
28 package require vc::fossil::import::cvs::repository ; # Repository management.
29 package require vc::fossil::import::cvs::state ; # State storage.
30 package require vc::fossil::import::cvs::project::sym ; # Project level symbols
31
32 # # ## ### ##### ######## ############# #####################
@@ -49,11 +46,10 @@
49 # pass.
50
51 state reading symbol
52 state reading blocker
53 state reading parent
54
55 return
56 }
57
58 typemethod load {} {
59 # TODO
@@ -68,25 +64,132 @@
68 repository determinesymboltypes
69
70 project::sym printrulestatistics
71 project::sym printtypestatistics
72 }
 
 
 
 
 
 
 
 
 
 
 
73
74 log write 1 collsym "Collation completed"
75 return
76 }
77
78 typemethod discard {} {
79 # Pass manager interface. Executed for all passes after the
80 # run passes, to remove all data of this pass from the state,
81 # as being out of date.
82
83 return
84 }
85
86 # # ## ### ##### ######## #############
87 ## Internal methods
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
89 # # ## ### ##### ######## #############
90 ## Configuration
91
92 pragma -hasinstances no ; # singleton
@@ -102,11 +205,11 @@
102 namespace import ::vc::fossil::import::cvs::repository
103 namespace import ::vc::fossil::import::cvs::state
104 namespace eval project {
105 namespace import ::vc::fossil::import::cvs::project::sym
106 }
107 #namespace import ::vc::tools::trouble
108 namespace import ::vc::tools::log
109 log register collsym
110 }
111 }
112
113
--- tools/cvs2fossil/lib/c2f_pcollsym.tcl
+++ tools/cvs2fossil/lib/c2f_pcollsym.tcl
@@ -9,24 +9,21 @@
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 III. This pass divides the symbols collected by the previous
14 ## pass into branches, tags, and excludes. The latter are also
15 ## partially deleted by this pass, not only marked. It is the next
16 ## pass however, 'FilterSym', which performs the full deletion.
17
18 # # ## ### ##### ######## ############# #####################
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::tools::log ; # User feedback.
 
25 package require vc::fossil::import::cvs::repository ; # Repository management.
26 package require vc::fossil::import::cvs::state ; # State storage.
27 package require vc::fossil::import::cvs::project::sym ; # Project level symbols
28
29 # # ## ### ##### ######## ############# #####################
@@ -49,11 +46,10 @@
46 # pass.
47
48 state reading symbol
49 state reading blocker
50 state reading parent
 
51 return
52 }
53
54 typemethod load {} {
55 # TODO
@@ -68,25 +64,132 @@
64 repository determinesymboltypes
65
66 project::sym printrulestatistics
67 project::sym printtypestatistics
68 }
69
70 if {![trouble ?]} {
71 UnconvertedSymbols
72 BadSymbolTypes
73 BlockedExcludes
74 InvalidTags
75 }
76
77 if {![trouble ?]} {
78 DropExcludedSymbolsFromReferences
79 }
80
81 log write 1 collsym "Collation completed"
82 return
83 }
84
85 typemethod discard {} {
86 # Pass manager interface. Executed for all passes after the
87 # run passes, to remove all data of this pass from the state,
88 # as being out of date.
 
89 return
90 }
91
92 # # ## ### ##### ######## #############
93 ## Internal methods
94
95 proc UnconvertedSymbols {} {
96 # Paranoia - Have we left symbols without conversion
97 # information (i.e. with type 'undefined') ?
98
99 set undef [project::sym undef]
100
101 foreach {pname sname} [state run {
102 SELECT P.name, S.name
103 FROM project P, symbol S
104 WHERE P.pid = S.pid
105 AND S.type = $undef
106 }] {
107 trouble fatal "$pname : The symbol '$sname' was left undefined"
108 }
109 return
110 }
111
112 proc BadSymbolTypes {} {
113 # Paranoia - Have we left symbols with bogus conversion
114 # information (type out of the valid range (excluded, branch,
115 # tag)) ?
116
117 foreach {pname sname} [state run {
118 SELECT P.name, S.name
119 FROM project P, symbol S
120 WHERE P.pid = S.pid
121 AND S.type NOT IN (0,1,2)
122 }] {
123 trouble fatal "$pname : The symbol '$sname' has no proper conversion type"
124 }
125 return
126 }
127
128 proc BlockedExcludes {} {
129 # Paranoia - Have we scheduled symbols for exclusion without
130 # also excluding their dependent symbols ?
131
132 set excl [project::sym excluded]
133
134 foreach {pname sname bname} [state run {
135 SELECT P.name, S.name, SB.name
136 FROM project P, symbol S, blocker B, symbol SB
137 WHERE P.pid = S.pid
138 AND S.type = $excl
139 AND S.sid = B.sid
140 AND B.bid = SB.sid
141 AND SB.type != $excl
142 }] {
143 trouble fatal "$pname : The symbol '$sname' cannot be excluded as the unexcluded symbol '$bname' depends on it."
144 }
145 return
146 }
147
148 proc InvalidTags {} {
149 # Paranoia - Have we scheduled symbols for conversion as tags
150 # which absolutely cannot be converted as tags due to commits
151 # made on them ?
152
153 # In other words, this checks finds out if the user has asked
154 # nonsensical conversions of symbols, which should have been
155 # left to the heuristics, most specifically
156 # 'project::sym.HasCommits()'.
157
158 set tag [project::sym tag]
159
160 foreach {pname sname} [state run {
161 SELECT P.name, S.name
162 FROM project P, symbol S
163 WHERE P.pid = S.pid
164 AND S.type = $tag
165 AND S.commit_count > 0
166 }] {
167 trouble fatal "$pname : The symbol '$sname' cannot be forced to be converted as tag because it has commits."
168 }
169 return
170 }
171
172 proc DropExcludedSymbolsFromReferences {} {
173 # The excluded symbols cann be used as blockers nor as
174 # possible parent for other symbols. We now drop the relevant
175 # entries to prevent them from causing confusion later on.
176
177 set excl [project::sym excluded]
178
179 state run {
180 DELETE FROM blocker
181 WHERE bid IN (SELECT sid
182 FROM symbol
183 WhERE type = $excl);
184 DELETE FROM parent
185 WHERE pid IN (SELECT sid
186 FROM symbol
187 WhERE type = $excl);
188 }
189 return
190 }
191
192 # # ## ### ##### ######## #############
193 ## Configuration
194
195 pragma -hasinstances no ; # singleton
@@ -102,11 +205,11 @@
205 namespace import ::vc::fossil::import::cvs::repository
206 namespace import ::vc::fossil::import::cvs::state
207 namespace eval project {
208 namespace import ::vc::fossil::import::cvs::project::sym
209 }
210 namespace import ::vc::tools::trouble
211 namespace import ::vc::tools::log
212 log register collsym
213 }
214 }
215
216
--- tools/cvs2fossil/lib/c2f_psym.tcl
+++ tools/cvs2fossil/lib/c2f_psym.tcl
@@ -178,10 +178,61 @@
178178
variable mytype {} ; # The type chosen for the symbol to use in
179179
# the conversion.
180180
181181
# # ## ### ##### ######## #############
182182
183
+ typemethod exclude {pattern} {
184
+ # Store the pattern in memory for use by the code doing type
185
+ # determination.
186
+
187
+ lappend myexcludepattern [ProcessPattern $pattern exclusion]
188
+ return
189
+ }
190
+
191
+ typemethod forcetag {pattern} {
192
+ # Store the pattern in memory for use by the code doing type
193
+ # determination.
194
+
195
+ lappend myforcepattern [ProcessPattern $pattern force-tag] $mytag
196
+ return
197
+ }
198
+
199
+ typemethod forcebranch {pattern} {
200
+ # Store the pattern in memory for use by the code doing type
201
+ # determination.
202
+
203
+ lappend myforcepattern [ProcessPattern $pattern force-branch] $mybranch
204
+ return
205
+ }
206
+
207
+ proc ProcessPattern {pattern label} {
208
+ if {[string match *:*:* $pattern]} {
209
+ # Bad syntax for the pattern, using multiple colons.
210
+
211
+ trouble fatal "Bad $label pattern '$pattern'"
212
+ } elseif {![string match *:* $pattern]} {
213
+ # When only a symbol pattern is specified it applies to
214
+ # all projects.
215
+
216
+ return [list * $pattern]
217
+ } else {
218
+ # Both project and symbol patterns are present, we split
219
+ # them apart now for storage and easier extraction later.
220
+
221
+ return [split $pattern :]
222
+ }
223
+ }
224
+
225
+ typevariable myexcludepattern {} ; # List of patterns specifying
226
+ # the symbols to exclude from
227
+ # conversion. Tags and/or
228
+ # branches.
229
+
230
+ typevariable myforcepattern {} ; # List of patterns and types
231
+ # specifying which symbols to
232
+ # force to specific types.
233
+
183234
typemethod getsymtypes {} {
184235
foreach {tid name} [state run {
185236
SELECT tid, name FROM symtype;
186237
}] { set mysymtype($tid) $name }
187238
return
@@ -191,10 +242,14 @@
191242
typevariable myexcluded 0 ; # Code for symbols which are excluded.
192243
typevariable mytag 1 ; # Code for symbols which are tags.
193244
typevariable mybranch 2 ; # Code for symbols which are branches.
194245
typevariable myundef 3 ; # Code for symbols of unknown type.
195246
typevariable mysymtype -array {} ; # Map from type code to label for the log.
247
+
248
+ typemethod undef {} { return $myundef }
249
+ typemethod excluded {} { return $myexcluded }
250
+ typemethod tag {} { return $mytag }
196251
197252
typemethod printrulestatistics {} {
198253
log write 2 symbol "Rule usage statistics:"
199254
200255
set fmt %[string length $mynum]s
@@ -246,11 +301,35 @@
246301
247302
# # ## ### ##### ######## #############
248303
## Internal methods
249304
250305
method UserConfig {} {
251
- # No user based guidance yet.
306
+ set project [$myproject base]
307
+
308
+ # First check if the user requested the exclusion of the
309
+ # symbol from conversion.
310
+
311
+ foreach ex $myexcludepattern {
312
+ struct::list assign $ex pp sp
313
+ if {![string match $pp $project]} continue
314
+ if {![string match $sp $myname]} continue
315
+ return $myexcluded
316
+ }
317
+
318
+ # If the symbol is not excluded further check if the user
319
+ # forces its conversion as a specific type.
320
+
321
+ foreach {ex stype} $myforcepattern {
322
+ struct::list assign $ex pp sp
323
+ if {![string match $pp $project]} continue
324
+ if {![string match $sp $myname]} continue
325
+ return $stype
326
+ }
327
+
328
+ # Nothing is forced, have the main system hand the symbol over
329
+ # to the regular heuristics.
330
+
252331
return $myundef
253332
}
254333
255334
method Unambigous {} {
256335
# If a symbol is used unambiguously as a tag/branch, convert
257336
--- tools/cvs2fossil/lib/c2f_psym.tcl
+++ tools/cvs2fossil/lib/c2f_psym.tcl
@@ -178,10 +178,61 @@
178 variable mytype {} ; # The type chosen for the symbol to use in
179 # the conversion.
180
181 # # ## ### ##### ######## #############
182
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183 typemethod getsymtypes {} {
184 foreach {tid name} [state run {
185 SELECT tid, name FROM symtype;
186 }] { set mysymtype($tid) $name }
187 return
@@ -191,10 +242,14 @@
191 typevariable myexcluded 0 ; # Code for symbols which are excluded.
192 typevariable mytag 1 ; # Code for symbols which are tags.
193 typevariable mybranch 2 ; # Code for symbols which are branches.
194 typevariable myundef 3 ; # Code for symbols of unknown type.
195 typevariable mysymtype -array {} ; # Map from type code to label for the log.
 
 
 
 
196
197 typemethod printrulestatistics {} {
198 log write 2 symbol "Rule usage statistics:"
199
200 set fmt %[string length $mynum]s
@@ -246,11 +301,35 @@
246
247 # # ## ### ##### ######## #############
248 ## Internal methods
249
250 method UserConfig {} {
251 # No user based guidance yet.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
252 return $myundef
253 }
254
255 method Unambigous {} {
256 # If a symbol is used unambiguously as a tag/branch, convert
257
--- tools/cvs2fossil/lib/c2f_psym.tcl
+++ tools/cvs2fossil/lib/c2f_psym.tcl
@@ -178,10 +178,61 @@
178 variable mytype {} ; # The type chosen for the symbol to use in
179 # the conversion.
180
181 # # ## ### ##### ######## #############
182
183 typemethod exclude {pattern} {
184 # Store the pattern in memory for use by the code doing type
185 # determination.
186
187 lappend myexcludepattern [ProcessPattern $pattern exclusion]
188 return
189 }
190
191 typemethod forcetag {pattern} {
192 # Store the pattern in memory for use by the code doing type
193 # determination.
194
195 lappend myforcepattern [ProcessPattern $pattern force-tag] $mytag
196 return
197 }
198
199 typemethod forcebranch {pattern} {
200 # Store the pattern in memory for use by the code doing type
201 # determination.
202
203 lappend myforcepattern [ProcessPattern $pattern force-branch] $mybranch
204 return
205 }
206
207 proc ProcessPattern {pattern label} {
208 if {[string match *:*:* $pattern]} {
209 # Bad syntax for the pattern, using multiple colons.
210
211 trouble fatal "Bad $label pattern '$pattern'"
212 } elseif {![string match *:* $pattern]} {
213 # When only a symbol pattern is specified it applies to
214 # all projects.
215
216 return [list * $pattern]
217 } else {
218 # Both project and symbol patterns are present, we split
219 # them apart now for storage and easier extraction later.
220
221 return [split $pattern :]
222 }
223 }
224
225 typevariable myexcludepattern {} ; # List of patterns specifying
226 # the symbols to exclude from
227 # conversion. Tags and/or
228 # branches.
229
230 typevariable myforcepattern {} ; # List of patterns and types
231 # specifying which symbols to
232 # force to specific types.
233
234 typemethod getsymtypes {} {
235 foreach {tid name} [state run {
236 SELECT tid, name FROM symtype;
237 }] { set mysymtype($tid) $name }
238 return
@@ -191,10 +242,14 @@
242 typevariable myexcluded 0 ; # Code for symbols which are excluded.
243 typevariable mytag 1 ; # Code for symbols which are tags.
244 typevariable mybranch 2 ; # Code for symbols which are branches.
245 typevariable myundef 3 ; # Code for symbols of unknown type.
246 typevariable mysymtype -array {} ; # Map from type code to label for the log.
247
248 typemethod undef {} { return $myundef }
249 typemethod excluded {} { return $myexcluded }
250 typemethod tag {} { return $mytag }
251
252 typemethod printrulestatistics {} {
253 log write 2 symbol "Rule usage statistics:"
254
255 set fmt %[string length $mynum]s
@@ -246,11 +301,35 @@
301
302 # # ## ### ##### ######## #############
303 ## Internal methods
304
305 method UserConfig {} {
306 set project [$myproject base]
307
308 # First check if the user requested the exclusion of the
309 # symbol from conversion.
310
311 foreach ex $myexcludepattern {
312 struct::list assign $ex pp sp
313 if {![string match $pp $project]} continue
314 if {![string match $sp $myname]} continue
315 return $myexcluded
316 }
317
318 # If the symbol is not excluded further check if the user
319 # forces its conversion as a specific type.
320
321 foreach {ex stype} $myforcepattern {
322 struct::list assign $ex pp sp
323 if {![string match $pp $project]} continue
324 if {![string match $sp $myname]} continue
325 return $stype
326 }
327
328 # Nothing is forced, have the main system hand the symbol over
329 # to the regular heuristics.
330
331 return $myundef
332 }
333
334 method Unambigous {} {
335 # If a symbol is used unambiguously as a tag/branch, convert
336
--- tools/cvs2fossil/lib/trouble.tcl
+++ tools/cvs2fossil/lib/trouble.tcl
@@ -51,10 +51,18 @@
5151
foreach m $myinfo { log write 0 "" $m }
5252
foreach m $mywarn { log write 0 warning $m }
5353
foreach m $myfatal { log write 0 fatal $m }
5454
return
5555
}
56
+
57
+ typemethod ? {} {
58
+ return [expr {
59
+ [llength $myinfo] ||
60
+ [llength $mywarn] ||
61
+ [llength $myfatal]
62
+ }]
63
+ }
5664
5765
typemethod abort? {} {
5866
if {
5967
![llength $myinfo] &&
6068
![llength $mywarn] &&
6169
--- tools/cvs2fossil/lib/trouble.tcl
+++ tools/cvs2fossil/lib/trouble.tcl
@@ -51,10 +51,18 @@
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
--- tools/cvs2fossil/lib/trouble.tcl
+++ tools/cvs2fossil/lib/trouble.tcl
@@ -51,10 +51,18 @@
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 ? {} {
58 return [expr {
59 [llength $myinfo] ||
60 [llength $mywarn] ||
61 [llength $myfatal]
62 }]
63 }
64
65 typemethod abort? {} {
66 if {
67 ![llength $myinfo] &&
68 ![llength $mywarn] &&
69

Keyboard Shortcuts

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