--- a/ChangeSet.st Fri Apr 08 07:05:17 2016 +0200
+++ b/ChangeSet.st Tue Apr 12 07:02:03 2016 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1993 by Claus Gittinger
All Rights Reserved
@@ -790,6 +792,7 @@
"Created: / 27.10.1997 / 13:52:54 / cg"
! !
+
!ChangeSet class methodsFor:'Compatibility-VW'!
component: component definition: anObject change: changeSymbol
@@ -1993,11 +1996,11 @@
diffSetsAgainst:anotherChangeSet
"walk over the receiver and anotherChangeSet,
add all changes to one of the tree lists:
- onlyInReceiver, onlyInArg or changed,
+ onlyInReceiver, onlyInArg or changed,
each being a changeSet containing corresponding changes.
WARNING:
- destructive; could modify both the receiver and the argument by possibly
- changing methodChanges into categoryChanges"
+ destructive; could modify both the receiver and the argument by possibly
+ changing methodChanges into categoryChanges"
|otherChangeIndicesBySelector otherNonMethodChangeIndices changeIndicesBySelector nonMethodChangeIndices
onlyInReceiver onlyInArg changedMethods same
@@ -2017,136 +2020,136 @@
"/ these caches reduces square runtime to almost linear...
anotherChangeSet keysAndValuesDo:[:idxB :aChangeInB |
- |setOfOtherChangeIndicesForThisSelector|
-
- aChangeInB isMethodChange ifTrue:[
- setOfOtherChangeIndicesForThisSelector := otherChangeIndicesBySelector at:(aChangeInB selector) ifAbsentPut:[OrderedCollection new].
- setOfOtherChangeIndicesForThisSelector add:idxB.
- ] ifFalse:[
- otherNonMethodChangeIndices add:idxB
- ].
+ |setOfOtherChangeIndicesForThisSelector|
+
+ aChangeInB isMethodChange ifTrue:[
+ setOfOtherChangeIndicesForThisSelector := otherChangeIndicesBySelector at:(aChangeInB selector) ifAbsentPut:[OrderedCollection new].
+ setOfOtherChangeIndicesForThisSelector add:idxB.
+ ] ifFalse:[
+ otherNonMethodChangeIndices add:idxB
+ ].
].
self keysAndValuesDo:[:idxA :aChangeInA |
- |indicesOfChangesToExplore anyFound ch|
-
- anyFound := false.
-
- aChangeInA isMethodChange ifTrue:[
- indicesOfChangesToExplore := otherChangeIndicesBySelector at:(aChangeInA selector) ifAbsent:#()
- ] ifFalse:[
- indicesOfChangesToExplore := otherNonMethodChangeIndices.
- ].
-
- indicesOfChangesToExplore do:[:idxB |
- |aChangeInB|
-
- aChangeInB := anotherChangeSet at:idxB.
-
- (aChangeInA isForSameAs:aChangeInB) ifTrue:[
- anyFound := true.
-
- "/ also in B - is it different ?
- (aChangeInA sameAs:aChangeInB) ifFalse:[
- changedMethods add:aChangeInA.
- indexFromChangedMethodsToA add:idxA.
- indexFromChangedMethodsToB add:idxB.
- ] ifTrue:[
- aChangeInA isMethodChange ifTrue:[
- aChangeInA methodCategory ~= aChangeInB methodCategory ifTrue:[
- "/ only the category is different;
- "/ make it a MethodCategory changes.
-
- ch := MethodCategoryChange new
- className:aChangeInA className
- selector:aChangeInA selector
- category:aChangeInA methodCategory;
- "JV@2012-03-20: Also keeps origin, required by merge tool"
- origin: aChangeInA.
- self at:idxA put:ch.
-
- ch := MethodCategoryChange new
- className:aChangeInB className
- selector:aChangeInB selector
- category:aChangeInB methodCategory;
- "JV@2012-03-20: Also keeps origin, required by merge tool"
- origin: aChangeInB.
- anotherChangeSet at:idxB put:ch.
-
- changedMethods add:aChangeInA.
- indexFromChangedMethodsToA add:idxA.
- indexFromChangedMethodsToB add:idxB.
- ]
- ].
- ]
- ] ifFalse:[
- (aChangeInA sameAs:aChangeInB) ifTrue:[
- anyFound := true.
- ] ifFalse:[
- ]
- ]
- ].
-
- anyFound ifFalse:[
- onlyInReceiver add:aChangeInA.
- ]
+ |indicesOfChangesToExplore anyFound ch|
+
+ anyFound := false.
+
+ aChangeInA isMethodChange ifTrue:[
+ indicesOfChangesToExplore := otherChangeIndicesBySelector at:(aChangeInA selector) ifAbsent:#()
+ ] ifFalse:[
+ indicesOfChangesToExplore := otherNonMethodChangeIndices.
+ ].
+
+ indicesOfChangesToExplore do:[:idxB |
+ |aChangeInB|
+
+ aChangeInB := anotherChangeSet at:idxB.
+
+ (aChangeInA isForSameAs:aChangeInB) ifTrue:[
+ anyFound := true.
+
+ "/ also in B - is it different?
+ (aChangeInA sameAs:aChangeInB) ifFalse:[
+ changedMethods add:aChangeInA.
+ indexFromChangedMethodsToA add:idxA.
+ indexFromChangedMethodsToB add:idxB.
+ ] ifTrue:[
+ aChangeInA isMethodChange ifTrue:[
+ aChangeInA methodCategory ~= aChangeInB methodCategory ifTrue:[
+ "/ only the category is different;
+ "/ make it a MethodCategory changes.
+
+ ch := MethodCategoryChange new
+ className:aChangeInA className
+ selector:aChangeInA selector
+ category:aChangeInA methodCategory;
+ "JV@2012-03-20: Also keeps origin, required by merge tool"
+ origin: aChangeInA.
+ self at:idxA put:ch.
+
+ ch := MethodCategoryChange new
+ className:aChangeInB className
+ selector:aChangeInB selector
+ category:aChangeInB methodCategory;
+ "JV@2012-03-20: Also keeps origin, required by merge tool"
+ origin: aChangeInB.
+ anotherChangeSet at:idxB put:ch.
+
+ changedMethods add:aChangeInA.
+ indexFromChangedMethodsToA add:idxA.
+ indexFromChangedMethodsToB add:idxB.
+ ]
+ ].
+ ]
+ ] ifFalse:[
+ (aChangeInA sameAs:aChangeInB) ifTrue:[
+ anyFound := true.
+ ] ifFalse:[
+ ]
+ ]
+ ].
+
+ anyFound ifFalse:[
+ onlyInReceiver add:aChangeInA.
+ ]
].
- "/ these caches reduces square runtime to almost linear...
+ "/ these caches reduce square runtime to almost linear...
changeIndicesBySelector := Dictionary new.
nonMethodChangeIndices := OrderedCollection new.
self keysAndValuesDo:[:idxA :aChangeInA |
- |setOfChangeIndicesForThisSelector|
-
- aChangeInA isMethodChange ifTrue:[
- setOfChangeIndicesForThisSelector := changeIndicesBySelector at:(aChangeInA selector) ifAbsentPut:[OrderedCollection new].
- setOfChangeIndicesForThisSelector add:idxA.
- ] ifFalse:[
- nonMethodChangeIndices add:idxA
- ].
+ |setOfChangeIndicesForThisSelector|
+
+ aChangeInA isMethodChange ifTrue:[
+ setOfChangeIndicesForThisSelector := changeIndicesBySelector at:(aChangeInA selector) ifAbsentPut:[OrderedCollection new].
+ setOfChangeIndicesForThisSelector add:idxA.
+ ] ifFalse:[
+ nonMethodChangeIndices add:idxA
+ ].
].
anotherChangeSet keysAndValuesDo:[:idxB :aChangeInB |
- |anyFound indicesOfChangesToExplore|
-
- anyFound := false.
-
- aChangeInB isMethodChange ifTrue:[
- indicesOfChangesToExplore := changeIndicesBySelector at:(aChangeInB selector) ifAbsent:#()
- ] ifFalse:[
- indicesOfChangesToExplore := nonMethodChangeIndices.
- ].
-
- indicesOfChangesToExplore do:[:idxA |
- |aChangeInA idxM|
-
- aChangeInA := self at:idxA.
-
- (aChangeInA isForSameAs:aChangeInB) ifTrue:[
- anyFound := true.
-
- "/ also in B - is it different ?
- (aChangeInA sameAs:aChangeInB) ifFalse:[
- "/ already there ?
- idxM := changedMethods findFirst:[:c | c isForSameAs:aChangeInB].
- idxM == 0 ifTrue:[
- changedMethods add:aChangeInB.
- indexFromChangedMethodsToB add:idxB.
- ] ifFalse:[
- indexFromChangedMethodsToB at:idxM put:idxB
- ]
- ]
- ] ifFalse:[
- (aChangeInA sameAs:aChangeInB) ifTrue:[
- anyFound := true.
- ] ifFalse:[
- ]
- ]
- ].
- anyFound ifFalse:[
- onlyInArg add:aChangeInB.
- ]
+ |anyFound indicesOfChangesToExplore|
+
+ anyFound := false.
+
+ aChangeInB isMethodChange ifTrue:[
+ indicesOfChangesToExplore := changeIndicesBySelector at:(aChangeInB selector) ifAbsent:#()
+ ] ifFalse:[
+ indicesOfChangesToExplore := nonMethodChangeIndices.
+ ].
+
+ indicesOfChangesToExplore do:[:idxA |
+ |aChangeInA idxM|
+
+ aChangeInA := self at:idxA.
+
+ (aChangeInA isForSameAs:aChangeInB) ifTrue:[
+ anyFound := true.
+
+ "/ also in B - is it different ?
+ (aChangeInA sameAs:aChangeInB) ifFalse:[
+ "/ already there ?
+ idxM := changedMethods findFirst:[:c | c isForSameAs:aChangeInB].
+ idxM == 0 ifTrue:[
+ changedMethods add:aChangeInB.
+ indexFromChangedMethodsToB add:idxB.
+ ] ifFalse:[
+ indexFromChangedMethodsToB at:idxM put:idxB
+ ]
+ ]
+ ] ifFalse:[
+ (aChangeInA sameAs:aChangeInB) ifTrue:[
+ anyFound := true.
+ ] ifFalse:[
+ ]
+ ]
+ ].
+ anyFound ifFalse:[
+ onlyInArg add:aChangeInB.
+ ]
].
"/ info := OrderedCollection new:(changedMethods size).
@@ -2157,20 +2160,20 @@
"/ )
"/ ].
changedMethods := (1 to:changedMethods size) asOrderedCollection collect:[:idx |
- |cA cB|
-
- cA := self at:(indexFromChangedMethodsToA at:idx).
- cB := anotherChangeSet at:(indexFromChangedMethodsToB at:idx).
- Array with:cA with:cB
- ].
+ |cA cB|
+
+ cA := self at:(indexFromChangedMethodsToA at:idx).
+ cB := anotherChangeSet at:(indexFromChangedMethodsToB at:idx).
+ Array with:cA with:cB
+ ].
same := self reject:[:chg|(changedMethods contains:[:pair|pair first == chg]) or:[onlyInReceiver includes: chg]].
ret := DiffSet new
- changed:changedMethods
- onlyInReceiver:onlyInReceiver
- onlyInArg:onlyInArg
- same: same.
+ changed:changedMethods
+ onlyInReceiver:onlyInReceiver
+ onlyInArg:onlyInArg
+ same: same.
"/ ret info:info.
^ret