Check-in [f94f7e17d1]
Not logged in
Overview

SHA1 Hash:f94f7e17d1e26febfb10ff25669077474ac18794
Date: 2008-02-02 22:59:53
User: aku
Comment:Reworked the storage of the text range a bit, split immediately (settext) and store the pieces, instead of splitting everytime a piece is needed.
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 [928c3acc91] to [5f2783ed91].

@@ -47,16 +47,18 @@
 
     # Basic pieces ________________________
 
     method hasmeta {} { return [expr {$mymetaid ne ""}] }
     method hastext {} {
-	struct::list assign $mytext s e
-	return [expr {$s <= $e}]
+	return [expr {$mytextstart <= $mytextend}]
     }
 
     method setmeta {meta} { set mymetaid $meta ; return }
-    method settext {text} { set mytext   $text ; return }
+    method settext {text} {
+	struct::list assign $text mytextstart mytextend
+	return
+    }
     method setlod  {lod}  { set mylod    $lod  ; return }
 
     method revnr {} { return $myrevnr }
     method state {} { return $mystate }
     method lod   {} { return $mylod   }
@@ -350,23 +352,21 @@
     method persist {} {
 	set fid [$myfile id]
 	set lod [$mylod id]
 	set op  $myopcode($myoperation)
 	set idb $myisondefaultbranch
-
-	struct::list assign $mytext coff end
-	set clen [expr {$end - $coff}]
+	set clen [expr {$mytextend - $mytextstart}]
 
 	lappend map @P@ [expr { ($myparent       eq "") ? "NULL" : [$myparent       id] }]
 	lappend map @C@ [expr { ($mychild        eq "") ? "NULL" : [$mychild        id] }]
 	lappend map @DP [expr { ($mydbparent     eq "") ? "NULL" : [$mydbparent     id] }]
 	lappend map @DC [expr { ($mydbchild      eq "") ? "NULL" : [$mydbchild      id] }]
 	lappend map @BP [expr { ($myparentbranch eq "") ? "NULL" : [$myparentbranch id] }]
 
 	set cmd {
-	    INSERT INTO revision ( rid,   fid,  rev,      lod, parent, child,  isdefault, dbparent, dbchild, bparent,  op,  date,    state,    mid,       coff,  clen)
-	    VALUES               ($myid, $fid, $myrevnr, $lod, @P@,    @C@,   $idb,       @DP,      @DC,     @BP    , $op, $mydate, $mystate, $mymetaid, $coff, $clen);
+	    INSERT INTO revision ( rid,   fid,  rev,      lod, parent, child,  isdefault, dbparent, dbchild, bparent,  op,  date,    state,    mid,       coff,        clen)
+	    VALUES               ($myid, $fid, $myrevnr, $lod, @P@,    @C@,   $idb,       @DP,      @DC,     @BP    , $op, $mydate, $mystate, $mymetaid, $mytextstart, $clen);
 	}
 
 	state transaction {
 	    state run [string map $map $cmd]
 
@@ -390,11 +390,11 @@
     #             mylod               - revision.lod
     #             myrevnr             - revision.rev
     #             mydate              - revision.date
     #             mystate             - revision.state
     #             mymetaid            - revision.mid
-    #             mytext              - revision.{cs,cl}
+    #             mytext{start,end}   - revision.{cs,ce}
     #             myparent            - revision.parent
     #             mychild             - revision.child
     #             myparentbranch      - revision.bparent
     #             myoperation         - revision.op
     #             myisondefaultbranch - revision.isdefault
@@ -429,11 +429,14 @@
     variable myrevnr     {} ; # Revision number of the revision.
     variable mydate      {} ; # Timestamp of the revision, seconds since epoch
     variable myorigdate  {} ; # Original unmodified timestamp.
     variable mystate     {} ; # State of the revision.
     variable myfile      {} ; # Ref to the file object the revision belongs to.
-    variable mytext      {} ; # Range of the (delta) text for this revision in the file.
+    variable mytextstart {} ; # Start of the range of the (delta) text
+			      # for this revision in the file.
+    variable mytextend   {} ; # End of the range of the (delta) text
+			      # for this revision in the file.
     variable mymetaid    {} ; # Id of the meta data group the revision
 			      # belongs to. This is later used to put
 			      # the file revisions into preliminary
 			      # changesets (aka project revisions).
 			      # This id encodes 4 pieces of data,