Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | 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. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
7eaa420a232a7aac94bb11455a40ef6c |
| User & Date: | aku 2007-11-05 09:04:25.000 |
Context
|
2007-11-06
| ||
| 04:39 | Completed pass 3, CollateSymbols. Added code determining for each symbol the prefered parent from all possible parents. This is the symbol with the lowest id among the set with the maximum number of occurences as a parent. ... (check-in: efc78b7a42 user: aku tags: trunk) | |
|
2007-11-05
| ||
| 09:04 | 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. ... (check-in: 7eaa420a23 user: aku tags: trunk) | |
|
2007-11-02
| ||
| 06:06 | Continued work on pass 3, added code to determine the type of symbols based on the tag-, branch-, and commit-counts. Hook for handling data coming from the option processoris present (UserConfig), but only as a placeholder. ... (check-in: f888f06fe3 user: aku tags: trunk) | |
Changes
Changes to tools/cvs2fossil/lib/c2f_option.tcl.
| ︙ | ︙ | |||
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 |
package require vc::tools::trouble ; # Error reporting.
package require vc::tools::log ; # User feedback.
package require vc::tools::misc ; # Misc. path reformatting.
package require vc::fossil::import::cvs::pass ; # Pass management
package require vc::fossil::import::cvs::pass::collar ; # Pass I.
package require vc::fossil::import::cvs::repository ; # Repository management
package require vc::fossil::import::cvs::state ; # State storage
# # ## ### ##### ######## ############# #####################
##
snit::type ::vc::fossil::import::cvs::option {
# # ## ### ##### ######## #############
## Public API, Options.
# --help, --help-passes, -h
# --version
# -p, --pass, --passes
# --ignore-conflicting-attics
# --project
# -v, --verbose
# -q, --quiet
# --state (conversion status, ala config.cache)
# --trunk-only
# -o, --output
# --dry-run
# --force-branch RE
# --force-tag RE
# --symbol-transform RE:XX
| > > < | 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 |
package require vc::tools::trouble ; # Error reporting.
package require vc::tools::log ; # User feedback.
package require vc::tools::misc ; # Misc. path reformatting.
package require vc::fossil::import::cvs::pass ; # Pass management
package require vc::fossil::import::cvs::pass::collar ; # Pass I.
package require vc::fossil::import::cvs::repository ; # Repository management
package require vc::fossil::import::cvs::state ; # State storage
package require vc::fossil::import::cvs::project::sym ; # Project level symbols
# # ## ### ##### ######## ############# #####################
##
snit::type ::vc::fossil::import::cvs::option {
# # ## ### ##### ######## #############
## Public API, Options.
# --help, --help-passes, -h
# --version
# -p, --pass, --passes
# --ignore-conflicting-attics
# --project
# -v, --verbose
# -q, --quiet
# --state (conversion status, ala config.cache)
# --trunk-only
# --exclude, --force-tag, --force-branch
# -o, --output
# --dry-run
# --force-branch RE
# --force-tag RE
# --symbol-transform RE:XX
# # ## ### ##### ######## #############
## Public API, Methods
typemethod process {arguments} {
# Syntax of arguments: ?option ?value?...? /path/to/cvs/repository
|
| ︙ | ︙ | |||
71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
--project { repository add [Value arguments] }
-v -
--verbose { log verbose }
-q -
--quiet { log quiet }
--state { state use [Value arguments] }
--trunk-only { repository trunkonly! }
default {
Usage $badoption$option\n$gethelp
}
}
}
if {[llength $arguments] > 1} Usage
| > > > | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
--project { repository add [Value arguments] }
-v -
--verbose { log verbose }
-q -
--quiet { log quiet }
--state { state use [Value arguments] }
--trunk-only { repository trunkonly! }
--exclude { project::sym exclude [Value arguments] }
--force-tag { project::sym forcetag [Value arguments] }
--force-branch { project::sym forcebranch [Value arguments] }
default {
Usage $badoption$option\n$gethelp
}
}
}
if {[llength $arguments] > 1} Usage
|
| ︙ | ︙ | |||
114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
trouble info ""
trouble info " --ignore-conflicting-attics"
trouble info " Prevent abort when conflicting archives"
trouble info " were found in both regular and Attic."
trouble info ""
trouble info " --state PATH Save state to the specified file, and"
trouble info " load state of previous runs from it too."
trouble info ""
# --project, --cache
# ...
return
}
| > > > > > > > > > > > > > > > > | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
trouble info ""
trouble info " --ignore-conflicting-attics"
trouble info " Prevent abort when conflicting archives"
trouble info " were found in both regular and Attic."
trouble info ""
trouble info " --state PATH Save state to the specified file, and"
trouble info " load state of previous runs from it too."
trouble info ""
trouble info " --exclude ?PROJECT:?SYMBOL Exclude the named symbol from all or"
trouble info " just the specified project. Both project"
trouble info " and symbol names are glob patterns."
trouble info ""
trouble info " --force-tag ?PROJECT:?SYMBOL"
trouble info " Force the named symbol from all or just"
trouble info " the specified project to be converted as"
trouble info " tag. Both project and symbol names are"
trouble info " glob patterns."
trouble info ""
trouble info " --force-branch ?PROJECT:?SYMBOL"
trouble info " Force the named symbol from all or just"
trouble info " the specified project to be converted as"
trouble info " branch. Both project and symbol names"
trouble info " are glob patterns."
trouble info ""
# --project, --cache
# ...
return
}
|
| ︙ | ︙ | |||
186 187 188 189 190 191 192 |
# # ## ### ##### ######## #############
}
namespace eval ::vc::fossil::import::cvs {
namespace export option
namespace eval option {
| < < > > > > > | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
# # ## ### ##### ######## #############
}
namespace eval ::vc::fossil::import::cvs {
namespace export option
namespace eval option {
namespace import ::vc::tools::misc::striptrailingslash
namespace import ::vc::fossil::import::cvs::pass
namespace import ::vc::fossil::import::cvs::pass::collar
namespace import ::vc::fossil::import::cvs::repository
namespace import ::vc::fossil::import::cvs::state
namespace eval project {
namespace import ::vc::fossil::import::cvs::project::sym
}
namespace import ::vc::tools::trouble
namespace import ::vc::tools::log
}
}
# # ## ### ##### ######## ############# #####################
## Ready
package provide vc::fossil::import::cvs::option 1.0
return
|
Changes to tools/cvs2fossil/lib/c2f_pcollrev.tcl.
| ︙ | ︙ | |||
313 314 315 316 317 318 319 | $project purgeghostsymbols } repository printrevstatistics repository persistrev | < > | 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 |
$project purgeghostsymbols
}
repository printrevstatistics
repository persistrev
Paranoia
log write 1 collrev "Scan completed"
return
}
typemethod discard {} {
# Pass manager interface. Executed for all passes after the
# run passes, to remove all data of this pass from the state,
# as being out of date.
|
| ︙ | ︙ |
Changes to tools/cvs2fossil/lib/c2f_pcollsym.tcl.
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## -*- tcl -*- # # ## ### ##### ######## ############# ##################### ## Copyright (c) 2007 Andreas Kupries. # # This software is licensed as described in the file LICENSE, which # you should have received as part of this distribution. # # This software consists of voluntary contributions made by many # individuals. For exact contribution history, see the revision # history and logs, available at http://fossil-scm.hwaci.com/fossil # # ## ### ##### ######## ############# ##################### ## Pass III. This pass divides the symbols collected by the previous | | | | < < | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ## -*- tcl -*- # # ## ### ##### ######## ############# ##################### ## Copyright (c) 2007 Andreas Kupries. # # This software is licensed as described in the file LICENSE, which # you should have received as part of this distribution. # # This software consists of voluntary contributions made by many # individuals. For exact contribution history, see the revision # history and logs, available at http://fossil-scm.hwaci.com/fossil # # ## ### ##### ######## ############# ##################### ## Pass III. This pass divides the symbols collected by the previous ## pass into branches, tags, and excludes. The latter are also ## partially deleted by this pass, not only marked. It is the next ## pass however, 'FilterSym', which performs the full deletion. # # ## ### ##### ######## ############# ##################### ## Requirements package require Tcl 8.4 ; # Required runtime. package require snit ; # OO system. package require vc::tools::trouble ; # Error reporting. package require vc::tools::log ; # User feedback. package require vc::fossil::import::cvs::repository ; # Repository management. package require vc::fossil::import::cvs::state ; # State storage. package require vc::fossil::import::cvs::project::sym ; # Project level symbols # # ## ### ##### ######## ############# ##################### ## Register the pass with the management |
| ︙ | ︙ | |||
47 48 49 50 51 52 53 |
typemethod setup {} {
# Define names and structure of the persistent state of this
# pass.
state reading symbol
state reading blocker
state reading parent
| < > > > > > > > > > > > < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 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 74 75 76 77 78 79 80 81 82 83 84 85 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 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 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 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
typemethod setup {} {
# Define names and structure of the persistent state of this
# pass.
state reading symbol
state reading blocker
state reading parent
return
}
typemethod load {} {
# TODO
return
}
typemethod run {} {
# Pass manager interface. Executed to perform the
# functionality of the pass.
state transaction {
repository determinesymboltypes
project::sym printrulestatistics
project::sym printtypestatistics
}
if {![trouble ?]} {
UnconvertedSymbols
BadSymbolTypes
BlockedExcludes
InvalidTags
}
if {![trouble ?]} {
DropExcludedSymbolsFromReferences
}
log write 1 collsym "Collation completed"
return
}
typemethod discard {} {
# Pass manager interface. Executed for all passes after the
# run passes, to remove all data of this pass from the state,
# as being out of date.
return
}
# # ## ### ##### ######## #############
## Internal methods
proc UnconvertedSymbols {} {
# Paranoia - Have we left symbols without conversion
# information (i.e. with type 'undefined') ?
set undef [project::sym undef]
foreach {pname sname} [state run {
SELECT P.name, S.name
FROM project P, symbol S
WHERE P.pid = S.pid
AND S.type = $undef
}] {
trouble fatal "$pname : The symbol '$sname' was left undefined"
}
return
}
proc BadSymbolTypes {} {
# Paranoia - Have we left symbols with bogus conversion
# information (type out of the valid range (excluded, branch,
# tag)) ?
foreach {pname sname} [state run {
SELECT P.name, S.name
FROM project P, symbol S
WHERE P.pid = S.pid
AND S.type NOT IN (0,1,2)
}] {
trouble fatal "$pname : The symbol '$sname' has no proper conversion type"
}
return
}
proc BlockedExcludes {} {
# Paranoia - Have we scheduled symbols for exclusion without
# also excluding their dependent symbols ?
set excl [project::sym excluded]
foreach {pname sname bname} [state run {
SELECT P.name, S.name, SB.name
FROM project P, symbol S, blocker B, symbol SB
WHERE P.pid = S.pid
AND S.type = $excl
AND S.sid = B.sid
AND B.bid = SB.sid
AND SB.type != $excl
}] {
trouble fatal "$pname : The symbol '$sname' cannot be excluded as the unexcluded symbol '$bname' depends on it."
}
return
}
proc InvalidTags {} {
# Paranoia - Have we scheduled symbols for conversion as tags
# which absolutely cannot be converted as tags due to commits
# made on them ?
# In other words, this checks finds out if the user has asked
# nonsensical conversions of symbols, which should have been
# left to the heuristics, most specifically
# 'project::sym.HasCommits()'.
set tag [project::sym tag]
foreach {pname sname} [state run {
SELECT P.name, S.name
FROM project P, symbol S
WHERE P.pid = S.pid
AND S.type = $tag
AND S.commit_count > 0
}] {
trouble fatal "$pname : The symbol '$sname' cannot be forced to be converted as tag because it has commits."
}
return
}
proc DropExcludedSymbolsFromReferences {} {
# The excluded symbols cann be used as blockers nor as
# possible parent for other symbols. We now drop the relevant
# entries to prevent them from causing confusion later on.
set excl [project::sym excluded]
state run {
DELETE FROM blocker
WHERE bid IN (SELECT sid
FROM symbol
WhERE type = $excl);
DELETE FROM parent
WHERE pid IN (SELECT sid
FROM symbol
WhERE type = $excl);
}
return
}
# # ## ### ##### ######## #############
## Configuration
pragma -hasinstances no ; # singleton
pragma -hastypeinfo no ; # no introspection
pragma -hastypedestroy no ; # immortal
# # ## ### ##### ######## #############
}
namespace eval ::vc::fossil::import::cvs::pass {
namespace export collsym
namespace eval collsym {
namespace import ::vc::fossil::import::cvs::repository
namespace import ::vc::fossil::import::cvs::state
namespace eval project {
namespace import ::vc::fossil::import::cvs::project::sym
}
namespace import ::vc::tools::trouble
namespace import ::vc::tools::log
log register collsym
}
}
# # ## ### ##### ######## ############# #####################
## Ready
package provide vc::fossil::import::cvs::pass::collsym 1.0
return
|
Changes to tools/cvs2fossil/lib/c2f_psym.tcl.
| ︙ | ︙ | |||
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
# been a parent of this symbol.
variable mytype {} ; # The type chosen for the symbol to use in
# the conversion.
# # ## ### ##### ######## #############
typemethod getsymtypes {} {
foreach {tid name} [state run {
SELECT tid, name FROM symtype;
}] { set mysymtype($tid) $name }
return
}
# Keep the codes below in sync with 'pass::collrev/setup('symtype').
typevariable myexcluded 0 ; # Code for symbols which are excluded.
typevariable mytag 1 ; # Code for symbols which are tags.
typevariable mybranch 2 ; # Code for symbols which are branches.
typevariable myundef 3 ; # Code for symbols of unknown type.
typevariable mysymtype -array {} ; # Map from type code to label for the log.
typemethod printrulestatistics {} {
log write 2 symbol "Rule usage statistics:"
set fmt %[string length $mynum]s
set all 0
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 |
# been a parent of this symbol.
variable mytype {} ; # The type chosen for the symbol to use in
# the conversion.
# # ## ### ##### ######## #############
typemethod exclude {pattern} {
# Store the pattern in memory for use by the code doing type
# determination.
lappend myexcludepattern [ProcessPattern $pattern exclusion]
return
}
typemethod forcetag {pattern} {
# Store the pattern in memory for use by the code doing type
# determination.
lappend myforcepattern [ProcessPattern $pattern force-tag] $mytag
return
}
typemethod forcebranch {pattern} {
# Store the pattern in memory for use by the code doing type
# determination.
lappend myforcepattern [ProcessPattern $pattern force-branch] $mybranch
return
}
proc ProcessPattern {pattern label} {
if {[string match *:*:* $pattern]} {
# Bad syntax for the pattern, using multiple colons.
trouble fatal "Bad $label pattern '$pattern'"
} elseif {![string match *:* $pattern]} {
# When only a symbol pattern is specified it applies to
# all projects.
return [list * $pattern]
} else {
# Both project and symbol patterns are present, we split
# them apart now for storage and easier extraction later.
return [split $pattern :]
}
}
typevariable myexcludepattern {} ; # List of patterns specifying
# the symbols to exclude from
# conversion. Tags and/or
# branches.
typevariable myforcepattern {} ; # List of patterns and types
# specifying which symbols to
# force to specific types.
typemethod getsymtypes {} {
foreach {tid name} [state run {
SELECT tid, name FROM symtype;
}] { set mysymtype($tid) $name }
return
}
# Keep the codes below in sync with 'pass::collrev/setup('symtype').
typevariable myexcluded 0 ; # Code for symbols which are excluded.
typevariable mytag 1 ; # Code for symbols which are tags.
typevariable mybranch 2 ; # Code for symbols which are branches.
typevariable myundef 3 ; # Code for symbols of unknown type.
typevariable mysymtype -array {} ; # Map from type code to label for the log.
typemethod undef {} { return $myundef }
typemethod excluded {} { return $myexcluded }
typemethod tag {} { return $mytag }
typemethod printrulestatistics {} {
log write 2 symbol "Rule usage statistics:"
set fmt %[string length $mynum]s
set all 0
|
| ︙ | ︙ | |||
244 245 246 247 248 249 250 |
typevariable mynum 0
# # ## ### ##### ######## #############
## Internal methods
method UserConfig {} {
| > | > > > > > > > > > > > > > > > > > > > > > > > | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 |
typevariable mynum 0
# # ## ### ##### ######## #############
## Internal methods
method UserConfig {} {
set project [$myproject base]
# First check if the user requested the exclusion of the
# symbol from conversion.
foreach ex $myexcludepattern {
struct::list assign $ex pp sp
if {![string match $pp $project]} continue
if {![string match $sp $myname]} continue
return $myexcluded
}
# If the symbol is not excluded further check if the user
# forces its conversion as a specific type.
foreach {ex stype} $myforcepattern {
struct::list assign $ex pp sp
if {![string match $pp $project]} continue
if {![string match $sp $myname]} continue
return $stype
}
# Nothing is forced, have the main system hand the symbol over
# to the regular heuristics.
return $myundef
}
method Unambigous {} {
# If a symbol is used unambiguously as a tag/branch, convert
# it as such.
|
| ︙ | ︙ |
Changes to tools/cvs2fossil/lib/trouble.tcl.
| ︙ | ︙ | |||
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
typemethod show {} {
foreach m $myinfo { log write 0 "" $m }
foreach m $mywarn { log write 0 warning $m }
foreach m $myfatal { log write 0 fatal $m }
return
}
typemethod abort? {} {
if {
![llength $myinfo] &&
![llength $mywarn] &&
![llength $myfatal]
} return
| > > > > > > > > | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
typemethod show {} {
foreach m $myinfo { log write 0 "" $m }
foreach m $mywarn { log write 0 warning $m }
foreach m $myfatal { log write 0 fatal $m }
return
}
typemethod ? {} {
return [expr {
[llength $myinfo] ||
[llength $mywarn] ||
[llength $myfatal]
}]
}
typemethod abort? {} {
if {
![llength $myinfo] &&
![llength $mywarn] &&
![llength $myfatal]
} return
|
| ︙ | ︙ |