VersionInfo.st
branchjv
changeset 4166 66a7a47f9253
parent 3838 474d8ec95b33
parent 4161 55ad833b981e
child 4167 ee0c93ae59e0
--- a/VersionInfo.st	Wed Sep 07 16:04:00 2016 +0100
+++ b/VersionInfo.st	Mon Nov 28 17:11:46 2016 +0000
@@ -14,7 +14,8 @@
 "{ NameSpace: Smalltalk }"
 
 Object subclass:#VersionInfo
-	instanceVariableNames:'revision binaryRevision user date time fileName'
+	instanceVariableNames:'moreAttributes logMessage revision binaryRevision user timestamp
+		date time fileName state'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'System-SourceCodeManagement'
@@ -52,13 +53,12 @@
 
 !VersionInfo methodsFor:'accessing'!
 
-at:aKey
+at:aSymbolKey
     "backward compatible dictionary-like accessing"
 
-    (self respondsTo:aKey) ifTrue:[
-        ^ self perform:aKey
-    ].
-    ^ self errorKeyNotFound:aKey
+    ^ self 
+        at:aSymbolKey 
+        ifAbsent:[ self warn:'VersionInfo: no such property: ',aSymbolKey. nil]
 
     "
      self new at:#binaryRevision
@@ -68,13 +68,16 @@
     "Modified: / 22-10-2008 / 20:23:31 / cg"
 !
 
-at:aKey ifAbsent:replacement
+at:aSymbolKey ifAbsent:replacement
     "backward compatible dictionary-like accessing"
 
-    (self respondsTo:aKey) ifTrue:[
-        ^ (self perform:aKey) ? replacement
+    (self respondsTo:aSymbolKey) ifTrue:[
+        ^ (self perform:aSymbolKey)
     ].
-    ^ replacement
+    moreAttributes notNil ifTrue:[
+        ^ moreAttributes at:aSymbolKey ifAbsent:replacement
+    ].    
+    ^ replacement value
 
     "
      self new at:#binaryRevision
@@ -84,18 +87,25 @@
     "Created: / 22-10-2008 / 20:19:42 / cg"
 !
 
-at:aKey put:value
+at:aSymbolKey put:value
     "backward compatible dictionary-like accessing"
 
-    (self respondsTo:aKey) ifTrue:[
-        self perform:aKey asMutator with:value.
+    |setter|
+
+    setter := aSymbolKey asMutator.
+    (self respondsTo:setter) ifTrue:[
+        self perform:setter with:value.
         ^ value "/ sigh
     ].
-    ^ self errorKeyNotFound:aKey
+    moreAttributes isNil ifTrue:[
+        moreAttributes := IdentityDictionary new.
+    ].
+    moreAttributes at:aSymbolKey put:value.
+    ^ value "/ sigh
 
     "
      self new at:#binaryRevision put:#bar
-     self new at:#foo put:#bar
+     self new at:#foo put:#bar; yourself
     "
 
     "Created: / 22-10-2008 / 20:20:54 / cg"
@@ -107,15 +117,22 @@
     "Created: / 21-12-2011 / 23:09:54 / cg"
 !
 
+author:aString
+    ^ self user:aString
+
+    "Created: / 21-12-2011 / 23:09:54 / cg"
+!
+
 binaryRevision
     ^ binaryRevision
 !
 
-binaryRevision:something
-    binaryRevision := something.
+binaryRevision:aString
+    binaryRevision := aString.
 !
 
 date
+    timestamp notNil ifTrue:[^ timestamp asDate].
     ^ date
 !
 
@@ -123,20 +140,37 @@
     date := something.
 !
 
+day
+    ^ date
+!
+
 fileName
     ^ fileName
 !
 
-fileName:something
-    fileName := something.
+fileName:aString
+    fileName := aString.
 !
 
 keysAndValuesDo:aBlock
     self class instVarNames do:[:nm |
-        aBlock value:(nm asSymbol) value:(self perform:nm asSymbol)
+        nm ~= 'moreAttributes' ifTrue:[   
+            aBlock value:(nm asSymbol) value:(self perform:nm asSymbol)
+        ].
+    ].
+    moreAttributes notNil ifTrue:[
+        moreAttributes keysAndValuesDo:aBlock
     ].
+    
+    "Created: / 22-10-2008 / 20:48:08 / cg"
+!
 
-    "Created: / 22-10-2008 / 20:48:08 / cg"
+logMessage
+    ^ logMessage
+!
+
+logMessage:aString
+    logMessage := aString.
 !
 
 majorVersion
@@ -179,8 +213,16 @@
     ^ revision
 !
 
-revision:something
-    revision := something.
+revision:aString
+    revision := aString.
+!
+
+state
+    ^ state
+!
+
+state:something
+    state := something.
 !
 
 symbolicVersionName
@@ -195,6 +237,7 @@
 !
 
 time
+    timestamp notNil ifTrue:[^ timestamp asTime].
     ^ time
 !
 
@@ -209,9 +252,22 @@
     "Created: / 04-12-2011 / 10:06:02 / cg"
 !
 
+timestamp
+    timestamp notNil ifTrue:[^ timestamp].
+    date isNil ifTrue:[^ nil].
+    time isNil ifTrue:[^ date asTimestamp].
+    ^ Timestamp fromDate:date andTime:time
+!
+
+timestamp:aTimestamp
+    timestamp := aTimestamp
+
+    "Created: / 04-12-2011 / 10:06:02 / cg"
+!
+
 timezone
-    "raise an error: must be redefined in concrete subclass(es)"
-
+    timestamp notNil ifTrue:[^ timestamp timezone].
+    
     ^ nil "Not known"
 
     "Modified: / 23-11-2011 / 13:54:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -221,17 +277,17 @@
     ^ user
 !
 
-user:something
-    user := something.
+user:aString
+    user := aString.
 ! !
 
 !VersionInfo class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/VersionInfo.st,v 1.10 2015-02-03 17:51:15 cg Exp $'
+    ^ '$Header$'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic3/VersionInfo.st,v 1.10 2015-02-03 17:51:15 cg Exp $'
+    ^ '$Header$'
 ! !