Diff
Not logged in

Differences From:

File tools/lib/importcvs.tcl part of check-in [86a7f249c1] - Started to restructure the namespace hierarchy, beginning at the bottom, with the log module. by aku on 2007-09-09 00:58:18. [view]

To:

File tools/lib/importcvs.tcl part of check-in [9671b65174] - Continued restructuring of the code (namespace hierarchy, import control). by aku on 2007-09-13 05:43:56. [view]

@@ -8,9 +8,9 @@
 package require cvs             ; # Frontend, reading from source repository
 package require fossil          ; # Backend,  writing to destination repository.
 package require vc::tools::log  ; # User feedback
 
-namespace eval ::import::cvs {
+namespace eval ::vc::fossil::import::cvs {
     vc::tools::log::system import
     namespace import ::vc::tools::log::write
 }
 
@@ -18,22 +18,22 @@
 # API
 
 # Configuration
 #
-#	import::cvs::configure key value - Set configuration
+#	vc::fossil::import::cvs::configure key value - Set configuration
 #
 #	Legal keys:	-nosign		<bool>, default false
 #			-debugcommit	<bool>, default false
 #			-stopat		<int>,  default :none:
 #
 # Functionality
 #
-#	import::cvs::run src dst         - Perform an import.
+#	vc::fossil::import::cvs::run src dst         - Perform an import.
 
 # -----------------------------------------------------------------------------
 # API Implementation - Functionality
 
-proc ::import::cvs::configure {key value} {
+proc ::vc::fossil::import::cvs::configure {key value} {
     variable nosign
     variable stopat
 
     switch -exact -- $key {
@@ -62,9 +62,9 @@
 
 # Import the CVS repository found at directory 'src' into the new
 # fossil repository at 'dst'.
 
-proc ::import::cvs::run {src dst} {
+proc ::vc::fossil::import::cvs::run {src dst} {
     variable stopat
 
     cvs::at       $src  ; # Define location of CVS repository
 
@@ -84,9 +84,9 @@
     set ntrunk [cvs::ntrunk] ; set ntfmt %[string length $ntrunk]s
     set nmax   [cvs::ncsets] ; set nmfmt %[string length $nmax]s
 
     cvs::foreach_cset cset [cvs::root] {
-	::vc::tools::log::write 0 import "ChangeSet [format $nmfmt $cset] @ [format $ntfmt $nto]/$ntrunk ([format %6.2f [expr {$nto*100.0/$ntrunk}]]%)"
+	write 0 import "ChangeSet [format $nmfmt $cset] @ [format $ntfmt $nto]/$ntrunk ([format %6.2f [expr {$nto*100.0/$ntrunk}]]%)"
 	Statistics [OneChangeSet $cset]
     }
 
     write 0 import "========= [string repeat = 61]"
@@ -103,9 +103,9 @@
 
 # -----------------------------------------------------------------------------
 # Internal operations - Import a single changeset.
 
-proc ::import::cvs::Statistics {sec} {
+proc ::vc::fossil::import::cvs::Statistics {sec} {
     upvar 1 tot tot nto nto ntrunk ntrunk
 
     # No statistics if the commit was stopped before it was run
     if {$sec eq ""} return
@@ -116,16 +116,16 @@
     set avg [expr {$tot/$nto}]
     set max [expr {$ntrunk * $avg}]
     set rem [expr {$max - $tot}]
 
-    ::vc::tools::log::write 3 import "st avg [format %.2f $avg] sec"
-    ::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"
-    ::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"
-    ::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"
+    write 3 import "st avg [format %.2f $avg] sec"
+    write 3 import "st run [format %7.2f $tot] sec [format %6.2f [expr {$tot/60}]] min [format %5.2f [expr {$tot/3600}]] hr"
+    write 3 import "st end [format %7.2f $max] sec [format %6.2f [expr {$max/60}]] min [format %5.2f [expr {$max/3600}]] hr"
+    write 3 import "st rem [format %7.2f $rem] sec [format %6.2f [expr {$rem/60}]] min [format %5.2f [expr {$rem/3600}]] hr"
     return
 }
 
-proc ::import::cvs::OneChangeSet {cset} {
+proc ::vc::fossil::import::cvs::OneChangeSet {cset} {
     variable nosign
     variable stopat
 
     if {$stopat == $cset} {
@@ -144,23 +144,25 @@
     cvs::uuid $cset $uuid
 
     set sec [expr {$usec/1e6}]
 
-    ::vc::tools::log::write 2 import "== $uuid +${ad}-${rm}*${ch}"
-    ::vc::tools::log::write 2 import "st in  [format %.2f $sec] sec"
+    write 2 import "== $uuid +${ad}-${rm}*${ch}"
+    write 2 import "st in  [format %.2f $sec] sec"
 
     return $sec
 }
 
 # -----------------------------------------------------------------------------
 
-namespace eval ::import::cvs {
+namespace eval ::vc::fossil::import::cvs {
     variable debugcommit 0  ; # Debug the commit operation.
     variable nosign      0  ; # Require signing
     variable stopat      {} ; # Stop nowhere
+
+    namespace export run configure
 }
 
 # -----------------------------------------------------------------------------
 # Ready
 
-package provide import::cvs 1.0
+package provide vc::fossil::import::cvs 1.0
 return