| | @@ -7,34 +7,34 @@ |
| 7 | 7 | package require Tcl 8.4 |
| 8 | 8 | package require cvs ; # Frontend, reading from source repository |
| 9 | 9 | package require fossil ; # Backend, writing to destination repository. |
| 10 | 10 | package require vc::tools::log ; # User feedback |
| 11 | 11 | |
| 12 | | -namespace eval ::import::cvs { |
| 12 | +namespace eval ::vc::fossil::import::cvs { |
| 13 | 13 | vc::tools::log::system import |
| 14 | 14 | namespace import ::vc::tools::log::write |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | # ----------------------------------------------------------------------------- |
| 18 | 18 | # API |
| 19 | 19 | |
| 20 | 20 | # Configuration |
| 21 | 21 | # |
| 22 | | -# import::cvs::configure key value - Set configuration |
| 22 | +# vc::fossil::import::cvs::configure key value - Set configuration |
| 23 | 23 | # |
| 24 | 24 | # Legal keys: -nosign <bool>, default false |
| 25 | 25 | # -debugcommit <bool>, default false |
| 26 | 26 | # -stopat <int>, default :none: |
| 27 | 27 | # |
| 28 | 28 | # Functionality |
| 29 | 29 | # |
| 30 | | -# import::cvs::run src dst - Perform an import. |
| 30 | +# vc::fossil::import::cvs::run src dst - Perform an import. |
| 31 | 31 | |
| 32 | 32 | # ----------------------------------------------------------------------------- |
| 33 | 33 | # API Implementation - Functionality |
| 34 | 34 | |
| 35 | | -proc ::import::cvs::configure {key value} { |
| 35 | +proc ::vc::fossil::import::cvs::configure {key value} { |
| 36 | 36 | variable nosign |
| 37 | 37 | variable stopat |
| 38 | 38 | |
| 39 | 39 | switch -exact -- $key { |
| 40 | 40 | -debugcommit { |
| | @@ -61,11 +61,11 @@ |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | # Import the CVS repository found at directory 'src' into the new |
| 64 | 64 | # fossil repository at 'dst'. |
| 65 | 65 | |
| 66 | | -proc ::import::cvs::run {src dst} { |
| 66 | +proc ::vc::fossil::import::cvs::run {src dst} { |
| 67 | 67 | variable stopat |
| 68 | 68 | |
| 69 | 69 | cvs::at $src ; # Define location of CVS repository |
| 70 | 70 | |
| 71 | 71 | cvs::scan ; # Gather revision data from the archives |
| | @@ -83,11 +83,11 @@ |
| 83 | 83 | |
| 84 | 84 | set ntrunk [cvs::ntrunk] ; set ntfmt %[string length $ntrunk]s |
| 85 | 85 | set nmax [cvs::ncsets] ; set nmfmt %[string length $nmax]s |
| 86 | 86 | |
| 87 | 87 | cvs::foreach_cset cset [cvs::root] { |
| 88 | | - ::vc::tools::log::write 0 import "ChangeSet [format $nmfmt $cset] @ [format $ntfmt $nto]/$ntrunk ([format %6.2f [expr {$nto*100.0/$ntrunk}]]%)" |
| 88 | + write 0 import "ChangeSet [format $nmfmt $cset] @ [format $ntfmt $nto]/$ntrunk ([format %6.2f [expr {$nto*100.0/$ntrunk}]]%)" |
| 89 | 89 | Statistics [OneChangeSet $cset] |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | write 0 import "========= [string repeat = 61]" |
| 93 | 93 | write 0 import "Imported $nto [expr {($nto == 1) ? "changeset" : "changesets"}]" |
| | @@ -102,11 +102,11 @@ |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | # ----------------------------------------------------------------------------- |
| 105 | 105 | # Internal operations - Import a single changeset. |
| 106 | 106 | |
| 107 | | -proc ::import::cvs::Statistics {sec} { |
| 107 | +proc ::vc::fossil::import::cvs::Statistics {sec} { |
| 108 | 108 | upvar 1 tot tot nto nto ntrunk ntrunk |
| 109 | 109 | |
| 110 | 110 | # No statistics if the commit was stopped before it was run |
| 111 | 111 | if {$sec eq ""} return |
| 112 | 112 | |
| | @@ -115,18 +115,18 @@ |
| 115 | 115 | set tot [expr {$tot + $sec}] |
| 116 | 116 | set avg [expr {$tot/$nto}] |
| 117 | 117 | set max [expr {$ntrunk * $avg}] |
| 118 | 118 | set rem [expr {$max - $tot}] |
| 119 | 119 | |
| 120 | | - ::vc::tools::log::write 3 import "st avg [format %.2f $avg] sec" |
| 121 | | - ::vc::tools::log::write 3 import "st run [format %7.2f $tot] sec [format %6.2f [expr {$tot/60}]] min [format %5.2f [expr {$tot/3600}]] hr" |
| 122 | | - ::vc::tools::log::write 3 import "st end [format %7.2f $max] sec [format %6.2f [expr {$max/60}]] min [format %5.2f [expr {$max/3600}]] hr" |
| 123 | | - ::vc::tools::log::write 3 import "st rem [format %7.2f $rem] sec [format %6.2f [expr {$rem/60}]] min [format %5.2f [expr {$rem/3600}]] hr" |
| 120 | + write 3 import "st avg [format %.2f $avg] sec" |
| 121 | + write 3 import "st run [format %7.2f $tot] sec [format %6.2f [expr {$tot/60}]] min [format %5.2f [expr {$tot/3600}]] hr" |
| 122 | + write 3 import "st end [format %7.2f $max] sec [format %6.2f [expr {$max/60}]] min [format %5.2f [expr {$max/3600}]] hr" |
| 123 | + write 3 import "st rem [format %7.2f $rem] sec [format %6.2f [expr {$rem/60}]] min [format %5.2f [expr {$rem/3600}]] hr" |
| 124 | 124 | return |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | | -proc ::import::cvs::OneChangeSet {cset} { |
| 127 | +proc ::vc::fossil::import::cvs::OneChangeSet {cset} { |
| 128 | 128 | variable nosign |
| 129 | 129 | variable stopat |
| 130 | 130 | |
| 131 | 131 | if {$stopat == $cset} { |
| 132 | 132 | fossil::commit 1 cvs2fossil $nosign \ |
| | @@ -143,24 +143,26 @@ |
| 143 | 143 | } 1] 0] |
| 144 | 144 | cvs::uuid $cset $uuid |
| 145 | 145 | |
| 146 | 146 | set sec [expr {$usec/1e6}] |
| 147 | 147 | |
| 148 | | - ::vc::tools::log::write 2 import "== $uuid +${ad}-${rm}*${ch}" |
| 149 | | - ::vc::tools::log::write 2 import "st in [format %.2f $sec] sec" |
| 148 | + write 2 import "== $uuid +${ad}-${rm}*${ch}" |
| 149 | + write 2 import "st in [format %.2f $sec] sec" |
| 150 | 150 | |
| 151 | 151 | return $sec |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | # ----------------------------------------------------------------------------- |
| 155 | 155 | |
| 156 | | -namespace eval ::import::cvs { |
| 156 | +namespace eval ::vc::fossil::import::cvs { |
| 157 | 157 | variable debugcommit 0 ; # Debug the commit operation. |
| 158 | 158 | variable nosign 0 ; # Require signing |
| 159 | 159 | variable stopat {} ; # Stop nowhere |
| 160 | + |
| 161 | + namespace export run configure |
| 160 | 162 | } |
| 161 | 163 | |
| 162 | 164 | # ----------------------------------------------------------------------------- |
| 163 | 165 | # Ready |
| 164 | 166 | |
| 165 | | -package provide import::cvs 1.0 |
| 167 | +package provide vc::fossil::import::cvs 1.0 |
| 166 | 168 | return |
| 167 | 169 | |