author | Claus Gittinger <cg@exept.de> |
Sun, 07 Jul 2019 23:42:57 +0200 | |
changeset 4453 | 5e6ad8c5a97e |
parent 4069 | b9b7b32895f5 |
child 4074 | 533d1c715e83 |
child 4478 | 7ae834471dde |
permissions | -rw-r--r-- |
2406 | 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 |
||
4017 | 29 |
"{ NameSpace: Smalltalk }" |
30 |
||
2424
bc7e320cec40
Inherit from object, not Model (to fix dependencies)
vrany
parents:
2406
diff
changeset
|
31 |
Object subclass:#ChangeSetDiffComponent |
2406 | 32 |
instanceVariableNames:'parent' |
33 |
classVariableNames:'' |
|
34 |
poolDictionaries:'' |
|
35 |
category:'System-Changes-Diff' |
|
36 |
! |
|
37 |
||
38 |
!ChangeSetDiffComponent class methodsFor:'documentation'! |
|
39 |
||
40 |
copyright |
|
41 |
" |
|
42 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, |
|
43 |
Czech Technical University in Prague |
|
44 |
Copyright (c) 2009-2010 eXept Software AG |
|
45 |
||
46 |
Permission is hereby granted, free of charge, to any person |
|
47 |
obtaining a copy of this software and associated documentation |
|
48 |
files (the 'Software'), to deal in the Software without |
|
49 |
restriction, including without limitation the rights to use, |
|
50 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
51 |
copies of the Software, and to permit persons to whom the |
|
52 |
Software is furnished to do so, subject to the following |
|
53 |
conditions: |
|
54 |
||
55 |
The above copyright notice and this permission notice shall be |
|
56 |
included in all copies or substantial portions of the Software. |
|
57 |
||
58 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
59 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
60 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
61 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
62 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
63 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
64 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
65 |
OTHER DEALINGS IN THE SOFTWARE. |
|
66 |
||
67 |
" |
|
68 |
! ! |
|
69 |
||
70 |
!ChangeSetDiffComponent methodsFor:'accessing'! |
|
71 |
||
72 |
changesetA |
|
2643 | 73 |
"Answers a changeset with containing all versionA changes" |
74 |
| cs | |
|
2406 | 75 |
|
2643 | 76 |
cs := ChangeSet new name: self versionALabel. |
77 |
self do:[:item| |
|
3457 | 78 |
(item versionA notNil" and:[item versionMerged isClassDefinitionChange or:[item versionMerged isMethodCodeChange]]") ifTrue:[ |
2880 | 79 |
cs add: item versionA |
80 |
] |
|
2643 | 81 |
]. |
82 |
^cs |
|
83 |
||
3457 | 84 |
"Modified: / 18-12-2013 / 20:55:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2406 | 85 |
! |
86 |
||
87 |
changesetB |
|
2880 | 88 |
"Answers a changeset with containing all versionA changes" |
2643 | 89 |
| cs | |
2406 | 90 |
|
2643 | 91 |
cs := ChangeSet new name: self versionBLabel. |
92 |
self do:[:item| |
|
3457 | 93 |
(item versionB notNil" and:[item versionMerged isClassDefinitionChange or:[item versionMerged isMethodCodeChange]]") ifTrue:[ |
2880 | 94 |
cs add: item versionB |
95 |
] |
|
2643 | 96 |
]. |
97 |
^cs |
|
98 |
||
3457 | 99 |
"Modified: / 18-12-2013 / 20:55:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2880 | 100 |
! |
101 |
||
102 |
changesetBase |
|
103 |
"Answers a changeset with containing all versionA changes" |
|
104 |
| cs | |
|
105 |
||
106 |
cs := ChangeSet new name: self versionBaseLabel. |
|
107 |
self do:[:item| |
|
3457 | 108 |
(item versionBase notNil" and:[item versionBase isClassDefinitionChange or:[item versionBase isMethodCodeChange]]") ifTrue:[ |
2880 | 109 |
cs add: item versionBase |
110 |
] |
|
111 |
]. |
|
112 |
^cs |
|
113 |
||
114 |
"Created: / 20-03-2012 / 13:31:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3457 | 115 |
"Modified: / 13-11-2013 / 11:47:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2880 | 116 |
! |
117 |
||
118 |
changesetMerged |
|
119 |
"Answers a changeset with containing all versionA changes" |
|
120 |
| cs | |
|
121 |
||
122 |
cs := ChangeSet new name: 'Merged'. |
|
123 |
self do:[:item| |
|
3457 | 124 |
(item versionMerged notNil "and:[item versionMerged isClassDefinitionChange or:[item versionMerged isMethodCodeChange]]") ifTrue:[ |
2880 | 125 |
cs add: item versionMerged |
3457 | 126 |
] |
2880 | 127 |
]. |
128 |
^cs |
|
129 |
||
130 |
"Created: / 20-03-2012 / 13:32:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3457 | 131 |
"Modified: / 13-11-2013 / 11:47:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
132 |
! |
|
133 |
||
134 |
depth |
|
135 |
"Return the depth if diff component hierarchy, 0 if there is no nesting at all" |
|
136 |
^0 |
|
137 |
||
138 |
"Created: / 15-01-2013 / 11:26:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2406 | 139 |
! |
140 |
||
141 |
diffs |
|
142 |
||
143 |
^#() |
|
144 |
||
145 |
"Created: / 10-11-2009 / 11:29:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
146 |
! |
|
147 |
||
148 |
flattened |
|
149 |
||
150 |
^ChangeSetDiffSet new add: self |
|
151 |
||
152 |
"Created: / 05-12-2009 / 11:07:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
153 |
! |
|
154 |
||
155 |
name |
|
156 |
"raise an error: must be redefined in concrete subclass(es)" |
|
157 |
||
158 |
^ self subclassResponsibility |
|
159 |
! |
|
160 |
||
161 |
parent |
|
162 |
^ parent |
|
163 |
! |
|
164 |
||
165 |
parent:aDiffSet |
|
166 |
parent := aDiffSet. |
|
2643 | 167 |
! |
168 |
||
169 |
versionALabel |
|
170 |
^ parent versionALabel |
|
171 |
||
172 |
"Created: / 09-11-2009 / 12:38:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
173 |
! |
|
174 |
||
175 |
versionBLabel |
|
176 |
^ parent versionBLabel |
|
177 |
||
178 |
"Created: / 09-11-2009 / 12:38:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2880 | 179 |
! |
180 |
||
181 |
versionBaseLabel |
|
182 |
^ parent versionBaseLabel |
|
183 |
||
184 |
"Created: / 20-03-2012 / 13:31:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2406 | 185 |
! ! |
186 |
||
187 |
!ChangeSetDiffComponent methodsFor:'change & update'! |
|
188 |
||
189 |
changed: aspect with: param |
|
190 |
||
191 |
(aspect = #resolution and:[parent notNil]) |
|
192 |
ifTrue:[parent changed: aspect with: param]. |
|
193 |
super changed: aspect with: param. |
|
194 |
||
195 |
"Created: / 24-11-2009 / 12:58:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
196 |
! ! |
|
197 |
||
198 |
!ChangeSetDiffComponent methodsFor:'enumerating'! |
|
199 |
||
200 |
do: aBlock |
|
201 |
||
202 |
self subclassResponsibility |
|
203 |
||
204 |
"Created: / 25-11-2009 / 10:22:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
205 |
! ! |
|
206 |
||
207 |
!ChangeSetDiffComponent methodsFor:'printing & storing'! |
|
208 |
||
209 |
printOn:aStream |
|
4069 | 210 |
"append a printed representation of the receiver to the argument, aStream" |
2406 | 211 |
|
212 |
super printOn:aStream. |
|
213 |
aStream nextPut:$(. |
|
214 |
self name printOn: aStream. |
|
215 |
aStream nextPut:$). |
|
216 |
||
217 |
"Modified: / 26-11-2009 / 16:25:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
218 |
! ! |
|
219 |
||
220 |
!ChangeSetDiffComponent methodsFor:'private'! |
|
221 |
||
222 |
flattenOn: stream |
|
223 |
||
224 |
^stream nextPut: self |
|
225 |
||
226 |
"Created: / 05-12-2009 / 11:06:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3457 | 227 |
! |
228 |
||
229 |
sort |
|
230 |
self sort: [:a :b|a printString < b printString ]. |
|
231 |
||
232 |
"Created: / 17-01-2013 / 13:56:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
233 |
! |
|
234 |
||
235 |
sort: sortBlock |
|
236 |
self subclassResponsibility |
|
237 |
||
238 |
"Created: / 17-01-2013 / 13:57:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2406 | 239 |
! ! |
240 |
||
241 |
!ChangeSetDiffComponent methodsFor:'testing'! |
|
242 |
||
3457 | 243 |
isConflict |
244 |
"Return true, if there is a conflict." |
|
245 |
||
246 |
^ self subclassResponsibility |
|
247 |
||
248 |
"Modified (comment): / 01-08-2012 / 17:11:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
249 |
! |
|
250 |
||
2406 | 251 |
isDiffItem |
252 |
^ false |
|
253 |
! |
|
254 |
||
255 |
isDiffSet |
|
256 |
^ false |
|
257 |
! |
|
258 |
||
259 |
isEmpty |
|
260 |
||
261 |
^false |
|
2880 | 262 |
! |
263 |
||
3457 | 264 |
isForCopyrightMethod |
265 |
"Returns true, if this is an entry for #copyright method" |
|
266 |
^self subclassResponsibility |
|
267 |
||
268 |
"Created: / 01-08-2012 / 16:37:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
269 |
! |
|
270 |
||
2880 | 271 |
isForVersionMethod |
272 |
"Returns true, if this is an entry for version method" |
|
273 |
^self subclassResponsibility |
|
274 |
||
275 |
"Created: / 18-04-2012 / 19:04:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
276 |
! |
|
277 |
||
278 |
isMerged |
|
279 |
"raise an error: must be redefined in concrete subclass(es)" |
|
280 |
||
281 |
^ self subclassResponsibility |
|
2406 | 282 |
! ! |
283 |
||
284 |
!ChangeSetDiffComponent class methodsFor:'documentation'! |
|
285 |
||
4017 | 286 |
version_CVS |
287 |
^ '$Header$' |
|
288 |
! |
|
289 |
||
2880 | 290 |
version_SVN |
4017 | 291 |
^ '$Id$' |
2406 | 292 |
! ! |
3457 | 293 |