[Pkg] DeltaStreams: DeltaStreams-Model-gk.10.mcz
squeak-dev-noreply at lists.squeakfoundation.org
squeak-dev-noreply at lists.squeakfoundation.org
Wed Mar 11 13:19:56 UTC 2009
A new version of DeltaStreams-Model was added to project DeltaStreams:
http://www.squeaksource.com/DeltaStreams/DeltaStreams-Model-gk.10.mcz
==================== Summary ====================
Name: DeltaStreams-Model-gk.10
Author: gk
Time: 11 March 2009, 2:19:52 pm
UUID: e052568e-2e83-410c-a178-986e2585c7a5
Ancestors: DeltaStreams-Model-mtf.9
Print out class name in DSBasicClassChange, easier to debug.
Added DSChange>>copy!
A few added "isMethods", trivial.
Better implementation of generic DSClassRemovedChange>>fromClass:
Fix in DSCompositeChange>>collect:, reverseCollect: and friends (it should not do species new)
Added DSCompositeChange>>fromChange: (plus subclass implementations) which was missing.
Changed odd default implementation of reverseDo: to be subclassResponsibility instead.
Changed DSDelta>>addChange: to only copy a change before adding it - if it has a number set (meaning it is already in another DSDelta).
Some other cleanups.
This makes all these tests green:
DSDeltaApplyTest
DSDeltaLoggingTest
DSDeltaCreationTest
DSDeltaAntiTest
DSDeltaCopyTest
Noted one problem though - you can't run them all together in TestRunner because some will tearDown the DSTestResource!!
=============== Diff against DeltaStreams-Model-mtf.9 ===============
Item was changed:
----- Method: DSCompositeChange>>reverseCollect: (in category 'enumerating') -----
reverseCollect: aBlock
- "Evaluate aBlock with each of the receiver's elements as the argument.
- Collect the resulting values into a collection like the receiver. Answer
- the new collection."
| newCollection |
+ newCollection := OrderedCollection new.
- newCollection := self species new.
self reverseDo: [:each | newCollection add: (aBlock value: each)].
^ newCollection!
Item was added:
+ ----- Method: DSChange>>isClassAddedOrCreated (in category 'testing') -----
+ isClassAddedOrCreated
+ ^self isClassAdded or: [self isClassCreated]!
Item was changed:
----- Method: DSBasicClassChange>>printOn: (in category 'printing') -----
printOn: aStream
aStream nextPutAll: self className.
self isMeta ifTrue: [aStream nextPutAll: ' class'].
+ aStream space; nextPutAll: self action; nextPutAll: ' (', self class name, ' )'!
- aStream space; nextPutAll: self action!
Item was changed:
----- Method: DSCompositeClassDeletedChange>>fromClass: (in category 'initialize-release') -----
fromClass: aClass
"We add changes corresponding to removing every bit individually.
+ This is in order to be able to do a full revert later.
+
+ NOTE: Do not use this method directly, use instead:
+
+ DSClassRemovedChange fromClass: aClass
+ "
- This is mainly in order to be able to do a full revert later."
aClass theNonMetaClass selectors do: [:sel | self
add: (DSMethodRemovedChange fromClass: aClass theNonMetaClass selector: sel)].
aClass theMetaClass selectors do: [:sel | self
add: (DSMethodRemovedChange fromClass: aClass theMetaClass selector: sel)].
self add: (DSClassRemovedChange new fromClass: aClass)!
Item was added:
+ ----- Method: DSChange>>isClassDeletedOrRemoved (in category 'testing') -----
+ isClassDeletedOrRemoved
+ ^self isClassDeleted or: [self isClassRemoved]!
Item was added:
+ ----- Method: DSCompositeMethodChange>>fromChange: (in category 'initialize-release') -----
+ fromChange: aChange
+
+ super fromChange: aChange.
+ protocol := aChange protocol!
Item was changed:
----- Method: DSCompositeChange>>reverseDo: (in category 'enumerating') -----
reverseDo: aBlock
+ self subclassResponsibility!
- ^ self do: aBlock!
Item was added:
+ ----- Method: DSChange>>copy (in category 'copying') -----
+ copy
+ "Not sure if we should override #copy in this manner.
+ We don't conform to the postCopy pattern here."
+
+ ^ self class fromChange: self!
Item was changed:
----- Method: DSCompositeChange>>collect:displayingProgress: (in category 'enumerating') -----
collect: aBlock displayingProgress: aString
+ "Evaluate aBlock with each of the receiver's changes as the argument.
+ Collect the resulting values into an OrderedCollection."
- "Evaluate aBlock with each of the receiver's elements as the argument.
- Collect the resulting values into a collection like the receiver. Answer
- the new collection."
| newCollection |
+ newCollection := OrderedCollection new.
- newCollection := self species new.
self do: [:each | newCollection add: (aBlock value: each)] displayingProgress: aString.
^ newCollection!
Item was changed:
----- Method: DSClassRemovedChange class>>fromClass: (in category 'instance creation') -----
fromClass: aClass
+ "A class was removed from the system. If aClass
+ has methods we need to do create a composite delete change,
+ otheriwse this class change is enough."
- "A class was removed from the system. The default change
- is a composite class deleted change - since it needs to contain
- all individual changes needed to do a revert. If the resulting
- composite ends up containing just one change - then that
- can be used instead - a simple DSClassRemovedChange."
+ (aClass theNonMetaClass selectors isEmpty and: [aClass theMetaClass selectors isEmpty])
+ ifTrue: [ ^ super fromClass: aClass]
+ ifFalse: [ ^ DSCompositeClassDeletedChange fromClass: aClass]!
- | change |
- change := DSCompositeClassDeletedChange fromClass: aClass.
- ^ change changes size = 1
- ifTrue: [change changes first]
- ifFalse: [change]!
Item was changed:
----- Method: DSDelta>>addChange: (in category 'change logging') -----
addChange: aChange
"Within a Delta we give a change a monotonically increasing number
in order to be able to sort changes chronologically. The TimeStamp does
not work if changes are created very fast, they end up the same and sorting
+ becomes undefined. The change is copied if it already has a number,
+ in that case it is already in a different delta and we do not want to share."
- becomes undefined. The change is copied before it's number is changed since
- the change may be in multiple deltas under different numbers."
+ | change |
+ change := aChange number ifNil: [aChange] ifNotNil: [aChange copy].
+ change number: self incrementChangeCounter.
+ self compositeChange add: change.
+ self grouper ifNotNil: [self grouper add: change].
- | newChange |
- newChange := aChange copy number: self incrementChangeCounter; yourself.
- self compositeChange add: newChange.
- self grouper ifNotNil: [self grouper add: newChange].
self changed: #changeList.
+ ^ change!
- ^ newChange!
Item was changed:
----- Method: DSCompositeChange>>collect: (in category 'enumerating') -----
collect: aBlock
+ "Evaluate aBlock with each of the receiver's changes as the argument.
+ Collect the resulting values into an OrderedCollection."
- "Evaluate aBlock with each of the receiver's elements as the argument.
- Collect the resulting values into a collection like the receiver. Answer
- the new collection."
| newCollection |
+ newCollection := OrderedCollection new.
- newCollection := self species new.
self do: [:each | newCollection add: (aBlock value: each)].
^ newCollection!
Item was changed:
----- Method: DSChange>>isClassAddedOrRemoved (in category 'testing') -----
isClassAddedOrRemoved
+ ^self isClassAdded or: [self isClassRemoved]!
- ^false!
Item was changed:
----- Method: DSClassChange>>fromClass: (in category 'initialize-release') -----
fromClass: aClass
"We extract all needed attributes from the class so that we can recreate it."
| class metaclass |
super fromClass: aClass.
class := aClass theNonMetaClass.
metaclass := aClass theMetaClass.
self superclassName: class superclass name.
self instVarNames: class instVarNames.
self classVarNames: class classVarNames asArray.
self poolDictionaryNames: class poolDictionaryNames.
self category: class category.
self type: class typeOfClass.
self classInstVarNames: metaclass instVarNames.
self comment: class organization classComment.
self stamp: class organization commentStamp.!
Item was changed:
----- Method: DSBasicMethodChange>>meta: (in category 'accessing') -----
meta: aBoolean
+
meta := aBoolean!
Item was changed:
----- Method: DSChange>>initialize (in category 'initialize-release') -----
initialize
+
timeStamp := TimeStamp now!
Item was added:
+ ----- Method: DSChangeSequence>>mergeChanges (in category 'applying') -----
+ mergeChanges
+ "Merge the changes in the group best we can."!
Item was added:
+ ----- Method: DSCompositeClassChange>>fromChange: (in category 'initialize-release') -----
+ fromChange: aChange
+ super fromChange: aChange.
+ category := aChange category!
Item was changed:
----- Method: DSCompositeChange>>reverseCollect:displayingProgress: (in category 'enumerating') -----
reverseCollect: aBlock displayingProgress: aString
- "Evaluate aBlock with each of the receiver's elements as the argument.
- Collect the resulting values into a collection like the receiver. Answer
- the new collection."
| newCollection |
+ newCollection := OrderedCollection new.
- newCollection := self species new.
self reverseDo: [:each | newCollection add: (aBlock value: each)] displayingProgress: aString.
^ newCollection!
Item was changed:
DSClassChange subclass: #DSClassRemovedChange
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'DeltaStreams-Model-Class'!
+ !DSClassRemovedChange commentStamp: 'gk 3/11/2009 10:32' prior: 0!
+ This change represents a removal of an empty class, in other words the anti change of a DSClassCreatedChange (see implementors of #antiChangeClass). Removal of a class with methods is more complex and is handled by DSCompositeClassDeletedChange.!
- !DSClassRemovedChange commentStamp: 'gk 10/22/2007 15:02' prior: 0!
- This change represents a removal of an empty class. Removal of a class with methods is more complex and is handled by DSClassRemovedCompositeChange.!
Item was added:
+ ----- Method: DSCompositeChange>>fromChange: (in category 'initialize-release') -----
+ fromChange: aChange
+
+ super fromChange: aChange.
+ self changes: (aChange collect: [:each | each copy])!
Item was removed:
- ----- Method: DSDelta>>mergeChanges (in category 'applying') -----
- mergeChanges
- "Merge the changes in the group best we can."
-
- !
Item was removed:
- ----- Method: DSCompositeClassDeletedChange>>isClassRemoved (in category 'testing') -----
- isClassRemoved
- ^ true!
Item was removed:
- ----- Method: DSClassChange>>isClassAddedOrRemoved (in category 'testing') -----
- isClassAddedOrRemoved
- ^true!
More information about the Packages
mailing list