Merged cf76b0a531ae and b9c068ea5906 (branch default - CVS HEAD) jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Tue, 16 Jul 2013 14:00:01 +0100
branchjv
changeset 3350 2331896e5005
parent 3349 cf76b0a531ae (current diff)
parent 3348 b9c068ea5906 (diff)
child 3365 be2a165ae10b
Merged cf76b0a531ae and b9c068ea5906 (branch default - CVS HEAD)
AbstractSourceCodeManager.st
MessageTracer.st
ProjectProblem.st
SourceCodeManagerUtilities.st
--- a/.hgtags	Mon Jul 15 13:18:07 2013 +0100
+++ b/.hgtags	Tue Jul 16 14:00:01 2013 +0100
@@ -24,6 +24,7 @@
 7ab1d2bd960d70cd723a2b82491d7bfb29051430 rel3_6_1
 7c144e5638b40d5105c8153f73cf17dc83405607 rel5_1_4
 7e98ed39d4fd9dbabf33dac219211e9b26b0ec49 rel2_10_8_6_last_before_vmData_change
+82a6273869ffc92c82ad02a122fd0f2b0c00bbb7 stable
 83824ad8d5cb4b9564a8d61d4eaea720e383ee4f rel5_1_3
 83824ad8d5cb4b9564a8d61d4eaea720e383ee4f stx_513
 882d87800deaf0bb95f7d7cdefb4622997dd4543 expeccoNET_1_5_0rc1
@@ -34,7 +35,6 @@
 b54eeae38942103e87cdfaf3110a0228c8827258 testTagging
 b9e4b4465a2c3cd844ac12cedcab8efc84fde6f3 rel3_4_1_1
 b9e4b4465a2c3cd844ac12cedcab8efc84fde6f3 rel3_4_1_2
-be2d79684ef3a500e92ee2dfa9f3ecf15f68e2ed stable
 c0b55d3a8f08ecd17cde65f06004c1272b7078b1 expecco_2_0_0
 c0b55d3a8f08ecd17cde65f06004c1272b7078b1 expecco_2_0_0_0
 c0fb3ccbd1dd30253dffb40fd4829001f325d87c expecco_2_5_0
--- a/AbstractSourceCodeManager.st	Mon Jul 15 13:18:07 2013 +0100
+++ b/AbstractSourceCodeManager.st	Tue Jul 16 14:00:01 2013 +0100
@@ -2210,6 +2210,15 @@
      The classes source code is extracted using the revision and the sourceCodeInfo,
      which itself is extracted from the classes packageString."
 
+    ^ self getSourceStreamFor:aClass revision:aRevisionStringOrNil cache:true
+!
+
+getSourceStreamFor:aClass revision:aRevisionStringOrNil cache:cache
+    "extract a classes source code and return an open readStream on it.
+     A revision of nil selects the current (in image) revision.
+     The classes source code is extracted using the revision and the sourceCodeInfo,
+     which itself is extracted from the classes packageString."
+
     |classFileName binaryRevision revision revisionUsed
      packageDir moduleDir sourceInfo revForMeOrNil|
 
@@ -2257,25 +2266,29 @@
 
     sourceInfo := self sourceInfoOfClass:aClass.
     sourceInfo isNil ifTrue:[
-       ('SourceCodeManager [warning]: no sourceInfo for class "%1"' bindWith:aClass name) infoPrintCR.
-        ^ nil
-    ].
-
-    packageDir := self directoryFromSourceInfo:sourceInfo.
-    packageDir isNil ifTrue:[
+"/       ('SourceCodeManager [warning]: no sourceInfo for class "%1"' bindWith:aClass name) infoPrintCR.
+"/        ^ nil
+        "/ let's hope...
+        classFileName := aClass classFilename.
         packageDir := aClass package asPackageId directory.
         moduleDir := aClass package asPackageId module.
     ] ifFalse:[
-        moduleDir := self moduleFromSourceInfo:sourceInfo.  "/ use the modules name as CVS module
+        packageDir := self directoryFromSourceInfo:sourceInfo.
+        packageDir isNil ifTrue:[
+            packageDir := aClass package asPackageId directory.
+            moduleDir := aClass package asPackageId module.
+        ] ifFalse:[
+            moduleDir := self moduleFromSourceInfo:sourceInfo.  "/ use the modules name as CVS module
+        ].
+        classFileName := self containerFromSourceInfo:sourceInfo.
     ].
-    classFileName := self containerFromSourceInfo:sourceInfo.
     ^ self 
         streamForClass:aClass
         fileName:classFileName 
         revision:revisionUsed 
         directory:packageDir 
         module:moduleDir
-        cache:true
+        cache:cache
 
     "Created: / 12-10-1996 / 17:21:52 / cg"
     "Modified: / 29-09-2011 / 22:02:55 / cg"
@@ -3818,11 +3831,11 @@
 !AbstractSourceCodeManager class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.312 2013-06-25 17:13:34 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.313 2013-07-12 13:57:33 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.312 2013-06-25 17:13:34 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.313 2013-07-12 13:57:33 cg Exp $'
 !
 
 version_HG
@@ -3831,7 +3844,7 @@
 !
 
 version_SVN
-    ^ '$Id: AbstractSourceCodeManager.st,v 1.312 2013-06-25 17:13:34 cg Exp $'
+    ^ '$Id: AbstractSourceCodeManager.st,v 1.313 2013-07-12 13:57:33 cg Exp $'
 ! !
 
 
--- a/MessageTracer.st	Mon Jul 15 13:18:07 2013 +0100
+++ b/MessageTracer.st	Tue Jul 16 14:00:01 2013 +0100
@@ -1659,21 +1659,21 @@
             MethodCounts removeKey:originalMethod ifAbsent:nil.
         ].
         MethodCounts removeKey:aMethod ifAbsent:nil.
-        MethodCounts isEmpty ifTrue:[MethodCounts := nil].
+        MethodCounts := MethodCounts asNilIfEmpty.
     ].
     MethodMemoryUsage notNil ifTrue:[
         aMethod isWrapped ifTrue:[
             MethodMemoryUsage removeKey:originalMethod ifAbsent:nil.
         ].
         MethodMemoryUsage removeKey:aMethod ifAbsent:nil.
-        MethodMemoryUsage isEmpty ifTrue:[MethodMemoryUsage := nil].
+        MethodMemoryUsage := MethodMemoryUsage asNilIfEmpty.
     ].
     MethodTiming notNil ifTrue:[
         aMethod isWrapped ifTrue:[
             MethodTiming removeKey:originalMethod ifAbsent:nil.
         ].
         MethodTiming removeKey:aMethod ifAbsent:nil.
-        MethodTiming isEmpty ifTrue:[MethodTiming := nil].
+        MethodTiming := MethodTiming asNilIfEmpty.
     ].
 
     CallingLevel := 0.
@@ -3448,7 +3448,7 @@
 !MessageTracer class methodsFor:'documentation'!
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic3/MessageTracer.st,v 1.125 2013-06-30 08:11:02 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/MessageTracer.st,v 1.126 2013-07-13 20:36:18 cg Exp $'
 !
 
 version_HG
--- a/ProjectProblem.st	Mon Jul 15 13:18:07 2013 +0100
+++ b/ProjectProblem.st	Tue Jul 16 14:00:01 2013 +0100
@@ -1360,9 +1360,11 @@
     ^
 'Method %1 does not belong to any package. Such methods
 are not committed and will be lost when you restart/recompile.
-Method should be moved to some package, %2 maybe?'
+Especially, it will not be included when you generate a compiled class library.
+However, it will be kept in the changes file, so it is not completely lost.
+The method should be moved to some package, %2 maybe?'
     bindWith: (self linkToMethod)
-	with: package
+        with: package
 
     "Modified: / 23-02-2012 / 14:21:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
@@ -1559,11 +1561,11 @@
 !ProjectProblem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/ProjectProblem.st,v 1.22 2013-04-17 21:45:28 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/ProjectProblem.st,v 1.23 2013-07-10 14:48:49 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic3/ProjectProblem.st,v 1.22 2013-04-17 21:45:28 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/ProjectProblem.st,v 1.23 2013-07-10 14:48:49 cg Exp $'
 !
 
 version_HG
@@ -1572,6 +1574,6 @@
 !
 
 version_SVN
-    ^ '§Id: ProjectProblem.st 1962 2012-09-10 10:34:08Z vranyj1 §'
+    ^ '$Id: ProjectProblem.st,v 1.23 2013-07-10 14:48:49 cg Exp $'
 ! !
 
--- a/SourceCodeManagerUtilities.st	Mon Jul 15 13:18:07 2013 +0100
+++ b/SourceCodeManagerUtilities.st	Tue Jul 16 14:00:01 2013 +0100
@@ -2917,7 +2917,43 @@
         aStream cr.
     ].
 
-    info notNil ifTrue:[
+    "/ old
+"/    info isNil ifTrue:[
+"/        aStream nextPutLine:'No revision info found'.
+"/        aClass isLoaded ifFalse:[
+"/            aStream cr; nextPutAll:'This is an autoloaded class - you may see more after it is loaded.'
+"/        ] ifTrue:[
+"/            fn := aClass classFilename.
+"/            aClass wasAutoloaded ifTrue:[
+"/                msg := 'This class was autoloaded.'.
+"/                msg := msg , ' (from ''' , fn , ''')'.
+"/            ] ifFalse:[
+"/                msg := 'This class was loaded from ''' , fn , '''.'
+"/            ].
+"/            msg notNil ifTrue:[
+"/                aStream cr; nextPutAll:msg.
+"/            ]
+"/        ].
+"/        ^ self
+"/    ]
+
+    info isNil ifTrue:[
+        aClass isLoaded ifFalse:[
+            aStream nextPutLine:'This is an autoloaded class - you may see more after it is loaded.'
+        ] ifTrue:[
+            fn := aClass classFilename.
+            aClass wasAutoloaded ifTrue:[
+                msg := 'This class was autoloaded.'.
+                msg := msg , ' (from ''' , fn , ''')'.
+            ] ifFalse:[
+                msg := 'This class was loaded from ''' , fn , '''.'
+            ].
+            msg notNil ifTrue:[
+                aStream nextPutLine:msg.
+            ]
+        ].
+        aStream cr.
+    ] ifFalse:[
         (info revision notNil) ifFalse:[
             aStream nextPutLine:'WARNING:'; cr.
             aStream nextPutLine:'  The class seems not to be loaded from the repository.'.
@@ -2937,44 +2973,29 @@
                                                        (info time ? '?'), ' ', 
                                                        (info timezone ? '').
         aStream nextPutLine:'  Checkin user .... : ' , (info user ? '?').
-
-        (info2 := aClass packageSourceCodeInfo) notNil ifTrue:[
-            aStream nextPutLine:'  Repository: ..... : ' , (info2 at:#module ifAbsent:'?').
-            aStream nextPutLine:'  Directory: ...... : ' , (info2 at:#directory ifAbsent:'?').
-        ].
+    ].
+
+    (info2 := aClass packageSourceCodeInfo) notNil ifTrue:[
+        aStream nextPutLine:'  Repository: ..... : ' , (info2 at:#module ifAbsent:'?').
+        aStream nextPutLine:'  Directory: ...... : ' , (info2 at:#directory ifAbsent:'?').
+    ].
+    info notNil ifTrue:[
         aStream nextPutLine:'  Container ....... : ' , (info repositoryPathName ? '?').
-        aStream cr.
-
-        mgr := self sourceCodeManagerFor:aClass.
-        mgr notNil ifTrue:[
-            aStream nextPutLine:'**** Repository information ****'; cr.
-
-            module := nil.
-            info2 notNil ifTrue:[
-                module := info2 at:#module ifAbsent:nil.
-            ].
-            module notNil ifTrue:[
-                aStream nextPutLine:('  Repository URL ......: ' , 
-                                    ((mgr repositoryNameForPackage:aClass package) ifNil:[mgr repositoryName , ' (default)'])).
-            ].
-            mgr writeRevisionLogOf:aClass short:shortOrNot to:aStream.
-        ]
-    ] ifFalse:[
-        aStream nextPutLine:'No revision info found'.
-        aClass isLoaded ifFalse:[
-            aStream cr; nextPutAll:'This is an autoloaded class - you may see more after it is loaded.'
-        ] ifTrue:[
-            fn := aClass classFilename.
-            aClass wasAutoloaded ifTrue:[
-                msg := 'This class was autoloaded.'.
-                msg := msg , ' (from ''' , fn , ''')'.
-            ] ifFalse:[
-                msg := 'This class was loaded from ''' , fn , '''.'
-            ].
-            msg notNil ifTrue:[
-                aStream cr; nextPutAll:msg.
-            ]
-        ]
+    ].
+    aStream cr.
+    mgr := self sourceCodeManagerFor:aClass.
+    mgr notNil ifTrue:[
+        aStream nextPutLine:'**** Repository information ****'; cr.
+
+        module := nil.
+        info2 notNil ifTrue:[
+            module := info2 at:#module ifAbsent:nil.
+        ].
+        module notNil ifTrue:[
+            aStream nextPutLine:('  Repository URL ......: ' , 
+                                ((mgr repositoryNameForPackage:aClass package) ifNil:[mgr repositoryName , ' (default)'])).
+        ].
+        mgr writeRevisionLogOf:aClass short:shortOrNot to:aStream.
     ]
 
     "Modified: / 12-10-2011 / 18:06:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -3741,7 +3762,7 @@
                 ].
             ] ifFalse:[
                 initialLogStream 
-                    print: (selectors size); nextPutAll: ' methods'.
+                    print: (selectors size); nextPutAll: ' methods'; cr.
             ].
         ].
 
@@ -3886,6 +3907,27 @@
     ^ initialLogStream contents
 
     "Modified: / 26-09-2012 / 18:31:38 / cg"
+!
+
+revisionForSymbolicName:tag class:cls fileName:classFileName directory:packageDir module:moduleDir manager:aSourceCodeManager
+    "given a tag, return the corresponding revision"
+
+    |partialLog symbolicNames|
+
+    partialLog := aSourceCodeManager
+        revisionLogOf:cls
+        numberOfRevisions:20
+        fileName:classFileName
+        directory:packageDir 
+        module:moduleDir.
+
+    partialLog notNil ifTrue:[
+        symbolicNames := partialLog at:#symbolicNames ifAbsent:[].
+        symbolicNames notNil ifTrue:[
+            ^ symbolicNames at:tag ifAbsent:nil
+        ].
+    ].
+    ^ nil
 ! !
 
 !SourceCodeManagerUtilities methodsFor:'utilities-encoding'!
@@ -3928,11 +3970,11 @@
 !SourceCodeManagerUtilities class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/SourceCodeManagerUtilities.st,v 1.287 2013-07-06 19:27:24 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/SourceCodeManagerUtilities.st,v 1.289 2013-07-12 13:57:13 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic3/SourceCodeManagerUtilities.st,v 1.287 2013-07-06 19:27:24 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/SourceCodeManagerUtilities.st,v 1.289 2013-07-12 13:57:13 cg Exp $'
 !
 
 version_HG