| | @@ -3,14 +3,15 @@ |
| 3 | 3 | |
| 4 | 4 | # ----------------------------------------------------------------------------- |
| 5 | 5 | # Requirements |
| 6 | 6 | |
| 7 | 7 | package require Tcl 8.4 |
| 8 | | -package require fileutil ; # Tcllib (traverse directory hierarchy) |
| 9 | | -package require vc::rcs::parser ; # Handling the RCS archive files. |
| 10 | | -package require vc::tools::log ; # User feedback |
| 11 | | -package require vc::cvs::cmd ; # Access to cvs application. |
| 8 | +package require fileutil ; # Tcllib (traverse directory hierarchy) |
| 9 | +package require vc::rcs::parser ; # Handling the RCS archive files. |
| 10 | +package require vc::tools::log ; # User feedback |
| 11 | +package require vc::cvs::cmd ; # Access to cvs application. |
| 12 | +package require vc::cvs::ws::files ; # Scan CVS repository for relevant files. |
| 12 | 13 | package require struct::tree |
| 13 | 14 | |
| 14 | 15 | namespace eval ::vc::cvs::ws { |
| 15 | 16 | vc::tools::log::system cvs |
| 16 | 17 | namespace import ::vc::tools::log::write |
| | @@ -145,71 +146,25 @@ |
| 145 | 146 | # information (file, revision -> date, author, commit message) |
| 146 | 147 | |
| 147 | 148 | proc ::vc::cvs::ws::scan {} { |
| 148 | 149 | variable project |
| 149 | 150 | variable base |
| 150 | | - variable npaths |
| 151 | | - variable rpaths |
| 152 | 151 | variable timeline |
| 153 | 152 | |
| 154 | | - write 0 cvs {Scanning directory hierarchy} |
| 155 | | - |
| 156 | 153 | set n 0 |
| 157 | 154 | set d $base ; if {$project ne ""} {append d /$project} |
| 158 | 155 | |
| 159 | | - ::foreach rcs [fileutil::findByPattern $d -glob *,v] { |
| 160 | | - set rcs [fileutil::stripPath $d $rcs] |
| 161 | | - # Now rcs is relative to base/project |
| 162 | | - |
| 163 | | - write 1 cvs "Archive $rcs" |
| 164 | | - |
| 165 | | - if {[string match CVSROOT/* $rcs]} { |
| 166 | | - write 2 cvs {Ignored. Administrative file} |
| 167 | | - continue |
| 168 | | - } |
| 169 | | - |
| 170 | | - # Derive the regular path from the rcs path. Meaning: Chop of |
| 171 | | - # the ",v" suffix, and remove a possible "Attic". |
| 172 | | - set f [string range $rcs 0 end-2] |
| 173 | | - if {"Attic" eq [lindex [file split $rcs] end-1]} { |
| 174 | | - |
| 175 | | - # The construction below ensures that Attic/X maps to X |
| 176 | | - # instead of ./X. Otherwise, Y/Attic/X maps to Y/X. |
| 177 | | - |
| 178 | | - set fx [file dirname [file dirname $f]] |
| 179 | | - set f [file tail $f] |
| 180 | | - if {$fx ne "."} { set f [file join $fx $f] } |
| 181 | | - |
| 182 | | - if {[file exists $d/$f,v]} { |
| 183 | | - # We have a regular archive and an Attic archive |
| 184 | | - # refering to the same user visible file. Ignore the |
| 185 | | - # file in the Attic. |
| 186 | | - |
| 187 | | - write 2 cvs "Ignored. Attic superceded by regular archive" |
| 188 | | - |
| 189 | | - # TODO/CHECK. My method of co'ing exact file revisions |
| 190 | | - # per the info in the collected csets has the flaw |
| 191 | | - # that I may have to know exactly when what archive |
| 192 | | - # file to use, see above. It might be better to use |
| 193 | | - # the info only to gather when csets begin and end, |
| 194 | | - # and then to co complete slices per exact timestamp |
| 195 | | - # (-D) instead of file revisions (-r). The flaw in |
| 196 | | - # that is that csets can occur in the same second |
| 197 | | - # (trf, memchan - check for examples). For that exact |
| 198 | | - # checkout may be needed to recreate exact sequence of |
| 199 | | - # changes. Grr. Six of one ... |
| 200 | | - |
| 201 | | - continue |
| 202 | | - } |
| 203 | | - } |
| 156 | + set files [::vc::cvs::ws::files::find $d] |
| 157 | + |
| 158 | + write 0 cvs "Scanning archives ..." |
| 159 | + |
| 160 | + ::foreach {rcs f} $files { |
| 161 | + write 1 cvs "Archive $rcs" |
| 204 | 162 | |
| 205 | 163 | # Get the meta data we need (revisions, timeline, messages). |
| 206 | 164 | set meta [process $d/$rcs] |
| 207 | 165 | |
| 208 | | - set npaths($rcs) $f |
| 209 | | - set rpaths($f) $rcs |
| 210 | | - |
| 211 | 166 | array set p $meta |
| 212 | 167 | |
| 213 | 168 | ::foreach {rev ts} $p(date) {_ a} $p(author) {_ cm} $p(commit) {_ st} $p(state) { |
| 214 | 169 | set op [expr {($rev eq "1.1") ? "A" : "M"}] |
| 215 | 170 | if {$st eq "dead"} {set op "R"} |
| | @@ -236,16 +191,10 @@ |
| 236 | 191 | write 0 cvs "Processed $n [expr {($n == 1) ? "file" : "files"}]" |
| 237 | 192 | return |
| 238 | 193 | } |
| 239 | 194 | |
| 240 | 195 | namespace eval ::vc::cvs::ws { |
| 241 | | - # Path mappings. npaths: rcs file -> user file |
| 242 | | - # rpaths: user file -> rcs file, dead-status |
| 243 | | - |
| 244 | | - variable npaths ; array set npaths {} |
| 245 | | - variable rpaths ; array set rpaths {} |
| 246 | | - |
| 247 | 196 | # Timeline: tstamp -> (op, tstamp, author, revision, file, commit message) |
| 248 | 197 | |
| 249 | 198 | variable timeline ; array set timeline {} |
| 250 | 199 | } |
| 251 | 200 | |
| 252 | 201 | |
| 253 | 202 | ADDED tools/lib/cvs_files.tcl |