initial checkin
authorClaus Gittinger <cg@exept.de>
Wed, 22 Nov 2006 14:16:18 +0100
changeset 80 349349d9b55a
parent 79 5f6ee04f4dc9
child 81 f11d32f2ede9
initial checkin
MCVersionDependency.st
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MCVersionDependency.st	Wed Nov 22 14:16:18 2006 +0100
@@ -0,0 +1,96 @@
+"{ Package: 'stx:goodies/monticello' }"
+
+Object subclass:#MCVersionDependency
+	instanceVariableNames:'package versionInfo'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Monticello-Versioning'
+!
+
+
+!MCVersionDependency class methodsFor:'as yet unclassified'!
+
+package: aPackage info: aVersionInfo
+	^ self basicNew initializeWithPackage: aPackage info: aVersionInfo
+! !
+
+!MCVersionDependency methodsFor:'accessing'!
+
+package
+	^ package
+!
+
+repositoryGroup
+	^ self package workingCopy repositoryGroup
+!
+
+versionInfo
+	^ versionInfo
+! !
+
+!MCVersionDependency methodsFor:'comparing'!
+
+= other
+	^ other species = self species
+		and: [other versionInfo = versionInfo
+				and: [other package = package]]
+!
+
+hash
+	^ versionInfo hash
+! !
+
+!MCVersionDependency methodsFor:'initialize-release'!
+
+initializeWithPackage: aPackage info: aVersionInfo
+	package _ aPackage.
+	versionInfo _ aVersionInfo
+! !
+
+!MCVersionDependency methodsFor:'resolving'!
+
+resolve
+	^ self repositoryGroup
+		versionWithInfo: versionInfo
+		ifNone: [ MCRepositoryGroup default versionWithInfo: versionInfo ifNone: []]
+! !
+
+!MCVersionDependency methodsFor:'testing'!
+
+isCurrent
+	^ package hasWorkingCopy
+		and: [self isFulfilled
+			and: [package workingCopy modified not]]
+!
+
+isFulfilled
+	^package hasWorkingCopy
+		and: [self isFulfilledBy: package workingCopy ancestry]
+!
+
+isFulfilledBy: anAncestry
+	^ anAncestry ancestors includes: versionInfo
+!
+
+isFulfilledByAncestors
+	^ package hasWorkingCopy
+		and: [self isFulfilledByAncestorsOf: package workingCopy ancestry]
+!
+
+isFulfilledByAncestorsOf: anAncestry
+	^ anAncestry hasAncestor: versionInfo
+!
+
+isOlder
+	"Answer true if I represent an older version of a package that is loaded."
+	^ package hasWorkingCopy
+		and: [self isFulfilled not
+			and: [ self isFulfilledByAncestors
+				and: [package workingCopy modified not]]]
+! !
+
+!MCVersionDependency class methodsFor:'documentation'!
+
+version
+    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCVersionDependency.st,v 1.1 2006-11-22 13:16:18 cg Exp $'
+! !