Overview
SHA1 Hash: | 8a93ffa9c1aac9943459f1de4b2b31f3ab532278 |
---|---|
Date: | 2007-10-06 18:43:01 |
User: | aku |
Comment: | Fleshed out pass II, added skeleton of rcs archive class, started integration of rcs parser. |
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]Added tools/cvs2fossil/lib/c2f_file.tcl version [d278cae8eb]
@@ -1,1 +1,62 @@ +## -*- 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 +# # ## ### ##### ######## ############# ##################### + +## File, part of a project, part of a CVS repository. Multiple +## instances are possible. + +# # ## ### ##### ######## ############# ##################### +## Requirements + +package require Tcl 8.4 ; # Required runtime. +package require snit ; # OO system. + +# # ## ### ##### ######## ############# ##################### +## + +snit::type ::vc::fossil::import::cvs::file { + # # ## ### ##### ######## ############# + ## Public API + + constructor {path project} { + set mypath $path + set myproject $project + return + } + + method path {} { return $mypath } + + # # ## ### ##### ######## ############# + ## State + + variable mypath {} ; # Path of rcs archive + variable myproject {} ; # Project object the file belongs to. + + # # ## ### ##### ######## ############# + ## Internal methods + + pragma -hastypeinfo no ; # no type introspection + pragma -hasinfo no ; # no object introspection + pragma -hastypemethods no ; # type is not relevant. + pragma -simpledispatch yes ; # simple fast dispatch + + # # ## ### ##### ######## ############# +} + +namespace eval ::vc::fossil::import::cvs { + namespace export file +} + +# # ## ### ##### ######## ############# ##################### +## Ready +package provide vc::fossil::import::cvs::file 1.0 +return
Modified tools/cvs2fossil/lib/c2f_pcollrev.tcl from [db77055e39] to [71d77fda76].
@@ -22,11 +22,12 @@ 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. -package require vc::fossil::import::cvs::state ; # State storage +package require vc::fossil::import::cvs::state ; # State storage. +package require vc::rcs::parser ; # Rcs archive data extraction. # # ## ### ##### ######## ############# ##################### ## Register the pass with the management vc::fossil::import::cvs::pass define \ @@ -156,10 +157,13 @@ cid INTEGER NOT NULL REFERENCES cmessage, UNIQUE (pid, bid, aid, cid) } + # Author and commit message information is fully global, + # i.e. per repository. + state writing author { aid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL UNIQUE } @@ -178,10 +182,25 @@ return } typemethod run {} { + set rbase [repository base?] + foreach project [repository projects] { + set base [file join $rbase [$project base]] + log write 1 collrev "Processing $base" + + foreach file [$project files] { + set path [$file path] + log write 2 collrev "Parsing $path" + rcs::process [file join $base $path] $file + } + } + + repository printrevstatistics + repository persistrev + log write 1 collrev "Scan completed" return } # # ## ### ##### ######## ############# @@ -198,10 +217,13 @@ } namespace eval ::vc::fossil::import::cvs::pass { namespace export collrev namespace eval collrev { + namespace eval rcs { + namespace import ::vc::rcs::parser::process + } namespace import ::vc::fossil::import::cvs::repository namespace import ::vc::fossil::import::cvs::state namespace import ::vc::tools::trouble namespace import ::vc::tools::log log register collrev
Modified tools/cvs2fossil/lib/c2f_project.tcl from [870e1c1dce] to [079a9bd314].
@@ -15,10 +15,11 @@ # # ## ### ##### ######## ############# ##################### ## Requirements package require Tcl 8.4 ; # Required runtime. package require snit ; # OO system. +package require vc::fossil::import::cvs::file ; # CVS archive file. package require vc::fossil::import::cvs::state ; # State storage # # ## ### ##### ######## ############# ##################### ## @@ -41,12 +42,21 @@ method add {rcs usr} { set myfiles($rcs) $usr return } - method files {} { - return [array names myfiles] + method filenames {} { + return [array names myfiles] + } + + method files {} { + # TODO: Loading from state + set res {} + foreach f [array names myfiles] { + lappend res [file %AUTO% $f $self] + } + return $res } method persist {} { state transaction { # Project data first. Required so that we have its id @@ -73,11 +83,11 @@ # # ## ### ##### ######## ############# ## State variable mybase {} ; # Project directory - variable myfiles -array {} ; # Maps rcss archive to their user files. + variable myfiles -array {} ; # Maps rcs archive to their user files. # # ## ### ##### ######## ############# ## Internal methods pragma -hastypeinfo no ; # no type introspection @@ -89,14 +99,15 @@ } namespace eval ::vc::fossil::import::cvs { namespace export project namespace eval project { + namespace import ::vc::fossil::import::cvs::file namespace import ::vc::fossil::import::cvs::state } } # # ## ### ##### ######## ############# ##################### ## Ready package provide vc::fossil::import::cvs::project 1.0 return
Modified tools/cvs2fossil/lib/c2f_repository.tcl from [66efb474fb] to [e7ff366ee1].
@@ -91,11 +91,11 @@ set nfmt %s } set keep {} foreach p $prlist { - set nfiles [llength [$p files]] + set nfiles [llength [$p filenames]] set line "Project [format $bfmt \"[$p printbase]\"] : [format $nfmt $nfiles] [sp $nfiles file]" if {$nfiles < 1} { append line ", dropped" } else { lappend keep $p @@ -137,11 +137,11 @@ proc .BaseLength {p} { return [string length [$p printbase]] } proc .NFileLength {p} { - return [string length [llength [$p files]]] + return [string length [llength [$p filenames]]] } proc IsRepositoryBase {path mv} { upvar 1 $mv msg mybase mybase if {![fileutil::test $mybase edr msg {CVS Repository}]} {return 0}
Modified tools/cvs2fossil/lib/pkgIndex.tcl from [96ca91f42c] to [94d4362076].
@@ -2,10 +2,11 @@ ## 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::file 1.0 [list source [file join $dir c2f_file.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::pass::collrev 1.0 [list source [file join $dir c2f_pcollrev.tcl]] package ifneeded vc::fossil::import::cvs::project 1.0 [list source [file join $dir c2f_project.tcl]]
Modified tools/cvs2fossil/lib/rcsparser.tcl from [f2a4e1c864] to [2b8758d0ac].
@@ -14,12 +14,12 @@ package require Tcl 8.4 package require fileutil ; # Tcllib (cat) package require vc::tools::log ; # User feedback namespace eval ::vc::rcs::parser { - vc::tools::log::system rcs - namespace import ::vc::tools::log::* + namespace import ::vc::tools::log + log register rcs } # ----------------------------------------------------------------------------- # API