Check-in [0af7a3c8ac]
Not logged in
Overview

SHA1 Hash:0af7a3c8acfdfce52ff74a7949db128303c3c3da
Date: 2007-11-30 06:57:19
User: aku
Comment:Easier name for self-referential changesets, loopcheck. Made conditional on option --loopcheck, default off, and avoided if the general checks on changesets report trouble. Reinstated the loop check in the cycle breaker core in simpler form, reusing the new command in the changeset class.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified tools/cvs2fossil/lib/c2f_cyclebreaker.tcl from [10b6b95ceb] to [9dfc0b4e4f].

@@ -24,10 +24,11 @@
 package require vc::tools::log                            ; # User feedback.
 package require vc::tools::trouble                        ; # Error reporting.
 package require vc::tools::misc                           ; # Text formatting.
 package require vc::fossil::import::cvs::project::rev     ; # Project level changesets
 package require vc::fossil::import::cvs::project::revlink ; # Cycle links.
+package require vc::fossil::import::cvs::integrity        ; # State integrity checks.
 
 # # ## ### ##### ######## ############# #####################
 ##
 
 snit::type ::vc::fossil::import::cvs::cyclebreaker {
@@ -197,10 +198,14 @@
 	    foreach succ [$cset successors] {
 		# Changesets may have dependencies outside of the
 		# chosen set. These are ignored
 		if {![$dg node exists $succ]} continue
 		$dg arc insert $cset $succ
+		if {$succ eq $cset} {
+		    $cset loopcheck
+		    trouble fatal "[$cset str] depends on itself"
+		}
 	    }
 	}
 
 	if {$log} {
 	    log write 3 cyclebreaker "Has [nsp [llength [$dg arcs]] dependency dependencies]"
@@ -416,10 +421,14 @@
 	    foreach succ [$cset successors] {
 		# The new changesets may have dependencies outside of
 		# the chosen set. These are ignored
 		if {![$dg node exists $succ]} continue
 		$dg arc insert $cset $succ
+		if {$succ eq $cset} {
+		    $cset loopcheck
+		    trouble fatal "[$cset str] depends on itself"
+		}
 	    }
 	}
 	foreach cset $pre {
 	    foreach succ [$cset successors] {
 		# Note that the arc may already exist in the graph. If
@@ -539,10 +548,11 @@
 
 namespace eval ::vc::fossil::import::cvs {
     namespace export cyclebreaker
     namespace eval cyclebreaker {
 	namespace eval project {
+	    namespace import ::vc::fossil::import::cvs::integrity
 	    namespace import ::vc::fossil::import::cvs::project::rev
 	    namespace import ::vc::fossil::import::cvs::project::revlink
 	}
 	namespace import ::vc::tools::misc::*
 	namespace import ::vc::tools::log

Modified tools/cvs2fossil/lib/c2f_integrity.tcl from [ea08d30250] to [59163ec67c].

@@ -58,11 +58,18 @@
 
 	set n 0
 	RevisionChangesets
 	TagChangesets
 	BranchChangesets
-	Selfreferentiality $csets
+	trouble abort? ; # Avoid expensive check if anything found before
+
+	LoopCheck $csets
+	return
+    }
+
+    typemethof loopcheckon {} {
+	set myloopcheck 1
 	return
     }
 
     # # ## ### ##### ######## #############
     ## Internal methods
@@ -736,15 +743,18 @@
 		AND    T.tid = C.type
 	    }
 	return
     }
 
-    proc Selfreferentiality {csets} {
+    proc LoopCheck {csets} {
+	variable ::myloopcheck
+	if {!$myloopcheck} return
+
 	log write 4 integrity {Checking changesets for self-references}
 
 	foreach cset $csets {
-	    if {[$cset selfreferential]} {
+	    if {[$cset loopcheck]} {
 		trouble fatal "[$cset str] depends on itself"
 	    }
 	}
 	return
     }
@@ -866,10 +876,17 @@
 	    trouble fatal "$fname <$revnr> [string map [list @ $b] $label]"
 	}
 	log write 5 integrity {\[[format %02d [incr n]]\] [expr {$ok ? "Ok    " : "Failed"}] ... $header}
 	return
     }
+
+    # # ## ### ##### ######## #############
+
+    typevariable myloopcheck 0 ; # Boolean flag. Controls whether
+				 # 'integrity changesets' looks for
+				 # changesets with loops or not.
+				 # Default is to not look for them.
 
     # # ## ### ##### ######## #############
     ## Configuration
 
     pragma -hasinstances   no ; # singleton

Modified tools/cvs2fossil/lib/c2f_option.tcl from [21dce38cba] to [b6d7645a3c].

@@ -25,10 +25,11 @@
 package require vc::tools::misc                       ; # Misc. path reformatting.
 package require vc::fossil::import::cvs::pass         ; # Pass management
 package require vc::fossil::import::cvs::pass::collar ; # Pass I.
 package require vc::fossil::import::cvs::repository   ; # Repository management
 package require vc::fossil::import::cvs::state        ; # State storage
+package require vc::fossil::import::cvs::integrity    ; # State integrity checks.
 package require vc::fossil::import::cvs::project::sym ; # Project level symbols
 package require vc::fossil::import::cvs::cyclebreaker ; # Breaking dependency cycles.
 
 # # ## ### ##### ######## ############# #####################
 ##
@@ -46,10 +47,11 @@
     # -q, --quiet
     # --state (conversion status, ala config.cache)
     # --trunk-only
     # --exclude, --force-tag, --force-branch
     # --batch
+    # --loopcheck
 
     # -o, --output
     # --dry-run
     # --symbol-transform RE:XX
 
@@ -80,10 +82,11 @@
 		--force-tag                 { project::sym forcetag    [Value arguments] }
 		--force-branch              { project::sym forcebranch [Value arguments] }
 		--batch                     { log noprogress }
 		--dots                      { cyclebreaker dotsto [Value arguments] }
 		--watch                     { cyclebreaker watch  [Value arguments] }
+		--loopcheck                 { integrity loopcheckon }
 		default {
 		    Usage $badoption$option\n$gethelp
 		}
 	    }
 	}
@@ -146,10 +149,12 @@
 	trouble info ""
 	trouble info "    --dots PATH                Write the changeset graphs before, after,"
 	trouble info "                               and during breaking the of cycles to the"
 	trouble info "                               direcotry PATH, using GraphViz's dot format"
 	trouble info ""
+	trouble info "    --loopcheck                Activate the expensive search for change-"
+	trouble info "                               with loops, i.e. depending on themselves."
 
 	# --project, --cache
 	# ...
 	return
     }
@@ -223,10 +228,11 @@
 	namespace import ::vc::fossil::import::cvs::pass
 	namespace import ::vc::fossil::import::cvs::pass::collar
 	namespace import ::vc::fossil::import::cvs::cyclebreaker
 	namespace import ::vc::fossil::import::cvs::repository
 	namespace import ::vc::fossil::import::cvs::state
+	namespace import ::vc::fossil::import::cvs::integrity
 	namespace eval project {
 	    namespace import ::vc::fossil::import::cvs::project::sym
 	}
 	namespace import ::vc::tools::trouble
 	namespace import ::vc::tools::log

Modified tools/cvs2fossil/lib/c2f_prev.tcl from [b900e0555e] to [6a7202a9dc].

@@ -363,11 +363,11 @@
 	set pos          [lsearch -exact $mychangesets $self]
 	set mychangesets [lreplace $mychangesets $pos $pos]
 	return
     }
 
-    method selfreferential {} {
+    method loopcheck {} {
 	log write 7 csets {Checking [$self str] /[llength $myitems]}
 
 	if {![struct::set contains [$self successors] $self]} {
 	    return 0
 	}
@@ -422,11 +422,11 @@
 	    set fragment [$type %AUTO% $project $cstype $cssrc \
 			      [Untag $fragmentitems $cstype]]
 	    lappend newcsets $fragment
 	    $fragment persist
 
-	    if {[$fragment selfreferential]} {
+	    if {[$fragment loopcheck]} {
 		trouble fatal "[$fragment str] depends on itself"
 	    }
 	}
 
 	trouble abort?