Overview
SHA1 Hash: | 47740cc1f6e14ac2449d87a0fc28a6ef23106e18 |
---|---|
Date: | 2007-10-03 04:18:18 |
User: | aku |
Comment: | Added stub for repository management, added most of pass I, collecting archives in the repository. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified tools/cvs2fossil/lib/c2f_option.tcl from [87e6ea6315] to [08855f1e15].
@@ -16,14 +16,16 @@ ## delegation # # ## ### ##### ######## ############# ##################### ## Requirements -package require Tcl 8.4 ; # Required runtime. -package require snit ; # OO system. -package require vc::tools::trouble ; # Error reporting. -package require vc::fossil::import::cvs::pass ; # Pass management +package require Tcl 8.4 ; # Required runtime. +package require snit ; # OO system. +package require vc::tools::trouble ; # Error reporting. +package require vc::fossil::import::cvs::pass ; # Pass management +package require vc::fossil::import::cvs::pass::collar ; # Pass I. +package require vc::fossil::import::cvs::repository ; # Repository management # # ## ### ##### ######## ############# ##################### ## snit::type ::vc::fossil::import::cvs::option { @@ -31,10 +33,11 @@ ## Public API, Options. # --help, --help-passes, -h # --version # -p, --pass, --passes + # --ignore-conflicting-attics # --project # --cache (conversion status, ala config.cache) # -o, --output # --dry-run @@ -62,12 +65,15 @@ -p - --pass - --passes { pass select [Value arguments] } + --ignore-conflicting-attics { + collar ignore_conflicting_attics + } --project { - #cvs::repository addproject [Value arguments] + repository add [Value arguments] } --cache { # [Value arguments] } default { @@ -76,11 +82,11 @@ } } if {[llength $arguments] > 1} Usage if {[llength $arguments] < 1} { Usage $nocvs } - #cvs::repository setbase [lindex $arguments 0] + repository base [lindex $arguments 0] Validate return } @@ -103,10 +109,15 @@ trouble info " -p, --passes ?START?:?END? Run only the passes START through END," trouble info " inclusive." trouble info "" trouble info " Passes are specified by name." 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 "" + # --project, --cache # ... return } @@ -153,10 +164,11 @@ proc Validate {} { # Prevent in-depth validation if the options were already bad. trouble abort? + repository validate trouble abort? return } @@ -168,15 +180,20 @@ pragma -hastypedestroy no ; # immortal # # ## ### ##### ######## ############# } -namespace eval ::vc::fossil::import::cvs::option { - namespace import ::vc::tools::trouble - namespace import ::vc::fossil::import::cvs::pass +namespace eval ::vc::fossil::import::cvs { + namespace export option + namespace eval option { + namespace import ::vc::tools::trouble + namespace import ::vc::fossil::import::cvs::pass + namespace import ::vc::fossil::import::cvs::pass::collar + namespace import ::vc::fossil::import::cvs::repository + } } # # ## ### ##### ######## ############# ##################### ## Ready package provide vc::fossil::import::cvs::option 1.0 return
Modified tools/cvs2fossil/lib/c2f_pass.tcl from [2ca003bd9b] to [6e976f604b].
@@ -18,10 +18,11 @@ ## 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 struct::list ; # Portable lassign # # ## ### ##### ######## ############# ##################### ## @@ -95,12 +96,20 @@ # TODO: Timing statistics for the passes. # TODO: Artifact manager (clean after pass?. need to know skipped/defered passes ?) # TODO: # TODO: - foreach p $runlist { Call $p setup } - foreach p $runlist { Call $p run } + foreach p $runlist { + log write 0 pass "Setup $p" + Call $p setup + } + foreach p $runlist { + log write 0 pass "Begin $p" + Call $p run + log write 0 pass "Done $p" + trouble abort? + } return } # # ## ### ##### ######## ############# ## Internal methods @@ -127,11 +136,11 @@ proc Call {code args} { upvar 1 mycmd mycmd set cmd $mycmd($code) foreach a $args { lappend cmd $a } - eval $a + eval $cmd return } # # ## ### ##### ######## ############# ## Internal, state @@ -153,13 +162,17 @@ # # ## ### ##### ######## ############# } namespace eval ::vc::fossil::import::cvs { namespace export pass - namespace eval pass { namespace import ::vc::tools::trouble } + namespace eval pass { + namespace import ::vc::tools::trouble + namespace import ::vc::tools::log + log register pass + } } # # ## ### ##### ######## ############# ##################### ## Ready package provide vc::fossil::import::cvs::pass 1.0 return
Added tools/cvs2fossil/lib/c2f_pcollar.tcl version [5c566fc378]
@@ -1,1 +1,170 @@ +## -*- 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 I. This pass scans the repository to import for RCS archives, +## and sorts and filters them into the declared projects, if any +## Without declared projects the whole repository is treated as a +## single project. + +# # ## ### ##### ######## ############# ##################### +## Requirements + +package require Tcl 8.4 ; # Required runtime. +package require snit ; # OO system. +package require fileutil::traverse ; # Directory traversal. +package require fileutil ; # File & path utilities. +package require vc::tools::trouble ; # Error reporting. +package require vc::tools::log ; # User feedback. +package require vc::fossil::import::cvs::pass ; # Pass management. +package require vc::fossil::import::cvs::repository ; # Repository management. + +# # ## ### ##### ######## ############# ##################### +## Register the pass with the management + +vc::fossil::import::cvs::pass define \ + CollectAr \ + {Collect archives in repository} \ + ::vc::fossil::import::cvs::pass::collar + +# # ## ### ##### ######## ############# ##################### +## + +snit::type ::vc::fossil::import::cvs::pass::collar { + # # ## ### ##### ######## ############# + ## Public API + + typemethod setup {} { + # TODO ... artifact/cache - drop projects/files, create projects/files + } + + typemethod run {} { + foreach project [repository projects] { + set base [$project base] + log write 1 collar "Scan $base" + + set traverse [fileutil::traverse %AUTO% $base] + set n 0 + set r {} + + $traverse foreach path { + set rcs [fileutil::stripPath $base $path] + if {[IsCVSAdmin $rcs]} continue + if {![IsRCSArchive $path]} continue + + set usr [UserPath $rcs isattic] + if {[IsSuperceded $base $rcs $usr $isattic]} continue + + log write 1 collar "Found $rcs" + $project add $rcs $usr + + incr n + log progress 0 collar $n {} + } + + $traverse destroy + } + return + } + + typemethod ignore_conflicting_attics {} { + set ignore 1 + return + } + + # # ## ### ##### ######## ############# + ## Internal methods + + typevariable ignore 0 + + proc IsRCSArchive {path} { + if {![string match *,v $path]} {return 0} + if {[fileutil::test $path fr msg]} {return 1} + trouble warn $msg + return 0 + } + + proc IsCVSAdmin {rcs} { + if {![string match CVSROOT/* $rcs]} {return 0} + log write 2 collar "Ignored $rcs, administrative archive" + return 1 + } + + proc UserPath {rcs iav} { + upvar 1 $iav isattic + + # Derive the user-visible path from the rcs path. Meaning: + # Chop off the ",v" suffix, and remove a possible "Attic". + + set f [string range $rcs 0 end-2] + + if {"Attic" eq [lindex [file split $rcs] end-1]} { + + # The construction below ensures that Attic/X maps to X + # instead of ./X. Otherwise, Y/Attic/X maps to Y/X. + + set fx [file dirname [file dirname $f]] + set f [file tail $f] + if {$fx ne "."} { set f [file join $fx $f] } + + set isattic 1 + } else { + set isattic 0 + } + + return $f + } + + proc IsSuperceded {base rcs usr isattic} { + if {!$isattic} {return 0} + if {![file exists $base/$usr,v]} {return 0} + + # We have a regular archive and an Attic archive refering to + # the same user visible file. Ignore the file in the Attic. + # + # By default this is a problem causing an abort after the pass + # has completed. The user can however force us to ignore it. + # In that case the warning is still printed, but will not + # induce an abort any longer. + + if {$ignore} { + log write 2 collar "Ignored $rcs, superceded archive" + } else { + trouble warn "Ignored $rcs, superceded archive" + } + return 1 + } + + # # ## ### ##### ######## ############# + ## Configuration + + pragma -hasinstances no ; # singleton + pragma -hastypeinfo no ; # no introspection + pragma -hastypedestroy no ; # immortal + + # # ## ### ##### ######## ############# +} + +namespace eval ::vc::fossil::import::cvs::pass { + namespace export collar + namespace eval collar { + namespace import ::vc::fossil::import::cvs::repository + namespace import ::vc::tools::trouble + namespace import ::vc::tools::log + log register collar + } +} + +# # ## ### ##### ######## ############# ##################### +## Ready +package provide vc::fossil::import::cvs::pass::collar 1.0 +return
Added tools/cvs2fossil/lib/c2f_repository.tcl version [1272254724]
@@ -1,1 +1,63 @@ +## -*- 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 +# # ## ### ##### ######## ############# ##################### + +## Repository manager. Keeps projects and their files around. + +# # ## ### ##### ######## ############# ##################### +## Requirements + +package require Tcl 8.4 ; # Required runtime. +package require snit ; # OO system. + +# # ## ### ##### ######## ############# ##################### +## + +snit::type ::vc::fossil::import::cvs::repository { + # # ## ### ##### ######## ############# + ## Public API + + typemethod base {path} { + } + + typemethod add {path} { + } + + typemethod projects {} { + } + + typemethod validate {} { + } + + # # ## ### ##### ######## ############# + ## Configuration + + pragma -hasinstances no ; # singleton + pragma -hastypeinfo no ; # no introspection + pragma -hastypedestroy no ; # immortal + + # # ## ### ##### ######## ############# +} + +namespace eval ::vc::fossil::import::cvs { + namespace export repository + namespace eval repository { + #namespace import ::vc::tools::trouble + #namespace import ::vc::tools::log + #log register collar + } +} + +# # ## ### ##### ######## ############# ##################### +## Ready +package provide vc::fossil::import::cvs::repository 1.0 +return
Modified tools/cvs2fossil/lib/cvs2fossil.tcl from [5cf11cf591] to [afcd4ba6f1].
@@ -16,10 +16,21 @@ # # ## ### ##### ######## ############# ##################### ## Requirements package require Tcl 8.4 ; # Required runtime. package require snit ; # OO system + +# # ## ### ##### ######## ############# ##################### +## Passes. The order in which the import passes are loaded is +## important. It is the same order they will register, and then be run +## in. + +package require vc::fossil::import::cvs::pass::collar ; # Coll'ect AR'chives. + +# # ## ### ##### ######## ############# ##################### +## Support for passes etc. + package require vc::fossil::import::cvs::option ; # Cmd line parsing & database package require vc::fossil::import::cvs::pass ; # Pass management # # ## ### ##### ######## ############# ##################### ##
Modified tools/cvs2fossil/lib/pkgIndex.tcl from [d90ebe99e1] to [2c71099183].
@@ -1,10 +1,12 @@ # # ## ### ##### ######## ############# ##################### ## Package management. ## Index of the local packages required by cvs2fossil # # ## ### ##### ######## ############# ##################### if {![package vsatisfies [package require Tcl] 8.4]} return -package ifneeded vc::fossil::import::cvs 1.0 [list source [file join $dir cvs2fossil.tcl]] -package ifneeded vc::fossil::import::cvs::option 1.0 [list source [file join $dir c2f_option.tcl]] -package ifneeded vc::fossil::import::cvs::pass 1.0 [list source [file join $dir c2f_pass.tcl]] -package ifneeded vc::tools::trouble 1.0 [list source [file join $dir trouble.tcl]] -package ifneeded vc::tools::log 1.0 [list source [file join $dir log.tcl]] +package ifneeded vc::fossil::import::cvs 1.0 [list source [file join $dir cvs2fossil.tcl]] +package ifneeded vc::fossil::import::cvs::option 1.0 [list source [file join $dir c2f_option.tcl]] +package ifneeded vc::fossil::import::cvs::pass 1.0 [list source [file join $dir c2f_pass.tcl]] +package ifneeded vc::fossil::import::cvs::pass::collar 1.0 [list source [file join $dir c2f_pcollar.tcl]] +package ifneeded vc::fossil::import::cvs::repository 1.0 [list source [file join $dir c2f_repository.tcl]] +package ifneeded vc::tools::trouble 1.0 [list source [file join $dir trouble.tcl]] +package ifneeded vc::tools::log 1.0 [list source [file join $dir log.tcl]]