Check-in [7ab490df24]
Not logged in
Overview

SHA1 Hash:7ab490df244230f349455bbb106e2093c99a69a0
Date: 2007-11-07 06:19:13
User: aku
Comment:Extended pass 2, save branch positions, needed for pass 4, and added optype table to have the revision opcodes available in the state as well.
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 [f165072caa] to [10659a0b86].

@@ -176,11 +176,13 @@
 	ldelete mybranchchildren $rev
 	return
     }
 
     method sortbranches {} {
-	if {![llength $mybranches]} return
+	# Pass 2: CollectRev
+
+	if {[llength $mybranches] < 2} return
 
 	# Sort the branches spawned by this revision in creation
 	# order. To help in this our file gave all branches a position
 	# id, in order of their definition by the RCS archive.
 	#
@@ -480,10 +482,11 @@
 	{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

Modified tools/cvs2fossil/lib/c2f_fsym.tcl from [605873f19e] to [31fcf57a52].

@@ -169,15 +169,10 @@
     # # ## ### ##### ######## #############
 
     method persist {} {
 	# Save the information we need after the collection pass.
 
-	# NOTE: mybranchposition is currently not saved. This can
-	# likely be figured out later from the id itself. If yes, we
-	# can also get rid of 'sortbranches' (cvs::file) and the
-	# associated information.
-
 	set fid [$myfile   id]
 	set sid [$mysymbol id]
 	set lod [$mylod    id]
 
 	switch -exact -- $mytype {
@@ -193,12 +188,12 @@
 	    branch {
 		lappend map @F@ [expr { ($mybranchchild eq "") ? "NULL" : [$mybranchchild id] }]
 
 		set rid [$mybranchparent id]
 		set cmd {
-		    INSERT INTO branch ( bid,   fid,  lod,  sid,  root, first, bra )
-		    VALUES             ($myid, $fid, $lod, $sid, $rid,  @F@,  $mynr);
+		    INSERT INTO branch ( bid,   fid,  lod,  sid,  root, first, bra,  pos              )
+		    VALUES             ($myid, $fid, $lod, $sid, $rid,  @F@,  $mynr, $mybranchposition);
 		}
 		state transaction {
 		    state run [string map $map $cmd]
 		}
 	    }

Modified tools/cvs2fossil/lib/c2f_pcollrev.tcl from [903f027831] to [ef1b5512b8].

@@ -132,40 +132,50 @@
 	    -- project). The last is encoded as single id, see table
 	    -- 'meta'. The date/time is given in seconds since the
 	    -- epoch, for easy comparison. The text content is an
 	    -- (offset,length) pair into the rcs archive.
 
-	    op    INTEGER  NOT NULL,
+	    op    INTEGER  NOT NULL  REFERENCES optype,
 	    date  INTEGER  NOT NULL,
 	    state TEXT     NOT NULL,
-	    mid   INTEGER  NOT NULL REFERENCES meta,
+	    mid   INTEGER  NOT NULL  REFERENCES meta,
 	    coff  INTEGER  NOT NULL,
 	    clen  INTEGER  NOT NULL,
 
 	    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
+	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');
+	}
 	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)
-
 	    sid  INTEGER  NOT NULL  REFERENCES symbol,   -- Symbol capturing the tag
 
 	    rev  INTEGER  NOT NULL  REFERENCES revision  -- The revision being tagged.
 	}
 
 	state writing branch {
 	    bid   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)
-
 	    sid   INTEGER  NOT NULL  REFERENCES symbol,   -- Symbol capturing the branch
 
 	    root  INTEGER  NOT NULL  REFERENCES revision, -- Revision the branch sprouts from
 	    first INTEGER            REFERENCES revision, -- First revision committed to the branch
-	    bra   TEXT     NOT NULL                       -- branch number
+	    bra   TEXT     NOT NULL,                      -- branch number
+	    pos   INTEGER  NOT NULL                       -- creation order in root.
 	}
 
 	# Project level ...
 	#	pLineOfDevelopment, pSymbol, pBranch, pTag, pTrunk
 	#
@@ -211,14 +221,14 @@
 	    plural TEXT     NOT NULL,
 	    UNIQUE (name)
 	    UNIQUE (plural)
 	}
 	state run {
-	    INSERT INTO symtype VALUES (0,'excluded');
-	    INSERT INTO symtype VALUES (1,'tag');
-	    INSERT INTO symtype VALUES (2,'branch');
-	    INSERT INTO symtype VALUES (3,'undefined');
+	    INSERT INTO symtype VALUES (0,'excluded', 'excluded');
+	    INSERT INTO symtype VALUES (1,'tag',      'tags');
+	    INSERT INTO symtype VALUES (2,'branch',   'branches');
+	    INSERT INTO symtype VALUES (3,'undefined','undefined');
 	}
 
 	state writing meta {
 	    -- Meta data of revisions. See revision.mid for the
 	    -- reference. Many revisions can share meta data. This is