Differences From:
File
tools/cvs2fossil/lib/c2f_prev.tcl
part of check-in
[24c0b662de]
- Reworked the in-memory storage of changesets in pass 5 and supporting classes, and added loading of changesets from the persistent state for when the pass is skipped.
by
aku on
2007-11-13 05:09:07.
[view]
To:
File
tools/cvs2fossil/lib/c2f_prev.tcl
part of check-in
[85bd219d0b]
- Continued work on pass 6. Completed creation of changeset graph (nodes, dependencies), started on topological iteration and breaking cycles. Basic iteration is complete, fiding a cycle ditto. Not yet done is to actually break a found cycle. Extended the changeset class with the necessary accessor methods (getting cset type, successors, time range). Note: Looking at my code it may be that my decision to save the cset order caused this pass to subsume the RevisionTopologicalSortPass of cvs2svn. Check again when I am done. Note 2: The test case (tcl repository, tcl project) had no cycles.
by
aku on
2007-11-13 07:22:35.
[view]
@@ -36,15 +36,33 @@
set mytype $cstype
set mysrcid $srcid
set myrevisions $revisions
- # Keep track of the generated changesets.
+ # Keep track of the generated changesets and of the inverse
+ # mapping from revisions to them.
lappend mychangesets $self
+ foreach r $revisions { set myrevmap($r) $self }
return
}
- method id {} { return $myid }
+ method id {} { return $myid }
+ method revisions {} { return $myrevisions }
+
method setid {id} { set myid $id ; return }
+
+ method bysymbol {} { return [expr {$mytype eq "sym"}] }
+ method byrevision {} { return [expr {$mytype eq "rev"}] }
+
+ method successors {} {
+ # NOTE / FUTURE: Possible bottleneck.
+ array set dependencies {}
+ PullSuccessorRevisions dependencies $myrevisions
+ set csets {}
+ foreach {_ child} [array get dependencies] {
+ lappend csets $myrevmap($child)
+ }
+ return [lsort -unique $csets]
+ }
method breakinternaldependencies {} {
# This method inspects the changesets for internal
# dependencies. Nothing is done if there are no
@@ -67,9 +85,9 @@
# Array of dependencies (parent -> child). This is pulled from
# the state, and limited to successors within the changeset.
array set dependencies {}
- PullInternalDependencies dependencies $myrevisions
+ PullSuccessorRevisions dependencies $myrevisions
if {![array size dependencies]} {return 0} ; # Nothing to break.
log write 6 csets ...<$myid>.......................................................
@@ -206,8 +224,17 @@
}
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
+ "]
+ }
+
# # ## ### ##### ######## #############
## State
variable myid ; # Id of the cset for the persistent state.
@@ -228,9 +255,9 @@
}] { set mycstype($name) $tid }
return
}
- proc PullInternalDependencies {dv revisions} {
+ proc PullSuccessorRevisions {dv revisions} {
upvar 1 $dv dependencies
set theset ('[join $revisions {','}]')
foreach {rid child} [state run "
@@ -292,9 +319,9 @@
#
# Note 2: start == end is not possible. It indicates a
# self-dependency due to the uniqueness of positions,
# and that is something we have ruled out already, see
- # PullInternalDependencies.
+ # PullSuccessorRevisions.
foreach {rid child} [array get dependencies] {
set dkey [list $rid $child]
set start $pos($rid)
@@ -471,9 +498,10 @@
}
# # ## ### ##### ######## #############
- typevariable mychangesets {} ; # List of all known changesets.
+ typevariable mychangesets {} ; # List of all known changesets.
+ typevariable myrevmap -array {} ; # Map from revisions to their changeset.
typemethod all {} {
return $mychangesets
}