Check-in [c9270189c2]
Not logged in
Overview

SHA1 Hash:c9270189c29457862f24fcb824400a06e3a18123
Date: 2008-02-05 15:52:35
User: aku
Comment:Added tracking of file removal in changesets.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified cvs2fossil.txt from [9547bce2db] to [3dae827157].

@@ -1,68 +1,13 @@
 
 Known problems and areas to work on
 ===================================
 
-*	Currently not properly tracking when a file is removed on some
-	branch (detectable by a 'dead' revision (optype)) during the
-	import of changesets.
-
 *	Not yet able to handle the specification of multiple projects
 	for one CVS repository. I.e. I can, for example, import all of
 	tcllib, or a single subproject of tcllib, like tklib, but not
 	multiple sub-projects in one go.
-
-*	An internal error thrown when trying to import tcllib of
-	tcllib shows that I am apparently not properly handling the
-	possibility of more than one symbol used to create a
-	vendor-branch with.
-
-	In tcllib most files (18) have 'tcllib-vendor-branch' as the
-	name of their vendor branch, done in 2000, however two files
-	use the name 'vendor' instead, they were done in 2003. Each
-	set of files corresponds a single changeset.
-
-	This causes the code importing the changesets to flip out when
-	the second changeset tries to create ':trunk:' and finds it
-	already existing (both changesets are the last trunk-changeset
-	on the vendor branch :) )
-
-	Not sure yet if I should try to abort this at the beginning,
-	i.e. CVS integrity failure, force the user to manually edit
-	the RCS archives to bring the symbol used for the vendor
-	branch into sync. Or if I should allow the import to let this
-	slide by, by simply assuming that all such second changesets
-	should not try to create the :trunk: if it exists.
-
-	---
-	Another possibility is to somehow identify such symbols and
-	rewrite the structures on my own, i.e. choose one of the
-	symbols as the canonical vendor branch V and rewrite all
-	revisions using other vendor branch symbols to use V. This
-	would have to happen somewhere in either pass CollateSymbols
-	or in pass FilterSymbols.
-
-	Thinking about it would have to happen before we even start to
-	aggregate the branch/tag/commit counts, so that all of them
-	apply to V later on, instead of spread over several symbols.
-
-	Luckily we have all the relevant information in the state
-	database, in the tables 'revision' and 'symbol'.
-
-	Thinking even more, this type of symbol rewriting, whether by
-	the importer, or directly in the rcs archives before doing the
-	import, will not address the fact that both changesets will
-	have file revisions in them which declare that they are the
-	last trunk changeset on the vendor branch, despite the second
-	changeset added about three years after the previous last
-	trunk changeset on the vendor branch.
-
-	It seems that I will have to rewrite the changeset import to
-	simply allow for this situation and force the second changeset
-	(and any further) to be non-trunk on the vendor-branch,
-	whatever I do after collecting the revision. And if I do that
-	I don't really a good reason to rewrite the symbols.
 
 *	An internal error thrown when trying to import bwidget of
 	tcllib shows that there have to be some situation I am not
 	handling correctly in the cycle-breaker and sorting passes.
 

Modified tools/cvs2fossil/lib/c2f_prev.tcl from [f526a431ee] to [a49a0c1211].

@@ -454,18 +454,18 @@
     }
 
     proc Getrevisioninfo {revisions} {
 	set theset ('[join $revisions {','}]')
 	set revisions {}
-	foreach {frid path fname revnr} [state run [subst -nocommands -nobackslashes {
-	    SELECT U.uuid, F.visible, F.name, R.rev
+	foreach {frid path fname revnr rop} [state run [subst -nocommands -nobackslashes {
+	    SELECT U.uuid, F.visible, F.name, R.rev, R.op
 	    FROM   revision R, revuuid U, file F
 	    WHERE  R.rid IN $theset  -- All specified revisions
 	    AND    U.rid = R.rid     -- get fossil uuid of revision
 	    AND    F.fid = R.fid     -- get file of revision
 	}]] {
-	    lappend revisions $frid $path $fname/$revnr
+	    lappend revisions $frid $path $fname/$revnr $rop
 	}
 	return $revisions
     }
 
     proc Getworkspace {rstate lodname project isdefault} {

Modified tools/cvs2fossil/lib/c2f_ristate.tcl from [4252f4cc12] to [9cab4d3dc8].

@@ -57,12 +57,12 @@
 		[info exists mystate($parentlod)]
 	    } {Trying to inherit from undefined lod "$parentlod"}
 
 	    set pwss $mystate($parentlod)
 
-	    $wss add   [$pwss get]
-	    $wss defid [$pwss getid]
+	    $wss defstate [$pwss getstate]
+	    $wss defid    [$pwss getid]
 	}
 
 	return $wss
     }
 

Modified tools/cvs2fossil/lib/c2f_wsstate.tcl from [d379054276] to [f84a18f068].

@@ -18,10 +18,11 @@
 ## Requirements
 
 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.
 
 # # ## ### ##### ######## ############# #####################
 ##
 
 snit::type ::vc::fossil::import::cvs::wsstate {
@@ -34,21 +35,25 @@
 	return
     }
 
     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
     }
 
     method get {} {
@@ -65,10 +70,13 @@
 	return
     }
 
     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
 				 # for.
@@ -75,10 +83,17 @@
     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.
+
+    typevariable myop -array {
+	-1 REM
+	0  ---
+	1  ADD
+	2  CHG
+    }
 
     # # ## ### ##### ######## #############
     ## Configuration
 
     pragma -hastypeinfo    no  ; # no type introspection
@@ -89,13 +104,15 @@
 }
 
 namespace eval ::vc::fossil::import::cvs {
     namespace export wsstate
     namespace eval wsstate {
+	namespace import ::vc::tools::log
+	log register wss
     }
 }
 
 # # ## ### ##### ######## ############# #####################
 ## Ready
 
 package provide vc::fossil::import::cvs::wsstate 1.0
 return