Diff
Not logged in

Differences From:

File tools/cvs2fossil/lib/c2f_frev.tcl part of check-in [970be48fce] - Added debug helper methods. Fixed description of symbol reference in instances. by aku on 2008-01-27 20:43:19. [view]

To:

File tools/cvs2fossil/lib/c2f_frev.tcl part of check-in [f94f7e17d1] - Reworked the storage of the text range a bit, split immediately (settext) and store the pieces, instead of splitting everytime a piece is needed. by aku on 2008-02-02 22:59:53. [view]

@@ -48,14 +48,16 @@
     # 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 }
@@ -351,11 +353,9 @@
 	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] }]
@@ -362,10 +362,10 @@
 	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]
@@ -391,9 +391,9 @@
     #             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
@@ -430,9 +430,12 @@
     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).