author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Sat, 31 Mar 2012 01:14:49 +0100 | |
branch | jv |
changeset 3042 | 48e76977cdc3 |
parent 3034 | c892671f3e2a |
child 3069 | 89d2cfee177f |
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 |
||
74 |
!ChangeSetDiff class methodsFor:'utilities'! |
|
75 |
||
76 |
versionA:changesetA versionB:changesetB |
|
77 |
^ (self new) |
|
78 |
versionA:changesetA versionB:changesetB; |
|
79 |
diffset |
|
80 |
||
81 |
"Created: / 02-11-2009 / 16:12:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
82 |
! |
|
83 |
||
84 |
versionA:changesetA versionB:changesetB versionBase: versionBase |
|
85 |
^ (self new) |
|
86 |
versionA:changesetA versionB:changesetB versionBase: versionBase; |
|
87 |
diffset |
|
88 |
||
89 |
"Created: / 03-11-2009 / 07:58:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
90 |
! ! |
|
91 |
||
92 |
!ChangeSetDiff methodsFor:'accessing'! |
|
93 |
||
94 |
diffset |
|
95 |
^ diffset |
|
3032
f8b04203694b
ChangseSet::DiffSet now remembers the changes same in both...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3012
diff
changeset
|
96 |
! |
f8b04203694b
ChangseSet::DiffSet now remembers the changes same in both...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3012
diff
changeset
|
97 |
|
f8b04203694b
ChangseSet::DiffSet now remembers the changes same in both...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3012
diff
changeset
|
98 |
same |
f8b04203694b
ChangseSet::DiffSet now remembers the changes same in both...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3012
diff
changeset
|
99 |
^ same |
2407 | 100 |
! ! |
101 |
||
102 |
!ChangeSetDiff methodsFor:'diffing'! |
|
103 |
||
104 |
versionA:changesetA versionB:changesetB |
|
105 |
||
106 |
self versionA:changesetA versionB:changesetB versionBase: nil |
|
107 |
||
108 |
"Created: / 31-10-2009 / 19:12:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
109 |
"Modified: / 02-11-2009 / 18:38:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
110 |
! |
|
111 |
||
2630
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
112 |
versionA:a versionB:b versionBase:base |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
113 |
|ds diffsByClass include| |
2407 | 114 |
|
115 |
diffsByClass := Dictionary new. |
|
116 |
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
|
117 |
same := ds same. |
f8b04203694b
ChangseSet::DiffSet now remembers the changes same in both...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3012
diff
changeset
|
118 |
|
2630
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
119 |
include := [:chg | |
3032
f8b04203694b
ChangseSet::DiffSet now remembers the changes same in both...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3012
diff
changeset
|
120 |
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
|
121 |
]. |
2629
4786ed332f59
changed: #versionA:versionB:versionBase:
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
122 |
ds onlyInReceiver do:[:chg | |
2630
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
123 |
(include value:chg) ifTrue:[ |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
124 |
(diffsByClass at:(chg nonMetaClassName isNil ifTrue:[ |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
125 |
chg class name |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
126 |
]) |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
127 |
ifAbsentPut:[ChangeSetDiffSet new name:chg nonMetaClassName]) |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
128 |
add:(ChangeSetDiffEntry versionA:chg) |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
129 |
] |
2629
4786ed332f59
changed: #versionA:versionB:versionBase:
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
130 |
]. |
4786ed332f59
changed: #versionA:versionB:versionBase:
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
131 |
ds changed do:[:chgPair | |
2630
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
132 |
(include value:chgPair first) ifTrue:[ |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
133 |
(diffsByClass at:chgPair first nonMetaClassName |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
134 |
ifAbsentPut:[ChangeSetDiffSet new name:chgPair first nonMetaClassName]) |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
135 |
add:(ChangeSetDiffEntry versionA:chgPair first versionB:chgPair second) |
2629
4786ed332f59
changed: #versionA:versionB:versionBase:
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
136 |
] |
4786ed332f59
changed: #versionA:versionB:versionBase:
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
137 |
]. |
4786ed332f59
changed: #versionA:versionB:versionBase:
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
138 |
ds onlyInArg do:[:chg | |
2630
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
139 |
(include value:chg) ifTrue:[ |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
140 |
(diffsByClass at:chg nonMetaClassName |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
141 |
ifAbsentPut:[ChangeSetDiffSet new name:chg nonMetaClassName]) |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
142 |
add:(ChangeSetDiffEntry versionB:chg) |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
143 |
] |
2629
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 |
base notNil ifTrue:[ |
2407 | 146 |
"Try to assign base version to each diff item" |
147 |
"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
|
148 |
diffsByClass do:[:diffs | |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
149 |
diffs do:[:diff | |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
150 |
|versionBase| |
2629
4786ed332f59
changed: #versionA:versionB:versionBase:
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
151 |
|
3034
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
152 |
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
|
153 |
|
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
154 |
"/ 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
|
155 |
"/ 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
|
156 |
(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
|
157 |
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
|
158 |
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
|
159 |
versionBase := MethodCategoryChange new |
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
160 |
className:versionBase className |
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
161 |
selector:versionBase selector |
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
162 |
category:versionBase methodCategory; |
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
163 |
origin: versionBase |
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
164 |
]. |
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
165 |
"/ versionBase isNil ifTrue:[ |
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
166 |
"/ 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
|
167 |
"/ 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
|
168 |
"/ ] ifFalse:[ |
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
169 |
"/ 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
|
170 |
"/ ] |
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
171 |
"/ ]. |
2630
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
172 |
diff versionBase:versionBase. |
2629
4786ed332f59
changed: #versionA:versionB:versionBase:
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
173 |
diff automerge |
4786ed332f59
changed: #versionA:versionB:versionBase:
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
174 |
] |
4786ed332f59
changed: #versionA:versionB:versionBase:
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
175 |
] |
4786ed332f59
changed: #versionA:versionB:versionBase:
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
176 |
]. |
2630
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
177 |
diffsByClass size = 1 ifTrue:[ |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
178 |
diffset addAll:diffsByClass anyOne diffs |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
179 |
] ifFalse:[ |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
180 |
diffset addAll:diffsByClass values |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
181 |
]. |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
182 |
diffset versionALabel:a name. |
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
183 |
diffset versionBLabel:b name. |
2629
4786ed332f59
changed: #versionA:versionB:versionBase:
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
184 |
base notNil ifTrue:[ |
2630
deae273e56c3
changed: #versionA:versionB:versionBase: - fomatting && do not include version methods
vrany
parents:
2629
diff
changeset
|
185 |
diffset versionBaseLabel:base name. |
2407 | 186 |
]. |
187 |
||
188 |
"Created: / 02-11-2009 / 16:17:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
189 |
"Modified: / 29-06-2011 / 08:22:49 / Jan Vrany <enter your email here>" |
|
3034
c892671f3e2a
Improvements in merge tool - npw it could merge libtool3
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3032
diff
changeset
|
190 |
"Modified: / 20-03-2012 / 22:59:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2407 | 191 |
! ! |
192 |
||
193 |
!ChangeSetDiff methodsFor:'initialization'! |
|
194 |
||
195 |
initialize |
|
196 |
"Invoked when a new instance is created." |
|
197 |
||
198 |
"/ please change as required (and remove this comment) |
|
199 |
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
|
200 |
same := ChangeSet new. |
2407 | 201 |
|
202 |
"/ super initialize. -- commented since inherited method does nothing |
|
203 |
||
3032
f8b04203694b
ChangseSet::DiffSet now remembers the changes same in both...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3012
diff
changeset
|
204 |
"Modified: / 19-03-2012 / 21:51:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2407 | 205 |
! ! |
206 |
||
207 |
!ChangeSetDiff class methodsFor:'documentation'! |
|
208 |
||
209 |
version_CVS |
|
3011
1997ff6e7e55
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2630
diff
changeset
|
210 |
^ '§Header: /cvs/stx/stx/libbasic3/ChangeSetDiff.st,v 1.3 2011/11/29 13:12:30 vrany Exp §' |
3012 | 211 |
! |
212 |
||
213 |
version_SVN |
|
3042
48e76977cdc3
Added info-record processing support into changeset reader
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3034
diff
changeset
|
214 |
^ '$Id: ChangeSetDiff.st 1909 2012-03-31 00:14:49Z vranyj1 $' |
3012 | 215 |
! ! |