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