Diff
Not logged in

Differences From:

File tools/cvs2fossil/lib/c2f_pfiltersym.tcl part of check-in [8ce7ffff21] - Bugfix in FilterSym pass. Grafting branches operated on the tags table :( by aku on 2007-11-28 08:35:41. [view]

To:

File tools/cvs2fossil/lib/c2f_pfiltersym.tcl part of check-in [79c227a9c0] - Bugfix. Handle free-floating branches (their root revision was removed as unnecessary). by aku on 2007-12-01 18:36:26. [view]

@@ -319,8 +319,16 @@
 	    AND   T.rev = R.rid
 	}]
 
 	set branchestoadjust [state run {
+	    SELECT B.bid, B.fid, B.lod, B.pos, P.pid, S.name, NULL, NULL
+	    FROM branch B, preferedparent P, symbol S
+	    WHERE B.sid = P.sid
+	    AND   B.lod != P.pid
+	    AND   P.pid = S.sid
+	    AND   S.name != ':trunk:'
+	    AND   B.root IS NULL -- Accept free-floating branch
+	    UNION
 	    SELECT B.bid, B.fid, B.lod, B.pos, P.pid, S.name, R.rev, R.rid
 	    FROM branch B, preferedparent P, symbol S, revision R
 	    WHERE B.sid = P.sid
 	    AND   B.lod != P.pid
@@ -345,9 +353,8 @@
 	set mxs [format $fmt $tmax]
 
 	set n 0
 	foreach {id fid lod pid preferedname revnr rid} $tagstoadjust {
-
 	    # BOTTLE-NECK ...
 	    #
 	    # The check if the candidate (pid) is truly viable is
 	    # based finding the branch as possible parent, and done
@@ -413,9 +420,16 @@
 	    #                   FROM branch BX
 	    #                   WHERE BX.root = R.rid
 	    #                   AND   BX.pos > B.pos)
 
-	    if {![state one {
+	    # Note: rid eq "" hear means that this is a free-floating
+	    # branch, whose original root was removed as a unnecessary
+	    # dead revision (See 'file::RemoveIrrelevantDeletions').
+	    # Such a branch can be regrafted without trouble and there
+	    # is no need to look for the new parent in its
+	    # non-existent root.
+
+	    if {($rid ne "") && ![state one {
 		SELECT COUNT(*)
 		FROM branch B
 		WHERE  B.sid  = $pid
 		AND    B.root = $rid