CVSSourceCodeManager.st
changeset 1778 5c84a32c9fe4
parent 1736 2c44d15f1a0f
child 1779 ded4528d9ac1
--- a/CVSSourceCodeManager.st	Tue Aug 29 13:21:43 2006 +0200
+++ b/CVSSourceCodeManager.st	Tue Aug 29 13:21:47 2006 +0200
@@ -661,10 +661,6 @@
     path := (moduleDir asFilename construct:packageDir) construct:fileToCheckout.
 
     tempdir := self createTempDirectory:nil forModule:nil.
-    tempdir isNil ifTrue:[
-        ('CVSSourceCodeManager [error]: no tempDir - cannot checkout') errorPrintCR.
-        ^ nil
-    ].
 
     [
         OperatingSystem isUNIXlike ifTrue:[
@@ -732,9 +728,9 @@
      self createLocalDirectory:'libbasic' inModule:'stx'
     "
 
-    "Modified: / 26.7.1999 / 17:43:35 / stefan"
-    "Created: / 18.1.2000 / 20:55:52 / cg"
-    "Modified: / 18.1.2000 / 20:56:45 / cg"
+    "Modified: / 26-07-1999 / 17:43:35 / stefan"
+    "Created: / 18-01-2000 / 20:55:52 / cg"
+    "Modified: / 29-08-2006 / 13:17:32 / cg"
 !
 
 createTempDirectory:packageDir forModule:moduleDir
@@ -748,7 +744,7 @@
         tempdir recursiveRemove.
     ].
     OperatingSystem errorSignal handle:[:ex |
-        'SourceCodemanager [error]: cannot create temporary directory' errorPrintCR.
+        self reportError:('cannot create temporary directory').
         ^ nil.
     ] do:[
         tempdir makeDirectory.
@@ -763,8 +759,9 @@
             dir recursiveMakeDirectory.
         ].
         dir exists ifFalse:[
+            (tempdir construct:moduleDir) recursiveRemove.
             tempdir recursiveRemove.
-            'SourceCodemanager [error]: cannot create temporary directory' errorPrintCR.
+            self reportError:('cannot create temporary directory').
             ^ nil.
         ].
     ].
@@ -772,9 +769,9 @@
 
     "self createTempDirectory:'fooPackage' forModule:'fooModule'"
 
-    "Created: 9.12.1995 / 19:14:35 / cg"
-    "Modified: 19.12.1995 / 16:13:02 / stefan"
-    "Modified: 18.8.1997 / 19:06:52 / cg"
+    "Created: / 09-12-1995 / 19:14:35 / cg"
+    "Modified: / 19-12-1995 / 16:13:02 / stefan"
+    "Modified: / 29-08-2006 / 13:16:23 / cg"
 !
 
 cvsTimeString:absoluteTime
@@ -1295,10 +1292,6 @@
     "/ first, create a temporary work tree
     "/
     tempdir := self createTempDirectory:nil forModule:nil.
-    tempdir isNil ifTrue:[
-        ('CVSSourceCodeManager [error]: no tempDir - cannot checkin ' , containerFilename) errorPrintCR.
-        ^ false
-    ].
 
     "/
     "/ next, create CVS/Entries and CVS/Repository with version information of current version
@@ -1737,7 +1730,7 @@
     ].
     ^ true
 
-    "Modified: / 23-08-2006 / 14:15:18 / cg"
+    "Modified: / 29-08-2006 / 13:17:10 / cg"
 !
 
 checkinClass:cls fileName:classFileName directory:packageDir module:moduleDir source:sourceFileName logMessage:logMessage force:forceArg
@@ -1757,11 +1750,11 @@
 
     className := cls name.
     cls isPrivate ifTrue:[
-        self error:'refuse to check in private classes.'.
+        self reportError:'refuse to check in private classes.'.
+        ^ false.
     ].
     revision := cls revision.        
-    (revision notNil
-    and:[revision endsWith:$m]) 
+    (revision notNil and:[revision endsWith:$m]) 
     ifTrue:[
         "/ this class has already been checked in with a merge,
         "/ but not reloaded from the repository.
@@ -1794,7 +1787,7 @@
     ] ifFalse:[
         logMsg := logMessage asSingleByteStringIfPossible.
         logMsg bitsPerCharacter ~~ 8 ifTrue:[
-            'CVSSourceCodeManager [error]: cvs cannot handle unicode in logMessage' errorPrintCR.
+            self reportError:'cvs cannot handle unicode in logMessage'.
             ^ false.
         ].    
     ].
@@ -1814,10 +1807,6 @@
     "/ first, create a temporary work tree
     "/
     tempdir := self createTempDirectory:nil forModule:nil.
-    tempdir isNil ifTrue:[
-        ('CVSSourceCodeManager [error]: no tempDir - cannot checkin ' , className) errorPrintCR.
-        ^ false
-    ].
 
     "/
     "/ next, create CVS/Entries and CVS/Repository with version information of current version
@@ -1843,7 +1832,7 @@
     "/
     Error handle:[:ex|
         tempdir recursiveRemove.
-        'CVSSourceCodeManager [error]: cannot copy-over filedOut class source' errorPrintCR.
+        self reportError:'cannot copy-over filedOut class source'.
         ^ false.
     ] do:[
         sourceFileName asFilename copyTo:(tempdir construct:checkoutName).
@@ -1888,8 +1877,7 @@
                 ].
             ].
 
-            'CVSSourceCodeManager [error]: failed to execute: ' errorPrint. cmd errorPrintCR.
-            'CVSSourceCodeManager [error]: cannot merge current source with repository version' errorPrintCR.
+            self reportError:('cannot merge current source with repository version (failed to execute: ',cmd,')').
             ^ false.
         ].
     ] ifTrue:[
@@ -2057,8 +2045,8 @@
                             label:'merged version'.
                             
                     ].
-                    Transcript showCR:'checkin aborted - (no merge; repository unchanged)'.
                     tempdir recursiveRemove.
+                    self reportError:'checkin aborted - (no merge; repository unchanged)'.
                     ^ false.
                 ].
             ].
@@ -2223,9 +2211,9 @@
                     Transcript showCR:'checking in ' , className , ' (manually repaired version)...'
                 ].
             ] ifFalse:[
-                'CVSSourceCodeManager [warning]: cannot (for now) checkin; conflicts found' infoPrintCR.
                 Transcript showCR:'checkin of ' , className , ' aborted (conflicting changes; repository unchanged)'.
                 tempdir recursiveRemove.
+                self reportError:'checkin of ' , className , ' aborted (conflicting changes; repository unchanged)'.
                 ^ false.
             ]
         ] ifFalse:[
@@ -2248,8 +2236,8 @@
 ' , whatHappened , '
 
 No checkin performed.'.
-                Transcript showCR:'*** cannot checkin ' , className , ' (unexpected CVS response; repository unchanged)'.
                 tempdir recursiveRemove.
+                self reportError:'*** cannot checkin ' , className , ' (unexpected CVS response; repository unchanged)'.
                 ^ false.
             ]
         ]
@@ -2296,10 +2284,10 @@
 
 The class has NOT been checked into the repository.'.
 
-       'CVSSourceCodeManager [error]: cannot checkin modified class source' errorPrintCR.
         logTmp notNil ifTrue:[logTmp remove].
         cmdOut remove.
         tempdir recursiveRemove.
+        self reportError:'cannot checkin modified class source'.
         ^ false.
     ].
     logTmp notNil ifTrue:[logTmp remove].
@@ -2388,7 +2376,7 @@
 
     "Created: / 11-09-1996 / 16:16:11 / cg"
     "Modified: / 26-02-1998 / 17:34:16 / stefan"
-    "Modified: / 23-08-2006 / 13:55:16 / cg"
+    "Modified: / 29-08-2006 / 13:17:18 / cg"
 !
 
 checkoutModule:aModule directory:aPackage andDo:aBlock
@@ -2411,10 +2399,6 @@
     self activityNotification:'checking out everything in ' , dirName , ' ...'.
 
     tempdir := self createTempDirectory:nil forModule:nil.
-    tempdir isNil ifTrue:[
-        ('CVSSourceCodeManager [error]: no tempDir - cannot checkout') errorPrintCR.
-        ^ false
-    ].
 
     cmd := 'checkout ', dirName.
     OperatingSystem isUNIXlike ifTrue:[
@@ -2431,9 +2415,9 @@
         module:aModule
         inDirectory:tempdir name
     ) ifFalse:[
-        'CVSSourceCodeManager [error]: failed to execute: ' errorPrint. cmd errorPrintCR.
         cmdOut notNil ifTrue:[cmdOut remove].
         tempdir recursiveRemove.
+        self reportError:'failed to execute: ',cmd.
         ^ false
     ].
 
@@ -2444,8 +2428,8 @@
 
     packageDir := (tempdir construct:dirName).
     (packageDir isDirectory) ifFalse:[
-        'CVSSourceCodeManager [error]: checkout failed (no dir)' errorPrintCR.
         tempdir recursiveRemove.
+        self reportError:'checkout failed (no dir)'.
         ^ false
     ].
 
@@ -2459,6 +2443,7 @@
     ^ true
 
     "Created: / 23-08-2006 / 14:07:05 / cg"
+    "Modified: / 29-08-2006 / 13:17:24 / cg"
 !
 
 streamForClass:cls fileName:fileName revision:revision directory:packageDir module:moduleDir cache:cacheItArg
@@ -2469,7 +2454,7 @@
      to validate the correct container against the class.
      To check out a file (i.e. not a classes file), leave it nil."
 
-    |dir cachedSourceFilename cachedFile cmd fullName revisionArg stream
+    |cacheDir cacheSubDir cachedSourceFilename cachedFile cmd fullName revisionArg stream
      checkoutName checkoutNameLocal fullTempName fullCachedName tempdir cmdOut
      classFileName cvsRoot tempFile revMsg cacheIt|
 
@@ -2493,7 +2478,7 @@
     "/
 
     revision ~~ #newest ifTrue:[
-        (dir := self sourceCacheDirectory) isNil ifTrue:[
+        (cacheDir := self sourceCacheDirectory) isNil ifTrue:[
             'CVSSourceCodeManager [warning]: no source cache directory' errorPrintCR.
         ]
     ].
@@ -2518,16 +2503,16 @@
         cachedSourceFilename := classFileName , '_' , revision.
     ].
 
-    dir notNil ifTrue:[
-        cachedFile := dir construct:cachedSourceFilename.
-        cachedFile exists ifTrue:[
-"/            cachedFile fileSize < 10 ifTrue:[
-"/                ('CVSSourceCodeManager [warning]: existing: ', cachedFile name , ' seems corrupted.') errorPrintCR.
-"/                cachedFile remove
-"/            ] ifFalse:[
-"/            ('CVSSourceCodeManager [info]: found existing: ', cachedFile name) infoPrintCR.
-                ^ cachedFile readStream
-"/            ]
+    cacheDir notNil ifTrue:[
+        cacheSubDir := cacheDir construct:moduleDir.
+        cacheSubDir exists ifTrue:[
+            cacheSubDir := cacheSubDir construct:packageDir.
+            cacheSubDir exists ifTrue:[
+                cachedFile := cacheSubDir construct:cachedSourceFilename.
+                cachedFile exists ifTrue:[
+                    ^ cachedFile readStream
+                ].
+            ].
         ].
     ].
 
@@ -2536,10 +2521,6 @@
     "/ Do not make module and package directories, their existence cause cvs checkout to fail in server mode
     "/
     tempdir := self createTempDirectory:nil forModule:nil.
-    tempdir isNil ifTrue:[
-        ('CVSSourceCodeManager [error]: no tempDir - cannot checkout ' , classFileName) errorPrintCR.
-        ^ nil
-    ].
 
 "/    tempdir := Filename newTemporaryIn:nil.
 "/    tempdir exists ifTrue:[
@@ -2595,17 +2576,16 @@
         tempdir recursiveRemove.
         ('CVSSourceCodeManager [error]: cannot checkout ' , checkoutName) errorPrintCR.
 
-false ifTrue:[
-        "/ see if there is CVS access at all ...
-        (self checkForExistingModule:moduleDir) ifFalse:[
-            "/ disable
-            DisabledModules isNil ifTrue:[
-                DisabledModules := Set new.
-            ].
-            DisabledModules add:moduleDir.
-            ('CVSSourceCodeManager [warning]: disabled repository access for module ' , moduleDir) errorPrintCR.
-        ].
-].
+"/        "/ see if there is CVS access at all ...
+"/        (self checkForExistingModule:moduleDir) ifFalse:[
+"/            "/ disable
+"/            DisabledModules isNil ifTrue:[
+"/                DisabledModules := Set new.
+"/            ].
+"/            DisabledModules add:moduleDir.
+"/            ('CVSSourceCodeManager [warning]: disabled repository access for module ' , moduleDir) errorPrintCR.
+"/        ].
+
         ^ nil.
     ].
 
@@ -2614,7 +2594,8 @@
     CacheDirectoryName isNil ifTrue:[
         cacheIt := false
     ] ifFalse:[
-        fullCachedName := CacheDirectoryName asFilename constructString:cachedSourceFilename.
+        cacheSubDir recursiveMakeDirectory.
+        fullCachedName := cacheSubDir constructString:cachedSourceFilename.
     ].
     fullTempName exists ifFalse:[
         ('CVSSourceCodeManager [error]: failed to checkout ', fullTempName pathName, ' (file does not exist after cvs co)') errorPrintCR.
@@ -2655,9 +2636,9 @@
     self releaseAndRemove:tempdir module:moduleDir outputTo:nil. 
     ^ stream
 
-    "Created: / 4.11.1995 / 19:46:20 / cg"
-    "Modified: / 20.8.1997 / 16:37:11 / stefan"
-    "Modified: / 23.8.2001 / 12:28:59 / cg"
+    "Created: / 04-11-1995 / 19:46:20 / cg"
+    "Modified: / 20-08-1997 / 16:37:11 / stefan"
+    "Modified: / 29-08-2006 / 13:18:05 / cg"
 ! !
 
 !CVSSourceCodeManager class methodsFor:'source code administration'!
@@ -3255,10 +3236,6 @@
     "/ first, create a temporary work tree
     "/
     tempdir := self createTempDirectory:nil forModule:moduleName.
-    tempdir isNil ifTrue:[
-        ('CVSSourceCodeManager [error]: no tempDir - cannot create moduleDirectory') errorPrintCR.
-        ^ false
-    ].
 
     cmdOut := Filename newTemporary.
     cmdOut exists ifTrue:[
@@ -3297,9 +3274,9 @@
     cmdOut remove.
     ^ true
 
-    "Created: / 9.12.1995 / 19:53:51 / cg"
-    "Modified: / 7.1.1998 / 14:18:57 / stefan"
-    "Modified: / 6.6.1998 / 16:15:34 / cg"
+    "Created: / 09-12-1995 / 19:53:51 / cg"
+    "Modified: / 07-01-1998 / 14:18:57 / stefan"
+    "Modified: / 29-08-2006 / 13:17:37 / cg"
 !
 
 createModule:moduleDirName directory:packageDirName
@@ -3327,10 +3304,6 @@
     "/ first, create a temporary work tree
     "/
     tempdir := self createTempDirectory:packageDirName forModule:moduleDirName.
-    tempdir isNil ifTrue:[
-        ('CVSSourceCodeManager [error]: no tempDir - cannot create moduleDirectory') errorPrintCR.
-        ^ false
-    ].
 
     cmdOut := Filename newTemporary.
     cmdOut exists ifTrue:[
@@ -3388,6 +3361,7 @@
 
     "Modified: / 23-07-1999 / 18:40:49 / stefan"
     "Created: / 23-08-2006 / 14:04:39 / cg"
+    "Modified: / 29-08-2006 / 13:17:43 / cg"
 !
 
 deleteSymbolicName:symbolicName path:pathInRepository
@@ -3615,9 +3589,8 @@
     checkoutName :=  moduleDir , '/' , packageDir.
 
     (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.
+        self reportError:('cannot checkout ',checkoutName,' (cannot create local directory)').
         ^ false.
     ].
 
@@ -3631,8 +3604,8 @@
     "/
     tempFile := (tempdir construct:checkoutName) construct:fileName.
     tempFile exists ifFalse:[
-        'CVSSourceCodeManager [error]: temporary fileout failed' errorPrintCR.
         tempdir recursiveRemove.
+        self reportError:'temporary fileout failed'.
         ^ false
     ].
 
@@ -3651,11 +3624,10 @@
         module:moduleDir
         inDirectory:(tempdir constructString:checkoutName)
     ) ifFalse:[
-        'CVSSourceCodeManager [error]: failed to execute: ' errorPrint. cmd errorPrintCR.
-
         cmdOut remove.
         tempdir recursiveRemove.
-        ('CVSSourceCodeManager [error]: cannot remove ' , checkoutName) errorPrintCR.
+        'CVSSourceCodeManager [error]: failed to execute: ' errorPrint. cmd errorPrintCR.
+        self reportError:('cannot remove ',checkoutName).
         ^ false.
     ].
     cmdOut remove.
@@ -3684,9 +3656,9 @@
 
 The container has NOT been removed into the repository.'.
 
-       'CVSSourceCodeManager [error]: cannot remove container' errorPrintCR.
         cmdOut remove.
         tempdir recursiveRemove.
+        self reportError:'cannot remove container'.
         ^ false.
     ].
     cmdOut remove.
@@ -3703,8 +3675,8 @@
      CVSSourceCodeManager removeContainerInModule:'stx' package:'private' container:'WorldPO.st'
     "
 
-    "Modified: / 26.2.1998 / 17:33:57 / stefan"
-    "Modified: / 18.1.2000 / 21:02:30 / cg"
+    "Modified: / 26-02-1998 / 17:33:57 / stefan"
+    "Modified: / 29-08-2006 / 13:11:55 / cg"
 !
 
 reportHistoryLogSince:timeGoal filterSTSources:filter filterUser:userFilter filterRepository:filterRep filterModules:filterModules inTo:aBlock
@@ -3735,10 +3707,6 @@
     "/ against any info found in CVS/Root
 
     tempDir := self createTempDirectory:nil forModule:nil.
-    tempDir isNil ifTrue:[
-        ('CVSSourceCodeManager [error]: no tempDir - cannot extract log') errorPrintCR.
-        ^ nil.
-    ].
 
     roots do:[:eachCvsRoot |
         |root host cmd|
@@ -3866,8 +3834,8 @@
 
     tempDir recursiveRemove.
 
-    "Created: / 17.1.2001 / 13:11:20 / cg"
-    "Modified: / 17.1.2001 / 13:41:22 / cg"
+    "Created: / 17-01-2001 / 13:11:20 / cg"
+    "Modified: / 29-08-2006 / 13:17:50 / cg"
 !
 
 reportHistoryLogSince:timeGoal filterSTSources:filter filterUser:userFilter filterRepository:filterRep inTo:aBlock
@@ -3960,10 +3928,6 @@
 
     self use_rlog ifFalse:[
         tempDir := self createTempDirectory:nil forModule:nil.
-        tempDir isNil ifTrue:[
-            ('CVSSourceCodeManager [error]: no tempDir - cannot extract log') errorPrintCR.
-            ^ nil.
-        ].
     ].
 
     [
@@ -4126,9 +4090,9 @@
      SourceCodeManager revisionLogOf:Array fromRevision:0 toRevision:0  
     "
 
-    "Created: / 16.11.1995 / 13:25:30 / cg"
-    "Modified: / 29.1.1997 / 16:51:30 / stefan"
-    "Modified: / 27.8.1998 / 12:40:59 / cg"
+    "Created: / 16-11-1995 / 13:25:30 / cg"
+    "Modified: / 29-01-1997 / 16:51:30 / stefan"
+    "Modified: / 29-08-2006 / 13:17:55 / cg"
 !
 
 revisionLogOf:clsOrNil numberOfRevisions:numRevisions fileName:classFileName directory:packageDir module:moduleDir
@@ -4212,10 +4176,6 @@
     modulePath :=  moduleDir , '/' , packageDir. 
     fullName :=  modulePath , '/' , classFileName.
     tempDir := self createTempDirectory:nil forModule:nil.
-    tempDir isNil ifTrue:[
-        ('CVSSourceCodeManager [error]: no tempDir - cannot extract log') errorPrintCR.
-        ^ nil.
-    ].
 
     [
         self createEntryFor:fullName 
@@ -4294,7 +4254,7 @@
      SourceCodeManager statusOf:NewSystemBrowser fileName:'NewSystemBrowser.st' directory:'libtool' module:'stx'  
     "
 
-    "Modified: / 04-07-2006 / 17:46:22 / cg"
+    "Modified: / 29-08-2006 / 13:18:00 / cg"
 ! !
 
 !CVSSourceCodeManager class methodsFor:'testing'!
@@ -4308,7 +4268,7 @@
 !CVSSourceCodeManager class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/CVSSourceCodeManager.st,v 1.318 2006-08-25 17:42:16 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/CVSSourceCodeManager.st,v 1.319 2006-08-29 11:21:47 cg Exp $'
 ! !
 
 CVSSourceCodeManager initialize!