Overview
SHA1 Hash: | de4cff4142168685027cd1e212782c72fe097349 |
---|---|
Date: | 2007-11-22 03:21:43 |
User: | aku |
Comment: | Extended changeset class with in-memory database mapping from changeset ids to the proper object, and extended the objects with position information and associated accessors. Extended pass 8 to load the commit order computed in pass 6, this is stored in the new position slot of changesets, and an inverted index mapping from position to changeset at that position. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified tools/cvs2fossil/lib/c2f_pbreakacycle.tcl from [20494b63ab] to [5bbb149286].
@@ -44,10 +44,12 @@ ## Public API typemethod setup {} { # Define the names and structure of the persistent state of # this pass. + + state reading csorder return } typemethod load {} { # Pass manager interface. Executed to load data computed by @@ -63,10 +65,11 @@ cyclebreaker precmd [myproc BreakRetrogradeBranches] cyclebreaker savecmd [myproc SaveOrder] cyclebreaker breakcmd [myproc BreakCycle] state transaction { + LoadCommitOrder cyclebreaker run break-all [myproc Changesets] } repository printcsetstatistics return @@ -82,10 +85,27 @@ # # ## ### ##### ######## ############# ## Internal methods proc Changesets {} { project::rev all } + proc LoadCommitOrder {} { + ::variable mycset + + state transaction { + foreach {cid pos} [state run { SELECT cid, pos FROM csorder }] { + set cset [project::rev of $cid] + $cset setpos $pos + set mycset($pos) $cset + } + # Remove the order information now that we have it in + # memory, so that we can save it once more, for all + # changesets, while breaking the remaining cycles. + state run { DELETE FROM csorder } + } + return + } + # # ## ### ##### ######## ############# proc BreakRetrogradeBranches {graph} { } @@ -97,10 +117,16 @@ # # ## ### ##### ######## ############# proc BreakCycle {graph} { cyclebreaker break $graph } + + # # ## ### ##### ######## ############# + + typevariable mycset -array {} ; # Map from commit positions to the + # changeset (object ref) at that + # position. # # ## ### ##### ######## ############# ## Configuration pragma -hasinstances no ; # singleton
Modified tools/cvs2fossil/lib/c2f_prev.tcl from [04c278bb16] to [1769e1daa2].
@@ -39,14 +39,16 @@ set myproject $project set mytype $cstype set mysrcid $srcid set myrevisions $revisions + set mypos {} ; # Commit location is not known yet. # Keep track of the generated changesets and of the inverse # mapping from revisions to them. - lappend mychangesets $self + lappend mychangesets $self + set myidmap($myid) $self foreach r $revisions { set myrevmap($r) $self } return } method id {} { return $myid } @@ -53,10 +55,13 @@ method revisions {} { return $myrevisions } method data {} { return [list $myproject $mytype $mysrcid] } method bysymbol {} { return [expr {$mytype eq "sym"}] } method byrevision {} { return [expr {$mytype eq "rev"}] } + + method setpos {p} { set mypos $p ; return } + method pos {} { return $mypos } method successors {} { # NOTE / FUTURE: Possible bottleneck. set csets {} foreach {_ children} [$self nextmap] { @@ -294,10 +299,12 @@ # the cset. variable mynextmap {} ; # Dictionary mapping from the revisions # to their successors. Cache to avoid # loading this from the state more than # once. + variable mypos {} ; # Commit position of the changeset, if + # known. # # ## ### ##### ######## ############# ## Internal methods typevariable mycounter 0 ; # Id counter for csets. Last id used. @@ -590,12 +597,14 @@ # # ## ### ##### ######## ############# typevariable mychangesets {} ; # List of all known changesets. typevariable myrevmap -array {} ; # Map from revisions to their changeset. + typevariable myidmap -array {} ; # Map from changeset id to changeset. - typemethod all {} { return $mychangesets } + typemethod all {} { return $mychangesets } + typemethod of {id} { return $myidmap($id) } # # ## ### ##### ######## ############# ## Configuration pragma -hastypeinfo no ; # no type introspection