Check-in [e45f47ec4a]
Not logged in
Overview

SHA1 Hash:e45f47ec4aa0f67092c90e80b3f701b2df601ef1
Date: 2007-11-07 07:46:31
User: aku
Comment:Opcode synchronization reworked, optype table is master from which the in-memory array is loaded.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified tools/cvs2fossil/lib/c2f_frev.tcl from [10659a0b86] to [edfbe469f8].

@@ -482,17 +482,19 @@
 	{0 0} change
 	{0 1} delete
 	{1 0} add
 	{1 1} nothing
     }
-    # Keep myopcode in sync with project::collrev.optype
-    typevariable myopcode -array {
-	change   2
-	delete  -1
-	add      1
-	nothing  0
+
+    typemethod getopcodes {} {
+	foreach {id name} [state run {
+	    SELECT oid, name FROM optype;
+	}] { set myopcode($name) $id }
+	return
     }
+
+    typevariable myopcode -array {}
 
     # # ## ### ##### ######## #############
     ## Internal methods
 
     # # ## ### ##### ######## #############

Modified tools/cvs2fossil/lib/c2f_pcollrev.tcl from [ef1b5512b8] to [3d675ee00a].

@@ -21,11 +21,12 @@
 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::project::sym ; # Project level symbols
+package require vc::fossil::import::cvs::project::sym ; # Project level symbols.
+package require vc::fossil::import::cvs::file::rev    ; # File level revisions.
 package require vc::rcs::parser                       ; # Rcs archive data extraction.
 
 # # ## ### ##### ######## ############# #####################
 ## Register the pass with the management
 
@@ -144,18 +145,17 @@
 	    UNIQUE (fid, rev) -- The DTN is unique within the revision's file.
 	}
 	state writing optype {
 	    oid   INTEGER  NOT NULL  PRIMARY KEY,
 	    name  TEXT     NOT NULL,
-	    UNIQUE(text)
-	}
-	# Keep optype in sync with file::rev.myopcode
+	    UNIQUE(name)
+	}
 	state run {
-	    INSERT INTO optype VALUES (-1,'delete');
-	    INSERT INTO optype VALUES ( 0,'nothing');
-	    INSERT INTO optype VALUES ( 1,'add');
-	    INSERT INTO optype VALUES ( 2,'change');
+	    INSERT INTO optype VALUES (-1,'delete');  -- The opcode names are the
+	    INSERT INTO optype VALUES ( 0,'nothing'); -- fixed pieces, see myopstate
+	    INSERT INTO optype VALUES ( 1,'add');     -- in file::rev. myopcode is
+	    INSERT INTO optype VALUES ( 2,'change');  -- loaded from this.
 	}
 	state writing tag {
 	    tid  INTEGER  NOT NULL  PRIMARY KEY AUTOINCREMENT,
 	    fid  INTEGER  NOT NULL  REFERENCES file,     -- File the item belongs to
 	    lod  INTEGER            REFERENCES symbol,   -- Line of development (NULL => Trunk)
@@ -269,18 +269,21 @@
 	    cid  INTEGER  NOT NULL  PRIMARY KEY  AUTOINCREMENT,
 	    text TEXT     NOT NULL  UNIQUE
 	}
 
 	project::sym getsymtypes
+	file::rev    getopcodes
 	return
     }
 
     typemethod load {} {
 	state reading symbol
 	state reading symtype
-
-	project::sym getsymtypes
+	state reading optype
+
+	project::sym getsymtypes
+	file::rev    getopcodes
 	repository   loadsymbols
 	return
     }
 
     typemethod run {} {
@@ -607,10 +610,13 @@
 	namespace import ::vc::rcs::parser
 	namespace import ::vc::fossil::import::cvs::repository
 	namespace import ::vc::fossil::import::cvs::state
 	namespace eval project {
 	    namespace import ::vc::fossil::import::cvs::project::sym
+	}
+	namespace eval file {
+	    namespace import ::vc::fossil::import::cvs::file::rev
 	}
 	namespace import ::vc::tools::trouble
 	namespace import ::vc::tools::log
 	log register collrev
     }