#REFACTORING by stefan
authorStefan Vogel <sv@exept.de>
Fri, 18 May 2018 14:55:24 +0200
changeset 4323 17876f7b5860
parent 4322 e01f3898946f
child 4324 f8755312c4cd
#REFACTORING by stefan class: AbstractSourceCodeManager class added: #repositoryTopDirectoryFromSCMRoot removed: #checkForExistingContainerInModule:directory:container: #checkForExistingContainerInModule:package:container: comment/format in: #availableManagers #forgetDisabledModules #updateVersionMethod:of:for: changed: #checkMethodPackagesOf: #checkTabSpaceConventionIn: #fileOutSourceCodeOf:on:withTimeStamp:withInitialize:withDefinition:methodFilter: #initialize #pathInRepositoryFrom:forPackage: (send #repositoryTopDirectoryFromSCMRoot instead of #repositoryTopDirectoryFromCVSRoot) fix undefined method (belongs to subclass ansd should be subclassResponsibility)
AbstractSourceCodeManager.st
--- a/AbstractSourceCodeManager.st	Fri May 18 14:54:53 2018 +0200
+++ b/AbstractSourceCodeManager.st	Fri May 18 14:55:24 2018 +0200
@@ -66,7 +66,11 @@
 !AbstractSourceCodeManager class methodsFor:'initialization'!
 
 forgetDisabledModules
+    "intentionally left blank"
+
     ^ self
+
+    "Modified (comment): / 18-05-2018 / 12:37:57 / Stefan Vogel"
 !
 
 initCacheDirPath
@@ -109,6 +113,8 @@
 
     CachingSources isNil ifTrue:[CachingSources := true].
     UseWorkTree    isNil ifTrue:[UseWorkTree := false].
+    SuppressExtensionMethodConfirmation 
+                   isNil ifTrue:[SuppressExtensionMethodConfirmation := false].
 
     CachingSources ifTrue:[
         self validateCacheDirPath.
@@ -116,6 +122,7 @@
     Smalltalk addDependent:self
 
     "Modified: / 02-03-2012 / 17:00:11 / cg"
+    "Modified: / 18-05-2018 / 12:40:59 / Stefan Vogel"
 !
 
 update:something with:aParameter from:changedObject
@@ -133,16 +140,28 @@
     ].
 ! !
 
+!AbstractSourceCodeManager class methodsFor:'* uncategorized *'!
+
+repositoryTopDirectoryFromSCMRoot
+    "return the top of the repository."
+
+    ^ self subclassResponsibility
+
+    "Created: / 18-05-2018 / 12:30:23 / Stefan Vogel"
+! !
+
 !AbstractSourceCodeManager class methodsFor:'accessing'!
 
 availableManagers
     ^ AbstractSourceCodeManager 
         allSubclasses 
-            reject:[:cls | (cls isAbstract) or:[cls isExperimental ]].
+            reject:[:cls | (cls isAbstract) or:[cls isExperimental]].
 
     "
      self availableManagers   
     "
+
+    "Modified (format): / 18-05-2018 / 12:19:48 / Stefan Vogel"
 !
 
 branchStartTagFor:branchName
@@ -853,30 +872,6 @@
 
 !AbstractSourceCodeManager class methodsFor:'obsolete backward compatibility'!
 
-checkForExistingContainerInModule:moduleDir directory:packageDir container:fileName
-    <resource: #obsolete>
-    "check for a container to exist"
-
-    self obsoleteMethodWarning.
-    ^ self checkForExistingContainer:fileName inModule:moduleDir directory:packageDir
-
-    "Modified: / 13-09-2006 / 18:23:45 / cg"
-!
-
-checkForExistingContainerInModule:moduleName package:dirName container:fileName
-    "check for a container to be present"
-
-    <resource: #obsolete>
-
-    self obsoleteMethodWarning.
-    ^ self 
-        checkForExistingContainer:fileName
-        inModule:moduleName 
-        directory:dirName
-
-    "Modified: / 13-09-2006 / 18:23:35 / cg"
-!
-
 checkForExistingModule:moduleDir package:packageDir
     "check for a package directory to be present"
 
@@ -967,14 +962,11 @@
      Extensions always remain extensions, and must be moved by an explicit method-menu action.
     "
 
-    |checkInClassPackageOnly clsPackage otherPackages otherPackageNames methodsFromOtherPackages
-     methodCategoriesInOtherPackages methodCategoryInOtherPackages
-     msg answer isDefaultAnswer labels actions hasUnassignedExtensions
+    |clsPackage otherPackages methodsFromOtherPackages
+     methodCategoriesInOtherPackages msg answer labels actions hasUnassignedExtensions
      unassignedMethods methodCategoriesWithUnassignedMethods methodCategoryWithUnassignedMethods 
      args anyPackageChange|
 
-    checkInClassPackageOnly := false.
-
     clsPackage := aClass package.
 
     otherPackages := Set new.
@@ -1011,24 +1003,14 @@
     ].
 
     otherPackages := otherPackages asOrderedCollection sort.
-    otherPackageNames := 
-        String streamContents:[:stream| 
-            otherPackages 
-                do:[:eachPackageName| eachPackageName printOn:stream] 
-                separatedBy:[stream nextPutAll:', '].
-        ].
-
-    methodCategoriesInOtherPackages size == 1 ifTrue:[
-        methodCategoryInOtherPackages := methodCategoriesInOtherPackages anElement.
-    ].
+
     methodCategoriesWithUnassignedMethods size == 1 ifTrue:[
         methodCategoryWithUnassignedMethods := methodCategoriesWithUnassignedMethods anElement.
     ].
 
-    isDefaultAnswer := false.
     (SourceCodeManagerUtilities yesToAllNotification notNil 
     and:[SourceCodeManagerUtilities yesToAllNotification isHandled]) ifTrue:[
-        answer := isDefaultAnswer := true.
+        answer := true.
     ] ifFalse:[
         methodCategoriesWithUnassignedMethods size == 1 ifTrue:[
             unassignedMethods size == 1 ifTrue:[
@@ -1065,8 +1047,8 @@
             actions := #(#cancel false #browse true).
         ].
 
-        (SuppressExtensionMethodConfirmation == true
-        or:[ self isPackageWithoutExtensionMethodConfirmation:aClass package])
+        (SuppressExtensionMethodConfirmation 
+         or:[ self isPackageWithoutExtensionMethodConfirmation:aClass package])
         ifTrue:[
             answer := true
         ] ifFalse:[    
@@ -1140,6 +1122,7 @@
     ^ #base
 
     "Modified: / 01-09-2017 / 14:19:53 / cg"
+    "Modified: / 18-05-2018 / 12:46:11 / Stefan Vogel"
 !
 
 checkTabSpaceConventionIn: aStream
@@ -1161,9 +1144,9 @@
 
     aStream isFileStream ifTrue:[
         aStream flush.
-        checkStream := aStream pathName asFilename readStream .
+        checkStream := aStream pathName asFilename readStream.
     ] ifFalse:[
-        aStream isExternalStream not ifTrue:[
+        aStream isExternalStream ifFalse:[
             checkStream := aStream contents asString readStream.
         ].
     ].
@@ -1222,6 +1205,7 @@
 
     "Created: / 29-11-2013 / 12:01:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified (format): / 29-11-2013 / 14:02:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 18-05-2018 / 12:23:12 / Stefan Vogel"
 !
 
 compileVersionMethod:methodName of:aClass for:newRevisionString
@@ -1453,7 +1437,7 @@
     "/ the following is heuristics, in case that the packageID is not known
     "/ (should not be required)
     "/
-    top := self repositoryTopDirectoryFromCVSRoot.
+    top := self repositoryTopDirectoryFromSCMRoot.
     top notNil ifTrue:[
 
         (containerPath startsWith:(top , '/')) ifTrue:[
@@ -1489,6 +1473,7 @@
     "Created: / 25-11-1995 / 18:42:20 / cg"
     "Modified: / 21-06-2006 / 12:06:14 / cg"
     "Modified (comment): / 24-09-2012 / 11:10:50 / cg"
+    "Modified: / 18-05-2018 / 12:30:23 / Stefan Vogel"
 !
 
 postCheckInClass:aClass
@@ -1790,11 +1775,8 @@
 
     Class methodRedefinitionNotification answer:#keep do:[
         Class withoutUpdatingChangesDo:[
-            |oldVersion|
-
 "/            "/ must preserve the binary version, as methods still have the offsets into the old source file inside
-"/            oldVersion := aClass revision.
-"/            aClass setBinaryRevision:oldVersion.
+"/            aClass setBinaryRevision:aClass revision.
 
             self compileVersionMethod:selector of:aClass for:newRevisionString.
         ]
@@ -1802,6 +1784,7 @@
 
     "Modified: / 29-09-2011 / 21:59:41 / cg"
     "Created: / 02-12-2011 / 14:18:14 / cg"
+    "Modified (format): / 18-05-2018 / 12:26:00 / Stefan Vogel"
 !
 
 updateVersionMethodOf:aClass for:newRevisionString
@@ -2754,17 +2737,16 @@
       withTimeStamp:withTimeStamp withInitialize:withInitialize withDefinition:withDefinition
       methodFilter:methodFilter
 
-    | filter |
     "JV@2012-02-02: Do not fileout extensionVersion methods, that one is filed out
      when extensions are filed out."
-    (aClass inheritsFrom: ProjectDefinition) ifTrue:[
-        filter := [:m| (methodFilter value: m) 
-                        and:[ (self isExtensionsVersionMethodSelector:m selector) not
-                         "m selector ~~ self nameOfVersionMethodForExtensions"] 
-                  ]
-    ] ifFalse:[
-        filter := methodFilter.
-    ].
+"/    (aClass inheritsFrom: ProjectDefinition) ifTrue:[
+"/        filter := [:m| (methodFilter value: m) 
+"/                        and:[ (self isExtensionsVersionMethodSelector:m selector) not
+"/                         "m selector ~~ self nameOfVersionMethodForExtensions"] 
+"/                  ]
+"/    ] ifFalse:[
+"/        filter := methodFilter.
+"/    ].
 
     self withSourceRewriteHandlerDo:[
         | writer |
@@ -2789,6 +2771,7 @@
     self checkTabSpaceConventionIn: aStream.
 
     "Modified: / 22-01-2015 / 09:39:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 18-05-2018 / 12:47:06 / Stefan Vogel"
 !
 
 getExistingContainersInModule:aModule directory:aPackage