Diff
Not logged in

Differences From:

File tools/lib/cvs.tcl part of check-in [1593006ef3] - More structuring of the CVS backend, encapsulated the management of the global timeline of events in the project in a separate package. by aku on 2007-09-17 03:03:25. [view]

To:

File tools/lib/cvs.tcl part of check-in [2740b48b63] - Cleaned up the creation of the workspace directory. by aku on 2007-09-17 03:13:07. [view]

@@ -69,11 +69,8 @@
     return 1
 }
 
 proc ::vc::cvs::ws::begin {src} {
-    variable project
-
-    set src [file normalize $src]
     if {![check $src msg]} { return -code error $msg }
 
     DefBase $src
     MakeTimeline [ScanArchives [files::find [RootPath]]]
@@ -81,20 +78,13 @@
     # OLD api calls ... TODO rework for more structure ...
     csets    ; # Group changes into sets
     rtree    ; # Build revision tree (trunk only right now).
 
-    set w [workspace]   ; # OLD api ... TODO inline
-    if {$project ne ""} {
-	set w $w/$project
-	file mkdir $w
-    }
-    return $w
+    return [MakeWorkspace]
 }
 
 proc ::vc::cvs::ws::done {} {
-    variable cwd
-    variable workspace
-    cd $cwd
+    variable            workspace
     file delete -force $workspace
     return
 }
 
@@ -224,8 +214,21 @@
     if {$rev   eq "1.1"}  {return "A"} ; # Added
     return "M"                         ; # Modified
 }
 
+proc ::vc::cvs::ws::MakeWorkspace {} {
+    variable project
+    variable workspace [fileutil::tempfile importF_cvs_ws_]
+
+    set w $workspace
+    if {$project ne ""} { append w /$project }
+
+    file delete $workspace
+    file mkdir  $w
+
+    write 0 cvs "Workspace:  $workspace"
+    return $w
+}
 
 
 # Group single changes into changesets
 
@@ -314,20 +317,8 @@
     variable rtree {}
     variable ntrunk 0
 }
 
-proc ::vc::cvs::ws::workspace {} {
-    variable cwd [pwd]
-    variable workspace [fileutil::tempfile importF_cvs_ws_]
-    file delete $workspace
-    file mkdir  $workspace
-
-    write 0 cvs "Workspace:  $workspace"
-
-    cd     $workspace ; # Checkouts go here.
-    return $workspace
-}
-
 proc ::vc::cvs::ws::wssetup {c} {
     variable csets
     variable base
     variable project
@@ -392,16 +383,8 @@
     }
 
     # Provide metadata about the changeset the backend may wish to have
     return [list $u $s $cm]
-}
-
-namespace eval ::vc::cvs::ws {
-    # Workspace where checkouts happen
-    # Current working directory to go back to after the import.
-
-    variable workspace {}
-    variable cwd       {}
 }
 
 proc ::vc::cvs::ws::foreach_cset {cv node script} {
     upvar 1 $cv c
@@ -537,10 +520,11 @@
 
 # -----------------------------------------------------------------------------
 
 namespace eval ::vc::cvs::ws {
-    variable base    {} ; # Toplevel repository directory
-    variable project {} ; # Sub directory to limit the import to.
+    variable base      {} ; # Toplevel repository directory
+    variable project   {} ; # Sub directory to limit the import to.
+    variable workspace {} ; # Directory to checkout changesets to.
 
     namespace export configure begin done foreach ncsets checkout
 }