Diff
Not logged in

Differences From:

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]

To:

File tools/lib/importcvs.tcl part of check-in [d8c18fc148] - Reworked the CVS handling code to have a simpler API, more like the reworked Fossil API. The API now has a form where adding the handling of branches should not require complex changes in the import controller any longer. Extended the system to allow the user to restrict the importing to a sub-directory of the chosen repository, via the new switch --project. This is required to pull a SF CVS repository apart into the various projects it may have. Example: Under Tcl we have 3 projects, namely Tcl itself, sampleextension, and Thread. by aku on 2007-09-17 00:56:40. [view]

@@ -19,9 +19,9 @@
     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
+    fossil::configure -ignore  ::vc::cvs::ws::isadmin
 }
 
 # -----------------------------------------------------------------------------
 # API
@@ -29,11 +29,12 @@
 # Configuration
 #
 #	vc::fossil::import::cvs::configure key value - Set configuration
 #
-#	Legal keys:	-nosign		<bool>, default false
-#			-breakat	<int>,  default :none:
-#			-saveto		<path>, default :none:
+#       Legal keys:     -nosign  <bool>, default false
+#                       -breakat <int>,  default :none:
+#                       -saveto  <path>, default :none:
+#                       -limit   <path>, default :none:
 #
 # Functionality
 #
 #	vc::fossil::import::cvs::run src dst         - Perform an import.
@@ -46,8 +47,9 @@
     # backend.
     switch -exact -- $key {
 	-breakat { fossil::configure -breakat $value }
 	-nosign  { fossil::configure -nosign  $value }
+	-project { cvs::configure    -project $value }
 	-saveto  { fossil::configure -saveto  $value }
 	default {
 	    return -code error "Unknown switch $key, expected one of \
                                    -breakat, -nosign, or -saveto"
@@ -59,28 +61,24 @@
 # Import the CVS repository found at directory 'src' into the new
 # fossil repository at 'dst'.
 
 proc ::vc::fossil::import::cvs::run {src dst} {
-    cvs::at $src  ; # Define location of CVS repository
-    cvs::scan     ; # Gather revision data from the archives
-    cvs::csets    ; # Group changes into sets
-    cvs::rtree    ; # Build revision tree (trunk only right now).
-
-    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] {
+
+    set src [file normalize $src]
+    set dst [file normalize $dst]
+
+    set ws [cvs::begin $src]
+    fossil::begin $ws
+    stats::setup [cvs::ncsets -import] [cvs::ncsets]
+
+    cvs::foreach cset {
 	Import1 $cset
     }
 
     stats::done
-    cvs::wsclear
     fossil::done $dst
+    cvs::done
 
     write 0 import Ok.
     return
 }
@@ -99,9 +97,9 @@
 }
 
 proc ::vc::fossil::import::cvs::ImportCS {cset} {
     #B fossil::setup [map::get [cvs::parentOf $cset]]
-    lassign [cvs::wssetup   $cset] user  timestamp  message
+    lassign [cvs::checkout  $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