Fossil SCM
Reworked the storage of the text range a bit, split immediately (settext) and store the pieces, instead of splitting everytime a piece is needed.
Commit
f94f7e17d1e26febfb10ff25669077474ac18794
Parent
02d1ed6ad2ee015…
1 file changed
+13
-10
+13
-10
| --- tools/cvs2fossil/lib/c2f_frev.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_frev.tcl | ||
| @@ -47,16 +47,18 @@ | ||
| 47 | 47 | |
| 48 | 48 | # Basic pieces ________________________ |
| 49 | 49 | |
| 50 | 50 | method hasmeta {} { return [expr {$mymetaid ne ""}] } |
| 51 | 51 | method hastext {} { |
| 52 | - struct::list assign $mytext s e | |
| 53 | - return [expr {$s <= $e}] | |
| 52 | + return [expr {$mytextstart <= $mytextend}] | |
| 54 | 53 | } |
| 55 | 54 | |
| 56 | 55 | method setmeta {meta} { set mymetaid $meta ; return } |
| 57 | - method settext {text} { set mytext $text ; return } | |
| 56 | + method settext {text} { | |
| 57 | + struct::list assign $text mytextstart mytextend | |
| 58 | + return | |
| 59 | + } | |
| 58 | 60 | method setlod {lod} { set mylod $lod ; return } |
| 59 | 61 | |
| 60 | 62 | method revnr {} { return $myrevnr } |
| 61 | 63 | method state {} { return $mystate } |
| 62 | 64 | method lod {} { return $mylod } |
| @@ -350,23 +352,21 @@ | ||
| 350 | 352 | method persist {} { |
| 351 | 353 | set fid [$myfile id] |
| 352 | 354 | set lod [$mylod id] |
| 353 | 355 | set op $myopcode($myoperation) |
| 354 | 356 | set idb $myisondefaultbranch |
| 355 | - | |
| 356 | - struct::list assign $mytext coff end | |
| 357 | - set clen [expr {$end - $coff}] | |
| 357 | + set clen [expr {$mytextend - $mytextstart}] | |
| 358 | 358 | |
| 359 | 359 | lappend map @P@ [expr { ($myparent eq "") ? "NULL" : [$myparent id] }] |
| 360 | 360 | lappend map @C@ [expr { ($mychild eq "") ? "NULL" : [$mychild id] }] |
| 361 | 361 | lappend map @DP [expr { ($mydbparent eq "") ? "NULL" : [$mydbparent id] }] |
| 362 | 362 | lappend map @DC [expr { ($mydbchild eq "") ? "NULL" : [$mydbchild id] }] |
| 363 | 363 | lappend map @BP [expr { ($myparentbranch eq "") ? "NULL" : [$myparentbranch id] }] |
| 364 | 364 | |
| 365 | 365 | set cmd { |
| 366 | - INSERT INTO revision ( rid, fid, rev, lod, parent, child, isdefault, dbparent, dbchild, bparent, op, date, state, mid, coff, clen) | |
| 367 | - VALUES ($myid, $fid, $myrevnr, $lod, @P@, @C@, $idb, @DP, @DC, @BP , $op, $mydate, $mystate, $mymetaid, $coff, $clen); | |
| 366 | + INSERT INTO revision ( rid, fid, rev, lod, parent, child, isdefault, dbparent, dbchild, bparent, op, date, state, mid, coff, clen) | |
| 367 | + VALUES ($myid, $fid, $myrevnr, $lod, @P@, @C@, $idb, @DP, @DC, @BP , $op, $mydate, $mystate, $mymetaid, $mytextstart, $clen); | |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | state transaction { |
| 371 | 371 | state run [string map $map $cmd] |
| 372 | 372 | |
| @@ -390,11 +390,11 @@ | ||
| 390 | 390 | # mylod - revision.lod |
| 391 | 391 | # myrevnr - revision.rev |
| 392 | 392 | # mydate - revision.date |
| 393 | 393 | # mystate - revision.state |
| 394 | 394 | # mymetaid - revision.mid |
| 395 | - # mytext - revision.{cs,cl} | |
| 395 | + # mytext{start,end} - revision.{cs,ce} | |
| 396 | 396 | # myparent - revision.parent |
| 397 | 397 | # mychild - revision.child |
| 398 | 398 | # myparentbranch - revision.bparent |
| 399 | 399 | # myoperation - revision.op |
| 400 | 400 | # myisondefaultbranch - revision.isdefault |
| @@ -429,11 +429,14 @@ | ||
| 429 | 429 | variable myrevnr {} ; # Revision number of the revision. |
| 430 | 430 | variable mydate {} ; # Timestamp of the revision, seconds since epoch |
| 431 | 431 | variable myorigdate {} ; # Original unmodified timestamp. |
| 432 | 432 | variable mystate {} ; # State of the revision. |
| 433 | 433 | variable myfile {} ; # Ref to the file object the revision belongs to. |
| 434 | - variable mytext {} ; # Range of the (delta) text for this revision in the file. | |
| 434 | + variable mytextstart {} ; # Start of the range of the (delta) text | |
| 435 | + # for this revision in the file. | |
| 436 | + variable mytextend {} ; # End of the range of the (delta) text | |
| 437 | + # for this revision in the file. | |
| 435 | 438 | variable mymetaid {} ; # Id of the meta data group the revision |
| 436 | 439 | # belongs to. This is later used to put |
| 437 | 440 | # the file revisions into preliminary |
| 438 | 441 | # changesets (aka project revisions). |
| 439 | 442 | # This id encodes 4 pieces of data, |
| 440 | 443 |
| --- tools/cvs2fossil/lib/c2f_frev.tcl | |
| +++ tools/cvs2fossil/lib/c2f_frev.tcl | |
| @@ -47,16 +47,18 @@ | |
| 47 | |
| 48 | # Basic pieces ________________________ |
| 49 | |
| 50 | method hasmeta {} { return [expr {$mymetaid ne ""}] } |
| 51 | method hastext {} { |
| 52 | struct::list assign $mytext s e |
| 53 | return [expr {$s <= $e}] |
| 54 | } |
| 55 | |
| 56 | method setmeta {meta} { set mymetaid $meta ; return } |
| 57 | method settext {text} { set mytext $text ; return } |
| 58 | method setlod {lod} { set mylod $lod ; return } |
| 59 | |
| 60 | method revnr {} { return $myrevnr } |
| 61 | method state {} { return $mystate } |
| 62 | method lod {} { return $mylod } |
| @@ -350,23 +352,21 @@ | |
| 350 | method persist {} { |
| 351 | set fid [$myfile id] |
| 352 | set lod [$mylod id] |
| 353 | set op $myopcode($myoperation) |
| 354 | set idb $myisondefaultbranch |
| 355 | |
| 356 | struct::list assign $mytext coff end |
| 357 | set clen [expr {$end - $coff}] |
| 358 | |
| 359 | lappend map @P@ [expr { ($myparent eq "") ? "NULL" : [$myparent id] }] |
| 360 | lappend map @C@ [expr { ($mychild eq "") ? "NULL" : [$mychild id] }] |
| 361 | lappend map @DP [expr { ($mydbparent eq "") ? "NULL" : [$mydbparent id] }] |
| 362 | lappend map @DC [expr { ($mydbchild eq "") ? "NULL" : [$mydbchild id] }] |
| 363 | lappend map @BP [expr { ($myparentbranch eq "") ? "NULL" : [$myparentbranch id] }] |
| 364 | |
| 365 | set cmd { |
| 366 | INSERT INTO revision ( rid, fid, rev, lod, parent, child, isdefault, dbparent, dbchild, bparent, op, date, state, mid, coff, clen) |
| 367 | VALUES ($myid, $fid, $myrevnr, $lod, @P@, @C@, $idb, @DP, @DC, @BP , $op, $mydate, $mystate, $mymetaid, $coff, $clen); |
| 368 | } |
| 369 | |
| 370 | state transaction { |
| 371 | state run [string map $map $cmd] |
| 372 | |
| @@ -390,11 +390,11 @@ | |
| 390 | # mylod - revision.lod |
| 391 | # myrevnr - revision.rev |
| 392 | # mydate - revision.date |
| 393 | # mystate - revision.state |
| 394 | # mymetaid - revision.mid |
| 395 | # mytext - revision.{cs,cl} |
| 396 | # myparent - revision.parent |
| 397 | # mychild - revision.child |
| 398 | # myparentbranch - revision.bparent |
| 399 | # myoperation - revision.op |
| 400 | # myisondefaultbranch - revision.isdefault |
| @@ -429,11 +429,14 @@ | |
| 429 | variable myrevnr {} ; # Revision number of the revision. |
| 430 | variable mydate {} ; # Timestamp of the revision, seconds since epoch |
| 431 | variable myorigdate {} ; # Original unmodified timestamp. |
| 432 | variable mystate {} ; # State of the revision. |
| 433 | variable myfile {} ; # Ref to the file object the revision belongs to. |
| 434 | variable mytext {} ; # Range of the (delta) text for this revision in the file. |
| 435 | variable mymetaid {} ; # Id of the meta data group the revision |
| 436 | # belongs to. This is later used to put |
| 437 | # the file revisions into preliminary |
| 438 | # changesets (aka project revisions). |
| 439 | # This id encodes 4 pieces of data, |
| 440 |
| --- tools/cvs2fossil/lib/c2f_frev.tcl | |
| +++ tools/cvs2fossil/lib/c2f_frev.tcl | |
| @@ -47,16 +47,18 @@ | |
| 47 | |
| 48 | # Basic pieces ________________________ |
| 49 | |
| 50 | method hasmeta {} { return [expr {$mymetaid ne ""}] } |
| 51 | method hastext {} { |
| 52 | return [expr {$mytextstart <= $mytextend}] |
| 53 | } |
| 54 | |
| 55 | method setmeta {meta} { set mymetaid $meta ; return } |
| 56 | method settext {text} { |
| 57 | struct::list assign $text mytextstart mytextend |
| 58 | return |
| 59 | } |
| 60 | method setlod {lod} { set mylod $lod ; return } |
| 61 | |
| 62 | method revnr {} { return $myrevnr } |
| 63 | method state {} { return $mystate } |
| 64 | method lod {} { return $mylod } |
| @@ -350,23 +352,21 @@ | |
| 352 | method persist {} { |
| 353 | set fid [$myfile id] |
| 354 | set lod [$mylod id] |
| 355 | set op $myopcode($myoperation) |
| 356 | set idb $myisondefaultbranch |
| 357 | set clen [expr {$mytextend - $mytextstart}] |
| 358 | |
| 359 | lappend map @P@ [expr { ($myparent eq "") ? "NULL" : [$myparent id] }] |
| 360 | lappend map @C@ [expr { ($mychild eq "") ? "NULL" : [$mychild id] }] |
| 361 | lappend map @DP [expr { ($mydbparent eq "") ? "NULL" : [$mydbparent id] }] |
| 362 | lappend map @DC [expr { ($mydbchild eq "") ? "NULL" : [$mydbchild id] }] |
| 363 | lappend map @BP [expr { ($myparentbranch eq "") ? "NULL" : [$myparentbranch id] }] |
| 364 | |
| 365 | set cmd { |
| 366 | INSERT INTO revision ( rid, fid, rev, lod, parent, child, isdefault, dbparent, dbchild, bparent, op, date, state, mid, coff, clen) |
| 367 | VALUES ($myid, $fid, $myrevnr, $lod, @P@, @C@, $idb, @DP, @DC, @BP , $op, $mydate, $mystate, $mymetaid, $mytextstart, $clen); |
| 368 | } |
| 369 | |
| 370 | state transaction { |
| 371 | state run [string map $map $cmd] |
| 372 | |
| @@ -390,11 +390,11 @@ | |
| 390 | # mylod - revision.lod |
| 391 | # myrevnr - revision.rev |
| 392 | # mydate - revision.date |
| 393 | # mystate - revision.state |
| 394 | # mymetaid - revision.mid |
| 395 | # mytext{start,end} - revision.{cs,ce} |
| 396 | # myparent - revision.parent |
| 397 | # mychild - revision.child |
| 398 | # myparentbranch - revision.bparent |
| 399 | # myoperation - revision.op |
| 400 | # myisondefaultbranch - revision.isdefault |
| @@ -429,11 +429,14 @@ | |
| 429 | variable myrevnr {} ; # Revision number of the revision. |
| 430 | variable mydate {} ; # Timestamp of the revision, seconds since epoch |
| 431 | variable myorigdate {} ; # Original unmodified timestamp. |
| 432 | variable mystate {} ; # State of the revision. |
| 433 | variable myfile {} ; # Ref to the file object the revision belongs to. |
| 434 | variable mytextstart {} ; # Start of the range of the (delta) text |
| 435 | # for this revision in the file. |
| 436 | variable mytextend {} ; # End of the range of the (delta) text |
| 437 | # for this revision in the file. |
| 438 | variable mymetaid {} ; # Id of the meta data group the revision |
| 439 | # belongs to. This is later used to put |
| 440 | # the file revisions into preliminary |
| 441 | # changesets (aka project revisions). |
| 442 | # This id encodes 4 pieces of data, |
| 443 |