Overview
SHA1 Hash: | be2f99e6a4959f10c57fd2e198080b60da565897 |
---|---|
Date: | 2008-02-13 14:44:50 |
User: | drh |
Comment: | Merge with aku's branch. |
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 cvs2fossil.txt from [4a1e39371f] to [7755e1a714].
@@ -7,5 +7,36 @@ tcllib, or a single subproject of tcllib, like tklib, but not multiple sub-projects in one go. * We have to look into the pass 'InitCsets' and hunt for the cause of the large amount of memory it is gobbling up. + +* Look at the dependencies on external packages and consider + which of them can be moved into the importer, either as a + simple utility command, or wholesale. + + struct::list + assign, map, reverse, filter + + Very few and self-contained commands. + + struct::set + size, empty, contains, add, include, exclude, + intersect, subsetof + + Most of the core commands. + + fileutil + cat, appendToFile, writeFile, + tempfile, stripPath, test + + fileutil::traverse + In toto + + struct::graph + In toto + + snit + In toto + + sqlite3 + In tota
Modified tools/cvs2fossil/lib/c2f_fossil.tcl from [7c35d62cbf] to [3f0dcfd428].
@@ -140,10 +140,12 @@ Do rebuild [::file nativename $myrepository] ::file rename -force $myrepository $destination ::file delete -force $myworkspace $self destroy + + log write 2 fossil {destination $destination} return } # # ## ### ##### ######## ############# ##
Modified tools/cvs2fossil/lib/c2f_option.tcl from [490b79f397] to [be274ee796].
@@ -41,10 +41,11 @@ # --help, --help-passes, -h # --version # -p, --pass, --passes # --ignore-conflicting-attics + # --convert-dotfiles # --project # -v, --verbose # -q, --quiet # --state (conversion status, ala config.cache) # --trunk-only @@ -70,10 +71,11 @@ --version { PrintVersion ; exit 0 } -p - --pass - --passes { pass select [Value arguments] } --ignore-conflicting-attics { collar ignore_conflicting_attics } + --convert-dotfiles { collar accept_and_convert_dotfiles } --project { repository add [Value arguments] } -v - --verbose { log verbose } -q - --quiet { log quiet } @@ -127,10 +129,15 @@ trouble info " Passes are specified by name." trouble info "" trouble info " --ignore-conflicting-attics" trouble info " Prevent abort when conflicting archives" trouble info " were found in both regular and Attic." + trouble info "" + trouble info " --convert-dotfiles" + trouble info " Prevent abort when dot-files were found," + trouble info " causing their conversion to nondot-form" + trouble info " instead." trouble info "" trouble info " --state PATH Save state to the specified file, and" trouble info " load state of previous runs from it too." trouble info "" trouble info " --exclude ?PROJECT:?SYMBOL Exclude the named symbol from all or"
Modified tools/cvs2fossil/lib/c2f_pass.tcl from [98d1ccdb7b] to [d98651431b].
@@ -143,18 +143,35 @@ return } proc ShowTimes {} { ::variable mytime + set total 0 foreach {pass seconds} $mytime { ShowTime $pass $seconds + incr total $seconds } + ShowTime Total $total return } proc ShowTime {pass seconds} { - log write 0 pass "[format %8d $seconds] sec/$pass" + if {$seconds > 3600} { + set hr [expr {$seconds / 3600}] + set min [expr {$seconds % 3600}] + set sec [expr {$min % 60}] + set min [expr {$min / 60}] + + log write 0 pass "[format %8d $seconds] sec/$pass ([nsp $hr hour] [nsp $min minute] [nsp $sec second])" + } elseif {$seconds > 60} { + set min [expr {$seconds / 60}] + set sec [expr {$seconds % 60}] + + log write 0 pass "[format %8d $seconds] sec/$pass ([nsp $min minute] [nsp $sec second])" + } else { + log write 0 pass "[format %8d $seconds] sec/$pass" + } return } proc Ok? {code label ov {emptyok 1}} { upvar 1 $ov ok
Modified tools/cvs2fossil/lib/c2f_pcollar.tcl from [54fd12d643] to [7d94939b63].
@@ -111,23 +111,13 @@ set rcs [fileutil::stripPath $base $path] if {[IsCVSAdmin $rcs]} continue if {![IsRCSArchive $path]} continue set usr [UserPath $rcs isattic] - if {[IsSuperceded $base $rcs $usr $isattic]} continue - - # XXX Checkme: not sure if this will still fail in the case where a directory does conflict with a file XXX - if { - [fileexists_cs $base/$usr] && - [fileisdir_cs $base/$usr] - } { - trouble fatal "Directory name conflicts with filename." - trouble fatal "Please remove or rename one of the following:" - trouble fatal " $base/$usr" - trouble fatal " $base/$rcs" - continue - } + + if {[CheckForAndReportPathConflicts $base $rcs $usr $isattic]} continue + if {[HandleDotFile $base $rcs usr $isattic]} continue log write 4 collar "Found $rcs" $project addfile $rcs $usr [file executable $rcs] incr n @@ -159,14 +149,25 @@ typemethod ignore_conflicting_attics {} { set myignore 1 return } + typemethod accept_and_convert_dotfiles {} { + set myconvertdot 1 + return + } + # # ## ### ##### ######## ############# ## Internal methods - typevariable myignore 0 + typevariable myignore 0 ; # Flag. When set Attic files + # superceded by regular files + # ignored. + typevariable myconvertdot 0 ; # Flag. When set dotfiles do not + # cause rejection, but their names + # are converted to a dotless form + # ('dot-' prefix instead of '.'). proc FilterAtticSubdir {base path} { # This command is used by the traverser to prevent it from # scanning into subdirectories of an Attic. We get away with # checking the immediate parent directory of the current path @@ -186,13 +187,18 @@ trouble warn $msg return 0 } proc IsCVSAdmin {rcs} { - if {![string match CVSROOT/* $rcs]} {return 0} - log write 4 collar "Ignored $rcs, administrative archive" - return 1 + if { + [string match {CVSROOT/*} $rcs] || + [string match {.cvsignore*} [file tail $rcs]] + } { + log write 4 collar "Ignored $rcs, administrative archive" + return 1 + } + return 0 } proc UserPath {rcs iav} { upvar 1 $iav isattic @@ -236,10 +242,72 @@ log write 2 collar "Ignored $rcs, superceded archive" } else { trouble warn "Ignored $rcs, superceded archive" } return 1 + } + + # In the future we should move the activity below into the fossil + # backend, as the exact set of paths requiring translation, and + # how to translate them, depends entirely on the limitations + # imposed by the destination repository. + + proc HandleDotFile {base rcs usrvar isattic} { + ::variable myconvertdot + upvar 1 $usrvar usr + + set dedot [DeDot $usr] + if {$dedot eq $usr} { return 0 } + + # Ok, we now have established that the path has to be + # translated. Which as already happened as part of the check + # above. Left is to report the action, and to check if the new + # path collides with existing files and directories. + + if {!$myconvertdot} { + trouble warn "Ignored $rcs, is a dot-file" + return 1 + } + + log write 2 collar "Convert $rcs, is a dot-file" + set usr $dedot + + return [CheckForAndReportPathConflicts $base $rcs $usr $isattic] + } + + proc DeDot {path} { + set res {} + foreach segment [file split $path] { + lappend res [expr { + [string match {.*} $segment] + ? "dot-[string range $segment 1 end]" + : $segment + }] + } + return [eval [linsert $res 0 file join]] + #8.5: return [file join {*}$res] + } + + proc CheckForAndReportPathConflicts {base rcs usr isattic {intro {}}} { + if {[IsSuperceded $base $rcs $usr $isattic]} { return 1 } + + # XXX Checkme: not sure if this will still fail in the case + # where a directory does conflict with a file XXX + if { + [fileexists_cs $base/$usr] && + [fileisdir_cs $base/$usr] + } { + if {$intro ne {}} { + trouble fatal $intro + } + trouble fatal "Directory name conflicts with filename." + trouble fatal "Please remove or rename one of the following:" + trouble fatal " $base/$usr" + trouble fatal " $base/$rcs" + return 1 + } + return 0 } # # ## ### ##### ######## ############# ## Configuration
Modified tools/cvs2fossil/lib/c2f_pimport.tcl from [73e5e1d767] to [2e961c0798].
@@ -103,11 +103,17 @@ $rstate destroy # At last copy the temporary repository file to its final # destination and release the associated memory. - $fossil finalize [$project base].fsl + set destination [$project base] + if {$destination eq ""} { + set destination [file tail [repository base?]] + } + append destination .fsl + + $fossil finalize $destination } # This does not live beyond the pass. We use the state for the # data despite its transient nature to keep the memory # requirements down.
Modified tools/cvs2fossil/lib/c2f_prev.tcl from [c1187b458c] to [d233796d95].
@@ -497,20 +497,36 @@ # (a) root of a vendor branch, # (b) root of the trunk LOD, or # (c) the first changeset in a new LOD which was spawned from # an existing LOD. - if {$isdefault || ($lodname eq ":trunk:")} { - # For both (a) and (b) we have to create a new workspace - # for the lod, and it doesn't inherit from anything. - - # Note that case (b) may never occur. See the variable - # 'lastdefaultontrunk' in the caller (method pushto). This - # flag can the generation of the workspace for the :trunk: - # LOD as well, making it inherit the state of the last - # trunk-changeset on the vendor-branch. - + # For both (a) and (b) we have to create a new workspace for + # the lod, and it doesn't inherit from anything. + + # One exception for (a). If we already have a :vendor: branch + # then multiple symbols were used for the vendor branch by + # different files. In that case the 'new' branch is made an + # alias of the :vendor:, effectively merging the symbols + # together. + + # Note that case (b) may never occur. See the variable + # 'lastdefaultontrunk' in the caller (method pushto). This + # flag can the generation of the workspace for the :trunk: LOD + # as well, making it inherit the state of the last + # trunk-changeset on the vendor-branch. + + if {$isdefault} { + if {![$rstate has ":vendor:"]} { + # Create the vendor branch if not present already. + $rstate new :vendor: + } + # Merge the new symbol to the vendor branch + $rstate dup $lodname <-- :vendor: + return [$rstate get $lodname] + } + + if {$lodname eq ":trunk:"} { return [$rstate new $lodname] } # Case (c). We find the parent LOD of our LOD and let the new # workspace inherit from the parent's workspace.
Modified tools/cvs2fossil/lib/c2f_ristate.tcl from [9cab4d3dc8] to [a43e38672d].
@@ -68,10 +68,16 @@ method get {lod} { return $mystate($lod) } method has {lod} { return [info exists mystate($lod)] } method names {} { return [array names mystate] } + + method dup {dst _from_ src} { + log write 8 ristate {Duplicate workspace state for LOD "$dst" from "$src"} + set mystate($dst) $mystate($src) + return + } # # ## ### ##### ######## ############# ## State variable mystate -array {} ; # Map from lines of development