Diff
Not logged in

Differences From:

File tools/lib/importcvs.tcl part of check-in [18251642f3] - Moved the handling of the import statistics into its own package. Untested. by aku on 2007-09-14 23:23:48. [view]

To:

File tools/lib/importcvs.tcl part of check-in [b504674c5f] - Fixed problems with the untested statistics module. Moved cset <-> uuid map out of cvs to control layer, separate package. Currently not really useful, will be needed when handling cvs branches. Moved some user feedback around, and the import control too. by aku on 2007-09-15 03:18:31. [view]

@@ -6,17 +6,19 @@
 
 package require Tcl 8.4
 package require vc::cvs::ws               ; # Frontend, reading from source repository
 package require vc::fossil::ws            ; # Backend,  writing to destination repository.
-package require vc::tools::log            ; # User feedback
-package require vc::fossil::import::stats ; # Import Statistics
+package require vc::tools::log            ; # User feedback.
+package require vc::fossil::import::stats ; # Management for the Import Statistics.
+package require vc::fossil::import::map   ; # Management of the cset <-> uuid mapping.
 
 namespace eval ::vc::fossil::import::cvs {
     vc::tools::log::system import
     namespace import ::vc::tools::log::write
     namespace eval cvs    { namespace import ::vc::cvs::ws::* }
     namespace eval fossil { namespace import ::vc::fossil::ws::* }
     namespace eval stats  { namespace import ::vc::fossil::import::stats::* }
+    namespace eval map    { namespace import ::vc::fossil::import::map::* }
 
     fossil::configure -appname cvs2fossil
     fossil::configure -ignore  ::vc::cvs::ws::wsignore
 }
@@ -65,19 +67,20 @@
 
     write 0 import {Begin conversion}
     write 0 import {Setting up workspaces}
 
+    #B map::set {} {}
     cvs::workspace      ; # cd's to workspace
     fossil::begin [pwd] ; # Uses cwd as workspace to connect to.
     stats::setup [cvs::ntrunk] [cvs::ncsets]
 
     cvs::foreach_cset cset [cvs::root] {
-	OneChangeSet $cset
+	Import1 $cset
     }
 
     stats::done
     cvs::wsclear
-    fossil::close $dst
+    fossil::done $dst
 
     write 0 import Ok.
     return
 }
@@ -84,21 +87,30 @@
 
 # -----------------------------------------------------------------------------
 # Internal operations - Import a single changeset.
 
-proc ::vc::fossil::import::cvs::OneChangeSet {cset} {
+proc ::vc::fossil::import::cvs::Import1 {cset} {
     stats::csbegin $cset
 
-    set microseconds [lindex [time {
-	foreach {user message timestamp} [cvs::wssetup $cset] break
-	foreach {uuid ad rm ch} [fossil::commit $cset $user $timestamp $message] break
-    } 1] 0]
-    set seconds [expr {$microseconds/1e6}]
-
-    cvs::uuid $cset $uuid
-    write 2 import "== $uuid +${ad}-${rm}*${ch}"
+    set microseconds [lindex [time {ImportCS $cset} 1] 0]
+    set seconds      [expr {$microseconds/1e6}]
 
     stats::csend $seconds
+    return
+}
+
+proc ::vc::fossil::import::cvs::ImportCS {cset} {
+    #B fossil::setup [map::get [cvs::parentOf $cset]]
+    lassign [cvs::wssetup   $cset] user  timestamp  message
+    lassign [fossil::commit $cset $user $timestamp $message] uuid ad rm ch
+    write 2 import "== +${ad}-${rm}*${ch}"
+    map::set $cset $uuid
+    return
+}
+
+proc ::vc::fossil::import::cvs::lassign {l args} {
+    foreach v $args {upvar 1 $v $v}
+    foreach $args $l break
     return
 }
 
 # -----------------------------------------------------------------------------