Overview
SHA1 Hash: | d011e0b008825cf251cd50888d9cbcbc8778b261 |
---|---|
Date: | 2008-02-04 06:01:45 |
User: | aku |
Comment: | Added classes to track the state of a workspace, and of the whole revision import. |
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_ristate.tcl version [4252f4cc12]
@@ -1,1 +1,106 @@ +## -*- tcl -*- +# # ## ### ##### ######## ############# ##################### +## Copyright (c) 2008 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 +# # ## ### ##### ######## ############# ##################### + +## Track the state of revision import. Essentially maps lines of +## developments to their workspace state. + +# # ## ### ##### ######## ############# ##################### +## Requirements + +package require Tcl 8.4 ; # Required runtime. +package require snit ; # OO system. +package require struct::list ; # List assignment +package require vc::fossil::import::cvs::wsstate ; # Workspace state +package require vc::fossil::import::cvs::integrity ; # State integrity checks. +package require vc::tools::log ; # User feedback. +package require vc::tools::trouble ; # Error reporting. + +# # ## ### ##### ######## ############# ##################### +## + +snit::type ::vc::fossil::import::cvs::ristate { + # # ## ### ##### ######## ############# + ## Public API + + constructor {} { + # Start with an empty state + return + } + + method new {lod {parentlod {}}} { + # Create the workspace state for a line of development + # (LOD). If a parent LOD is specified let the new state + # inherit the current state of the parent. + + log write 8 ristate {Open workspace state for LOD "$lod"} + + integrity assert { + ![info exists mystate($lod)] + } {Trying to override existing state for lod "$lod"} + + set wss [wsstate ${selfns}::%AUTO% $lod] + set mystate($lod) $wss + + if {$parentlod ne ""} { + log write 8 ristate {Inheriting from workspace state for LOD "$parentlod"} + + integrity assert { + [info exists mystate($parentlod)] + } {Trying to inherit from undefined lod "$parentlod"} + + set pwss $mystate($parentlod) + + $wss add [$pwss get] + $wss defid [$pwss getid] + } + + return $wss + } + + method get {lod} { return $mystate($lod) } + method has {lod} { return [info exists mystate($lod)] } + + method names {} { return [array names mystate] } + + # # ## ### ##### ######## ############# + ## State + + variable mystate -array {} ; # Map from lines of development + # (identified by name) to their + # workspace state. + + # # ## ### ##### ######## ############# + ## Configuration + + pragma -hastypeinfo no ; # no type introspection + pragma -hasinfo no ; # no object introspection + pragma -hastypemethods no ; # type is not relevant. + + # # ## ### ##### ######## ############# +} + +namespace eval ::vc::fossil::import::cvs { + namespace export ristate + namespace eval ristate { + namespace import ::vc::fossil::import::cvs::wsstate + namespace import ::vc::fossil::import::cvs::integrity + namespace import ::vc::tools::trouble + namespace import ::vc::tools::log + log register ristate + } +} + +# # ## ### ##### ######## ############# ##################### +## Ready +package provide vc::fossil::import::cvs::ristate 1.0 +return
Added tools/cvs2fossil/lib/c2f_wsstate.tcl version [d379054276]
@@ -1,1 +1,101 @@ +## -*- tcl -*- +# # ## ### ##### ######## ############# ##################### +## Copyright (c) 2008 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 +# # ## ### ##### ######## ############# ##################### + +## Track the state of a cvs workspace as changesets are committed to +## it. Nothing actually happens in the filesystem, this is completely +## virtual. + +# # ## ### ##### ######## ############# ##################### +## Requirements + +package require Tcl 8.4 ; # Required runtime. +package require snit ; # OO system. +package require struct::list ; # List assignment + +# # ## ### ##### ######## ############# ##################### +## + +snit::type ::vc::fossil::import::cvs::wsstate { + # # ## ### ##### ######## ############# + ## Public API + + constructor {lod} { + # Start with an empty state + set myname $lod + return + } + + method name {} { return $myname } + + method add {revisioninfo} { + # revisioninfo = list (rid path label ...) /triples + + # Overwrite all changed files (identified by path) with the + # new revisions. This keeps all unchanged files. + + # BUG / TODO for FIX: Have to recognize dead files, to remove + # them. We need the per-file revision optype for this. + + foreach {rid path label} $revisioninfo { + set mystate($path) [list $rid $label] + } + return + } + + method get {} { + set res {} + foreach path [lsort -dict [array names mystate]] { + struct::list assign $mystate($path) rid label + lappend res $rid $path $label + } + return $res + } + + method defid {id} { + set myid $id + return + } + + method getid {} { return $myid } + + # # ## ### ##### ######## ############# + ## State + + variable myname {} ; # Name of the LOD the workspace is + # for. + variable myid {} ; # Record id of the fossil manifest + # associated with the current state. + variable mystate -array {} ; # Map from paths to the recordid of + # the file revision behind it, and + # the associated label for logging. + + # # ## ### ##### ######## ############# + ## Configuration + + pragma -hastypeinfo no ; # no type introspection + pragma -hasinfo no ; # no object introspection + pragma -hastypemethods no ; # type is not relevant. + + # # ## ### ##### ######## ############# +} + +namespace eval ::vc::fossil::import::cvs { + namespace export wsstate + namespace eval wsstate { + } +} + +# # ## ### ##### ######## ############# ##################### +## Ready +package provide vc::fossil::import::cvs::wsstate 1.0 +return
Modified tools/cvs2fossil/lib/pkgIndex.tcl from [a73808ace1] to [8e64440f57].
@@ -31,12 +31,14 @@ package ifneeded vc::fossil::import::cvs::project::rev 1.0 [list source [file join $dir c2f_prev.tcl]] package ifneeded vc::fossil::import::cvs::project::revlink 1.0 [list source [file join $dir c2f_prevlink.tcl]] package ifneeded vc::fossil::import::cvs::project::sym 1.0 [list source [file join $dir c2f_psym.tcl]] package ifneeded vc::fossil::import::cvs::project::trunk 1.0 [list source [file join $dir c2f_ptrunk.tcl]] package ifneeded vc::fossil::import::cvs::repository 1.0 [list source [file join $dir c2f_repository.tcl]] +package ifneeded vc::fossil::import::cvs::ristate 1.0 [list source [file join $dir c2f_ristate.tcl]] package ifneeded vc::fossil::import::cvs::state 1.0 [list source [file join $dir c2f_state.tcl]] +package ifneeded vc::fossil::import::cvs::wsstate 1.0 [list source [file join $dir c2f_wsstate.tcl]] package ifneeded vc::rcs::parser 1.0 [list source [file join $dir rcsparser.tcl]] package ifneeded vc::tools::dot 1.0 [list source [file join $dir dot.tcl]] package ifneeded vc::tools::id 1.0 [list source [file join $dir id.tcl]] package ifneeded vc::tools::log 1.0 [list source [file join $dir log.tcl]] package ifneeded vc::tools::misc 1.0 [list source [file join $dir misc.tcl]] package ifneeded vc::tools::trouble 1.0 [list source [file join $dir trouble.tcl]]