#REFACTORING by stefan
authorStefan Vogel <sv@exept.de>
Fri, 18 May 2018 14:54:53 +0200
changeset 4322 e01f3898946f
parent 4321 bd3d209082c3
child 4323 17876f7b5860
#REFACTORING by stefan class: CVSSourceCodeManager class added: #repositoryTopDirectoryFromSCMRoot removed: #repositoryTopDirectoryFromCVSRoot comment/format in: #checkForExistingContainer:inModule:directory: #checkin:text:directory:module:logMessage:force:onBranch: changed: #checkForExistingModule: #checkForExistingModule:directory: #checkinClass:fileName:directory:module:source:logMessage:force:asBranch: #diffListFor:fileName:directory:module:revision1:revision2:cache: #revisionsInModule:directory:fromDate: #revisionsInModule:directory:taggedAs: #statusOf:fileName:directory:module: fix undefined method (belongs to subclass ansd should be subclassResponsibility)
CVSSourceCodeManager.st
--- a/CVSSourceCodeManager.st	Fri May 18 04:27:28 2018 +0200
+++ b/CVSSourceCodeManager.st	Fri May 18 14:54:53 2018 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1995 by Claus Gittinger
               All Rights Reserved
@@ -1403,21 +1405,6 @@
     "Modified: / 3.9.1999 / 14:51:29 / ps"
 !
 
-repositoryTopDirectoryFromCVSRoot
-    "return the top of the repository. This handles remote CVS connections
-     as well"
-
-    CVSRoot isNil ifTrue:[^ nil].
-    ^ self repositoryTopDirectoryFromCVSRoot:CVSRoot.
-
-    "
-     CVSSourceCodeManager repositoryTopDirectory
-    "
-
-    "Modified: / 16-01-1998 / 17:33:31 / stefan"
-    "Created: / 21-06-2006 / 12:06:18 / cg"
-!
-
 repositoryTopDirectoryFromCVSRoot:aString
     "return the top of the repository (without remote prefix)"
 
@@ -1439,6 +1426,20 @@
     "Created: / 21-06-2006 / 12:05:53 / cg"
 !
 
+repositoryTopDirectoryFromSCMRoot
+    "return the top of the repository. This handles remote CVS connections
+     as well"
+
+    CVSRoot isNil ifTrue:[^ nil].
+    ^ self repositoryTopDirectoryFromCVSRoot:CVSRoot.
+
+    "
+     CVSSourceCodeManager repositoryTopDirectory
+    "
+
+    "Created: / 18-05-2018 / 12:30:05 / Stefan Vogel"
+!
+
 revisionStringFromLog:log entry:entry forClass:aClass
     "given a log entry, extract a revision string"
 
@@ -1800,7 +1801,7 @@
                             (line startsWith:'RCS file') not
                             and:[(line startsWith:'retrieving') not
                             and:[(line startsWith:'Merging') not
-                            and:[line size > 0]]]
+                            and:[line notEmpty]]]
                         ].
         whatHappened := whatHappened asString.
 
@@ -1988,7 +1989,7 @@
                             ]
                         ] ifTrue:[
                             "/ check if all green-stuff (separators) have been removed
-                            (repairedText findFirst:[:line | line notEmptyOrNil and:[(line emphasisAt:1) = emSep]]) ~~ 0 ifTrue:[
+                            (repairedText contains:[:line | line notEmptyOrNil and:[(line emphasisAt:1) = emSep]]) ifTrue:[
                                 self warn:'You have to look at ALL conflicts, and remove ALL green lines as a confirmation !!'.
                                 didAccept := false.
                             ]
@@ -2127,6 +2128,7 @@
     "Created: / 05-12-2017 / 23:28:31 / cg"
     "Modified: / 06-12-2017 / 03:19:59 / cg"
     "Modified: / 09-05-2018 / 19:31:44 / stefan"
+    "Modified: / 18-05-2018 / 13:43:44 / Stefan Vogel"
 !
 
 checkinClass:cls fileName:classFileName directory:packageDir module:moduleDir source:sourceFileName logMessage:logMessage force:forceArg
@@ -2609,7 +2611,7 @@
                             ]
                         ] ifTrue:[
                             "/ check if all green-stuff (separators) have been removed
-                            (repairedText findFirst:[:line | line notEmptyOrNil and:[(line emphasisAt:1) = emSep]]) ~~ 0 ifTrue:[
+                            (repairedText contains:[:line | line notEmptyOrNil and:[(line emphasisAt:1) = emSep]]) ifTrue:[
                                 self warn:'You have to look at ALL conflicts, and remove ALL green lines as a confirmation !!'.
                                 didAccept := false.
                             ]
@@ -2853,6 +2855,7 @@
 
     "Created: / 13-03-2017 / 15:38:19 / stefan"
     "Modified: / 31-03-2017 / 15:42:32 / stefan"
+    "Modified: / 18-05-2018 / 12:53:43 / Stefan Vogel"
 !
 
 checkoutModule:aModule directory:aPackage andDo:aBlock
@@ -3143,7 +3146,7 @@
 checkForExistingContainer:fileName inModule:moduleName directory:packageDirName
     "check for a container to exist. Return a boolean result."
 
-    |fullName ret ret2 cvsRoot cmd tempDir outputStream errorStream isLocalCVSRoot|
+    |fullName cvsRoot cmd tempDir outputStream errorStream isLocalCVSRoot|
 
     cvsRoot := self getCVSROOTForModule:moduleName.
     cvsRoot isNil ifTrue:[^ false].
@@ -3185,39 +3188,36 @@
 
     "/ cmd := '-n rtag -l -F dummy '.
     cmd := '-n rtag -F dummy '.
-    [  
+    ^ [  
         errorStream := '' writeStream.
         outputStream := '' writeStream.
         
         SourceCodeManagerError handle:[:ex |
             ^ false.
         ] do:[    
-            ret := self 
-                        executeCVSCommand:cmd , fullName 
-                        module:moduleName 
-                        "/ cg; cannot do it in current dir, in case it contains a CVS subDirectory,
-                        "/ with a different CVSRoot in its CVS/Root file ...
-                        "/ cvs would complain then.
-                        inDirectory:(tempDir pathName) 
-                        log:false
-                        outputTo:outputStream
-                        errorTo:errorStream.
+            self 
+                executeCVSCommand:cmd , fullName 
+                module:moduleName 
+                "/ cg; cannot do it in current dir, in case it contains a CVS subDirectory,
+                "/ with a different CVSRoot in its CVS/Root file ...
+                "/ cvs would complain then.
+                inDirectory:(tempDir pathName) 
+                log:false
+                outputTo:outputStream
+                errorTo:errorStream.
     
             "cannot check for exit status starting at cvs 1.11.5, because an exit status 0
              is returned even if the file does not exist"
 
             "But: if there is any output, the command failed and the container does not exist"
             "/ cg: read comment above.
-            ret2 := errorStream size == 0.
-            ret2 ifFalse:[
-                ret2 := (errorStream contents asCollectionOfLines 
-                            reject:[:l | l isBlank or:[l includesString:'WARNING:']]) isEmpty. 
-            ].
+            errorStream isEmpty 
+                or:[errorStream contents asCollectionOfLines 
+                       allSatisfy:[:l | l isBlank or:[l includesString:'WARNING:']]].
         ]
     ] ensure:[
         tempDir recursiveRemove.
     ].
-    ^ ret2
 
     "
      CVSSourceCodeManager 
@@ -3234,6 +3234,7 @@
     "Created: / 13-09-2006 / 18:20:36 / cg"
     "Modified (format): / 24-02-2017 / 11:32:37 / cg"
     "Modified: / 21-09-2017 / 11:00:40 / stefan"
+    "Modified: / 18-05-2018 / 13:42:15 / Stefan Vogel"
 !
 
 checkForExistingModule:moduleDir
@@ -3271,15 +3272,15 @@
          need a working directory, but reports missing files"
 
         cmd := '-n rtag -l dummy '.
-        [
-            ret := self 
-                        executeCVSCommand:cmd , moduleDir 
-                        module:moduleDir
-                        "/ cg; cannot do it in current dir, in case it contains a CVS subDirectory,
-                        "/ with a different CVSRoot in its CVS/Root file ...
-                        "/ cvs would complain then.
-                        inDirectory:(tempDir pathName) 
-                        log:false.
+        ret := [
+            self 
+                executeCVSCommand:cmd , moduleDir 
+                module:moduleDir
+                "/ cg; cannot do it in current dir, in case it contains a CVS subDirectory,
+                "/ with a different CVSRoot in its CVS/Root file ...
+                "/ cvs would complain then.
+                inDirectory:(tempDir pathName) 
+                log:false.
         ] ensure:[
             tempDir recursiveRemove.
         ].
@@ -3303,6 +3304,7 @@
     "Created: / 09-12-1995 / 19:13:37 / cg"
     "Modified: / 23-07-1999 / 17:38:59 / stefan"
     "Modified: / 19-08-2011 / 10:38:35 / cg"
+    "Modified: / 18-05-2018 / 12:49:05 / Stefan Vogel"
 !
 
 checkForExistingModule:moduleDir directory:directory
@@ -3343,16 +3345,15 @@
          need a working directory, but reports missing files"
 
         cmd := '-n rtag -l -F dummy '.
-        [
-            ret := self 
-                        executeCVSCommand:cmd, fullName 
-                        module:moduleDir
-                        "/ cg; cannot do it in current dir, in case it contains a CVS subDirectory,
-                        "/ with a different CVSRoot in its CVS/Root file ...
-                        "/ cvs would complain then.
-                        inDirectory:(tempDir pathName) 
-                        log:false.
-
+        ret := [
+            self 
+                executeCVSCommand:cmd, fullName 
+                module:moduleDir
+                "/ cg; cannot do it in current dir, in case it contains a CVS subDirectory,
+                "/ with a different CVSRoot in its CVS/Root file ...
+                "/ cvs would complain then.
+                inDirectory:(tempDir pathName) 
+                log:false.
         ] ensure:[
             tempDir recursiveRemove.
         ].
@@ -3375,6 +3376,7 @@
 
     "Modified: / 23-07-1999 / 17:39:21 / stefan"
     "Created: / 23-08-2006 / 14:03:03 / cg"
+    "Modified: / 18-05-2018 / 12:49:39 / Stefan Vogel"
 !
 
 createBranch:branchName forClasses:aCollectionOfClasses
@@ -4587,17 +4589,17 @@
             "/ The repair code will be removed at some time in the future...
 
             "/ temporary fix Felix' bad string translation:
-            (aString startsWith:'§Header:') ifTrue:[
-                (aString endsWith:'Exp §') ifTrue:[
+            (aString startsWith:'§Header:') ifTrue:[
+                (aString endsWith:'Exp §') ifTrue:[
                     fixedString := '$' , (aString copyFrom:3 to:(aString size - 2)) , '$'.
 
                     aClass isNil ifTrue:[
                         autoFixHolder value ifFalse:[
-                            Dialog information:'Attention: the CVS version string is corrupted (§-bug). Please fix it manually'.
+                            Dialog information:'Attention: the CVS version string is corrupted (§-bug). Please fix it manually'.
                         ]
                     ] ifFalse:[
                         (autoFixHolder value 
-                            or:[ Dialog confirm:('Attention: the CVS version string is corrupted in "%1" (§-bug). Fix it?' withCRs bindWith:aClass name) ]
+                            or:[ Dialog confirm:('Attention: the CVS version string is corrupted in "%1" (§-bug). Fix it?' withCRs bindWith:aClass name) ]
                         ) ifTrue:[
                             self updateVersionMethodOf:aClass for:fixedString.
                         ].
@@ -4605,7 +4607,7 @@
                 ].
             ].
 
-            "/ temporary fix Jan's bad Umlaut-removal (which results in Felix's bad § being removed):
+            "/ temporary fix Jan's bad Umlaut-removal (which results in Felix's bad § being removed):
             (aString startsWith:'Header: ') ifTrue:[
                 (aString endsWith:'Exp ') ifTrue:[
                     fixedString := '$' , aString , '$'.
@@ -5112,7 +5114,7 @@
     ] ifFalse:[
         modulePath :=  module , '/' , packageDir. 
     ].
-    [
+    info := [
         |revisionUsed dateSelector searchFor|
 
         self activityNotification:('CVS: Fetching revision infos for %1%2'
@@ -5143,7 +5145,7 @@
                             ifTrue:[ 'head:' ]
                             ifFalse:[ 'revision ' ].
 
-        info := self fetchRevisionsFromRLogStream:inStream searchForKeyword:searchFor.
+        self fetchRevisionsFromRLogStream:inStream searchForKeyword:searchFor.
     ] ensure:[
         inStream notNil ifTrue:[inStream close].
     ].
@@ -5158,6 +5160,7 @@
     "
 
     "Created: / 12-10-2006 / 10:12:59 / cg"
+    "Modified: / 18-05-2018 / 12:50:53 / Stefan Vogel"
 !
 
 revisionsInModule:module directory:packageDir taggedAs:symbolicName
@@ -5181,7 +5184,7 @@
                                     bindWith:modulePath
                                     with:(' tagged as "',symbolicName,'"')).
 
-    [
+    info := [
         |revisionUsed tagSelector searchFor|
 
         tagSelector := '-S -r"%1"' bindWith:symbolicName.
@@ -5200,7 +5203,7 @@
         "/
         "/ read the commands pipe output and extract the container infos
         "/
-        info := self fetchRevisionsFromRLogStream:inStream searchForKeyword:'revision '.
+        self fetchRevisionsFromRLogStream:inStream searchForKeyword:'revision '.
     ] ensure:[
         inStream notNil ifTrue:[inStream close].
     ].
@@ -5213,6 +5216,7 @@
     "
 
     "Created: / 12-10-2006 / 10:12:59 / cg"
+    "Modified: / 18-05-2018 / 12:51:12 / Stefan Vogel"
 !
 
 setSymbolicName:symbolicName asBranch:asBranch revision:rev overWrite:overWriteBool classes:aCollectionOfClasses
@@ -5546,17 +5550,14 @@
         "/ read the commands pipe output and extract the container info
         "/
         info := IdentityDictionary new.
-        [inStream atEnd] whileFalse:[
-            line:= inStream nextLine.
-            line notNil ifTrue:[
-                line := line withoutSeparators.
-            ].
-            line size > 0 ifTrue:[
+        [inStream atEnd not and:[(line:= inStream nextLine) notNil]] whileTrue:[
+            line := line withoutSeparators.
+            line notEmpty ifTrue:[
                 |gotIt i|
 
                 ((line includesString:'warning')
-                and:[ (line includesString:'is not')
-                and:[ (line includesString:'pertinent') ]]) ifTrue:[
+                 and:[ (line includesString:'is not')
+                 and:[ (line includesString:'pertinent') ]]) ifTrue:[
                     ^ nil
                 ].
 
@@ -5577,7 +5578,7 @@
                         ].                        
                     ]
                 ].
-            ]
+            ].
         ].
         info isEmpty ifTrue:[
             ('CVSSourceCodeManager [warning]: no status for "', fullName,'"') errorPrintCR.
@@ -5591,13 +5592,13 @@
     ^ info
 
     "
-     SourceCodeManager statusOf:Array 
      SourceCodeManager statusOf:Array fileName:'Array.st' directory:'libbasic' module:'stx'  
      SourceCodeManager statusOf:Filename fileName:'Filename.st' directory:'libbasic' module:'stx'  
-     SourceCodeManager statusOf:NewSystemBrowser fileName:'NewSystemBrowser.st' directory:'libtool' module:'stx'  
+     SourceCodeManager statusOf:Tools::NewSystemBrowser fileName:'Tools__NewSystemBrowser.st' directory:'libtool' module:'stx'  
     "
 
     "Modified: / 29-08-2006 / 13:18:00 / cg"
+    "Modified (comment): / 18-05-2018 / 13:55:10 / Stefan Vogel"
 ! !
 
 !CVSSourceCodeManager class methodsFor:'source code utilities'!
@@ -5737,7 +5738,7 @@
         ^ nil.
     ].
 
-    [
+    list := [
         self createEntryFor:fullName 
              module:moduleDir
              in:(tempDir construct:modulePath) 
@@ -5772,7 +5773,7 @@
         "/
         [ inStream nextLine startsWith:'diff -'] whileFalse.
 
-        list := inStream contents.
+        inStream contents.
     ] ensure:[
         inStream notNil ifTrue:[inStream close].
         tempDir recursiveRemove
@@ -5792,6 +5793,7 @@
     "
 
     "Modified: / 29-08-2006 / 13:18:00 / cg"
+    "Modified: / 18-05-2018 / 12:50:12 / Stefan Vogel"
 !
 
 initialRCSRevisionStringFor:aClass in:dir container:fileName
@@ -5917,7 +5919,7 @@
     "/ $-Revision: rev $
     "/ $-Id:       fileName rev date time user state $
     "/
-    (firstWord = '$Header:' or:[firstWord = '§Header:']) ifTrue:[
+    (firstWord = '$Header:' or:[firstWord = '§Header:']) ifTrue:[
         d := firstWord first.
         s skipSeparators.
         nm := s throughAll:',v '.
@@ -5947,12 +5949,12 @@
         ^ info
     ].
 
-    (firstWord = '$Revision:' or:[firstWord = '§Revision:']) ifTrue:[
+    (firstWord = '$Revision:' or:[firstWord = '§Revision:']) ifTrue:[
         info revision:(s upToEnd asCollectionOfWords first).
         ^ info
     ].
 
-    (firstWord = '$Id:' or:[firstWord = '§Id:']) ifTrue:[
+    (firstWord = '$Id:' or:[firstWord = '§Id:']) ifTrue:[
         "/commented out by Jan Vrany, 2009/10/20
         "/according to http://svnbook.red-bean.com/en/1.5/svn.advanced.props.special.keywords.html
         "/svn has no support for $ Header $ expansion. Therefore