fixed (hopefully) creation of new package dirs
authorClaus Gittinger <cg@exept.de>
Tue, 18 Jan 2000 21:11:16 +0100
changeset 885 f0a7be47b53a
parent 884 21edcec092e1
child 886 401f915dd118
fixed (hopefully) creation of new package dirs (no longer creates wrong duplicated subdir) and removal (under windows)
CVSSourceCodeManager.st
--- a/CVSSourceCodeManager.st	Tue Jan 18 09:47:31 2000 +0100
+++ b/CVSSourceCodeManager.st	Tue Jan 18 21:11:16 2000 +0100
@@ -377,15 +377,15 @@
 
 !CVSSourceCodeManager class methodsFor:'private'!
 
-checkOut:relativeFilename in:tempdir
+checkOut:relativeFilename module:moduleDir in:tempdir
     "checkout realtiveFilename in tempdir"
 
     |cmd|
 
-    cmd := 'checkout -l ' , relativeFilename name.
+    cmd := 'checkout -l ' , relativeFilename.
     ^ self 
         executeCVSCommand:cmd 
-        module:''
+        module:moduleDir
         inDirectory:tempdir name
         log:false
 
@@ -394,7 +394,8 @@
       self checkOut:'stx/libbasic/Integer.st' asFilename in:'/tmp' asFilename
     "
 
-    "Created: / 23.7.1999 / 19:19:34 / stefan"
+    "Created: / 18.1.2000 / 20:30:01 / cg"
+    "Modified: / 18.1.2000 / 20:35:06 / cg"
 !
 
 checkinTroubleDialog:title message:message log:log abortable:abortable option:optionTitle
@@ -540,11 +541,28 @@
      the whole tree. If the file is not present, we will create it.
      Return the name of a temporary directory containing the package"
 
-    |dummyName path absolutePath tempdir|
-
-    dummyName := '.stxCvsDummy'.
-
-    path := (moduleDir asFilename construct:packageDir) construct:dummyName.
+    ^ self
+        createLocalDirectory:packageDir 
+        inModule:moduleDir 
+        with:'.stxCvsDummy'
+
+    "
+     self createLocalDirectory:'libbasic' inModule:'stx'
+    "
+
+    "Created: / 23.7.1999 / 19:14:28 / stefan"
+    "Modified: / 26.7.1999 / 17:43:35 / stefan"
+    "Modified: / 18.1.2000 / 20:56:19 / cg"
+!
+
+createLocalDirectory:packageDir inModule:moduleDir with:fileToCheckout
+    "create a local working directory for module/package, and checkout the
+     given file there.
+     Return the name of a temporary directory containing the package, or nil"
+
+    |path absolutePath tempdir unixPath|
+
+    path := (moduleDir asFilename construct:packageDir) construct:fileToCheckout.
 
     tempdir := self createTempDirectory:nil forModule:nil.
     tempdir isNil ifTrue:[
@@ -552,7 +570,16 @@
         ^ nil
     ].
 
-    (self checkOut:path in:tempdir) ifFalse:[
+    OperatingSystem isUNIXlike ifTrue:[
+        unixPath := path.
+    ] ifFalse:[
+        OperatingSystem isVMSlike ifTrue:[
+            self halt:'fixme'
+        ].
+        unixPath := path name copy replaceAll:$\ with:$/
+    ].
+
+    (self checkOut:unixPath module:moduleDir in:tempdir) ifFalse:[
         "dummy file does not exist, so create it"
         absolutePath := tempdir construct:path.
         absolutePath directory recursiveMakeDirectory.
@@ -570,7 +597,7 @@
         (tempdir construct:moduleDir) recursiveRemove.
 
         "checkout the dummy, the intermediate directories will be created"
-        (self checkOut:path in:tempdir) ifFalse:[
+        (self checkOut:unixPath module:moduleDir in:tempdir) ifFalse:[
             ('CVSSourceCodeManager [error]: cannot create working dir') errorPrintCR.
             tempdir recursiveRemove.
             ^ nil.
@@ -583,8 +610,9 @@
      self createLocalDirectory:'libbasic' inModule:'stx'
     "
 
-    "Created: / 23.7.1999 / 19:14:28 / stefan"
     "Modified: / 26.7.1999 / 17:43:35 / stefan"
+    "Created: / 18.1.2000 / 20:55:52 / cg"
+    "Modified: / 18.1.2000 / 20:56:45 / cg"
 !
 
 createTempDirectory:packageDir forModule:moduleDir
@@ -736,16 +764,15 @@
     "Modified: / 20.5.1998 / 16:30:12 / cg"
 !
 
-import:repository in:tempdir
+import:moduleDir in:tempdir
     "import the existing tree in tempdir as repository"
 
     |cmd|
 
-    cmd := 'import -m "checkin from stx browser" ', 
-           repository, ' initialV initialR'.
+    cmd := 'import -m "checkin from stx browser" . initialV initialR'.
     ^ self 
         executeCVSCommand:cmd 
-        module:''
+        module:moduleDir
         inDirectory:tempdir name
         log:false
 
@@ -761,6 +788,7 @@
 
     "Created: / 23.7.1999 / 19:19:34 / stefan"
     "Modified: / 26.7.1999 / 17:46:29 / stefan"
+    "Modified: / 18.1.2000 / 20:21:32 / cg"
 !
 
 releaseAndRemove:tempdir module:moduleDir outputTo:outputFilename
@@ -2154,13 +2182,14 @@
     "/
     "/ then import it into CVS
     "/
+self halt.
 
     relativePath := moduleDirName asFilename constructString:packageDirName.
-    cmd := 'import -m "created from browser" ' , relativePath, ' initialV initialR > ' , cmdOut name.
+    cmd := 'import -m "created from browser" . initialV initialR > ' , cmdOut name.
     (self 
         executeCVSCommand:cmd 
         module:moduleDirName
-        inDirectory:tempdir name
+        inDirectory:moduleDir name
     ) ifFalse:[
         'CVSSourceCodeManager [error]: failed to execute: ' errorPrint. cmd errorPrintCR.
 
@@ -2179,8 +2208,8 @@
     "
 
     "Created: / 9.12.1995 / 20:09:33 / cg"
-    "Modified: / 6.6.1998 / 16:15:46 / cg"
     "Modified: / 23.7.1999 / 18:40:49 / stefan"
+    "Modified: / 18.1.2000 / 20:14:01 / cg"
 !
 
 getExistingContainersInModule:aModule package:aPackage
@@ -2499,45 +2528,15 @@
 
     |fullName tempdir checkoutName cmdOut cmd tempFile whatHappened|
 
-    "/
-    "/ first, create a temporary work tree
-    "/
-    tempdir := self createTempDirectory:packageDir forModule:moduleDir.
-    tempdir isNil ifTrue:[
-        ('CVSSourceCodeManager [error]: no tempDir - cannot remove container') errorPrintCR.
-        ^ nil.
-    ].
-
-    cmdOut := Filename newTemporary.
-    cmdOut exists ifTrue:[
-        cmdOut remove.
-    ].
-
     fullName := moduleDir , '/' , packageDir , '/' , fileName.
-
-    "/
-    "/ first, check out everything there - this creates the CVS helpfiles
-    "/ required later.
-    "/
     checkoutName :=  moduleDir , '/' , packageDir.
 
-    self activityNotification:'checking for directory ' , checkoutName.
-
-    cmd := 'checkout -l ' , checkoutName , ' > ' , cmdOut name.
-    (self 
-        executeCVSCommand:cmd 
-        module:moduleDir
-        inDirectory:tempdir name
-        log:false
-    ) ifFalse:[
-        'CVSSourceCodeManager [error]: failed to execute: ' errorPrint. cmd errorPrintCR.
-
-        cmdOut remove.
+    (tempdir := self createLocalDirectory:packageDir inModule:moduleDir with:fileName) isNil ifTrue:[
+        'CVSSourceCodeManager [error]: failed to checkout: ' errorPrint. checkoutName errorPrintCR.
         tempdir recursiveRemove.
         ('CVSSourceCodeManager [error]: cannot checkout ' , checkoutName) errorPrintCR.
         ^ false.
     ].
-    cmdOut remove.
 
     "/
     "/ and remove it to the repository
@@ -2554,7 +2553,14 @@
         ^ false
     ].
 
-    tempFile renameTo:(tempFile withSuffix:'sav').
+    tempFile exists ifTrue:[
+        tempFile remove.
+    ].
+
+    cmdOut := Filename newTemporary.
+    cmdOut exists ifTrue:[
+        cmdOut remove.
+    ].
 
     cmd := 'remove ' , fileName , ' > ' , cmdOut name.
     (self 
@@ -2615,7 +2621,7 @@
     "
 
     "Modified: / 26.2.1998 / 17:33:57 / stefan"
-    "Modified: / 6.6.1998 / 16:17:05 / cg"
+    "Modified: / 18.1.2000 / 21:02:30 / cg"
 !
 
 reportHistoryLogSince:timeGoal filterSTSources:filter filterUser:userFilter filterRepository:filterRep inTo:aBlock
@@ -3011,6 +3017,6 @@
 !CVSSourceCodeManager class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/CVSSourceCodeManager.st,v 1.207 1999-12-29 15:31:03 ps Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/CVSSourceCodeManager.st,v 1.208 2000-01-18 20:11:16 cg Exp $'
 ! !
 CVSSourceCodeManager initialize!