Differences From:
File
tools/cvs2fossil/lib/c2f_file.tcl
part of check-in
[177a0cc55c]
- Fix setting of myimported, wrong condition.
Fix item assignment when sorting branches.
Fix parent/child linkage when setting up branch dependencies.
Completed processes on non-trunk default branch revisions.
Added skeleton code for the deletion of superfluous revisions.
by
aku on
2007-10-17 03:15:12.
[view]
To:
File
tools/cvs2fossil/lib/c2f_file.tcl
part of check-in
[b5b2d61527]
- Switched procs to methods, got rid of unwieldy and error-prone explicit import of instance variables.
by
aku on
2007-10-17 03:24:30.
[view]
@@ -113,9 +113,9 @@
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 {} {
@@ -122,13 +122,13 @@
# 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}
@@ -162,9 +162,9 @@
# 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
@@ -193,16 +193,16 @@
# 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
}
@@ -307,9 +307,9 @@
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
@@ -327,11 +327,8 @@
# 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 {
@@ -339,11 +336,9 @@
}
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
@@ -351,11 +346,9 @@
}
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)]} {
@@ -386,20 +379,14 @@
}
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"
@@ -419,11 +406,9 @@
}
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
@@ -440,54 +425,47 @@
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
@@ -512,10 +490,8 @@
# 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.
@@ -594,10 +570,9 @@
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]"
@@ -703,26 +678,23 @@
}
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