Check-in [c4003e7b93]
Not logged in
Overview

SHA1 Hash:c4003e7b9365bf8f26b8e1a1a22cf431279d6d7c
Date: 2007-12-05 02:22:52
User: aku
Comment:The handling of detached lines of development (floating branches) still had some bugs regarding the linkage to their revisions, especially the first revision on such branches. Fixed the relevant places, added early integrity checks and updated the main checks to handle the situation.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified tools/cvs2fossil/lib/c2f_file.tcl from [995eee5b4c] to [04dc95a1eb].

@@ -769,13 +769,11 @@
 
 	    foreach branch [$root branches] {
 		$branch cutbranchparent
 		if {![$branch haschild]} continue
 		set first [$branch child]
-		$first cutfromparentbranch
-		$first cutfromparent
-		$branch cutchild
+		$first cutfromparent
 		lappend myroots $first
 	    }
 	    $root removeallbranches
 
 	    # Tagging a dead revision doesn't do anything, so remove
@@ -814,12 +812,16 @@
 	    set child  [$root child]
 
 	    ldelete myroots $root
 	    lappend myroots $child
 
+	    $branch cutbranchparent
 	    $branch cutchild
 	    $child  cutfromparent
+
+	    $branch setchild        $child
+	    $child  setparentbranch $branch
 
 	    $parent removebranch        $branch
 	    $parent removechildonbranch $root
 	}
 	return
@@ -1017,13 +1019,23 @@
 	foreach root [$self LinesOfDevelopment] {
 	    if {[$root hasparentbranch]} { lappend symbols [$root parentbranch] }
 	    while {$root ne ""} {
 		lappend revisions $root
 		foreach tag    [$root tags]     { lappend symbols $tag    }
-		foreach branch [$root branches] { lappend symbols $branch }
+		foreach branch [$root branches] {
+		    integrity assert {
+			[$branch parent] eq $root
+		    } {Backreference branch to its root is missing or wrong}
+		    lappend symbols $branch
+		}
 		set lod [$root lod]
-		if {![$lod istrunk]} { lappend symbols $lod }
+		if {![$lod istrunk]} {
+		    integrity assert {
+			[$lod haschild]
+		    } {Branch is LOD symbol without revisions}
+		    lappend symbols $lod
+		}
 		set root [$root child]
 	    }
 	}
 
 	return [list [lsort -unique -dict $revisions] [lsort -unique -dict $symbols]]

Modified tools/cvs2fossil/lib/c2f_fsym.tcl from [6b46b59edb] to [b2ddfe62f2].

@@ -78,10 +78,13 @@
     method BranchParents {} {
 	# The "obvious" parent of a branch is the branch holding the
 	# revision spawning the branch. Any other branches that are
 	# rooted at the same revision and were committed earlier than
 	# the branch are also possible parents.
+
+	# Ignore this if the branch symbol is detached.
+	if {$mybranchparent eq ""} return
 
 	$mysymbol possibleparent [[$mybranchparent lod] symbol]
 
 	foreach branch [$mybranchparent branches] {
 	    # A branch cannot be its own parent. Nor can a branch

Modified tools/cvs2fossil/lib/c2f_integrity.tcl from [3028615e2a] to [565865cf88].

@@ -178,17 +178,20 @@
 		;
 	    }
 	# Find all revisions with a branch parent symbol which do not
 	# have a parent.
 	CheckRev \
-	    {Branch starting revisions have to have a parent} \
-	    {at the beginning of its branch has no parent} {
+	    {Branch starting revisions have to have a parent, if not detached} \
+	    {at the beginning of its branch has no parent, but its branch has} {
 		SELECT F.name, R.rev
-		FROM revision R, file F
+		FROM revision R, file F, branch B
 		WHERE R.fid = F.fid
 		AND   R.bparent IS NOT NULL
-		AND   R.parent IS NULL
+		AND   R.parent  IS NULL
+		AND   B.sid = R.bparent
+		AND   B.fid = R.fid
+		AND   B.root    IS NOT NULL
 		;
 	    }
 	# Find all revisions with a branch parent symbol whose parent
 	# has them as primary child.
 	CheckRev \