Overview
SHA1 Hash: | cfe4b269ac5ef7edf85c8b39c633d62465d874ad |
---|---|
Date: | 2007-10-17 04:37:05 |
User: | aku |
Comment: | Added detection of irrelevant trunk revisions for files added to a branch but not the trunk. Repository extended to keep inverted indices for the meta data and commit messages for retrieval of commit messages per meta data, required for the previous. fixed problem with file objects, we kept only the rcs path, and need the user visible path too. |
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 [84ab0c78a7] to [a38feddbdf].
@@ -30,20 +30,24 @@ snit::type ::vc::fossil::import::cvs::file { # # ## ### ##### ######## ############# ## Public API - constructor {path executable project} { + constructor {path usrpath executable project} { set mypath $path + set myusrpath $usrpath set myexecutable $executable set myproject $project set mytrunk [$myproject trunk] return } method path {} { return $mypath } + method usrpath {} { return $myusrpath } method project {} { return $myproject } + + delegate method commitmessageof to myproject # # ## ### ##### ######## ############# ## Methods required for the class to be a sink of the rcs parser #method begin {} {puts begin} @@ -208,10 +212,11 @@ # # ## ### ##### ######## ############# ## State variable mypath {} ; # Path of the file's rcs archive. + variable myusrpath {} ; # Path of the file as seen by users. variable myexecutable 0 ; # Boolean flag 'file executable'. variable myproject {} ; # Reference to the project object # the file belongs to. variable myrev -array {} ; # Maps revision number to the # associated revision object. @@ -686,10 +691,54 @@ } return } method RemoveIrrelevantDeletions {} { + # From cvs2fossil: + # If a file is added on a branch, then a trunk revision is + # added at the same time in the 'Dead' state. This revision + # doesn't do anything useful, so delete it. + + foreach root $myroots { + if {[$root isneeded]} continue + log write 2 file "Removing unnecessary dead revision [$root revnr]" + + # Remove as root, make its child new root after + # disconnecting it from the revision just going away. + + ldelete myroots $root + if {[$root haschild]} { + set child [$root child] + $child cutfromparent + lappend myroots $child + } + + # Remove the branches spawned by the revision to be + # deleted. If the branch has revisions they should already + # use operation 'add', no need to change that. The first + # revision on each branch becomes a new and disconnected + # root. + + foreach branch [$root branches] { + if {![$branch haschild]} continue + set first [$branch child] + $first cutfromparentbranch + $first cutfromparent + lappend myroots $first + } + $root removeallbranches + + # Tagging a dead revision doesn't do anything, so remove + # any tags that were set on it. + + $root removealltags + + # This can only happen once per file, and we might have + # just changed myroots, so break out of the loop: + break + } + return } method RemoveInitialBranchDeletions {} { } @@ -700,11 +749,10 @@ ## Configuration pragma -hastypeinfo no ; # no type introspection pragma -hasinfo no ; # no object introspection pragma -hastypemethods no ; # type is not relevant. - pragma -simpledispatch yes ; # simple fast dispatch # # ## ### ##### ######## ############# } namespace eval ::vc::fossil::import::cvs {
Modified tools/cvs2fossil/lib/c2f_frev.tcl from [89b7595516] to [49171e7a40].
@@ -50,10 +50,28 @@ method revnr {} { return $myrevnr } method state {} { return $mystate } method lod {} { return $mylod } method date {} { return $mydate } + method isneeded {} { + if {$myoperation ne "nothing"} {return 1} + if {$myrevnr ne "1.1"} {return 1} + if {![$mylod istrunk]} {return 1} + if {![llength $mybranches]} {return 1} + set firstbranch [lindex $mybranches 0] + if {![$firstbranch haschild]} {return 1} + if {$myisondefaultbranch} {return 1} + + # FIX: This message will not match if the RCS file was renamed + # manually after it was created. + + set gen "file [file tail [$myfile usrpath]] was initially added on branch [$firstbranch name]." + set log [$myfile commitmessageof $mymetaid] + + return [expr {$log ne $gen}] + } + # Basic parent/child linkage __________ method hasparent {} { return [expr {$myparent ne ""}] } method haschild {} { return [expr {$mychild ne ""}] } @@ -82,10 +100,11 @@ set myparentbranch $branch return } method parentbranch {} { return $myparentbranch } + method branches {} { return $mybranches } method addbranch {branch} { lappend mybranches $branch return } @@ -148,14 +167,29 @@ set mybranches {} set mybranchchildren {} return } + method removeallbranches {} { + foreach branch $mybranches { + $branch destroy + } + set mybranches {} + set mybranchchildren {} + return + } + # Tag linkage _________________________ method addtag {tag} { lappend mytags $tag + return + } + + method removealltags {} { + foreach tag $mytags { $tag destroy } + set mytags {} return } method movetagsto {rev} { set revlod [$rev lod]
Modified tools/cvs2fossil/lib/c2f_project.tcl from [9e2870d71c] to [69ed821c29].
@@ -58,13 +58,14 @@ method files {} { return [TheFiles] } - delegate method defauthor to myrepository - delegate method defcmessage to myrepository - delegate method trunkonly to myrepository + delegate method defauthor to myrepository + delegate method defcmessage to myrepository + delegate method trunkonly to myrepository + delegate method commitmessageof to myrepository method defmeta {bid aid cid} { return [$myrepository defmeta $myid $bid $aid $cid] } @@ -139,13 +140,13 @@ } proc EmptyFiles {fv} { upvar 1 $fv myfiles self self set res {} - foreach item [lsort -dict [array names myfiles]] { - struct::list assign $item f executable - lappend res [file %AUTO% $f $executable $self] + foreach rcs [lsort -dict [array names myfiles]] { + struct::list assign $myfiles($rcs) f executable + lappend res [file %AUTO% $rcs $f $executable $self] } return $res } # # ## ### ##### ######## #############
Modified tools/cvs2fossil/lib/c2f_repository.tcl from [7f7328b5b7] to [3ba48f18aa].
@@ -83,12 +83,13 @@ return $myauthor($a) } typemethod defcmessage {cm} { if {![info exists mycmsg($cm)]} { - set mycmsg($cm) [incr mycmsgcnt] - log write 6 repository "cmessage '$cm' = $mycmsg($cm)" + set mycmsg($cm) [set cid [incr mycmsgcnt]] + set mycmsginv($cid) $cm + log write 6 repository "cmessage '$cm' = $cid" } return $mycmsg($cm) } typemethod defsymbol {pid name} { @@ -101,14 +102,20 @@ } typemethod defmeta {pid bid aid cid} { set key [list $pid $bid $aid $cid] if {![info exists mymeta($key)]} { - set mymeta($key) [incr mymetacnt] + set mymeta($key) [set mid [incr mymetacnt]] + set mymetainv($mid) $key log write 6 repository "meta ($key) = $mymeta($key)" } return $mymeta($key) + } + + typemethod commitmessageof {metaid} { + struct::list assign $mymetainv($metaid) pid bid aid cid + return $mycmsginv($cid) } # pass I results typemethod printstatistics {} { set prlist [TheProjects] @@ -203,34 +210,35 @@ } # # ## ### ##### ######## ############# ## State - typevariable mybase {} ; # Base path to CVS repository. - typevariable myprojpaths {} ; # List of paths to all declared - # projects, relative to mybase. - typevariable myprojects {} ; # List of objects for all - # declared projects. - typevariable myauthor -array {} ; # Names of all authors found, - # maps to their ids. - typevariable myauthorcnt 0 ; # Counter for author ids. - typevariable mycmsg -array {} ; # All commit messages found, - # maps to their ids. - typevariable mycmsgcnt 0 ; # Counter for message ids. - typevariable mymeta -array {} ; # Maps all meta data tuples - # (project, branch, author, - # cmessage) to their ids. - typevariable mymetacnt 0 ; # Counter for meta ids. - typevariable mysymbol -array {} ; # Map symbols identified by - # project and name to their - # id. This information is not - # saved directly. - typevariable mysymbolcnt 0 ; # Counter for symbol ids. - - typevariable mytrunkonly 0 ; # Boolean flag. Set by option - # processing when the user - # requested a trunk-only import + typevariable mybase {} ; # Base path to CVS repository. + typevariable myprojpaths {} ; # List of paths to all declared + # projects, relative to mybase. + typevariable myprojects {} ; # List of objects for all + # declared projects. + typevariable myauthor -array {} ; # Names of all authors found, + # maps to their ids. + typevariable myauthorcnt 0 ; # Counter for author ids. + typevariable mycmsg -array {} ; # All commit messages found, + # maps to their ids. + typevariable mycmsginv -array {} ; # Inverted index, keyed by id. + typevariable mycmsgcnt 0 ; # Counter for message ids. + typevariable mymeta -array {} ; # Maps all meta data tuples + # (project, branch, author, + # cmessage) to their ids. + typevariable mymetainv -array {} ; # Inverted index, keyed by id. + typevariable mymetacnt 0 ; # Counter for meta ids. + typevariable mysymbol -array {} ; # Map symbols identified by + # project and name to their + # id. This information is not + # saved directly. + typevariable mysymbolcnt 0 ; # Counter for symbol ids. + typevariable mytrunkonly 0 ; # Boolean flag. Set by option + # processing when the user + # requested a trunk-only import # # ## ### ##### ######## ############# ## Internal methods proc .BaseLength {p} {