MCSnapshot.st
author convert-repo
Thu, 07 Apr 2016 04:05:21 +0000
changeset 1008 c9cdc9559304
parent 895 b85534b16bd4
child 1002 54b4906215ca
child 1039 88f5b1106042
permissions -rw-r--r--
update tags

"{ Package: 'stx:goodies/monticello' }"

Object subclass:#MCSnapshot
	instanceVariableNames:'definitions'
	classVariableNames:''
	poolDictionaries:''
	category:'SCM-Monticello-Base'
!


!MCSnapshot class methodsFor:'as yet unclassified'!

empty
	^ self fromDefinitions: #()
!

fromDefinitions: aCollection
	^ self new initializeWithDefinitions: aCollection
! !

!MCSnapshot methodsFor:'accessing'!

= other
	^ definitions asArray = other definitions asArray
!

definitions
	^ definitions
!

hash
	^ definitions asArray hash
!

includeExtrasForSTX
    "/ do not default to true here, as the version is snapshotted twice in order to
    "/ update the version-strings, and we don not need this stuff in the first round!!
    | includeExtrasForSTX |
    includeExtrasForSTX := self objectAttributeAt: #includeExtrasForSTX.
    ^ includeExtrasForSTX ? false

    "Modified: / 12-08-2013 / 01:57:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

includeExtrasForSTX:something
    self objectAttributeAt: #includeExtrasForSTX put: something.

    "Modified: / 12-08-2013 / 01:57:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!MCSnapshot methodsFor:'converting'!

asChangeSet

    ^(ChangeSet withAll:
        (self definitions collect:[:def|def asChange]))

    "Created: / 13-10-2010 / 17:18:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 26-10-2010 / 23:05:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!MCSnapshot methodsFor:'copying'!

postCopy
    "Do half-shallow copy of definitions to allow for their transformation"
    definitions := definitions copy.
    1 to: definitions size do:[:i|
        definitions at: i put: (definitions at:i) copy
    ]

    "Created: / 29-05-2013 / 01:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 31-05-2013 / 00:54:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!MCSnapshot methodsFor:'initializing'!

initializeWithDefinitions: aCollection
	definitions := aCollection.
! !

!MCSnapshot methodsFor:'loading'!

install
	MCPackageLoader installSnapshot: self
!

updatePackage: aPackage
	MCPackageLoader updatePackage: aPackage withSnapshot: self
! !

!MCSnapshot methodsFor:'patching'!

patchRelativeToBase: aSnapshot
	^ MCPatch fromBase: aSnapshot target: self
! !

!MCSnapshot methodsFor:'queries'!

includesClassNamed: className
    definitions reverseDo:[:definition|
        (definition isClassDefinition and:[definition className = className])
            ifTrue:[ ^ true ].
    ].
    ^false

    "Created: / 31-05-2013 / 00:04:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!MCSnapshot class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCSnapshot.st,v 1.10 2013-08-12 00:59:30 vrany Exp $'
!

version_CVS
    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCSnapshot.st,v 1.10 2013-08-12 00:59:30 vrany Exp $'
!

version_SVN
    ^ '$Id: MCSnapshot.st,v 1.10 2013-08-12 00:59:30 vrany Exp $'
! !