MCVersion.st
branchjv
changeset 1143 1999f5363e6f
parent 891 a4e2e9b2947d
child 1153 16866d65107a
--- a/MCVersion.st	Mon May 03 22:03:54 2021 +0100
+++ b/MCVersion.st	Mon May 03 22:04:51 2021 +0100
@@ -1,5 +1,10 @@
+"
+COPYRIGHT (c) 2021 LabWare
+"
 "{ Package: 'stx:goodies/monticello' }"
 
+"{ NameSpace: Smalltalk }"
+
 Object subclass:#MCVersion
 	instanceVariableNames:'package info snapshot dependencies cachable'
 	classVariableNames:''
@@ -7,9 +12,42 @@
 	category:'SCM-Monticello-Versioning'
 !
 
+!MCVersion class methodsFor:'documentation'!
+
+copyright
+"
+COPYRIGHT (c) 2021 LabWare
+
+
+"
+! !
 
 !MCVersion class methodsFor:'instance creation'!
 
+forPackage: packageId
+    "Returns an MCVersion for currently loaded code"
+
+    | pkg wc versionInfo version |
+
+    pkg := MCPackage named: packageId.
+    wc := pkg workingCopy.
+    versionInfo := MCVersionInfo forPackage: packageId.
+    [
+        version := wc newVersion.
+        version snapshot options includeExtrasForSTX:false.
+    ] on:MCVersionNameAndMessageRequest do:[:ex | 
+        ex resume:(Array with:versionInfo name with:versionInfo message) 
+    ].
+    version info:versionInfo.        
+    ^ version
+
+    "
+    MCVersion forPackage: 'MachineArithmetic'
+    "
+
+    "Created: / 03-05-2021 / 16:14:04 / Jan Vrany <jan.vrany@labware.com>"
+!
+
 package: aPackageOrPackageID
 	aPackageOrPackageID isSymbol ifTrue:[
 	    "/ an ST/X package-ID
@@ -248,5 +286,10 @@
 
 version_CVS
     ^ '$Header: /cvs/stx/stx/goodies/monticello/MCVersion.st,v 1.10 2013-07-27 13:50:54 cg Exp $'
+!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
 ! !