Diff
Not logged in

Differences From:

File tools/cvs2fossil/lib/c2f_wsstate.tcl part of check-in [d011e0b008] - Added classes to track the state of a workspace, and of the whole revision import. by aku on 2008-02-04 06:01:45. [view]

To:

File tools/cvs2fossil/lib/c2f_wsstate.tcl part of check-in [c9270189c2] - Added tracking of file removal in changesets. by aku on 2008-02-05 15:52:35. Also file tools/cvs2fossil/lib/c2f_wsstate.tcl part of check-in [6b78df3861] - Merge in changes from Andreas's branch. by drh on 2008-02-08 21:52:21. [view]

@@ -19,8 +19,9 @@
 
 package require Tcl 8.4                             ; # Required runtime.
 package require snit                                ; # OO system.
 package require struct::list                        ; # List assignment
+package require vc::tools::log                      ; # User feedback.
 
 # # ## ### ##### ######## ############# #####################
 ##
 
@@ -35,19 +36,23 @@
     }
 
     method name {} { return $myname }
 
-    method add {revisioninfo} {
-	# revisioninfo = list (rid path label ...) /triples
+    method add {oprevisioninfo} {
+	# oprevisioninfo = list (rid path label op ...) /quadruples
 
 	# 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]
+	# new revisions. This keeps all unchanged files. Files marked
+	# as dead are removed.
+
+	foreach {rid path label rop} $oprevisioninfo {
+	    log write 5 wss {$myop($rop) $label}
+
+	    if {$rop < 0} {
+		unset mystate($path)
+	    } else {
+		set mystate($path) [list $rid $label]
+	    }
 	}
 	return
     }
 
@@ -66,8 +71,11 @@
     }
 
     method getid {} { return $myid }
 
+    method defstate {s} { array set mystate $s ; return }
+    method getstate {}  { return [array get mystate] }
+
     # # ## ### ##### ######## #############
     ## State
 
     variable myname {}         ; # Name of the LOD the workspace is
@@ -76,8 +84,15 @@
 				 # 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.
+
+    typevariable myop -array {
+	-1 REM
+	0  ---
+	1  ADD
+	2  CHG
+    }
 
     # # ## ### ##### ######## #############
     ## Configuration
 
@@ -90,8 +105,10 @@
 
 namespace eval ::vc::fossil::import::cvs {
     namespace export wsstate
     namespace eval wsstate {
+	namespace import ::vc::tools::log
+	log register wss
     }
 }
 
 # # ## ### ##### ######## ############# #####################