VersionInfo.st
branchjv
changeset 3838 474d8ec95b33
parent 3128 87750af738dc
parent 3745 0c3d925c0347
child 4166 66a7a47f9253
--- a/VersionInfo.st	Tue Feb 04 21:01:56 2014 +0100
+++ b/VersionInfo.st	Wed Apr 01 10:37:40 2015 +0100
@@ -11,6 +11,8 @@
 "
 "{ Package: 'stx:libbasic3' }"
 
+"{ NameSpace: Smalltalk }"
+
 Object subclass:#VersionInfo
 	instanceVariableNames:'revision binaryRevision user date time fileName'
 	classVariableNames:''
@@ -36,10 +38,12 @@
 
 documentation
 "
-    Class used to return a Dictionary when asked for versionInfo.
+    In ancient times, Class used to return a Dictionary when asked for versionInfo.
     This has been replaced by instances of this class and subclasses.
-    Notice, that subclasses may add more info for specific source repositories,
-    (CVSVersionInfo, MonticelloVersionInfo etc.)
+
+    Notice, that subclasses may add more info for specific source repositories
+    (CVSVersionInfo, MonticelloVersionInfo etc.).
+    However, any generic tools/ui should only depend on the values (and getters) found here.
 
     [author:]
         cg (cg@AQUA-DUO)
@@ -84,7 +88,7 @@
     "backward compatible dictionary-like accessing"
 
     (self respondsTo:aKey) ifTrue:[
-        self perform:(aKey,':') asSymbol with:value.
+        self perform:aKey asMutator with:value.
         ^ value "/ sigh
     ].
     ^ self errorKeyNotFound:aKey
@@ -135,6 +139,34 @@
     "Created: / 22-10-2008 / 20:48:08 / cg"
 !
 
+majorVersion
+    |v|
+
+    v := self revision.
+    v notEmptyOrNil ifTrue:[
+        ^ v upTo:$.
+    ].
+    ^ nil
+
+    "
+     Array revisionInfo majorVersion
+    "
+!
+
+minorVersion
+    |v|
+
+    v := self revision.
+    v notEmptyOrNil ifTrue:[
+        ^ v copyFrom:(v indexOf:$.)+1
+    ].
+    ^ nil
+
+    "
+     Array revisionInfo minorVersion
+    "
+!
+
 repositoryPathName
     "raise an error: must be redefined in concrete subclass(es)"
 
@@ -151,6 +183,17 @@
     revision := something.
 !
 
+symbolicVersionName
+    "iff that source code manager uses cryptic names for versions,
+     (eg. dbManager, git and hg managers), we may add an additional symbolic
+     version name, which is used for human readers (and not required to be unique).
+     Usually something like x.y-nn, where nn is the user name is returned there.
+     Here, we return the revision proper, which is ok for cvs, svn and others with a 
+     user-friendly version number."
+
+    ^ revision
+!
+
 time
     ^ time
 !
@@ -184,16 +227,11 @@
 
 !VersionInfo class methodsFor:'documentation'!
 
-version_CVS
-    ^ '§Header: /cvs/stx/stx/libbasic3/VersionInfo.st,v 1.6 2011/12/22 08:59:53 cg Exp §'
+version
+    ^ '$Header: /cvs/stx/stx/libbasic3/VersionInfo.st,v 1.10 2015-02-03 17:51:15 cg Exp $'
 !
 
-version_HG
-
-    ^ '$Changeset: <not expanded> $'
-!
-
-version_SVN
-    ^ '§Id: VersionInfo.st 1909 2012-03-31 00:14:49Z vranyj1 §'
+version_CVS
+    ^ '$Header: /cvs/stx/stx/libbasic3/VersionInfo.st,v 1.10 2015-02-03 17:51:15 cg Exp $'
 ! !