d011e0b008 2008-02-04 aku: ## -*- tcl -*- d011e0b008 2008-02-04 aku: # # ## ### ##### ######## ############# ##################### d011e0b008 2008-02-04 aku: ## Copyright (c) 2008 Andreas Kupries. d011e0b008 2008-02-04 aku: # d011e0b008 2008-02-04 aku: # This software is licensed as described in the file LICENSE, which d011e0b008 2008-02-04 aku: # you should have received as part of this distribution. d011e0b008 2008-02-04 aku: # d011e0b008 2008-02-04 aku: # This software consists of voluntary contributions made by many d011e0b008 2008-02-04 aku: # individuals. For exact contribution history, see the revision d011e0b008 2008-02-04 aku: # history and logs, available at http://fossil-scm.hwaci.com/fossil d011e0b008 2008-02-04 aku: # # ## ### ##### ######## ############# ##################### d011e0b008 2008-02-04 aku: d011e0b008 2008-02-04 aku: ## Track the state of a cvs workspace as changesets are committed to d011e0b008 2008-02-04 aku: ## it. Nothing actually happens in the filesystem, this is completely d011e0b008 2008-02-04 aku: ## virtual. d011e0b008 2008-02-04 aku: d011e0b008 2008-02-04 aku: # # ## ### ##### ######## ############# ##################### d011e0b008 2008-02-04 aku: ## Requirements d011e0b008 2008-02-04 aku: d011e0b008 2008-02-04 aku: package require Tcl 8.4 ; # Required runtime. d011e0b008 2008-02-04 aku: package require snit ; # OO system. d011e0b008 2008-02-04 aku: package require struct::list ; # List assignment d011e0b008 2008-02-04 aku: d011e0b008 2008-02-04 aku: # # ## ### ##### ######## ############# ##################### d011e0b008 2008-02-04 aku: ## d011e0b008 2008-02-04 aku: d011e0b008 2008-02-04 aku: snit::type ::vc::fossil::import::cvs::wsstate { d011e0b008 2008-02-04 aku: # # ## ### ##### ######## ############# d011e0b008 2008-02-04 aku: ## Public API d011e0b008 2008-02-04 aku: d011e0b008 2008-02-04 aku: constructor {lod} { d011e0b008 2008-02-04 aku: # Start with an empty state d011e0b008 2008-02-04 aku: set myname $lod d011e0b008 2008-02-04 aku: return d011e0b008 2008-02-04 aku: } d011e0b008 2008-02-04 aku: d011e0b008 2008-02-04 aku: method name {} { return $myname } d011e0b008 2008-02-04 aku: d011e0b008 2008-02-04 aku: method add {revisioninfo} { d011e0b008 2008-02-04 aku: # revisioninfo = list (rid path label ...) /triples d011e0b008 2008-02-04 aku: d011e0b008 2008-02-04 aku: # Overwrite all changed files (identified by path) with the d011e0b008 2008-02-04 aku: # new revisions. This keeps all unchanged files. d011e0b008 2008-02-04 aku: d011e0b008 2008-02-04 aku: # BUG / TODO for FIX: Have to recognize dead files, to remove d011e0b008 2008-02-04 aku: # them. We need the per-file revision optype for this. d011e0b008 2008-02-04 aku: d011e0b008 2008-02-04 aku: foreach {rid path label} $revisioninfo { d011e0b008 2008-02-04 aku: set mystate($path) [list $rid $label] d011e0b008 2008-02-04 aku: } d011e0b008 2008-02-04 aku: return d011e0b008 2008-02-04 aku: } d011e0b008 2008-02-04 aku: d011e0b008 2008-02-04 aku: method get {} { d011e0b008 2008-02-04 aku: set res {} d011e0b008 2008-02-04 aku: foreach path [lsort -dict [array names mystate]] { d011e0b008 2008-02-04 aku: struct::list assign $mystate($path) rid label d011e0b008 2008-02-04 aku: lappend res $rid $path $label d011e0b008 2008-02-04 aku: } d011e0b008 2008-02-04 aku: return $res d011e0b008 2008-02-04 aku: } d011e0b008 2008-02-04 aku: d011e0b008 2008-02-04 aku: method defid {id} { d011e0b008 2008-02-04 aku: set myid $id d011e0b008 2008-02-04 aku: return d011e0b008 2008-02-04 aku: } d011e0b008 2008-02-04 aku: d011e0b008 2008-02-04 aku: method getid {} { return $myid } d011e0b008 2008-02-04 aku: d011e0b008 2008-02-04 aku: # # ## ### ##### ######## ############# d011e0b008 2008-02-04 aku: ## State d011e0b008 2008-02-04 aku: d011e0b008 2008-02-04 aku: variable myname {} ; # Name of the LOD the workspace is d011e0b008 2008-02-04 aku: # for. d011e0b008 2008-02-04 aku: variable myid {} ; # Record id of the fossil manifest d011e0b008 2008-02-04 aku: # associated with the current state. d011e0b008 2008-02-04 aku: variable mystate -array {} ; # Map from paths to the recordid of d011e0b008 2008-02-04 aku: # the file revision behind it, and d011e0b008 2008-02-04 aku: # the associated label for logging. d011e0b008 2008-02-04 aku: d011e0b008 2008-02-04 aku: # # ## ### ##### ######## ############# d011e0b008 2008-02-04 aku: ## Configuration d011e0b008 2008-02-04 aku: d011e0b008 2008-02-04 aku: pragma -hastypeinfo no ; # no type introspection d011e0b008 2008-02-04 aku: pragma -hasinfo no ; # no object introspection d011e0b008 2008-02-04 aku: pragma -hastypemethods no ; # type is not relevant. d011e0b008 2008-02-04 aku: d011e0b008 2008-02-04 aku: # # ## ### ##### ######## ############# d011e0b008 2008-02-04 aku: } d011e0b008 2008-02-04 aku: d011e0b008 2008-02-04 aku: namespace eval ::vc::fossil::import::cvs { d011e0b008 2008-02-04 aku: namespace export wsstate d011e0b008 2008-02-04 aku: namespace eval wsstate { d011e0b008 2008-02-04 aku: } d011e0b008 2008-02-04 aku: } d011e0b008 2008-02-04 aku: d011e0b008 2008-02-04 aku: # # ## ### ##### ######## ############# ##################### d011e0b008 2008-02-04 aku: ## Ready d011e0b008 2008-02-04 aku: d011e0b008 2008-02-04 aku: package provide vc::fossil::import::cvs::wsstate 1.0 d011e0b008 2008-02-04 aku: return