Check-in [b5b2d61527]
Not logged in
Overview

SHA1 Hash:b5b2d61527be84a9ba57f17b6de305793e3b1dd4
Date: 2007-10-17 03:24:30
User: aku
Comment:Switched procs to methods, got rid of unwieldy and error-prone explicit import of instance variables.
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 [952128b4cc] to [84ab0c78a7].

@@ -112,24 +112,24 @@
 	}
 
 	set myaid($revnr) [$myproject defauthor $author]
 	set myrev($revnr) [rev %AUTO% $revnr $date $state $self]
 
-	RecordBasicDependencies $revnr $next
+	$self RecordBasicDependencies $revnr $next
 	return
     }
 
     method defdone {} {
 	# This is all done after the revision tree has been extracted
 	# from the file, before the commit mesages and delta texts are
 	# processed.
 
-	ProcessPrimaryDependencies
-	ProcessBranchDependencies
-	SortBranches
-	ProcessTagDependencies
-	DetermineTheRootRevision
+	$self ProcessPrimaryDependencies
+	$self ProcessBranchDependencies
+	$self SortBranches
+	$self ProcessTagDependencies
+	$self DetermineTheRootRevision
 	return
     }
 
     method setdesc {d} {# ignore}
 
@@ -161,11 +161,11 @@
 	# branch/lod and project information into the group we ensure
 	# that any cross-project and cross-branch commits are
 	# separated into multiple commits, one in each of the projects
 	# and/or branches).
 
-	set lod [GetLOD $revnr]
+	set lod [$self GetLOD $revnr]
 
 	$rev setmeta [$myproject defmeta [$lod id] $myaid($revnr) $cmid]
 	$rev settext $textrange
 	$rev setlod  $lod
 
@@ -192,18 +192,18 @@
     method done {} {
 	# Complete the revisions, branches, and tags. This includes
 	# looking for a non-trunk default branch, marking its members
 	# and linking them into the trunk.
 
-	DetermineRevisionOperations
-	DetermineLinesOfDevelopment
-	HandleNonTrunkDefaultBranch
-	RemoveIrrelevantDeletions
-	RemoveInitialBranchDeletions
+	$self DetermineRevisionOperations
+	$self DetermineLinesOfDevelopment
+	$self HandleNonTrunkDefaultBranch
+	$self RemoveIrrelevantDeletions
+	$self RemoveInitialBranchDeletions
 
 	if {[$myproject trunkonly]} {
-	    ExcludeNonTrunkInformation
+	    $self ExcludeNonTrunkInformation
 	}
 	return
     }
 
     # # ## ### ##### ######## #############
@@ -306,11 +306,11 @@
 	set tag [sym %AUTO% tag $revnr [$myproject getsymbol $name]]
 	lappend mytags($revnr) $tag
 	return $tag
     }
 
-    proc RecordBasicDependencies {revnr next} {
+    method RecordBasicDependencies {revnr next} {
 	# Handle the revision dependencies. Record them for now, do
 	# nothing with them yet.
 
 	# On the trunk the 'next' field points to the previous
 	# revision, i.e. the _parent_ of the current one. Example:
@@ -326,37 +326,30 @@
 	# The dependencies needed here are the logical structure,
 	# parent/child, and not the implementation dependent delta
 	# pointers.
 
 	if {$next eq ""} return
-
-	upvar 1 mydependencies mydependencies
-
 	#                          parent -> child
 	if {[rev istrunkrevnr $revnr]} {
 	    lappend mydependencies $next $revnr
 	} else {
 	    lappend mydependencies $revnr $next
 	}
 	return
     }
 
-    proc ProcessPrimaryDependencies {} {
-	upvar 1 mydependencies mydependencies myrev myrev
-
+    method ProcessPrimaryDependencies {} {
 	foreach {parentrevnr childrevnr} $mydependencies {
 	    set parent $myrev($parentrevnr)
 	    set child  $myrev($childrevnr)
 	    $parent setchild $child
 	    $child setparent $parent
 	}
 	return
     }
 
-    proc ProcessBranchDependencies {} {
-	upvar 1 mybranches mybranches myrev myrev
-
+    method ProcessBranchDependencies {} {
 	foreach {branchnr branch} [array get mybranches] {
 	    set revnr [$branch parentrevnr]
 
 	    if {![info exists myrev($revnr)]} {
 		log write 1 file "In '$mypath': The branch '[$branch name]' references"
@@ -385,22 +378,16 @@
 	    }
 	}
 	return
     }
 
-    proc SortBranches {} {
-	upvar 1 myrev myrev
-
-	foreach {revnr rev} [array get myrev] {
-	    $rev sortbranches
-	}
+    method SortBranches {} {
+	foreach {revnr rev} [array get myrev] { $rev sortbranches }
 	return
     }
 
-    proc ProcessTagDependencies {} {
-	upvar 1 mytags mytags myrev myrev
-
+    method ProcessTagDependencies {} {
 	foreach {revnr taglist} [array get mytags] {
 	    if {![info exists myrev($revnr)]} {
 		set n [llength $taglist]
 		log write 1 file "In '$mypath': The following [nsp $n tag] reference"
 		log write 1 file "the bogus revision '$revnr' and will be ignored."
@@ -418,13 +405,11 @@
 	    }
 	}
 	return
     }
 
-    proc DetermineTheRootRevision {} {
-	upvar 1 myrev myrev myroot myroot
-
+    method DetermineTheRootRevision {} {
 	# The root is the one revision which has no parent. By
 	# checking all revisions we ensure that we can detect and
 	# report the case of multiple roots. Without that we could
 	# simply take one revision and follow the parent links to
 	# their root (sic!).
@@ -439,56 +424,49 @@
 	# severed from their parent, making them their own root.
 	set myroots [list $myroot]
 	return
     }
 
-    proc DetermineRevisionOperations {} {
-	upvar 1 myrevisions myrevisions
+    method DetermineRevisionOperations {} {
 	foreach rev $myrevisions { $rev determineoperation }
 	return
     }
 
-    proc DetermineLinesOfDevelopment {} {
+    method DetermineLinesOfDevelopment {} {
 	# For revisions this has been done already, in 'extend'. Now
 	# we do this for the branches and tags.
 
-	upvar 1 self self mybranches mybranches mytags mytags mytrunk mytrunk
-
 	foreach {_ branch} [array get mybranches] {
-	    $branch setlod [GetLOD [$branch parentrevnr]]
+	    $branch setlod [$self GetLOD [$branch parentrevnr]]
 	}
 
 	foreach {_ taglist} [array get mytags] {
 	    foreach tag $taglist {
-		$tag setlod [GetLOD [$tag tagrevnr]]
+		$tag setlod [$self GetLOD [$tag tagrevnr]]
 	    }
 	}
 	return
     }
 
-    proc GetLOD {revnr} {
-	if {[rev istrunkrevnr $revnr]} {
-	    upvar 1 mytrunk mytrunk
+    method GetLOD {revnr} {
+	if {[rev istrunkrevnr $revnr]} {
 	    return $mytrunk
 	} else {
-	    upvar 1 self self
 	    return [$self Rev2Branch $revnr]
 	}
     }
 
-    proc HandleNonTrunkDefaultBranch {} {
-	upvar 1 myprincipal myprincipal myroot myroot mybranches mybranches myimported myimported myroots myroots myrev myrev
-
-	set revlist [NonTrunkDefaultRevisions]
+    method HandleNonTrunkDefaultBranch {} {
+	set revlist [$self NonTrunkDefaultRevisions]
 	if {![llength $revlist]} return
 
-	AdjustNonTrunkDefaultBranch $revlist
-	CheckLODs
+	$self AdjustNonTrunkDefaultBranch $revlist
+	$self CheckLODs
 	return
     }
 
-    proc NonTrunkDefaultRevisions {} {
+    method NonTrunkDefaultRevisions {} {
 	# From cvs2svn the following explanation (with modifications
 	# for our algorithm):
 
 	# Determine whether there are any non-trunk default branch
 	# revisions.
@@ -511,12 +489,10 @@
 	# example, the file has vendor revisions 1.1.1.1 -> 1.1.1.96,
 	# all of which are dated before 1.2, and then it has 1.1.1.97
 	# -> 1.1.1.100 dated after 1.2.  In this case, we should
 	# record 1.1.1.96 as the last vendor revision to have been the
 	# head of the default branch.
-
-	upvar 1 myprincipal myprincipal myroot myroot mybranches mybranches myimported myimported
 
 	if {$myprincipal ne ""} {
 	    # There is still a default branch; that means that all
 	    # revisions on that branch get marked.
 
@@ -593,12 +569,11 @@
 	} else {
 	    return {}
 	}
     }
 
-    proc AdjustNonTrunkDefaultBranch {revlist} {
-	upvar 1 myroot myroot myimported myimported myroots myroots myrev myrev mybranches mybranches
+    method AdjustNonTrunkDefaultBranch {revlist} {
 	set stop [$myroot child] ;# rev '1.2'
 
 	log write 5 file "Adjusting NTDB containing [nsp [llength $revlist] revision]"
 
 	# From cvs2svn the following explanation (with modifications
@@ -702,28 +677,25 @@
 	    $last setdefaultbranchchild  $stop
 	}
 	return
     }
 
-    proc CheckLODs {} {
-	upvar 1 mybranches mybranches mytags mytags
-
-	foreach {_ branch} [array get mybranches] { $branch checklod }
-
+    method CheckLODs {} {
+	foreach {_ branch}  [array get mybranches] { $branch checklod }
 	foreach {_ taglist} [array get mytags] {
 	    foreach tag $taglist { $tag checklod }
 	}
 	return
     }
 
-    proc RemoveIrrelevantDeletions {} {
+    method RemoveIrrelevantDeletions {} {
     }
 
-    proc RemoveInitialBranchDeletions {} {
+    method RemoveInitialBranchDeletions {} {
     }
 
-    proc ExcludeNonTrunkInformation {} {
+    method ExcludeNonTrunkInformation {} {
     }
 
     # # ## ### ##### ######## #############
     ## Configuration