Check-in [4866889e88]
Not logged in
Overview

SHA1 Hash:4866889e88a0324e60732d9b48b388c90ddd761f
Date: 2007-11-22 03:33:32
User: aku
Comment:Continued work on pass 8, added outline for handling of retrograde branches, extended changesets with predicate allowing us to find the branch changesets.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified tools/cvs2fossil/lib/c2f_pbreakacycle.tcl from [5bbb149286] to [a4b4de4900].

@@ -20,11 +20,13 @@
 ## Requirements
 
 package require Tcl 8.4                                   ; # Required runtime.
 package require snit                                      ; # OO system.
 package require struct::list                              ; # Higher order list operations.
+package require vc::tools::misc                           ; # Min, max.
 package require vc::tools::log                            ; # User feedback.
+package require vc::tools::trouble                        ; # Error reporting.
 package require vc::fossil::import::cvs::repository       ; # Repository management.
 package require vc::fossil::import::cvs::cyclebreaker     ; # Breaking dependency cycles.
 package require vc::fossil::import::cvs::state            ; # State storage.
 package require vc::fossil::import::cvs::project::rev     ; # Project level changesets
 
@@ -105,10 +107,43 @@
     }
 
     # # ## ### ##### ######## #############
 
     proc BreakRetrogradeBranches {graph} {
+	# We go over all branch changesets, i.e. the changesets
+	# created by the symbols which are translated as branches, and
+	# break any which are 'retrograde'. Meaning that they have
+	# incoming revision changesets which are committed after some
+	# outgoing revision changeset.
+
+	# NOTE: We might be able to use our knowledge that we are
+	# looking at all changesets to create a sql which selects all
+	# the branch changesets from the state in one go instead of
+	# having to check each changeset separately. Consider this
+	# later, get the pass working first.
+	#
+	# NOTE 2: Might we even be able to select the retrograde
+	# changesets too ?
+
+	foreach cset [$graph nodes] {
+	    if {![$cset isbranch]} continue
+	    CheckAndBreakRetrograde $graph $cset
+	}
+	return
+    }
+
+    proc CheckAndBreakRetrograde {graph cset} {
+	while {[IsRetrograde $graph $cset]} {
+	    log write 5 breakacycle "Breaking retrograde changeset <[$cset id]>"
+
+	    break
+	}
+	return
+    }
+
+    proc IsRetrograde {dg cset} {
+	return 0
     }
 
     # # ## ### ##### ######## #############
 
     proc SaveOrder {cset pos} {
@@ -143,10 +178,12 @@
 	namespace import ::vc::fossil::import::cvs::repository
 	namespace import ::vc::fossil::import::cvs::state
 	namespace eval project {
 	    namespace import ::vc::fossil::import::cvs::project::rev
 	}
+	namespace import ::vc::tools::misc::*
+	namespace import ::vc::tools::trouble
 	namespace import ::vc::tools::log
 	log register breakacycle
     }
 }
 

Modified tools/cvs2fossil/lib/c2f_prev.tcl from [1769e1daa2] to [75f13681e5].

@@ -20,10 +20,11 @@
 package require snit                                  ; # OO system.
 package require vc::tools::misc                       ; # Text formatting
 package require vc::tools::trouble                    ; # Error reporting.
 package require vc::tools::log                        ; # User feedback.
 package require vc::fossil::import::cvs::state        ; # State storage.
+package require vc::fossil::import::cvs::project::sym ; # Project level symbols
 
 # # ## ### ##### ######## ############# #####################
 ##
 
 snit::type ::vc::fossil::import::cvs::project::rev {
@@ -58,10 +59,17 @@
     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 isbranch {} {
+	return [expr {($mytype eq "sym") &&
+		      ($mybranchcode == [state one {
+			  SELECT type FROM symbol WHERE sid = $mysrcid
+		      }])}]
+    }
 
     method successors {} {
 	# NOTE / FUTURE: Possible bottleneck.
 	set csets {}
 	foreach {_ children} [$self nextmap] {
@@ -598,13 +606,19 @@
     # # ## ### ##### ######## #############
 
     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.
+    typevariable mybranchcode    {} ; # Local copy of project::sym/mybranch.
 
     typemethod all {}   { return $mychangesets }
     typemethod of  {id} { return $myidmap($id) }
+
+    typeconstructor {
+	set mybranchcode [project::sym branch]
+	return
+    }
 
     # # ## ### ##### ######## #############
     ## Configuration
 
     pragma -hastypeinfo    no  ; # no type introspection
@@ -616,10 +630,13 @@
 
 namespace eval ::vc::fossil::import::cvs::project {
     namespace export rev
     namespace eval rev {
 	namespace import ::vc::fossil::import::cvs::state
+	namespace eval project {
+	    namespace import ::vc::fossil::import::cvs::project::sym
+	}
 	namespace import ::vc::tools::misc::*
 	namespace import ::vc::tools::trouble
 	namespace import ::vc::tools::log
 	log register csets
     }