Diff
Not logged in

Differences From:

File tools/cvs2fossil/lib/c2f_prev.tcl part of check-in [65be27aa69] - Modified the API for the construction of changesets a bit, now allowing their construction with the correct id, instead of correcting it later. Updated pass 5 to use this, and fixed bug where the id counter for changesets was left uninitialized, allowing the improper generation of duplicate ids. by aku on 2007-11-22 03:11:34. [view]

To:

File tools/cvs2fossil/lib/c2f_prev.tcl part of check-in [de4cff4142] - 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. by aku on 2007-11-22 03:21:43. [view]

@@ -40,12 +40,14 @@
 	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
     }
 
@@ -54,8 +56,11 @@
     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 {}
@@ -295,8 +300,10 @@
     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
 
@@ -591,10 +598,12 @@
     # # ## ### ##### ######## #############
 
     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