Overview
SHA1 Hash: | c74fe3de3fd031f4ca45685850aa0389ef910ddf |
---|---|
Date: | 2007-11-29 06:10:18 |
User: | aku |
Comment: | Integrate the new singletons with the main class, route the relevant places to them. |
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_prev.tcl from [dd4e59c472] to [225212eea4].
@@ -37,12 +37,15 @@ set myid $theid } else { set myid [incr mycounter] } + integrity assert {[info exists mycstype($cstype)]} {Bad changeset type '$cstype'.} + set myproject $project set mytype $cstype + set mytypeobj ::vc::fossil::import::cvs::project::rev::${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 @@ -72,23 +75,17 @@ method id {} { return $myid } 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"}] } + delegate method bysymbol to mytypeobj + delegate method byrevision to mytypeobj + delegate method isbranch to mytypeobj + delegate method istag to mytypeobj method setpos {p} { set mypos $p ; return } method pos {} { return $mypos } - - method isbranch {} { - error NOT-USED - return [expr {($mytype eq "sym") && - ($mybranchcode == [state one { - SELECT type FROM symbol WHERE sid = $mysrcid - }])}] - } # result = dict (revision -> list (changeset)) method successormap {} { # NOTE / FUTURE: Possible bottleneck. array set tmp {} @@ -135,19 +132,19 @@ } # revision -> list (revision) method nextmap {} { if {[llength $mynextmap]} { return $mynextmap } - PullSuccessorRevisions tmp $myrevisions + $mytypeobj successors tmp $myrevisions set mynextmap [array get tmp] return $mynextmap } # revision -> list (revision) method premap {} { if {[llength $mypremap]} { return $mypremap } - PullPredecessorRevisions tmp $myrevisions + $mytypeobj predecessors tmp $myrevisions set mypremap [array get tmp] return $mypremap } method breakinternaldependencies {} { @@ -171,11 +168,11 @@ # Array of dependencies (parent -> child). This is pulled from # the state, and limited to successors within the changeset. array set dependencies {} - PullInternalSuccessorRevisions dependencies $myrevisions + $mytypeobj internalsuccessors dependencies $myrevisions if {![array size dependencies]} {return 0} ; # Nothing to break. log write 5 csets ...[$self str]....................................................... # We have internal dependencies to break. We now iterate over @@ -316,18 +313,11 @@ } } return } - method timerange {} { - set theset ('[join $myrevisions {','}]') - return [state run " - SELECT MIN(R.date), MAX(R.date) - FROM revision R - WHERE R.rid IN $theset - "] - } + method timerange {} { return [$mytypeobj timerange $myrevisions] } method drop {} { state transaction { state run { DELETE FROM changeset WHERE cid = $myid; @@ -381,12 +371,20 @@ variable myid {} ; # Id of the cset for the persistent # state. variable myproject {} ; # Reference of the project object the # changeset belongs to. - variable mytype {} ; # rev or sym, where the cset originated - # from. + variable mytype {} ; # What the changeset is based on + # (revisions, tags, or branches). + # Values: See mycstype. Note that we + # have to keep the names of the helper + # singletons in sync with the contents + # of state table 'cstype', and various + # other places using them hardwired. + variable mytypeobj {} ; # Reference to the container for the + # type dependent code. Derived from + # mytype. variable mysrcid {} ; # Id of the metadata or symbol the cset # is based on. variable myrevisions {} ; # List of the file level revisions in # the cset. variable mypremap {} ; # Dictionary mapping from the revisions @@ -402,11 +400,15 @@ # # ## ### ##### ######## ############# ## Internal methods typevariable mycounter 0 ; # Id counter for csets. Last id used. - typevariable mycstype -array {} ; # Map cstypes to persistent ids. + typevariable mycstype -array {} ; # Map cstypes (names) to persistent + # ids. Note that we have to keep + # the names in the table 'cstype' + # in sync with the names of the + # helper singletons. typemethod getcstypes {} { foreach {tid name} [state run { SELECT tid, name FROM cstype; }] { set mycstype($name) $tid } @@ -854,10 +856,16 @@ typemethod istag {} { return 0 } typemethod isbranch {} { return 0 } # result = list (mintime, maxtime) typemethod timerange {items} { + set theset ('[join $items {','}]') + return [state run " + SELECT MIN(R.date), MAX(R.date) + FROM revision R + WHERE R.rid IN $theset + "] } # var(dv) = dict (revision -> list (revision)) typemethod internalsuccessors {dv revisions} { }