Check-in [7c28fe1312]
Not logged in
Overview

SHA1 Hash:7c28fe1312286211e78d5b18c4cfae9edef9a200
Date: 2007-11-29 06:31:08
User: aku
Comment:Started to adapt the integrity module. Renamed Check to CheckRev, and added analoguous commands for Tags and Branches. Added placeholders for the new integrity commands, updated main changeset integrity command.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified tools/cvs2fossil/lib/c2f_integrity.tcl from [ef24788cd7] to [0fe3d374ff].

@@ -55,13 +55,13 @@
 
     typemethod changesets {} {
 	log write 4 integrity {Check database consistency}
 
 	set n 0
-	AllChangesets
 	RevisionChangesets
-	SymbolChangesets
+	TagChangesets
+	BranchChangesets
 	return
     }
 
     # # ## ### ##### ######## #############
     ## Internal methods
@@ -73,11 +73,11 @@
 	upvar 1 n n ; # Counter for the checks (we print an id before
 		      # the main label).
 
 	# Find all revisions which disagree with their line of
 	# development about the project they are owned by.
-	Check \
+	CheckRev \
 	    {Revisions and their LODs have to be in the same project} \
 	    {disagrees with its LOD about owning project} {
 		SELECT F.name, R.rev
 		FROM revision R, file F, symbol S
 		WHERE R.fid = F.fid
@@ -85,11 +85,11 @@
 		AND   F.pid != S.pid
 		;
 	    }
 	# Find all revisions which disgree with their meta data about
 	# the project they are owned by.
-	Check \
+	CheckRev \
 	    {Revisions and their meta data have to be in the same project} \
 	    {disagrees with its meta data about owning project} {
 		SELECT F.name, R.rev
 		FROM revision R, file F, meta M
 		WHERE R.fid = F.fid
@@ -97,11 +97,11 @@
 		AND   F.pid != M.pid
 		;
 	    }
 	# Find all revisions with a primary child which disagrees
 	# about the file they belong to.
-	Check \
+	CheckRev \
 	    {Revisions and their primary children have to be in the same file} \
 	    {disagrees with its primary child about the owning file} {
 		SELECT F.name, R.rev
 		FROM revision R, revision C, file F
 		WHERE R.fid = F.fid
@@ -111,11 +111,11 @@
 		;
 	    }
 
 	# Find all revisions with a branch parent symbol whose parent
 	# disagrees about the file they belong to.
-	Check \
+	CheckRev \
 	    {Revisions and their branch children have to be in the same file} \
 	    {at the beginning of its branch and its parent disagree about the owning file} {
 		SELECT F.name, R.rev
 		FROM revision R, revision P, file F
 		WHERE R.fid = F.fid
@@ -124,11 +124,11 @@
 		AND   R.fid != P.fid
 		;
 	    }
 	# Find all revisions with a non-NTDB child which disagrees
 	# about the file they belong to.
-	Check \
+	CheckRev \
 	    {Revisions and their non-NTDB children have to be in the same file} \
 	    {disagrees with its non-NTDB child about the owning file} {
 		SELECT F.name, R.rev
 		FROM revision R, revision C, file F
 		WHERE R.fid = F.fid
@@ -137,11 +137,11 @@
 		AND   C.fid != R.fid
 		;
 	    }
 	# Find all revisions which have a primary child, but the child
 	# does not have them as parent.
-	Check \
+	CheckRev \
 	    {Revisions have to be parents of their primary children} \
 	    {is not the parent of its primary child} {
 		SELECT F.name, R.rev
 		FROM revision R, revision C, file F
 		WHERE R.fid = F.fid
@@ -150,11 +150,11 @@
 		AND   C.parent != R.rid
 		;
 	    }
 	# Find all revisions which have a primrary child, but the
 	# child has a branch parent symbol making them brach starters.
-	Check \
+	CheckRev \
 	    {Primary children of revisions must not start branches} \
 	    {is parent of a primary child which is the beginning of a branch} {
 		SELECT F.name, R.rev
 		FROM revision R, revision C, file F
 		WHERE R.fid = F.fid
@@ -163,11 +163,11 @@
 		AND   C.bparent IS NOT NULL
 		;
 	    }
 	# Find all revisions without branch parent symbol which have a
 	# parent, but the parent does not have them as primary child.
-	Check \
+	CheckRev \
 	    {Revisions have to be primary children of their parents, if any} \
 	    {is not the child of its parent} {
 		SELECT F.name, R.rev
 		FROM revision R, revision P, file F
 		WHERE R.fid = F.fid
@@ -177,11 +177,11 @@
 		AND   P.child != R.rid
 		;
 	    }
 	# Find all revisions with a branch parent symbol which do not
 	# have a parent.
-	Check \
+	CheckRev \
 	    {Branch starting revisions have to have a parent} \
 	    {at the beginning of its branch has no parent} {
 		SELECT F.name, R.rev
 		FROM revision R, file F
 		WHERE R.fid = F.fid
@@ -189,11 +189,11 @@
 		AND   R.parent IS NULL
 		;
 	    }
 	# Find all revisions with a branch parent symbol whose parent
 	# has them as primary child.
-	Check \
+	CheckRev \
 	    {Branch starting revisions must not be primary children of their parents} \
 	    {at the beginning of its branch is the primary child of its parent} {
 		SELECT F.name, R.rev
 		FROM revision R, revision P, file F
 		WHERE R.fid = F.fid
@@ -203,11 +203,11 @@
 		AND   P.child = R.rid
 		;
 	    }
 	# Find all revisions with a non-NTDB child which are not on
 	# the NTDB.
-	Check \
+	CheckRev \
 	    {NTDB to trunk transition has to begin on NTDB} \
 	    {has a non-NTDB child, yet is not on the NTDB} {
 		SELECT F.name, R.rev
 		FROM revision R, file F
 		WHERE R.fid = F.fid
@@ -214,11 +214,11 @@
 		AND   R.dbchild IS NOT NULL
 		AND   NOT R.isdefault
 		;
 	    }
 	# Find all revisions with a NTDB parent which are on the NTDB.
-	Check \
+	CheckRev \
 	    {NTDB to trunk transition has to end on non-NTDB} \
 	    {has a NTDB parent, yet is on the NTDB} {
 		SELECT F.name, R.rev
 		FROM revision R, file F
 		WHERE R.fid = F.fid
@@ -226,11 +226,11 @@
 		AND   R.isdefault
 		;
 	    }
 	# Find all revisions with a child which disagrees about the
 	# line of development they belong to.
-	Check \
+	CheckRev \
 	    {Revisions and their primary children have to be in the same LOD} \
 	    {and its primary child disagree about their LOD} {
 		SELECT F.name, R.rev
 		FROM revision R, revision C, file F
 		WHERE R.fid = F.fid
@@ -239,11 +239,11 @@
 		AND   C.lod != R.lod
 		;
 	    }
 	# Find all revisions with a non-NTDB child which agrees about
 	# the line of development they belong to.
-	Check \
+	CheckRev \
 	    {NTDB and trunk revisions have to be in different LODs} \
 	    {on NTDB and its non-NTDB child wrongly agree about their LOD} {
 		SELECT F.name, R.rev
 		FROM revision R, revision C, file F
 		WHERE R.fid = F.fid
@@ -252,11 +252,11 @@
 		AND   C.lod = R.lod
 		;
 	    }
 	# Find all revisions with a branch parent symbol which is not
 	# their LOD.
-	Check \
+	CheckRev \
 	    {Branch starting revisions have to have their LOD as branch parent symbol} \
 	    {at the beginning of its branch does not have the branch symbol as its LOD} {
 		SELECT F.name, R.rev
 		FROM revision R, file F
 		WHERE R.fid = F.fid
@@ -264,11 +264,11 @@
 		AND   R.lod != R.bparent
 		;
 	    }
 	# Find all revisions with a branch parent symbol whose parent
 	# is in the same line of development.
-	Check \
+	CheckRev \
 	    {Revisions and their branch children have to be in different LODs} \
 	    {at the beginning of its branch and its parent wrongly agree about their LOD} {
 		SELECT F.name, R.rev
 		FROM revision R, revision P, file F
 		WHERE R.fid = F.fid
@@ -287,11 +287,11 @@
 	upvar 1 n n ; # Counter for the checks (we print an id before
 		      # the main label).
 
 	# Find all revisions which disgree with their meta data about
 	# the branch/line of development they belong to.
-	Check \
+	CheckRev \
 	    {Revisions and their meta data have to be in the same LOD} \
 	    {disagrees with its meta data about owning LOD} {
 		SELECT F.name, R.rev
 		FROM revision R, meta M, file F
 		WHERE R.mid = M.mid
@@ -310,11 +310,11 @@
 	upvar 1 n n ; # Counter for the checks (we print an id before
 		      # the main label).
 
 	# Find all revisions which are not used by at least one
 	# revision changeset.
-	Check \
+	CheckRev \
 	    {All revisions have to be used by least one revision changeset} \
 	    {is not used by a revision changeset} {
 		-- Unused revisions = All revisions
 		--                  - revisions used by revision changesets.
 		--
@@ -331,11 +331,11 @@
 				AND C.type = 0)                               -- changeset
 		AND   R.fid = F.fid              -- get file of unused revision
 	    }
 	# Find all revisions which are used by more than one revision
 	# changeset.
-	Check \
+	CheckRev \
 	    {All revisions have to be used by at most one revision changeset} \
 	    {is used by multiple revision changesets} {
 		-- Principle of operation: Get all revision/changeset
                 -- pairs for all revision changesets, group by
                 -- revision to aggregate the changeset, counting
@@ -451,10 +451,32 @@
 		AND   CT.tid = C.type  -- get changeset type, for labeling
 	    }
 	return
     }
 
+    proc TagChangesets {} {
+	# This code performs a number of paranoid checks of the
+	# database, searching for inconsistent changeset/revision
+	# information.
+
+	return ; # Disabled for now, bottlenecks ...
+
+	upvar 1 n n ; # Counter for the checks (we print an id before
+		      # the main label).
+    }
+
+    proc BranchChangesets {} {
+	# This code performs a number of paranoid checks of the
+	# database, searching for inconsistent changeset/revision
+	# information.
+
+	return ; # Disabled for now, bottlenecks ...
+
+	upvar 1 n n ; # Counter for the checks (we print an id before
+		      # the main label).
+    }
+
     proc SymbolChangesets {} {
 	# This code performs a number of paranoid checks of the
 	# database, searching for inconsistent changeset/revision
 	# information.
 
@@ -515,16 +537,38 @@
 	# for all known branches.
 	return
     }
 
 
-    proc Check {header label sql} {
+    proc CheckRev {header label sql} {
 	upvar 1 n n
 	set ok 1
 	foreach {fname revnr} [state run $sql] {
 	    set ok 0
 	    trouble fatal "$fname <$revnr> $label"
+	}
+	log write 5 integrity {\[[format %02d [incr n]]\] [expr {$ok ? "Ok    " : "Failed"}] ... $header}
+	return
+    }
+
+    proc CheckTag {header label sql} {
+	upvar 1 n n
+	set ok 1
+	foreach {pname sname} [state run $sql] {
+	    set ok 0
+	    trouble fatal "<$pname tag '$sname'> $label"
+	}
+	log write 5 integrity {\[[format %02d [incr n]]\] [expr {$ok ? "Ok    " : "Failed"}] ... $header}
+	return
+    }
+
+    proc CheckBranch {header label sql} {
+	upvar 1 n n
+	set ok 1
+	foreach {pname sname} [state run $sql] {
+	    set ok 0
+	    trouble fatal "<$pname branch '$sname'> $label"
 	}
 	log write 5 integrity {\[[format %02d [incr n]]\] [expr {$ok ? "Ok    " : "Failed"}] ... $header}
 	return
     }