CVSSourceCodeManager.st
changeset 1832 e47ad13133b8
parent 1829 bc9065af3347
child 1839 68163810aa15
--- a/CVSSourceCodeManager.st	Fri Sep 29 16:01:30 2006 +0200
+++ b/CVSSourceCodeManager.st	Fri Sep 29 16:47:17 2006 +0200
@@ -904,7 +904,7 @@
      The doLog argument, if false supresses a logEntry to be added 
      in the cvs log file (used when reading / extracting history)"
 
-    |command cvsRoot rslt ok pathOfDir p|
+    |command cvsRoot rslt ok pathOfDir errorString|
 
     dirArg notNil ifTrue:[    
         pathOfDir := dirArg asFilename pathName.
@@ -932,29 +932,41 @@
         ok := rslt notNil.
     ] ifFalse:[
         Processor isDispatching ifFalse:[
-            rslt := ok := OperatingSystem executeCommand:command inDirectory:pathOfDir.
+            rslt := ok := OperatingSystem executeCommand:command errorTo:nil inDirectory:pathOfDir.
         ] ifTrue:[
             CVSCommandSemaphore critical:[
+                |p errOut|
+
+                errOut := WriteStream on:String new.
                 p := [
-                    rslt := ok := OperatingSystem executeCommand:command inDirectory:pathOfDir.
+                    rslt := ok := OperatingSystem executeCommand:command errorTo:errOut inDirectory:pathOfDir.
                 ] fork.
 
                 (p waitUntilTerminatedWithTimeout:300) ifTrue:[
                     ('CVSSourceCodeManager [info]: command timeout: ' , command) errorPrintCR.
-                    ^ false
-                ]. 
+                    ok := false.
+                    errorString := 'CVS command timeout'.
+                ] ifFalse:[
+                    ok ifFalse:[
+                        errorString := errOut contents.
+                    ].
+                ].
             ]. 
         ].
     ].
 
     ok ifFalse:[
         ('CVSSourceCodeManager [info]: command failed: ' , command) errorPrintCR.
+
+        SourceCodeManagerError isHandled ifTrue:[
+            SourceCodeManagerError raiseErrorString:(errorString ? 'CVS Error').
+        ].
     ].
     ^ rslt
 
     "Modified: / 23-04-1996 / 15:24:00 / stefan"
     "Created: / 20-05-1998 / 16:06:34 / cg"
-    "Modified: / 21-09-2006 / 16:39:31 / cg"
+    "Modified: / 29-09-2006 / 15:06:42 / cg"
 !
 
 getCVSROOTForModule:aModuleName
@@ -2363,7 +2375,7 @@
      Afterwards, the tempDir is removed.
      Return true, if OK, false if any error occurred."
 
-    |cvsRoot packageDir tempdir cmdOut cmd dirName|
+    |cvsRoot packageDir tempdir cmdOut cmd dirName rslt|
 
     cvsRoot := self getCVSROOTForModule:aModule.
     cvsRoot isNil ifTrue:[^ false ].
@@ -2388,15 +2400,13 @@
         cmd := cmd , ' > ', '"'  , cmdOut name, '"' .
     ].
 
-    (self 
-        executeCVSCommand:cmd 
-        module:aModule
-        inDirectory:tempdir name
-    ) ifFalse:[
-        cmdOut notNil ifTrue:[cmdOut remove].
-        tempdir recursiveRemove.
-        self reportError:'failed to execute: ',cmd.
-        ^ false
+    SourceCodeManagerError handle:[:ex |
+        self halt
+    ] do:[
+        rslt := self 
+            executeCVSCommand:cmd 
+            module:aModule
+            inDirectory:tempdir name.
     ].
 
     cmdOut notNil ifTrue:[
@@ -2405,9 +2415,9 @@
     ].
 
     packageDir := (tempdir construct:dirName).
-    (packageDir isDirectory) ifFalse:[
+    (packageDir exists and:[packageDir isDirectory]) ifFalse:[
         tempdir recursiveRemove.
-        self reportError:'checkout failed (no dir)'.
+        self reportError:(rslt ifTrue:['checkout failed (no dir)'] ifFalse:['failed to execute: ',cmd]).
         ^ false
     ].
 
@@ -2421,7 +2431,7 @@
     ^ true
 
     "Created: / 23-08-2006 / 14:07:05 / cg"
-    "Modified: / 29-08-2006 / 14:55:58 / cg"
+    "Modified: / 29-09-2006 / 15:26:13 / cg"
 !
 
 streamForClass:cls fileName:fileName revision:revision directory:packageDir module:moduleDir cache:cacheItArg
@@ -2749,9 +2759,9 @@
      CVSSourceCodeManager checkForExistingModule:'foo'   
     "
 
-    "Created: / 9.12.1995 / 19:13:37 / cg"
-    "Modified: / 1.3.1999 / 19:32:59 / cg"
-    "Modified: / 23.7.1999 / 17:38:59 / stefan"
+    "Created: / 09-12-1995 / 19:13:37 / cg"
+    "Modified: / 23-07-1999 / 17:38:59 / stefan"
+    "Modified: / 29-09-2006 / 15:04:53 / cg"
 !
 
 checkForExistingModule:moduleDir directory:directory
@@ -4368,7 +4378,7 @@
 !CVSSourceCodeManager class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/CVSSourceCodeManager.st,v 1.331 2006-09-26 12:01:15 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/CVSSourceCodeManager.st,v 1.332 2006-09-29 14:47:17 cg Exp $'
 ! !
 
 CVSSourceCodeManager initialize!