Overview
SHA1 Hash: | e5441b908ddf48ae32e27661a93b5b9cfc3fd63b |
---|---|
Date: | 2007-10-15 00:03:30 |
User: | aku |
Comment: | Continued work on pass II, starting to post-process tags, branches, and revisions, cleaning up cvs quirks, determining higher-level aggregates ... |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified tools/cvs2fossil/lib/c2f_file.tcl from [2626e348fd] to [6a3824b872].
@@ -33,10 +33,11 @@ constructor {path executable project} { set mypath $path set myexecutable $executable set myproject $project + set mytrunk [$myproject trunk] return } method path {} { return $mypath } method project {} { return $myproject } @@ -151,18 +152,23 @@ log write 1 file "In file $mypath : Duplicate delta data for revision $revnr" log write 1 file "Ignoring the duplicate" return } - if {[rev istrunkrevnr $revnr]} { - set branchid {} - } else { - set branchid [[$self Rev2Branch $revnr] id] - } - - $rev setmeta [$myproject defmeta $branchid $myaid($revnr) $cmid] + # Determine the line of development for the revision (project + # level). This gives us the branchid too, required for the + # meta data group the revision is in. (Note: By putting both + # 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] + + $rev setmeta [$myproject defmeta [$lod id] $myaid($revnr) $cmid] $rev settext $textrange + $rev setlod $lod # If this is revision 1.1, we have to determine whether the # file seems to have been created through 'cvs add' instead of # 'cvs import'. This can be done by looking at the un- # adulterated commit message, as CVS uses a hardwired magic @@ -180,11 +186,21 @@ lappend myrevisions $rev return } - method done {} {} + 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 + + # list of roots ... first only one, later can become more. + return + } # # ## ### ##### ######## ############# ## State variable mypath {} ; # Path of the file's rcs archive. @@ -228,10 +244,12 @@ # order of definition. This also defines # their order of creation, which is the # reverse of definition. I.e. a smaller # number means 'Defined earlier', means # 'Created later'. + + variable mytrunk {} ; # Direct reference to myproject -> trunk. # # ## ### ##### ######## ############# ## Internal methods method RecordBranchCommits {branches} { @@ -336,10 +354,11 @@ $branch destroy unset mybranches($branchnr) } else { set rev $myrev($revnr) $rev addbranch $branch + $branch setparent $rev # If revisions were committed on the branch we store a # reference to the branch there, and further declare # the first child's parent to be branch's parent, and # list this child in the parent revision. @@ -379,11 +398,14 @@ $tag destroy } unset mytags($revnr) } else { set rev $myrev($revnr) - foreach tag $taglist { $rev addtag $tag } + foreach tag $taglist { + $rev addtag $tag + $tag settagrev $rev + } } } return } @@ -400,10 +422,44 @@ if {[$rev hasparent]} continue if {$myroot ne ""} { trouble internal "Multiple root revisions found" } set myroot $rev } return + } + + proc DetermineRevisionOperations {} { + upvar 1 myrevisions myrevisions + foreach rev $myrevisions { $rev determineoperation } + return + } + + proc 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]] + } + + foreach {_ taglist} [array get mytags] { + foreach tag $taglist { + $tag setlod [GetLOD [$tag tagrevnr]] + } + } + return + } + + proc GetLOD {revnr} { + if {[rev istrunkrevnr $revnr]} { + upvar 1 mytrunk mytrunk + return $mytrunk + } else { + upvar 1 self self + return [$self Rev2Branch $revnr] + } } # # ## ### ##### ######## ############# ## Configuration
Modified tools/cvs2fossil/lib/c2f_frev.tcl from [6007a4dcd0] to [00508f634d].
@@ -37,12 +37,15 @@ # Basic pieces ________________________ method hasmeta {} { return [expr {$mymetaid ne ""}] } method setmeta {meta} { set mymetaid $meta ; return } method settext {text} { set mytext $text ; return } + method setlod {lod} { set mylod $lod ; return } method revnr {} { return $myrevnr } + method state {} { return $mystate } + method lod {} { return $mylod } # Basic parent/child linkage __________ method hasparent {} { return [expr {$myparent ne ""}] } method haschild {} { return [expr {$mychild ne ""}] } @@ -112,10 +115,25 @@ lappend mybranches $branch } return } + method determineoperation {} { + # Look at the state of both this revision and its parent to + # determine the type opf operation which was performed (add, + # modify, delete, none). + # + # The important information is dead vs not-dead for both, + # giving rise to four possible types. + + set sdead [expr {$mystate eq "dead"}] + set pdead [expr {$myparent eq "" || [$myparent state] eq "dead"}] + + set myoperation $myopstate([list $pdead $sdead]) + return + } + # # ## ### ##### ######## ############# ## Type API typemethod istrunkrevnr {revnr} { return [expr {[llength [split $revnr .]] == 2}] @@ -160,20 +178,25 @@ variable mydate {} ; # Timestamp of the revision, seconds since epoch variable myorigdate {} ; # Original unmodified timestamp. variable mystate {} ; # State of the revision. variable myfile {} ; # Ref to the file object the revision belongs to. variable mytext {} ; # Range of the (delta) text for this revision in the file. - variable mymetaid {} ; # Id of the meta data group the revision # belongs to. This is later used to put # the file revisions into preliminary # changesets (aka project revisions). # This id encodes 4 pieces of data, # namely: the project and branch the # revision was committed to, the author # who did the commit, and the message # used. + variable mylod {} ; # Reference to the line-of-development + # object the revision belongs to. An + # alternative idiom would be to call it + # the branch the revision is on. This + # reference is to a project-level object + # (symbol or trunk). # Basic parent/child linkage (lines of development) variable myparent {} ; # Ref to parent revision object. Link required because of # ; # 'cvsadmin -o', which can create arbitrary gaps in the @@ -208,10 +231,24 @@ # ; # mybranches. # Tag linkage ________________________ variable mytags {} ; # List of tags (objs) associated with this revision. + + # More derived data + + variable myoperation {} ; # One of 'add', 'change', 'delete', or + # 'nothing'. Derived from our and its + # parent's state. + + # dead(self) x dead(parent) -> operation + typevariable myopstate -array { + {0 0} change + {0 1} delete + {1 0} add + {1 1} nothing + } # # ## ### ##### ######## ############# ## Internal methods # # ## ### ##### ######## #############
Modified tools/cvs2fossil/lib/c2f_fsym.tcl from [64ff544fa2] to [85589454df].
@@ -51,24 +51,47 @@ if {$mybranchchildrevnr ne ""} { trouble internal "Child already defined" } set mybranchchildrevnr $revnr return } - method setposition {n} { set mybranchposition $n } + method setposition {n} { set mybranchposition $n ; return } + method setparent {rev} { set mybranchparent $rev ; return } method branchnr {} { return $mynr } method parentrevnr {} { return $mybranchparentrevnr } method childrevnr {} { return $mybranchchildrevnr } - method haschild {} { return [expr {$mybranchchildrevnr ne ""}] } method child {} { return $mybranchchild } - - method position {} { return $mybranchposition } + method position {} { return $mybranchposition } # Tag acessor methods. - method tagrevnr {} { return $mynr } + method tagrevnr {} { return $mynr } + method settagrev {rev} {set mytagrev $rev ; return } + + # Derived information + + method lod {} { return $mylod } + + method setlod {lod} { + set mylod $lod + + # Consistency check integrated. The symbol's + # line-of-development has to be same as the + # line-of-development of its source. + + switch -exact -- $mytype { + branch { set slod [$mybranchparent lod] } + tag { set slod [$mytagrev lod] } + } + + if {$mylod ne $slod} { + trouble fatal "For [$mysymbol name]: LOD conflict with source, '[$mylod name]' vs. '[$slod name]'" + return + } + return + } # # ## ### ##### ######## ############# ## State ## Basic, all symbols _________________ @@ -76,10 +99,15 @@ variable mytype {} ; # Symbol type, 'tag', or 'branch'. variable mynr {} ; # Revision number of a 'tag', branch number # of a 'branch'. variable mysymbol {} ; # Reference to the symbol object of this # symbol at the project level. + variable mylod {} ; # Reference to the line-of-development + # object the symbol belongs to. An + # alternative idiom would be to call it the + # branch the symbol is on. This reference + # is to a project-level symbol object. ## Branch symbols _____________________ variable mybranchparentrevnr {} ; # The number of the parent # revision, derived from our @@ -95,10 +123,13 @@ variable mybranchposition {} ; # Relative id of the branch in # the file, to sort into # creation order. ## Tag symbols ________________________ + + variable mytagrev {} ; # Reference to the revision object the tag + # is on, identified by 'mynr'. # ... nothing special ... (only mynr, see basic) # # ## ### ##### ######## ############# ## Internal methods
Modified tools/cvs2fossil/lib/c2f_project.tcl from [821db50884] to [855fb163a9].
@@ -13,16 +13,17 @@ ## Project, part of a CVS repository. Multiple instances are possible. # # ## ### ##### ######## ############# ##################### ## Requirements -package require Tcl 8.4 ; # Required runtime. -package require snit ; # OO system. -package require vc::fossil::import::cvs::file ; # CVS archive file. -package require vc::fossil::import::cvs::state ; # State storage. -package require vc::fossil::import::cvs::project::sym ; # Per project symbols. -package require struct::list ; # Advanced list operations.. +package require Tcl 8.4 ; # Required runtime. +package require snit ; # OO system. +package require vc::fossil::import::cvs::file ; # CVS archive file. +package require vc::fossil::import::cvs::state ; # State storage. +package require vc::fossil::import::cvs::project::sym ; # Per project symbols. +package require vc::fossil::import::cvs::project::trunk ; # Per project trunk, main lod +package require struct::list ; # Advanced list operations.. # # ## ### ##### ######## ############# ##################### ## snit::type ::vc::fossil::import::cvs::project { @@ -30,14 +31,16 @@ ## Public API constructor {path r} { set mybase $path set myrepository $r + set mytrunk [trunk %AUTO%] return } - method base {} { return $mybase } + method base {} { return $mybase } + method trunk {} { return $mytrunk } method printbase {} { if {$mybase eq ""} {return <Repository>} return $mybase } @@ -110,16 +113,20 @@ } # # ## ### ##### ######## ############# ## State - variable mybase {} ; # Project directory + variable mybase {} ; # Project directory. variable myid {} ; # Project id in the persistent state. - variable myfiles -array {} ; # Maps rcs archive to their user files. + variable mytrunk {} ; # Reference to the main line of + # development for the project. + variable myfiles -array {} ; # Maps the rcs archive paths to + # their user-visible files. variable myfobj {} ; # File objects for the rcs archives variable myrepository {} ; # Repository the prject belongs to. - variable mysymbols -array {} ; # Map symbol names to project-level symbol objects. + variable mysymbols -array {} ; # Map symbol names to project-level + # symbol objects. # # ## ### ##### ######## ############# ## Internal methods proc TheFiles {} {
Modified tools/cvs2fossil/lib/c2f_ptrunk.tcl from [cefb81731b] to [21f2d5f77f].
@@ -26,10 +26,13 @@ ## Public API constructor {} { return } + + method name {} { return :trunk: } + method id {} { return {} } # # ## ### ##### ######## ############# ## State # # ## ### ##### ######## #############