Fossil SCM
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.
Commit
cfe4b269ac5ef7edf85c8b39c633d62465d874ad
Parent
09af24fc7cedafa…
4 files changed
+50
-2
+34
+7
-6
+35
-27
+50
-2
| --- tools/cvs2fossil/lib/c2f_file.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_file.tcl | ||
| @@ -30,20 +30,24 @@ | ||
| 30 | 30 | |
| 31 | 31 | snit::type ::vc::fossil::import::cvs::file { |
| 32 | 32 | # # ## ### ##### ######## ############# |
| 33 | 33 | ## Public API |
| 34 | 34 | |
| 35 | - constructor {path executable project} { | |
| 35 | + constructor {path usrpath executable project} { | |
| 36 | 36 | set mypath $path |
| 37 | + set myusrpath $usrpath | |
| 37 | 38 | set myexecutable $executable |
| 38 | 39 | set myproject $project |
| 39 | 40 | set mytrunk [$myproject trunk] |
| 40 | 41 | return |
| 41 | 42 | } |
| 42 | 43 | |
| 43 | 44 | method path {} { return $mypath } |
| 45 | + method usrpath {} { return $myusrpath } | |
| 44 | 46 | method project {} { return $myproject } |
| 47 | + | |
| 48 | + delegate method commitmessageof to myproject | |
| 45 | 49 | |
| 46 | 50 | # # ## ### ##### ######## ############# |
| 47 | 51 | ## Methods required for the class to be a sink of the rcs parser |
| 48 | 52 | |
| 49 | 53 | #method begin {} {puts begin} |
| @@ -208,10 +212,11 @@ | ||
| 208 | 212 | |
| 209 | 213 | # # ## ### ##### ######## ############# |
| 210 | 214 | ## State |
| 211 | 215 | |
| 212 | 216 | variable mypath {} ; # Path of the file's rcs archive. |
| 217 | + variable myusrpath {} ; # Path of the file as seen by users. | |
| 213 | 218 | variable myexecutable 0 ; # Boolean flag 'file executable'. |
| 214 | 219 | variable myproject {} ; # Reference to the project object |
| 215 | 220 | # the file belongs to. |
| 216 | 221 | variable myrev -array {} ; # Maps revision number to the |
| 217 | 222 | # associated revision object. |
| @@ -686,10 +691,54 @@ | ||
| 686 | 691 | } |
| 687 | 692 | return |
| 688 | 693 | } |
| 689 | 694 | |
| 690 | 695 | method RemoveIrrelevantDeletions {} { |
| 696 | + # From cvs2fossil: | |
| 697 | + # If a file is added on a branch, then a trunk revision is | |
| 698 | + # added at the same time in the 'Dead' state. This revision | |
| 699 | + # doesn't do anything useful, so delete it. | |
| 700 | + | |
| 701 | + foreach root $myroots { | |
| 702 | + if {[$root isneeded]} continue | |
| 703 | + log write 2 file "Removing unnecessary dead revision [$root revnr]" | |
| 704 | + | |
| 705 | + # Remove as root, make its child new root after | |
| 706 | + # disconnecting it from the revision just going away. | |
| 707 | + | |
| 708 | + ldelete myroots $root | |
| 709 | + if {[$root haschild]} { | |
| 710 | + set child [$root child] | |
| 711 | + $child cutfromparent | |
| 712 | + lappend myroots $child | |
| 713 | + } | |
| 714 | + | |
| 715 | + # Remove the branches spawned by the revision to be | |
| 716 | + # deleted. If the branch has revisions they should already | |
| 717 | + # use operation 'add', no need to change that. The first | |
| 718 | + # revision on each branch becomes a new and disconnected | |
| 719 | + # root. | |
| 720 | + | |
| 721 | + foreach branch [$root branches] { | |
| 722 | + if {![$branch haschild]} continue | |
| 723 | + set first [$branch child] | |
| 724 | + $first cutfromparentbranch | |
| 725 | + $first cutfromparent | |
| 726 | + lappend myroots $first | |
| 727 | + } | |
| 728 | + $root removeallbranches | |
| 729 | + | |
| 730 | + # Tagging a dead revision doesn't do anything, so remove | |
| 731 | + # any tags that were set on it. | |
| 732 | + | |
| 733 | + $root removealltags | |
| 734 | + | |
| 735 | + # This can only happen once per file, and we might have | |
| 736 | + # just changed myroots, so break out of the loop: | |
| 737 | + break | |
| 738 | + } | |
| 739 | + return | |
| 691 | 740 | } |
| 692 | 741 | |
| 693 | 742 | method RemoveInitialBranchDeletions {} { |
| 694 | 743 | } |
| 695 | 744 | |
| @@ -700,11 +749,10 @@ | ||
| 700 | 749 | ## Configuration |
| 701 | 750 | |
| 702 | 751 | pragma -hastypeinfo no ; # no type introspection |
| 703 | 752 | pragma -hasinfo no ; # no object introspection |
| 704 | 753 | pragma -hastypemethods no ; # type is not relevant. |
| 705 | - pragma -simpledispatch yes ; # simple fast dispatch | |
| 706 | 754 | |
| 707 | 755 | # # ## ### ##### ######## ############# |
| 708 | 756 | } |
| 709 | 757 | |
| 710 | 758 | namespace eval ::vc::fossil::import::cvs { |
| 711 | 759 |
| --- tools/cvs2fossil/lib/c2f_file.tcl | |
| +++ tools/cvs2fossil/lib/c2f_file.tcl | |
| @@ -30,20 +30,24 @@ | |
| 30 | |
| 31 | snit::type ::vc::fossil::import::cvs::file { |
| 32 | # # ## ### ##### ######## ############# |
| 33 | ## Public API |
| 34 | |
| 35 | constructor {path executable project} { |
| 36 | set mypath $path |
| 37 | set myexecutable $executable |
| 38 | set myproject $project |
| 39 | set mytrunk [$myproject trunk] |
| 40 | return |
| 41 | } |
| 42 | |
| 43 | method path {} { return $mypath } |
| 44 | method project {} { return $myproject } |
| 45 | |
| 46 | # # ## ### ##### ######## ############# |
| 47 | ## Methods required for the class to be a sink of the rcs parser |
| 48 | |
| 49 | #method begin {} {puts begin} |
| @@ -208,10 +212,11 @@ | |
| 208 | |
| 209 | # # ## ### ##### ######## ############# |
| 210 | ## State |
| 211 | |
| 212 | variable mypath {} ; # Path of the file's rcs archive. |
| 213 | variable myexecutable 0 ; # Boolean flag 'file executable'. |
| 214 | variable myproject {} ; # Reference to the project object |
| 215 | # the file belongs to. |
| 216 | variable myrev -array {} ; # Maps revision number to the |
| 217 | # associated revision object. |
| @@ -686,10 +691,54 @@ | |
| 686 | } |
| 687 | return |
| 688 | } |
| 689 | |
| 690 | method RemoveIrrelevantDeletions {} { |
| 691 | } |
| 692 | |
| 693 | method RemoveInitialBranchDeletions {} { |
| 694 | } |
| 695 | |
| @@ -700,11 +749,10 @@ | |
| 700 | ## Configuration |
| 701 | |
| 702 | pragma -hastypeinfo no ; # no type introspection |
| 703 | pragma -hasinfo no ; # no object introspection |
| 704 | pragma -hastypemethods no ; # type is not relevant. |
| 705 | pragma -simpledispatch yes ; # simple fast dispatch |
| 706 | |
| 707 | # # ## ### ##### ######## ############# |
| 708 | } |
| 709 | |
| 710 | namespace eval ::vc::fossil::import::cvs { |
| 711 |
| --- tools/cvs2fossil/lib/c2f_file.tcl | |
| +++ tools/cvs2fossil/lib/c2f_file.tcl | |
| @@ -30,20 +30,24 @@ | |
| 30 | |
| 31 | snit::type ::vc::fossil::import::cvs::file { |
| 32 | # # ## ### ##### ######## ############# |
| 33 | ## Public API |
| 34 | |
| 35 | constructor {path usrpath executable project} { |
| 36 | set mypath $path |
| 37 | set myusrpath $usrpath |
| 38 | set myexecutable $executable |
| 39 | set myproject $project |
| 40 | set mytrunk [$myproject trunk] |
| 41 | return |
| 42 | } |
| 43 | |
| 44 | method path {} { return $mypath } |
| 45 | method usrpath {} { return $myusrpath } |
| 46 | method project {} { return $myproject } |
| 47 | |
| 48 | delegate method commitmessageof to myproject |
| 49 | |
| 50 | # # ## ### ##### ######## ############# |
| 51 | ## Methods required for the class to be a sink of the rcs parser |
| 52 | |
| 53 | #method begin {} {puts begin} |
| @@ -208,10 +212,11 @@ | |
| 212 | |
| 213 | # # ## ### ##### ######## ############# |
| 214 | ## State |
| 215 | |
| 216 | variable mypath {} ; # Path of the file's rcs archive. |
| 217 | variable myusrpath {} ; # Path of the file as seen by users. |
| 218 | variable myexecutable 0 ; # Boolean flag 'file executable'. |
| 219 | variable myproject {} ; # Reference to the project object |
| 220 | # the file belongs to. |
| 221 | variable myrev -array {} ; # Maps revision number to the |
| 222 | # associated revision object. |
| @@ -686,10 +691,54 @@ | |
| 691 | } |
| 692 | return |
| 693 | } |
| 694 | |
| 695 | method RemoveIrrelevantDeletions {} { |
| 696 | # From cvs2fossil: |
| 697 | # If a file is added on a branch, then a trunk revision is |
| 698 | # added at the same time in the 'Dead' state. This revision |
| 699 | # doesn't do anything useful, so delete it. |
| 700 | |
| 701 | foreach root $myroots { |
| 702 | if {[$root isneeded]} continue |
| 703 | log write 2 file "Removing unnecessary dead revision [$root revnr]" |
| 704 | |
| 705 | # Remove as root, make its child new root after |
| 706 | # disconnecting it from the revision just going away. |
| 707 | |
| 708 | ldelete myroots $root |
| 709 | if {[$root haschild]} { |
| 710 | set child [$root child] |
| 711 | $child cutfromparent |
| 712 | lappend myroots $child |
| 713 | } |
| 714 | |
| 715 | # Remove the branches spawned by the revision to be |
| 716 | # deleted. If the branch has revisions they should already |
| 717 | # use operation 'add', no need to change that. The first |
| 718 | # revision on each branch becomes a new and disconnected |
| 719 | # root. |
| 720 | |
| 721 | foreach branch [$root branches] { |
| 722 | if {![$branch haschild]} continue |
| 723 | set first [$branch child] |
| 724 | $first cutfromparentbranch |
| 725 | $first cutfromparent |
| 726 | lappend myroots $first |
| 727 | } |
| 728 | $root removeallbranches |
| 729 | |
| 730 | # Tagging a dead revision doesn't do anything, so remove |
| 731 | # any tags that were set on it. |
| 732 | |
| 733 | $root removealltags |
| 734 | |
| 735 | # This can only happen once per file, and we might have |
| 736 | # just changed myroots, so break out of the loop: |
| 737 | break |
| 738 | } |
| 739 | return |
| 740 | } |
| 741 | |
| 742 | method RemoveInitialBranchDeletions {} { |
| 743 | } |
| 744 | |
| @@ -700,11 +749,10 @@ | |
| 749 | ## Configuration |
| 750 | |
| 751 | pragma -hastypeinfo no ; # no type introspection |
| 752 | pragma -hasinfo no ; # no object introspection |
| 753 | pragma -hastypemethods no ; # type is not relevant. |
| 754 | |
| 755 | # # ## ### ##### ######## ############# |
| 756 | } |
| 757 | |
| 758 | namespace eval ::vc::fossil::import::cvs { |
| 759 |
| --- tools/cvs2fossil/lib/c2f_frev.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_frev.tcl | ||
| @@ -49,10 +49,28 @@ | ||
| 49 | 49 | |
| 50 | 50 | method revnr {} { return $myrevnr } |
| 51 | 51 | method state {} { return $mystate } |
| 52 | 52 | method lod {} { return $mylod } |
| 53 | 53 | method date {} { return $mydate } |
| 54 | + | |
| 55 | + method isneeded {} { | |
| 56 | + if {$myoperation ne "nothing"} {return 1} | |
| 57 | + if {$myrevnr ne "1.1"} {return 1} | |
| 58 | + if {![$mylod istrunk]} {return 1} | |
| 59 | + if {![llength $mybranches]} {return 1} | |
| 60 | + set firstbranch [lindex $mybranches 0] | |
| 61 | + if {![$firstbranch haschild]} {return 1} | |
| 62 | + if {$myisondefaultbranch} {return 1} | |
| 63 | + | |
| 64 | + # FIX: This message will not match if the RCS file was renamed | |
| 65 | + # manually after it was created. | |
| 66 | + | |
| 67 | + set gen "file [file tail [$myfile usrpath]] was initially added on branch [$firstbranch name]." | |
| 68 | + set log [$myfile commitmessageof $mymetaid] | |
| 69 | + | |
| 70 | + return [expr {$log ne $gen}] | |
| 71 | + } | |
| 54 | 72 | |
| 55 | 73 | # Basic parent/child linkage __________ |
| 56 | 74 | |
| 57 | 75 | method hasparent {} { return [expr {$myparent ne ""}] } |
| 58 | 76 | method haschild {} { return [expr {$mychild ne ""}] } |
| @@ -82,10 +100,11 @@ | ||
| 82 | 100 | set myparentbranch $branch |
| 83 | 101 | return |
| 84 | 102 | } |
| 85 | 103 | |
| 86 | 104 | method parentbranch {} { return $myparentbranch } |
| 105 | + method branches {} { return $mybranches } | |
| 87 | 106 | |
| 88 | 107 | method addbranch {branch} { |
| 89 | 108 | lappend mybranches $branch |
| 90 | 109 | return |
| 91 | 110 | } |
| @@ -147,17 +166,32 @@ | ||
| 147 | 166 | } |
| 148 | 167 | set mybranches {} |
| 149 | 168 | set mybranchchildren {} |
| 150 | 169 | return |
| 151 | 170 | } |
| 171 | + | |
| 172 | + method removeallbranches {} { | |
| 173 | + foreach branch $mybranches { | |
| 174 | + $branch destroy | |
| 175 | + } | |
| 176 | + set mybranches {} | |
| 177 | + set mybranchchildren {} | |
| 178 | + return | |
| 179 | + } | |
| 152 | 180 | |
| 153 | 181 | # Tag linkage _________________________ |
| 154 | 182 | |
| 155 | 183 | method addtag {tag} { |
| 156 | 184 | lappend mytags $tag |
| 157 | 185 | return |
| 158 | 186 | } |
| 187 | + | |
| 188 | + method removealltags {} { | |
| 189 | + foreach tag $mytags { $tag destroy } | |
| 190 | + set mytags {} | |
| 191 | + return | |
| 192 | + } | |
| 159 | 193 | |
| 160 | 194 | method movetagsto {rev} { |
| 161 | 195 | set revlod [$rev lod] |
| 162 | 196 | foreach tag $mytags { |
| 163 | 197 | $rev addtag $tag |
| 164 | 198 |
| --- tools/cvs2fossil/lib/c2f_frev.tcl | |
| +++ tools/cvs2fossil/lib/c2f_frev.tcl | |
| @@ -49,10 +49,28 @@ | |
| 49 | |
| 50 | method revnr {} { return $myrevnr } |
| 51 | method state {} { return $mystate } |
| 52 | method lod {} { return $mylod } |
| 53 | method date {} { return $mydate } |
| 54 | |
| 55 | # Basic parent/child linkage __________ |
| 56 | |
| 57 | method hasparent {} { return [expr {$myparent ne ""}] } |
| 58 | method haschild {} { return [expr {$mychild ne ""}] } |
| @@ -82,10 +100,11 @@ | |
| 82 | set myparentbranch $branch |
| 83 | return |
| 84 | } |
| 85 | |
| 86 | method parentbranch {} { return $myparentbranch } |
| 87 | |
| 88 | method addbranch {branch} { |
| 89 | lappend mybranches $branch |
| 90 | return |
| 91 | } |
| @@ -147,17 +166,32 @@ | |
| 147 | } |
| 148 | set mybranches {} |
| 149 | set mybranchchildren {} |
| 150 | return |
| 151 | } |
| 152 | |
| 153 | # Tag linkage _________________________ |
| 154 | |
| 155 | method addtag {tag} { |
| 156 | lappend mytags $tag |
| 157 | return |
| 158 | } |
| 159 | |
| 160 | method movetagsto {rev} { |
| 161 | set revlod [$rev lod] |
| 162 | foreach tag $mytags { |
| 163 | $rev addtag $tag |
| 164 |
| --- tools/cvs2fossil/lib/c2f_frev.tcl | |
| +++ tools/cvs2fossil/lib/c2f_frev.tcl | |
| @@ -49,10 +49,28 @@ | |
| 49 | |
| 50 | method revnr {} { return $myrevnr } |
| 51 | method state {} { return $mystate } |
| 52 | method lod {} { return $mylod } |
| 53 | method date {} { return $mydate } |
| 54 | |
| 55 | method isneeded {} { |
| 56 | if {$myoperation ne "nothing"} {return 1} |
| 57 | if {$myrevnr ne "1.1"} {return 1} |
| 58 | if {![$mylod istrunk]} {return 1} |
| 59 | if {![llength $mybranches]} {return 1} |
| 60 | set firstbranch [lindex $mybranches 0] |
| 61 | if {![$firstbranch haschild]} {return 1} |
| 62 | if {$myisondefaultbranch} {return 1} |
| 63 | |
| 64 | # FIX: This message will not match if the RCS file was renamed |
| 65 | # manually after it was created. |
| 66 | |
| 67 | set gen "file [file tail [$myfile usrpath]] was initially added on branch [$firstbranch name]." |
| 68 | set log [$myfile commitmessageof $mymetaid] |
| 69 | |
| 70 | return [expr {$log ne $gen}] |
| 71 | } |
| 72 | |
| 73 | # Basic parent/child linkage __________ |
| 74 | |
| 75 | method hasparent {} { return [expr {$myparent ne ""}] } |
| 76 | method haschild {} { return [expr {$mychild ne ""}] } |
| @@ -82,10 +100,11 @@ | |
| 100 | set myparentbranch $branch |
| 101 | return |
| 102 | } |
| 103 | |
| 104 | method parentbranch {} { return $myparentbranch } |
| 105 | method branches {} { return $mybranches } |
| 106 | |
| 107 | method addbranch {branch} { |
| 108 | lappend mybranches $branch |
| 109 | return |
| 110 | } |
| @@ -147,17 +166,32 @@ | |
| 166 | } |
| 167 | set mybranches {} |
| 168 | set mybranchchildren {} |
| 169 | return |
| 170 | } |
| 171 | |
| 172 | method removeallbranches {} { |
| 173 | foreach branch $mybranches { |
| 174 | $branch destroy |
| 175 | } |
| 176 | set mybranches {} |
| 177 | set mybranchchildren {} |
| 178 | return |
| 179 | } |
| 180 | |
| 181 | # Tag linkage _________________________ |
| 182 | |
| 183 | method addtag {tag} { |
| 184 | lappend mytags $tag |
| 185 | return |
| 186 | } |
| 187 | |
| 188 | method removealltags {} { |
| 189 | foreach tag $mytags { $tag destroy } |
| 190 | set mytags {} |
| 191 | return |
| 192 | } |
| 193 | |
| 194 | method movetagsto {rev} { |
| 195 | set revlod [$rev lod] |
| 196 | foreach tag $mytags { |
| 197 | $rev addtag $tag |
| 198 |
| --- tools/cvs2fossil/lib/c2f_project.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_project.tcl | ||
| @@ -58,13 +58,14 @@ | ||
| 58 | 58 | |
| 59 | 59 | method files {} { |
| 60 | 60 | return [TheFiles] |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - delegate method defauthor to myrepository | |
| 64 | - delegate method defcmessage to myrepository | |
| 65 | - delegate method trunkonly to myrepository | |
| 63 | + delegate method defauthor to myrepository | |
| 64 | + delegate method defcmessage to myrepository | |
| 65 | + delegate method trunkonly to myrepository | |
| 66 | + delegate method commitmessageof to myrepository | |
| 66 | 67 | |
| 67 | 68 | method defmeta {bid aid cid} { |
| 68 | 69 | return [$myrepository defmeta $myid $bid $aid $cid] |
| 69 | 70 | } |
| 70 | 71 | |
| @@ -139,13 +140,13 @@ | ||
| 139 | 140 | } |
| 140 | 141 | |
| 141 | 142 | proc EmptyFiles {fv} { |
| 142 | 143 | upvar 1 $fv myfiles self self |
| 143 | 144 | set res {} |
| 144 | - foreach item [lsort -dict [array names myfiles]] { | |
| 145 | - struct::list assign $item f executable | |
| 146 | - lappend res [file %AUTO% $f $executable $self] | |
| 145 | + foreach rcs [lsort -dict [array names myfiles]] { | |
| 146 | + struct::list assign $myfiles($rcs) f executable | |
| 147 | + lappend res [file %AUTO% $rcs $f $executable $self] | |
| 147 | 148 | } |
| 148 | 149 | return $res |
| 149 | 150 | } |
| 150 | 151 | |
| 151 | 152 | # # ## ### ##### ######## ############# |
| 152 | 153 |
| --- tools/cvs2fossil/lib/c2f_project.tcl | |
| +++ tools/cvs2fossil/lib/c2f_project.tcl | |
| @@ -58,13 +58,14 @@ | |
| 58 | |
| 59 | method files {} { |
| 60 | return [TheFiles] |
| 61 | } |
| 62 | |
| 63 | delegate method defauthor to myrepository |
| 64 | delegate method defcmessage to myrepository |
| 65 | delegate method trunkonly to myrepository |
| 66 | |
| 67 | method defmeta {bid aid cid} { |
| 68 | return [$myrepository defmeta $myid $bid $aid $cid] |
| 69 | } |
| 70 | |
| @@ -139,13 +140,13 @@ | |
| 139 | } |
| 140 | |
| 141 | proc EmptyFiles {fv} { |
| 142 | upvar 1 $fv myfiles self self |
| 143 | set res {} |
| 144 | foreach item [lsort -dict [array names myfiles]] { |
| 145 | struct::list assign $item f executable |
| 146 | lappend res [file %AUTO% $f $executable $self] |
| 147 | } |
| 148 | return $res |
| 149 | } |
| 150 | |
| 151 | # # ## ### ##### ######## ############# |
| 152 |
| --- tools/cvs2fossil/lib/c2f_project.tcl | |
| +++ tools/cvs2fossil/lib/c2f_project.tcl | |
| @@ -58,13 +58,14 @@ | |
| 58 | |
| 59 | method files {} { |
| 60 | return [TheFiles] |
| 61 | } |
| 62 | |
| 63 | delegate method defauthor to myrepository |
| 64 | delegate method defcmessage to myrepository |
| 65 | delegate method trunkonly to myrepository |
| 66 | delegate method commitmessageof to myrepository |
| 67 | |
| 68 | method defmeta {bid aid cid} { |
| 69 | return [$myrepository defmeta $myid $bid $aid $cid] |
| 70 | } |
| 71 | |
| @@ -139,13 +140,13 @@ | |
| 140 | } |
| 141 | |
| 142 | proc EmptyFiles {fv} { |
| 143 | upvar 1 $fv myfiles self self |
| 144 | set res {} |
| 145 | foreach rcs [lsort -dict [array names myfiles]] { |
| 146 | struct::list assign $myfiles($rcs) f executable |
| 147 | lappend res [file %AUTO% $rcs $f $executable $self] |
| 148 | } |
| 149 | return $res |
| 150 | } |
| 151 | |
| 152 | # # ## ### ##### ######## ############# |
| 153 |
+35
-27
| --- tools/cvs2fossil/lib/c2f_repository.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_repository.tcl | ||
| @@ -83,12 +83,13 @@ | ||
| 83 | 83 | return $myauthor($a) |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | typemethod defcmessage {cm} { |
| 87 | 87 | if {![info exists mycmsg($cm)]} { |
| 88 | - set mycmsg($cm) [incr mycmsgcnt] | |
| 89 | - log write 6 repository "cmessage '$cm' = $mycmsg($cm)" | |
| 88 | + set mycmsg($cm) [set cid [incr mycmsgcnt]] | |
| 89 | + set mycmsginv($cid) $cm | |
| 90 | + log write 6 repository "cmessage '$cm' = $cid" | |
| 90 | 91 | } |
| 91 | 92 | return $mycmsg($cm) |
| 92 | 93 | } |
| 93 | 94 | |
| 94 | 95 | typemethod defsymbol {pid name} { |
| @@ -101,15 +102,21 @@ | ||
| 101 | 102 | } |
| 102 | 103 | |
| 103 | 104 | typemethod defmeta {pid bid aid cid} { |
| 104 | 105 | set key [list $pid $bid $aid $cid] |
| 105 | 106 | if {![info exists mymeta($key)]} { |
| 106 | - set mymeta($key) [incr mymetacnt] | |
| 107 | + set mymeta($key) [set mid [incr mymetacnt]] | |
| 108 | + set mymetainv($mid) $key | |
| 107 | 109 | log write 6 repository "meta ($key) = $mymeta($key)" |
| 108 | 110 | } |
| 109 | 111 | return $mymeta($key) |
| 110 | 112 | } |
| 113 | + | |
| 114 | + typemethod commitmessageof {metaid} { | |
| 115 | + struct::list assign $mymetainv($metaid) pid bid aid cid | |
| 116 | + return $mycmsginv($cid) | |
| 117 | + } | |
| 111 | 118 | |
| 112 | 119 | # pass I results |
| 113 | 120 | typemethod printstatistics {} { |
| 114 | 121 | set prlist [TheProjects] |
| 115 | 122 | set npr [llength $prlist] |
| @@ -203,34 +210,35 @@ | ||
| 203 | 210 | } |
| 204 | 211 | |
| 205 | 212 | # # ## ### ##### ######## ############# |
| 206 | 213 | ## State |
| 207 | 214 | |
| 208 | - typevariable mybase {} ; # Base path to CVS repository. | |
| 209 | - typevariable myprojpaths {} ; # List of paths to all declared | |
| 210 | - # projects, relative to mybase. | |
| 211 | - typevariable myprojects {} ; # List of objects for all | |
| 212 | - # declared projects. | |
| 213 | - typevariable myauthor -array {} ; # Names of all authors found, | |
| 214 | - # maps to their ids. | |
| 215 | - typevariable myauthorcnt 0 ; # Counter for author ids. | |
| 216 | - typevariable mycmsg -array {} ; # All commit messages found, | |
| 217 | - # maps to their ids. | |
| 218 | - typevariable mycmsgcnt 0 ; # Counter for message ids. | |
| 219 | - typevariable mymeta -array {} ; # Maps all meta data tuples | |
| 220 | - # (project, branch, author, | |
| 221 | - # cmessage) to their ids. | |
| 222 | - typevariable mymetacnt 0 ; # Counter for meta ids. | |
| 223 | - typevariable mysymbol -array {} ; # Map symbols identified by | |
| 224 | - # project and name to their | |
| 225 | - # id. This information is not | |
| 226 | - # saved directly. | |
| 227 | - typevariable mysymbolcnt 0 ; # Counter for symbol ids. | |
| 228 | - | |
| 229 | - typevariable mytrunkonly 0 ; # Boolean flag. Set by option | |
| 230 | - # processing when the user | |
| 231 | - # requested a trunk-only import | |
| 215 | + typevariable mybase {} ; # Base path to CVS repository. | |
| 216 | + typevariable myprojpaths {} ; # List of paths to all declared | |
| 217 | + # projects, relative to mybase. | |
| 218 | + typevariable myprojects {} ; # List of objects for all | |
| 219 | + # declared projects. | |
| 220 | + typevariable myauthor -array {} ; # Names of all authors found, | |
| 221 | + # maps to their ids. | |
| 222 | + typevariable myauthorcnt 0 ; # Counter for author ids. | |
| 223 | + typevariable mycmsg -array {} ; # All commit messages found, | |
| 224 | + # maps to their ids. | |
| 225 | + typevariable mycmsginv -array {} ; # Inverted index, keyed by id. | |
| 226 | + typevariable mycmsgcnt 0 ; # Counter for message ids. | |
| 227 | + typevariable mymeta -array {} ; # Maps all meta data tuples | |
| 228 | + # (project, branch, author, | |
| 229 | + # cmessage) to their ids. | |
| 230 | + typevariable mymetainv -array {} ; # Inverted index, keyed by id. | |
| 231 | + typevariable mymetacnt 0 ; # Counter for meta ids. | |
| 232 | + typevariable mysymbol -array {} ; # Map symbols identified by | |
| 233 | + # project and name to their | |
| 234 | + # id. This information is not | |
| 235 | + # saved directly. | |
| 236 | + typevariable mysymbolcnt 0 ; # Counter for symbol ids. | |
| 237 | + typevariable mytrunkonly 0 ; # Boolean flag. Set by option | |
| 238 | + # processing when the user | |
| 239 | + # requested a trunk-only import | |
| 232 | 240 | |
| 233 | 241 | # # ## ### ##### ######## ############# |
| 234 | 242 | ## Internal methods |
| 235 | 243 | |
| 236 | 244 | proc .BaseLength {p} { |
| 237 | 245 |
| --- tools/cvs2fossil/lib/c2f_repository.tcl | |
| +++ tools/cvs2fossil/lib/c2f_repository.tcl | |
| @@ -83,12 +83,13 @@ | |
| 83 | return $myauthor($a) |
| 84 | } |
| 85 | |
| 86 | typemethod defcmessage {cm} { |
| 87 | if {![info exists mycmsg($cm)]} { |
| 88 | set mycmsg($cm) [incr mycmsgcnt] |
| 89 | log write 6 repository "cmessage '$cm' = $mycmsg($cm)" |
| 90 | } |
| 91 | return $mycmsg($cm) |
| 92 | } |
| 93 | |
| 94 | typemethod defsymbol {pid name} { |
| @@ -101,15 +102,21 @@ | |
| 101 | } |
| 102 | |
| 103 | typemethod defmeta {pid bid aid cid} { |
| 104 | set key [list $pid $bid $aid $cid] |
| 105 | if {![info exists mymeta($key)]} { |
| 106 | set mymeta($key) [incr mymetacnt] |
| 107 | log write 6 repository "meta ($key) = $mymeta($key)" |
| 108 | } |
| 109 | return $mymeta($key) |
| 110 | } |
| 111 | |
| 112 | # pass I results |
| 113 | typemethod printstatistics {} { |
| 114 | set prlist [TheProjects] |
| 115 | set npr [llength $prlist] |
| @@ -203,34 +210,35 @@ | |
| 203 | } |
| 204 | |
| 205 | # # ## ### ##### ######## ############# |
| 206 | ## State |
| 207 | |
| 208 | typevariable mybase {} ; # Base path to CVS repository. |
| 209 | typevariable myprojpaths {} ; # List of paths to all declared |
| 210 | # projects, relative to mybase. |
| 211 | typevariable myprojects {} ; # List of objects for all |
| 212 | # declared projects. |
| 213 | typevariable myauthor -array {} ; # Names of all authors found, |
| 214 | # maps to their ids. |
| 215 | typevariable myauthorcnt 0 ; # Counter for author ids. |
| 216 | typevariable mycmsg -array {} ; # All commit messages found, |
| 217 | # maps to their ids. |
| 218 | typevariable mycmsgcnt 0 ; # Counter for message ids. |
| 219 | typevariable mymeta -array {} ; # Maps all meta data tuples |
| 220 | # (project, branch, author, |
| 221 | # cmessage) to their ids. |
| 222 | typevariable mymetacnt 0 ; # Counter for meta ids. |
| 223 | typevariable mysymbol -array {} ; # Map symbols identified by |
| 224 | # project and name to their |
| 225 | # id. This information is not |
| 226 | # saved directly. |
| 227 | typevariable mysymbolcnt 0 ; # Counter for symbol ids. |
| 228 | |
| 229 | typevariable mytrunkonly 0 ; # Boolean flag. Set by option |
| 230 | # processing when the user |
| 231 | # requested a trunk-only import |
| 232 | |
| 233 | # # ## ### ##### ######## ############# |
| 234 | ## Internal methods |
| 235 | |
| 236 | proc .BaseLength {p} { |
| 237 |
| --- tools/cvs2fossil/lib/c2f_repository.tcl | |
| +++ tools/cvs2fossil/lib/c2f_repository.tcl | |
| @@ -83,12 +83,13 @@ | |
| 83 | return $myauthor($a) |
| 84 | } |
| 85 | |
| 86 | typemethod defcmessage {cm} { |
| 87 | if {![info exists mycmsg($cm)]} { |
| 88 | set mycmsg($cm) [set cid [incr mycmsgcnt]] |
| 89 | set mycmsginv($cid) $cm |
| 90 | log write 6 repository "cmessage '$cm' = $cid" |
| 91 | } |
| 92 | return $mycmsg($cm) |
| 93 | } |
| 94 | |
| 95 | typemethod defsymbol {pid name} { |
| @@ -101,15 +102,21 @@ | |
| 102 | } |
| 103 | |
| 104 | typemethod defmeta {pid bid aid cid} { |
| 105 | set key [list $pid $bid $aid $cid] |
| 106 | if {![info exists mymeta($key)]} { |
| 107 | set mymeta($key) [set mid [incr mymetacnt]] |
| 108 | set mymetainv($mid) $key |
| 109 | log write 6 repository "meta ($key) = $mymeta($key)" |
| 110 | } |
| 111 | return $mymeta($key) |
| 112 | } |
| 113 | |
| 114 | typemethod commitmessageof {metaid} { |
| 115 | struct::list assign $mymetainv($metaid) pid bid aid cid |
| 116 | return $mycmsginv($cid) |
| 117 | } |
| 118 | |
| 119 | # pass I results |
| 120 | typemethod printstatistics {} { |
| 121 | set prlist [TheProjects] |
| 122 | set npr [llength $prlist] |
| @@ -203,34 +210,35 @@ | |
| 210 | } |
| 211 | |
| 212 | # # ## ### ##### ######## ############# |
| 213 | ## State |
| 214 | |
| 215 | typevariable mybase {} ; # Base path to CVS repository. |
| 216 | typevariable myprojpaths {} ; # List of paths to all declared |
| 217 | # projects, relative to mybase. |
| 218 | typevariable myprojects {} ; # List of objects for all |
| 219 | # declared projects. |
| 220 | typevariable myauthor -array {} ; # Names of all authors found, |
| 221 | # maps to their ids. |
| 222 | typevariable myauthorcnt 0 ; # Counter for author ids. |
| 223 | typevariable mycmsg -array {} ; # All commit messages found, |
| 224 | # maps to their ids. |
| 225 | typevariable mycmsginv -array {} ; # Inverted index, keyed by id. |
| 226 | typevariable mycmsgcnt 0 ; # Counter for message ids. |
| 227 | typevariable mymeta -array {} ; # Maps all meta data tuples |
| 228 | # (project, branch, author, |
| 229 | # cmessage) to their ids. |
| 230 | typevariable mymetainv -array {} ; # Inverted index, keyed by id. |
| 231 | typevariable mymetacnt 0 ; # Counter for meta ids. |
| 232 | typevariable mysymbol -array {} ; # Map symbols identified by |
| 233 | # project and name to their |
| 234 | # id. This information is not |
| 235 | # saved directly. |
| 236 | typevariable mysymbolcnt 0 ; # Counter for symbol ids. |
| 237 | typevariable mytrunkonly 0 ; # Boolean flag. Set by option |
| 238 | # processing when the user |
| 239 | # requested a trunk-only import |
| 240 | |
| 241 | # # ## ### ##### ######## ############# |
| 242 | ## Internal methods |
| 243 | |
| 244 | proc .BaseLength {p} { |
| 245 |