Class.st
changeset 544 d78012b20769
parent 527 7eedfdb0db62
child 555 d63400e20718
--- a/Class.st	Tue Nov 14 15:25:25 1995 +0100
+++ b/Class.st	Tue Nov 14 20:02:34 1995 +0100
@@ -38,7 +38,7 @@
 !
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.69 1995-11-11 14:25:35 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.70 1995-11-14 19:01:36 cg Exp $'
 !
 
 documentation
@@ -380,7 +380,7 @@
      rcs-id of the source from which this class was compiled.
      This is always valid for stc-compiled classes which include a version method,
      since stc extracts this info and places it into an instance variable.
-     Alternatively, the code below tries to extract it from the versionString directly,
+     Alternatively, the code below tries to extract it from the revisionString directly,
      this is used with filed-In classes (non stc-compiled).
      To check if a source corresponds to a compiled binary, compare this 
      ID with the one found in the version-methods comment."
@@ -388,7 +388,7 @@
     |vsnString words|
 
     revision notNil ifTrue:[ ^ revision].
-    vsnString := self versionString.
+    vsnString := self revisionString.
     vsnString notNil ifTrue:[
 	words := vsnString asCollectionOfWords.
 	"/
@@ -398,13 +398,13 @@
 	"/ $-Revision: rev $
 	"/ $-Id: fileName rev date time user state $
 	"/
-	((words at:1) == '$Header:') ifTrue:[
+	((words at:1) = '$Header:') ifTrue:[
 	    ^ words at:3
 	].
-	((words at:1) == '$Revision:') ifTrue:[
+	((words at:1) = '$Revision:') ifTrue:[
 	    ^ words at:2 
 	].
-	((words at:1) == '$Id:') ifTrue:[
+	((words at:1) = '$Id:') ifTrue:[
 	    ^ words at:3 
 	].
     ].
@@ -502,7 +502,7 @@
 	oldComment := self comment.
 	comment := aString.
 	self changed:#comment with:oldComment.
-	self updateVersionString.
+	self updateRevisionString.
 	self addChangeRecordForClassComment:self.
     ]
 
@@ -714,7 +714,7 @@
 
     self setPrimitiveSpecsAt:1 to:aString.
     self addChangeRecordForPrimitiveDefinitions:self.
-    self updateVersionString.
+    self updateRevisionString.
 
     "Created: 29.10.1995 / 19:41:39 / cg"
 !
@@ -724,7 +724,7 @@
 
     self setPrimitiveSpecsAt:2 to:aString.
     self addChangeRecordForPrimitiveVariables:self.
-    self updateVersionString.
+    self updateRevisionString.
 
     "Created: 29.10.1995 / 19:41:58 / cg"
 !
@@ -734,7 +734,7 @@
 
     self setPrimitiveSpecsAt:3 to:aString.
     self addChangeRecordForPrimitiveFunctions:self.
-    self updateVersionString.
+    self updateRevisionString.
 
     "Created: 29.10.1995 / 19:41:48 / cg"
 !
@@ -883,7 +883,7 @@
     (self classVarNames includes:aString) ifFalse:[
 	self classVariableString:(self classVariableString , ' ' , aString).
 	self addChangeRecordForClass:self.
-	self updateVersionString.
+	self updateRevisionString.
 	self changed:#definition.
     ]
 
@@ -918,7 +918,7 @@
 	names do:[:nm | nm ~= aString ifTrue:[newNames := newNames , nm , ' ']].
 	self classVariableString:newNames withoutSpaces.
 	self addChangeRecordForClass:self.
-	self updateVersionString.
+	self updateRevisionString.
 	self changed:#definition.
     ]
 
@@ -940,7 +940,7 @@
     ].
     any ifTrue:[
 	self addChangeRecordForRenameCategory:oldCategory to:newCategory.
-	self updateVersionString.
+	self updateRevisionString.
 	self changed:#methodCategory.
     ]
 
@@ -982,7 +982,7 @@
 	]
     ].
     (super addSelector:newSelector withMethod:newMethod) ifTrue:[
-	self updateVersionString.
+	self updateRevisionString.
 	self addChangeRecordForMethod:newMethod.
     ]
 
@@ -996,7 +996,7 @@
 
     (super removeSelector:aSelector) ifTrue:[
 	self addChangeRecordForRemoveSelector:aSelector.
-	self updateVersionString.
+	self updateRevisionString.
 	self changed:#methodDictionary with:aSelector.
     ]
 
@@ -2606,10 +2606,10 @@
 
 !Class methodsFor:'private'!
 
-updateVersionString
-    "update my version string, to reflect a change w.r.t.
+updateRevisionString
+    "update my revision string, to reflect a change w.r.t.
      the original source.
-     The original version string is kept as a reference i.e.
+     The original revision string is kept as a reference i.e.
        Header: /files/CVS/stx/libbasic/Class.st,v 1.63 1995/10/28 16:44:51 cg Exp $
      is changed into:
        Header: /files/CVS/stx/libbasic/Class.st,v 1.63mod 1995/10/28 16:44:51 cg Exp $
@@ -2623,7 +2623,7 @@
     ].
     m := cls compiledMethodAt:#version.
     m isNil ifTrue:[^ self].
-    vs := self versionString.
+    vs := self revisionString.
     vs isNil ifTrue:[^ self].
 
     "/ search for ,v
@@ -2641,24 +2641,22 @@
 	^ self
     ].
     m source:'version
-"
-' , leftPart , ' ' , vsnString , 'mod' , ' ' , rightPart , '
-"'.
+^ ''' , leftPart , ' ' , vsnString , 'mod' , ' ' , rightPart , ''''.
 
 "/ ('updated to :' , vsnString , 'mod') printNL.
 
     "
-     Class updateVersionString
-     Number updateVersionString
-     ProcessMonitor updateVersionString
+     Class updateRevisionString
+     Number updateRevisionString
+     ProcessMonitor updateRevisionString
     "
 
     "Created: 29.10.1995 / 19:25:15 / cg"
     "Modified: 29.10.1995 / 19:39:38 / cg"
 !
 
-versionString
-    "return my version string; that one is extracted from the
+revisionString
+    "return my revision string; that one is extracted from the
      classes #version method. Either this is a method returning that string,
      or its a comment-only method and the comment defines the version.
      If the source is not accessable or no such method exists,
@@ -2690,17 +2688,74 @@
 
     "
      Smalltalk allClassesDo:[:cls |
-	Transcript showCr:cls versionString
+	Transcript showCr:cls revisionString
      ].
 
-     Number versionString  
-     FileDirectory versionString  
+     Number revisionString  
+     FileDirectory revisionString  
     "
 
     "Created: 29.10.1995 / 19:28:03 / cg"
     "Modified: 11.11.1995 / 14:11:41 / cg"
 !
 
+revisionInfo
+    "return a dictionary filled with revision info.
+     This extracts the reevant info from the revisionString."
+
+    |vsnString words info nm|
+
+    info := IdentityDictionary new.
+    vsnString := self revisionString.
+    vsnString notNil ifTrue:[
+	words := vsnString asCollectionOfWords.
+
+	"/
+	"/ supported formats:
+	"/
+	"/ $-Header: pathName rev date time user state $
+	"/ $-Revision: rev $
+	"/ $-Id: fileName rev date time user state $
+	"/
+	((words at:1) = '$Header:') ifTrue:[
+	    nm := words at:2.
+	    info at:#repositoryPathName put:nm.
+	    (nm endsWith:',v') ifTrue:[
+		nm := nm copyWithoutLast:2
+	    ].
+	    info at:#fileName put:nm asFilename baseName.
+	    info at:#revision put:(words at:3).
+	    info at:#date put:(words at:4).
+	    info at:#time put:(words at:5).
+	    info at:#user put:(words at:6).
+	    info at:#state put:(words at:7).
+	    ^ info
+	].
+	((words at:1) = '$Revision:') ifTrue:[
+	    info at:#revision put:(words at:2).
+	    ^ info
+	].
+	((words at:1) = '$Id:') ifTrue:[
+	    info at:#fileName put:(words at:2).
+	    info at:#revision put:(words at:3).
+	    info at:#date put:(words at:4).
+	    info at:#time put:(words at:5).
+	    info at:#user put:(words at:6).
+	    info at:#state put:(words at:7).
+	    ^ info
+	].
+    ].
+    ^ nil
+
+    "
+     Object revisionString 
+     Object revisionInfo 
+    "
+
+    "Created: 11.11.1995 / 14:27:20 / cg"
+    "Modified: 14.11.1995 / 16:00:51 / cg"
+!
+
 addAllClassVarNamesTo:aCollection
     "helper - add the name-strings of the class variables and of the class-vars
      of all superclasses to the argument, aCollection. Return aCollection"