author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Thu, 17 Jan 2013 17:13:41 +0000 | |
branch | jv |
changeset 3100 | 4154b5ce8690 |
parent 3099 | be6ff432a2ad |
child 3121 | 19723298dd2c |
child 3125 | 08d6603c4fe9 |
permissions | -rw-r--r-- |
2407 | 1 |
" |
2 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, |
|
3 |
Czech Technical University in Prague |
|
4 |
Copyright (c) 2009-2010 eXept Software AG |
|
5 |
||
6 |
Permission is hereby granted, free of charge, to any person |
|
7 |
obtaining a copy of this software and associated documentation |
|
8 |
files (the 'Software'), to deal in the Software without |
|
9 |
restriction, including without limitation the rights to use, |
|
10 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
11 |
copies of the Software, and to permit persons to whom the |
|
12 |
Software is furnished to do so, subject to the following |
|
13 |
conditions: |
|
14 |
||
15 |
The above copyright notice and this permission notice shall be |
|
16 |
included in all copies or substantial portions of the Software. |
|
17 |
||
18 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
19 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
20 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
21 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
22 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
23 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
24 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
25 |
OTHER DEALINGS IN THE SOFTWARE. |
|
26 |
" |
|
27 |
"{ Package: 'stx:libbasic3' }" |
|
28 |
||
29 |
Object subclass:#ChangeSetDiff |
|
3032
f8b04203694b
ChangseSet::DiffSet now remembers the changes same in both...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3012
diff
changeset
|
30 |
instanceVariableNames:'diffset same' |
2407 | 31 |
classVariableNames:'' |
32 |
poolDictionaries:'' |
|
33 |
category:'System-Changes-Diff' |
|
34 |
! |
|
35 |
||
36 |
!ChangeSetDiff class methodsFor:'documentation'! |
|
37 |
||
38 |
copyright |
|
39 |
" |
|
40 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, |
|
41 |
Czech Technical University in Prague |
|
42 |
Copyright (c) 2009-2010 eXept Software AG |
|
43 |
||
44 |
Permission is hereby granted, free of charge, to any person |
|
45 |
obtaining a copy of this software and associated documentation |
|
46 |
files (the 'Software'), to deal in the Software without |
|
47 |
restriction, including without limitation the rights to use, |
|
48 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
49 |
copies of the Software, and to permit persons to whom the |
|
50 |
Software is furnished to do so, subject to the following |
|
51 |
conditions: |
|
52 |
||
53 |
The above copyright notice and this permission notice shall be |
|
54 |
included in all copies or substantial portions of the Software. |
|
55 |
||
56 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
57 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
58 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
59 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
60 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
61 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
62 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
63 |
OTHER DEALINGS IN THE SOFTWARE. |
|
64 |
||
65 |
" |
|
66 |
! ! |
|
67 |
||
68 |
!ChangeSetDiff class methodsFor:'instance creation'! |
|
69 |
||
70 |
new |
|
71 |
^ self basicNew initialize. |
|
72 |
! ! |
|
73 |
||
3078 | 74 |
!ChangeSetDiff class methodsFor:'others'! |
75 |
||
76 |
version_CVS |
|
77 |
^ '§Header: /cvs/stx/stx/libbasic3/ChangeSetDiff.st,v 1.4 2012/07/31 12:34:25 vrany Exp §' |
|
78 |
! ! |
|
79 |
||
2407 | 80 |
!ChangeSetDiff class methodsFor:'utilities'! |
81 |
||
82 |
versionA:changesetA versionB:changesetB |
|
83 |
^ (self new) |
|
84 |
versionA:changesetA versionB:changesetB; |
|
85 |
diffset |
|
86 |
||
87 |
"Created: / 02-11-2009 / 16:12:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
88 |
! |
|
89 |
||
90 |
versionA:changesetA versionB:changesetB versionBase: versionBase |
|
91 |
^ (self new) |
|
92 |
versionA:changesetA versionB:changesetB versionBase: versionBase; |
|
93 |
diffset |
|
94 |
||
95 |
"Created: / 03-11-2009 / 07:58:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
96 |
! ! |
|
97 |
||
98 |
!ChangeSetDiff methodsFor:'accessing'! |
|
99 |
||
100 |
diffset |
|
101 |
^ diffset |
|
3032
f8b04203694b
ChangseSet::DiffSet now remembers the changes same in both...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3012
diff
changeset
|
102 |
! |
f8b04203694b
ChangseSet::DiffSet now remembers the changes same in both...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3012
diff
changeset
|
103 |
|
f8b04203694b
ChangseSet::DiffSet now remembers the changes same in both...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3012
diff
changeset
|
104 |
same |
f8b04203694b
ChangseSet::DiffSet now remembers the changes same in both...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3012
diff
changeset
|
105 |
^ same |
2407 | 106 |
! ! |
107 |
||
108 |
!ChangeSetDiff methodsFor:'diffing'! |
|
109 |
||
110 |
versionA:changesetA versionB:changesetB |
|
111 |
||
112 |
self versionA:changesetA versionB:changesetB versionBase: nil |
|
113 |
||
114 |
"Created: / 31-10-2009 / 19:12:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
115 |
"Modified: / 02-11-2009 / 18:38:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
116 |
! |
|
117 |
||
2630
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
118 |
versionA:a versionB:b versionBase:base |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
119 |
|ds diffsByClass include| |
2407 | 120 |
|
121 |
diffsByClass := Dictionary new. |
|
122 |
ds := a diffSetsAgainst:b. |
|
3032
f8b04203694b
ChangseSet::DiffSet now remembers the changes same in both...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3012
diff
changeset
|
123 |
same := ds same. |
f8b04203694b
ChangseSet::DiffSet now remembers the changes same in both...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3012
diff
changeset
|
124 |
|
2630
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
125 |
include := [:chg | |
3032
f8b04203694b
ChangseSet::DiffSet now remembers the changes same in both...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3012
diff
changeset
|
126 |
true"(AbstractSourceCodeManager isVersionMethodSelector:chg selector) not" |
f8b04203694b
ChangseSet::DiffSet now remembers the changes same in both...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3012
diff
changeset
|
127 |
]. |
2629
4786ed332f59
changed: #versionA:versionB:versionBase:
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
128 |
ds onlyInReceiver do:[:chg | |
3100 | 129 |
(include value:chg) ifTrue:[ |
130 |
(diffsByClass at:chg nonMetaClassName |
|
2630
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
131 |
ifAbsentPut:[ChangeSetDiffSet new name:chg nonMetaClassName]) |
3100 | 132 |
add:(ChangeSetDiffEntry versionB:chg) |
2630
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
133 |
] |
2629
4786ed332f59
changed: #versionA:versionB:versionBase:
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
134 |
]. |
4786ed332f59
changed: #versionA:versionB:versionBase:
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
135 |
ds changed do:[:chgPair | |
3099
be6ff432a2ad
Fixes in ChangeSetDiff...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3078
diff
changeset
|
136 |
| chg | |
be6ff432a2ad
Fixes in ChangeSetDiff...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3078
diff
changeset
|
137 |
|
be6ff432a2ad
Fixes in ChangeSetDiff...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3078
diff
changeset
|
138 |
chg := chgPair first ? chgPair second. |
be6ff432a2ad
Fixes in ChangeSetDiff...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3078
diff
changeset
|
139 |
(include value:chg) ifTrue:[ |
be6ff432a2ad
Fixes in ChangeSetDiff...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3078
diff
changeset
|
140 |
(diffsByClass at:chg nonMetaClassName |
be6ff432a2ad
Fixes in ChangeSetDiff...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3078
diff
changeset
|
141 |
ifAbsentPut:[ChangeSetDiffSet new name:chg nonMetaClassName]) |
2630
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
142 |
add:(ChangeSetDiffEntry versionA:chgPair first versionB:chgPair second) |
2629
4786ed332f59
changed: #versionA:versionB:versionBase:
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
143 |
] |
4786ed332f59
changed: #versionA:versionB:versionBase:
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
144 |
]. |
4786ed332f59
changed: #versionA:versionB:versionBase:
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
145 |
ds onlyInArg do:[:chg | |
2630
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
146 |
(include value:chg) ifTrue:[ |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
147 |
(diffsByClass at:chg nonMetaClassName |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
148 |
ifAbsentPut:[ChangeSetDiffSet new name:chg nonMetaClassName]) |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
149 |
add:(ChangeSetDiffEntry versionB:chg) |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
150 |
] |
2629
4786ed332f59
changed: #versionA:versionB:versionBase:
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
151 |
]. |
4786ed332f59
changed: #versionA:versionB:versionBase:
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
152 |
base notNil ifTrue:[ |
2407 | 153 |
"Try to assign base version to each diff item" |
154 |
"Sorry, we are using O^2 algorithm here, I'm too lazy now :-)" |
|
2630
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
155 |
diffsByClass do:[:diffs | |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
156 |
diffs do:[:diff | |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
157 |
|versionBase| |
2629
4786ed332f59
changed: #versionA:versionB:versionBase:
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
158 |
|
3034
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
159 |
versionBase := base detect:[:each | each isForSameAs:(diff versionA ? diff versionB)] ifNone:[nil]. |
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
160 |
|
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
161 |
"/ only the category is different; |
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
162 |
"/ make it a MethodCategory changes. |
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
163 |
(versionBase notNil and:[versionBase isMethodCodeChange and:[ |
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
164 |
diff versionA notNil and:[diff versionA isMethodCategoryChange |
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
165 |
and:[diff versionA notNil and:[diff versionB isMethodCategoryChange]]]]]) ifTrue:[ |
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
166 |
versionBase := MethodCategoryChange new |
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
167 |
className:versionBase className |
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
168 |
selector:versionBase selector |
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
169 |
category:versionBase methodCategory; |
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
170 |
origin: versionBase |
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
171 |
]. |
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
172 |
"/ versionBase isNil ifTrue:[ |
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
173 |
"/ diff versionA isClassRemoveChangeOrMethodRemoveChange not ifTrue:[ |
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
174 |
"/ versionBase := diff versionA asAntiChange |
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
175 |
"/ ] ifFalse:[ |
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
176 |
"/ versionBase := diff versionA copy |
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
177 |
"/ ] |
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
178 |
"/ ]. |
2630
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
179 |
diff versionBase:versionBase. |
2629
4786ed332f59
changed: #versionA:versionB:versionBase:
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
180 |
diff automerge |
4786ed332f59
changed: #versionA:versionB:versionBase:
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
181 |
] |
4786ed332f59
changed: #versionA:versionB:versionBase:
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
182 |
] |
4786ed332f59
changed: #versionA:versionB:versionBase:
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
183 |
]. |
2630
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
184 |
diffsByClass size = 1 ifTrue:[ |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
185 |
diffset addAll:diffsByClass anyOne diffs |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
186 |
] ifFalse:[ |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
187 |
diffset addAll:diffsByClass values |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
188 |
]. |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
189 |
diffset versionALabel:a name. |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
190 |
diffset versionBLabel:b name. |
2629
4786ed332f59
changed: #versionA:versionB:versionBase:
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
191 |
base notNil ifTrue:[ |
2630
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
192 |
diffset versionBaseLabel:base name. |
2407 | 193 |
]. |
194 |
||
195 |
"Created: / 02-11-2009 / 16:17:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
196 |
"Modified: / 29-06-2011 / 08:22:49 / Jan Vrany <enter your email here>" |
|
3100 | 197 |
"Modified: / 17-01-2013 / 17:11:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2407 | 198 |
! ! |
199 |
||
200 |
!ChangeSetDiff methodsFor:'initialization'! |
|
201 |
||
202 |
initialize |
|
203 |
"Invoked when a new instance is created." |
|
204 |
||
205 |
"/ please change as required (and remove this comment) |
|
206 |
diffset := ChangeSetDiffSet new. |
|
3032
f8b04203694b
ChangseSet::DiffSet now remembers the changes same in both...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3012
diff
changeset
|
207 |
same := ChangeSet new. |
2407 | 208 |
|
209 |
"/ super initialize. -- commented since inherited method does nothing |
|
210 |
||
3032
f8b04203694b
ChangseSet::DiffSet now remembers the changes same in both...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3012
diff
changeset
|
211 |
"Modified: / 19-03-2012 / 21:51:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2407 | 212 |
! ! |
213 |
||
214 |
!ChangeSetDiff class methodsFor:'documentation'! |
|
215 |
||
3069 | 216 |
version |
3100 | 217 |
^ '$Id: ChangeSetDiff.st 1987 2013-01-17 17:13:41Z vranyj1 $' |
3012 | 218 |
! |
219 |
||
220 |
version_SVN |
|
3100 | 221 |
^ '$Id: ChangeSetDiff.st 1987 2013-01-17 17:13:41Z vranyj1 $' |
3012 | 222 |
! ! |