Diff
Not logged in

Differences From:

File tools/cvs2fossil/lib/c2f_pinitcsets.tcl part of check-in [95af789e1f] - Oops. pass 5 is not complete. Missed the breaking of internal dependencies, this is done in this pass already. Extended pass _2_ and file revisions with code to save the branchchildren (possible dependencies), and pass 5 and changesets with the proper algorithm. From cvs2svn, works, do not truly like it, as it throws away and recomputes a lot of state after each split of a cset. Could update and reuse the state to perform all splits in one go. Will try that next, for now we have a working form in the code base. by aku on 2007-11-10 20:40:06. [view]

To:

File tools/cvs2fossil/lib/c2f_pinitcsets.tcl part of check-in [08ebab80cd] - Rewrote the algorithm for breaking internal dependencies to my liking. The complex part handling multiple splits has moved from the pass code to the changeset class itself, reusing the state computed for the first split. The state is a bit more complex to allow for its incremental update after a break has been done. Factored major pieces into separate procedures to keep the highlevel code readable. Added lots of official log output to help debugging in case of trouble. by aku on 2007-11-10 23:44:29. [view]

@@ -284,37 +284,15 @@
 	# fragments. The results are changesets which have no internal
 	# dependencies, only external ones.
 
 	log write 3 initcsets {Break internal dependencies}
-	set n 0
+	set old [llength $csets]
 
 	foreach cset $csets {
-	    # The main method for splitting does only one split, which
-	    # may not be enough. The code here iterates until no more
-	    # splits can be performed. An iterative algorithm was
-	    # chosen over a recursive one to prevent running into
-	    # stack limits.
+	    $cset breakinternaldependencies csets
+	}
 
-	    set tosplit [list $cset]
-	    set at 0
-	    while {$at < [llength $tosplit]} {
-		# Note here how we are __not__ advancing in the list
-		#      when we were able to break the current
-		#      changeset into two pieces, causing the loop to
-		#      immediately check the first of the two pieces
-		#      again for further break possibilities. The
-		#      other piece is added at the end, thus processed
-		#      later.
-		while {[[lindex $tosplit $at] breakinternaldependencies tosplit]} {}
-		incr at
-	    }
-
-	    # At last the generated fragments are added to the main
-	    # list of changesets. The first element is skipped as it
-	    # is already in the list.
-	    foreach cset [lrange $tosplit 1 end] { lappend csets $cset ; incr n }
-	}
-
+	set n [expr {[llength $csets] - $old}]
 	log write 4 initcsets "Created [nsp $n {additional revision changeset}]"
 	log write 4 initcsets Ok.
 	return
     }