Diff
Not logged in

Differences From:

File tools/cvs2fossil/lib/c2f_fsym.tcl part of check-in [2c08006d9d] - Changed the coding of trunk symbols. Using NULL makes for difficult comparisons later when doing integrity checks. Each trunk now has a regular unique id as a symbol. Added documentation to the table definitions, about references, constraints, etc. by aku on 2007-10-25 05:13:41. [view]

To:

File tools/cvs2fossil/lib/c2f_fsym.tcl part of check-in [6f8667b03e] - Added code creating aggregate symbol statistics. This completes pass 2 (CollRev). by aku on 2007-10-31 03:44:01. [view]

@@ -46,14 +46,70 @@
 	set myid [incr myidcounter]
 	return
     }
 
-    method fid {} { return $myid }
+    method fid    {} { return $myid     }
+    method symbol {} { return $mysymbol }
 
     # Symbol acessor methods.
 
     delegate method name to mysymbol
     delegate method id   to mysymbol
+
+    # Symbol aggregation methods
+
+    delegate method countasbranch to mysymbol
+    delegate method countastag    to mysymbol
+    delegate method countacommit  to mysymbol
+
+    method blockedby {fsymbol} {
+	$mysymbol blockedby [$fsymbol symbol]
+	return
+    }
+
+    method possibleparents {} {
+	switch -exact -- $mytype {
+	    branch { $self BranchParents }
+	    tag    { $self TagParents    }
+	}
+	return
+    }
+
+    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.
+
+	$mysymbol possibleparent [[$mybranchparent lod] symbol]
+
+	foreach branch [$mybranchparent branches] {
+	    # A branch cannot be its own parent. Nor can a branch
+	    # created after this one be its parent. This means that we
+	    # can abort the loop when we have reached ourselves in the
+	    # list of branches. Here the order of file::rev.mybranches
+	    # comes into play, as created by file::rev::sortbranches.
+
+	    if {$branch eq $self} break
+	    $mysymbol possibleparent [$branch symbol]
+	}
+	return
+    }
+
+    method TagParents {} {
+	# The "obvious" parent of a tag is the branch holding the
+	# revision spawning the tag. Branches that are spawned by the
+	# same revision are also possible parents.
+
+	$mysymbol possibleparent [[$mytagrev lod] symbol]
+
+	foreach branch [$mytagrev branches] {
+	    $mysymbol possibleparent [$branch symbol]
+	}
+	return
+    }
+
+    #
 
     method istrunk {} { return 0 }
 
     # Branch acessor methods.
@@ -76,9 +132,8 @@
     method haschild    {} { return [expr {$mybranchchild ne ""}] }
     method parent      {} { return $mybranchparent }
     method child       {} { return $mybranchchild }
     method position    {} { return $mybranchposition }
-
 
     # Tag acessor methods.
 
     method tagrevnr  {}    { return $mynr }