Check-in [2740b48b63]
Not logged in
Overview

SHA1 Hash:2740b48b6323093e9abcb57e3bcc90d8dd503bac
Date: 2007-09-17 03:13:07
User: aku
Comment:Cleaned up the creation of the workspace directory.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified tools/lib/cvs.tcl from [57072982aa] to [ceb442330d].

@@ -68,34 +68,24 @@
     }
     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]]]
 
     # 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
 }
 
 proc ::vc::cvs::ws::foreach {cv script} {
@@ -223,10 +213,23 @@
     if {$state eq "dead"} {return "R"} ; # Removed
     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
 
 proc ::vc::cvs::ws::csets {} {
@@ -313,22 +316,10 @@
 
     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
 
@@ -391,18 +382,10 @@
 	}
     }
 
     # 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
     variable rtree
@@ -536,16 +519,17 @@
 }
 
 # -----------------------------------------------------------------------------
 
 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
 }
 
 # -----------------------------------------------------------------------------
 # Ready
 
 package provide vc::cvs::ws 1.0
 return