1997 each being a changeSet containing corresponding changes. |
1997 each being a changeSet containing corresponding changes. |
1998 WARNING: |
1998 WARNING: |
1999 destructive; could modify both the receiver and the argument by possibly |
1999 destructive; could modify both the receiver and the argument by possibly |
2000 changing methodChanges into categoryChanges" |
2000 changing methodChanges into categoryChanges" |
2001 |
2001 |
|
2002 ^ self diffSetsAgainst:anotherChangeSet comparingDifferentClasses:false |
|
2003 ! |
|
2004 |
|
2005 diffSetsAgainst:anotherChangeSet comparingDifferentClasses:comparingDifferentClasses |
|
2006 "walk over the receiver and anotherChangeSet, |
|
2007 add all changes to one of the tree lists: |
|
2008 onlyInReceiver, onlyInArg or changed, |
|
2009 each being a changeSet containing corresponding changes. |
|
2010 If comparingDifferentClasses is false, changes to different classes will |
|
2011 generate onlyInA/onlyInB changes; eg. changes for the same selector will be |
|
2012 listed on either side. |
|
2013 If it is true, we are comparing two different classes, and selectors present in |
|
2014 both will be listed as different (or even as the same). |
|
2015 |
|
2016 WARNING: |
|
2017 destructive; could modify both the receiver and the argument by possibly |
|
2018 changing methodChanges into categoryChanges." |
|
2019 |
2002 |otherChangeIndicesBySelector otherNonMethodChangeIndices changeIndicesBySelector nonMethodChangeIndices |
2020 |otherChangeIndicesBySelector otherNonMethodChangeIndices changeIndicesBySelector nonMethodChangeIndices |
2003 onlyInReceiver onlyInArg changedMethods same |
2021 onlyInReceiver onlyInArg changedMethods same |
2004 indexFromChangedMethodsToA indexFromChangedMethodsToB |
2022 indexFromChangedMethodsToA indexFromChangedMethodsToB |
2005 "info" ret| |
2023 "info" ret isForSame isSame| |
|
2024 |
|
2025 comparingDifferentClasses ifTrue:[ |
|
2026 isForSame := [:aChangeInA :aChangeInB | |
|
2027 |isForSame| |
|
2028 |
|
2029 isForSame := false. |
|
2030 (((aChangeInA isMethodChange and:[aChangeInB isMethodChange]) |
|
2031 and:[aChangeInA changeSelector = aChangeInB changeSelector]) |
|
2032 and:[aChangeInA changeClass isMeta = aChangeInB changeClass isMeta]) |
|
2033 ifTrue:[ |
|
2034 isForSame := true. |
|
2035 ] ifFalse:[ |
|
2036 ((aChangeInA isClassChange and:[aChangeInB isClassChange]) |
|
2037 and:[aChangeInA changeClass nameWithoutNameSpacePrefix |
|
2038 = aChangeInB changeClass nameWithoutNameSpacePrefix]) |
|
2039 ifTrue:[ |
|
2040 isForSame := true. |
|
2041 ] |
|
2042 ]. |
|
2043 isForSame |
|
2044 ]. |
|
2045 |
|
2046 isSame := [:aChangeInA :aChangeInB | |
|
2047 (aChangeInA source = aChangeInB source) |
|
2048 ]. |
|
2049 ] ifFalse:[ |
|
2050 isForSame := [:aChangeInA :aChangeInB | |
|
2051 (aChangeInA isForSameAs:aChangeInB) |
|
2052 ]. |
|
2053 |
|
2054 isSame := [:aChangeInA :aChangeInB | |
|
2055 (aChangeInA sameAs:aChangeInB) |
|
2056 ]. |
|
2057 ]. |
2006 |
2058 |
2007 onlyInReceiver := ChangeSet new. |
2059 onlyInReceiver := ChangeSet new. |
2008 onlyInArg := ChangeSet new. |
2060 onlyInArg := ChangeSet new. |
2009 changedMethods := ChangeSet new. |
2061 changedMethods := ChangeSet new. |
2010 same := ChangeSet new. |
2062 same := ChangeSet new. |
2041 indicesOfChangesToExplore do:[:idxB | |
2093 indicesOfChangesToExplore do:[:idxB | |
2042 |aChangeInB| |
2094 |aChangeInB| |
2043 |
2095 |
2044 aChangeInB := anotherChangeSet at:idxB. |
2096 aChangeInB := anotherChangeSet at:idxB. |
2045 |
2097 |
2046 (aChangeInA isForSameAs:aChangeInB) ifTrue:[ |
2098 (isForSame value:aChangeInA value:aChangeInB) ifTrue:[ |
|
2099 "/ these two are for the same class/selector |
2047 anyFound := true. |
2100 anyFound := true. |
2048 |
2101 |
2049 "/ also in B - is it different? |
2102 "/ also in B - is it different? |
2050 (aChangeInA sameAs:aChangeInB) ifFalse:[ |
2103 (isSame value:aChangeInA value:aChangeInB) ifFalse:[ |
2051 changedMethods add:aChangeInA. |
2104 changedMethods add:aChangeInA. |
2052 indexFromChangedMethodsToA add:idxA. |
2105 indexFromChangedMethodsToA add:idxA. |
2053 indexFromChangedMethodsToB add:idxB. |
2106 indexFromChangedMethodsToB add:idxB. |
2054 ] ifTrue:[ |
2107 ] ifTrue:[ |
2055 aChangeInA isMethodChange ifTrue:[ |
2108 aChangeInA isMethodChange ifTrue:[ |
2121 indicesOfChangesToExplore do:[:idxA | |
2174 indicesOfChangesToExplore do:[:idxA | |
2122 |aChangeInA idxM| |
2175 |aChangeInA idxM| |
2123 |
2176 |
2124 aChangeInA := self at:idxA. |
2177 aChangeInA := self at:idxA. |
2125 |
2178 |
2126 (aChangeInA isForSameAs:aChangeInB) ifTrue:[ |
2179 (isForSame value:aChangeInA value:aChangeInB) ifTrue:[ |
2127 anyFound := true. |
2180 anyFound := true. |
2128 |
2181 |
2129 "/ also in B - is it different ? |
2182 "/ also in B - is it different ? |
2130 (aChangeInA sameAs:aChangeInB) ifFalse:[ |
2183 (isSame value:aChangeInA value:aChangeInB) ifFalse:[ |
2131 "/ already there ? |
2184 "/ already there ? |
2132 idxM := changedMethods findFirst:[:c | c isForSameAs:aChangeInB]. |
2185 idxM := changedMethods findFirst:[:c | (isForSame value:c value:aChangeInB)]. |
2133 idxM == 0 ifTrue:[ |
2186 idxM == 0 ifTrue:[ |
2134 changedMethods add:aChangeInB. |
2187 changedMethods add:aChangeInB. |
2135 indexFromChangedMethodsToB add:idxB. |
2188 indexFromChangedMethodsToB add:idxB. |
2136 ] ifFalse:[ |
2189 ] ifFalse:[ |
2137 indexFromChangedMethodsToB at:idxM put:idxB |
2190 indexFromChangedMethodsToB at:idxM put:idxB |
2138 ] |
2191 ] |
2139 ] |
2192 ] |
2140 ] ifFalse:[ |
2193 ] ifFalse:[ |
2141 (aChangeInA sameAs:aChangeInB) ifTrue:[ |
2194 (isSame value:aChangeInA value:aChangeInB) ifTrue:[ |
2142 anyFound := true. |
2195 anyFound := true. |
2143 ] ifFalse:[ |
2196 ] ifFalse:[ |
2144 ] |
2197 ] |
2145 ] |
2198 ] |
2146 ]. |
2199 ]. |