AbstractSourceCodeManager.st
changeset 93 83042eccb8d1
parent 87 e0f5b58481a6
child 95 aeda58a2343c
--- a/AbstractSourceCodeManager.st	Sat Nov 25 10:17:21 1995 +0100
+++ b/AbstractSourceCodeManager.st	Sat Nov 25 12:04:18 1995 +0100
@@ -41,10 +41,7 @@
     Please read more documentation in concrete subclasses 
     (especially: CVSSourceCodeManager) for how to use this manager.
 "
-!
-
-version
-^ '$Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.21 1995-11-23 01:58:09 cg Exp $'! !
+! !
 
 !AbstractSourceCodeManager class methodsFor:'initialization'!
 
@@ -250,11 +247,139 @@
 
 !AbstractSourceCodeManager class methodsFor:'source code administration'!
 
-writeRevisionLogOf:cls fromRevision:rev1 toRevision:rev2 fileName:classFileName directory:packageDir module:moduleDir to:aStream
+revisionLogOf:aClass
+    "return a classes revisionlog as a collection of revision entries, nil on failure.
+     The returned information is a structure (IdentityDictionary)
+     filled with:
+            #container          -> the RCS container file name
+            #filename           -> the actual source file name
+            #newestRevision     -> the revisionString of the newest revision
+            #numberOfRevisions  -> the number of revisions in the container
+            #revisions          -> collection of per-revision info
+
+            per revision info consists of one record per revision:
+
+              #revision              -> the revision string
+              #author                -> who checked that revision into the repository
+              #date                  -> when was it checked in
+              #state                 -> the RCS state
+              #numberOfChangedLines  -> the number of changed line w.r.t the previous
+
+            revisions are ordered newest first 
+            (i.e. the last entry is for the initial revision; the first for the most recent one)
+        "
+
+    ^ self
+        revisionLogOf:aClass fromRevision:nil toRevision:nil
+
+    "
+     SourceCodeManager revisionLogOf:Array 
+    "
+
+    "Created: 25.11.1995 / 11:25:02 / cg"
+    "Modified: 25.11.1995 / 11:56:16 / cg"
+!
+
+revisionLogOf:aClass fromRevision:rev1 toRevision:rev2
+    "return (part of) a classes revisionlog as a collection of revision entries, nil on failure.
+     The returned information is a structure (IdentityDictionary)
+     filled with:
+            #container          -> the RCS container file name
+            #filename           -> the actual source file name
+            #newestRevision     -> the revisionString of the newest revision
+            #numberOfRevisions  -> the number of revisions in the container
+            #revisions          -> collection of per-revision info
+
+            per revision info consists of one record per revision:
+
+              #revision              -> the revision string
+              #author                -> who checked that revision into the repository
+              #date                  -> when was it checked in
+              #state                 -> the RCS state
+              #numberOfChangedLines  -> the number of changed line w.r.t the previous
+
+            revisions are ordered newest first 
+            (i.e. the last entry is for the initial revision; the first for the most recent one)
+        "
+
+    |cls sourceInfo tempDir packageDir moduleDir tempFile classFileName ok|
+
+    cls := aClass.
+    cls isMeta ifTrue:[
+        cls := cls soleInstance
+    ].
+
+    sourceInfo := cls sourceCodeInfo.
+    sourceInfo isNil ifTrue:[
+        'SOURCEMGR: cannot extract classes sourceInfo' infoPrintNL.
+        ^ false
+    ].
+
+    packageDir := sourceInfo at:#directory.
+    moduleDir := sourceInfo at:#module.  "/ use the modules name as CVS module
+    classFileName := Smalltalk fileNameForClass:cls.
+
+    ^ self 
+        revisionLogOf:cls
+        fromRevision:rev1 
+        toRevision:rev2
+        fileName:classFileName 
+        directory:packageDir 
+        module:moduleDir
+
+    "
+     SourceCodeManager revisionLogOf:Array fromRevision:'1.40' toRevision:'1.43' 
+    "
+
+    "Created: 6.11.1995 / 18:56:00 / cg"
+    "Modified: 25.11.1995 / 11:56:13 / cg"
+!
+
+revisionLogOf:cls fromRevision:rev1 toRevision:rev2 fileName:classFileName directory:packageDir module:moduleDir 
+    "this must be implemented by a concrete source-code manager"
+
     self subclassResponsibility.
 
     "Created: 15.11.1995 / 18:12:51 / cg"
-    "Modified: 20.11.1995 / 12:20:12 / cg"
+    "Modified: 25.11.1995 / 11:56:38 / cg"
+!
+
+writeRevisionLogOf:cls fromRevision:rev1 toRevision:rev2 fileName:classFileName directory:packageDir module:moduleDir to:aStream
+    "send (part of) the revisionlog to aStream"
+
+    |log |
+
+    log := self revisionLogOf:cls fromRevision:rev1 toRevision:rev2 fileName:classFileName directory:packageDir module:moduleDir.
+    log isNil ifTrue:[^ false].
+
+    aStream nextPutAll:'  Total revisions: '; nextPutAll:(log at:#numberOfRevisions) printString; cr.
+    aStream nextPutAll:'  Newest revision: '; nextPutAll:(log at:#newestRevision) printString; cr.
+
+    (log at:#revisions) do:[:entry |
+        aStream cr.
+        aStream nextPutAll:'  revision '; nextPutAll:(entry at:#revision); tab.
+        aStream nextPutAll:' date: '; nextPutAll:(entry at:#date); tab.
+        aStream nextPutAll:' author: '; nextPutAll:(entry at:#author); tab.
+        aStream cr.
+
+        log := entry at:#logMessage.
+        (log isEmpty or:[log isBlank or:[log withoutSeparators = '.']]) ifTrue:[
+            log := '*** empty log message ***'
+        ].
+        aStream tab; nextPutAll:log.
+        aStream cr.
+    ].
+    ^ true
+
+    "
+     SourceCodeManager writeRevisionLogOf:Array to:Transcript 
+     SourceCodeManager writeRevisionLogOf:Array fromRevision:'1.40' toRevision:'1.43' to:Transcript 
+     SourceCodeManager writeRevisionLogOf:Array fromRevision:'1.40' toRevision:nil to:Transcript 
+     SourceCodeManager writeRevisionLogOf:Array fromRevision:nil toRevision:'1.3' to:Transcript 
+    "
+
+    "Created: 16.11.1995 / 13:25:30 / cg"
+    "Modified: 25.11.1995 / 12:02:53 / cg"
 !
 
 writeRevisionLogOf:aClass fromRevision:rev1 toRevision:rev2 to:aStream
@@ -305,3 +430,7 @@
     "
 ! !
 
+!AbstractSourceCodeManager class methodsFor:'documentation'!
+
+version
+^ '$Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.22 1995-11-25 11:04:18 cg Exp $'! !