class: SourceCodeManagerUtilities
authorClaus Gittinger <cg@exept.de>
Fri, 12 Jul 2013 15:57:13 +0200
changeset 3344 4e577aa5b998
parent 3343 01a016e0df7a
child 3345 ef913a1c10e8
class: SourceCodeManagerUtilities added: #revisionForSymbolicName:class:fileName:directory:module:manager: changed: #repositoryLogOf:short:onto: can extract revision log even from unloaded classes
SourceCodeManagerUtilities.st
--- a/SourceCodeManagerUtilities.st	Fri Jul 12 07:53:13 2013 +0200
+++ b/SourceCodeManagerUtilities.st	Fri Jul 12 15:57:13 2013 +0200
@@ -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>"
@@ -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,10 +3970,10 @@
 !SourceCodeManagerUtilities class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/SourceCodeManagerUtilities.st,v 1.288 2013-07-12 05:53:13 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.288 2013-07-12 05:53:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/SourceCodeManagerUtilities.st,v 1.289 2013-07-12 13:57:13 cg Exp $'
 ! !