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.

aku 2008-02-02 22:59 trunk
Commit f94f7e17d1e26febfb10ff25669077474ac18794
--- tools/cvs2fossil/lib/c2f_frev.tcl
+++ tools/cvs2fossil/lib/c2f_frev.tcl
@@ -47,16 +47,18 @@
4747
4848
# Basic pieces ________________________
4949
5050
method hasmeta {} { return [expr {$mymetaid ne ""}] }
5151
method hastext {} {
52
- struct::list assign $mytext s e
53
- return [expr {$s <= $e}]
52
+ return [expr {$mytextstart <= $mytextend}]
5453
}
5554
5655
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
+ }
5860
method setlod {lod} { set mylod $lod ; return }
5961
6062
method revnr {} { return $myrevnr }
6163
method state {} { return $mystate }
6264
method lod {} { return $mylod }
@@ -350,23 +352,21 @@
350352
method persist {} {
351353
set fid [$myfile id]
352354
set lod [$mylod id]
353355
set op $myopcode($myoperation)
354356
set idb $myisondefaultbranch
355
-
356
- struct::list assign $mytext coff end
357
- set clen [expr {$end - $coff}]
357
+ set clen [expr {$mytextend - $mytextstart}]
358358
359359
lappend map @P@ [expr { ($myparent eq "") ? "NULL" : [$myparent id] }]
360360
lappend map @C@ [expr { ($mychild eq "") ? "NULL" : [$mychild id] }]
361361
lappend map @DP [expr { ($mydbparent eq "") ? "NULL" : [$mydbparent id] }]
362362
lappend map @DC [expr { ($mydbchild eq "") ? "NULL" : [$mydbchild id] }]
363363
lappend map @BP [expr { ($myparentbranch eq "") ? "NULL" : [$myparentbranch id] }]
364364
365365
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);
368368
}
369369
370370
state transaction {
371371
state run [string map $map $cmd]
372372
@@ -390,11 +390,11 @@
390390
# mylod - revision.lod
391391
# myrevnr - revision.rev
392392
# mydate - revision.date
393393
# mystate - revision.state
394394
# mymetaid - revision.mid
395
- # mytext - revision.{cs,cl}
395
+ # mytext{start,end} - revision.{cs,ce}
396396
# myparent - revision.parent
397397
# mychild - revision.child
398398
# myparentbranch - revision.bparent
399399
# myoperation - revision.op
400400
# myisondefaultbranch - revision.isdefault
@@ -429,11 +429,14 @@
429429
variable myrevnr {} ; # Revision number of the revision.
430430
variable mydate {} ; # Timestamp of the revision, seconds since epoch
431431
variable myorigdate {} ; # Original unmodified timestamp.
432432
variable mystate {} ; # State of the revision.
433433
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.
435438
variable mymetaid {} ; # Id of the meta data group the revision
436439
# belongs to. This is later used to put
437440
# the file revisions into preliminary
438441
# changesets (aka project revisions).
439442
# This id encodes 4 pieces of data,
440443
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button