author | Claus Gittinger <cg@exept.de> |
Thu, 31 Aug 2000 12:23:18 +0200 | |
changeset 965 | 38bc91ec40c6 |
parent 960 | 9b0994b92e10 |
child 985 | d6e52410ac8a |
permissions | -rw-r--r-- |
3 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
16 | 3 |
All Rights Reserved |
3 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
0 | 12 |
|
921
fa4db05c887b
oops - nameSpace prefix handling needed fix due
Claus Gittinger <cg@exept.de>
parents:
916
diff
changeset
|
13 |
"{ Package: 'stx:libbasic3' }" |
fa4db05c887b
oops - nameSpace prefix handling needed fix due
Claus Gittinger <cg@exept.de>
parents:
916
diff
changeset
|
14 |
|
0 | 15 |
OrderedCollection subclass:#ChangeSet |
235 | 16 |
instanceVariableNames:'' |
17 |
classVariableNames:'' |
|
18 |
poolDictionaries:'' |
|
19 |
category:'System-Changes' |
|
0 | 20 |
! |
21 |
||
625
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
22 |
!ChangeSet class methodsFor:'documentation'! |
9 | 23 |
|
24 |
copyright |
|
25 |
" |
|
26 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
16 | 27 |
All Rights Reserved |
9 | 28 |
|
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
! |
|
37 |
||
38 |
documentation |
|
39 |
" |
|
40 |
used in the changes management to keep track of changes |
|
235 | 41 |
|
42 |
[author:] |
|
879 | 43 |
Claus Gittinger |
9 | 44 |
" |
45 |
! ! |
|
46 |
||
654 | 47 |
!ChangeSet class methodsFor:'instance creation'! |
48 |
||
931 | 49 |
changesFromParseTree:aTree andStream:aStream lineNumber:initialLineNumberOrNil do:aBlock |
930 | 50 |
"given a parse-tree (from parsing some changes source/chunk), |
51 |
create changes and evaluate aBlock on each. |
|
52 |
The block is invoked with the change and a lineNumberOrNil as |
|
53 |
arg; the lineNumber is only valid, if the underlying stream |
|
54 |
provides line-numbers; otherwise, nil is passed." |
|
55 |
||
56 |
|changes sel className categoryName |
|
57 |
methodSource methodSelector change parser |
|
58 |
oldName newName priv receiver receiverVarName |
|
59 |
receiverSelector receiverReceiver primSource |
|
60 |
nameSpace lineNumberOrNil| |
|
61 |
||
931 | 62 |
lineNumberOrNil := initialLineNumberOrNil. |
930 | 63 |
|
64 |
"/ nameSpace := Class nameSpaceQuerySignal query. |
|
65 |
"/ nameSpace isNil ifTrue:[nameSpace := Smalltalk]. |
|
66 |
||
67 |
sel := aTree selector. |
|
68 |
receiver := aTree receiver. |
|
69 |
receiver isMessage ifTrue:[ |
|
70 |
receiverSelector := receiver selector. |
|
71 |
receiverReceiver := receiver receiver. |
|
72 |
] ifFalse:[ |
|
73 |
receiver isVariable ifTrue:[ |
|
74 |
receiverVarName := receiver name |
|
75 |
] |
|
76 |
]. |
|
77 |
||
960
9b0994b92e10
parse v'age, squeak and stv changesets
Claus Gittinger <cg@exept.de>
parents:
959
diff
changeset
|
78 |
(sel == #'methods' |
9b0994b92e10
parse v'age, squeak and stv changesets
Claus Gittinger <cg@exept.de>
parents:
959
diff
changeset
|
79 |
or:[(sel == #'methodsFor:') |
9b0994b92e10
parse v'age, squeak and stv changesets
Claus Gittinger <cg@exept.de>
parents:
959
diff
changeset
|
80 |
or:[(sel == #'publicMethodsFor:') |
9b0994b92e10
parse v'age, squeak and stv changesets
Claus Gittinger <cg@exept.de>
parents:
959
diff
changeset
|
81 |
or:[(sel == #'privateMethodsFor:') |
9b0994b92e10
parse v'age, squeak and stv changesets
Claus Gittinger <cg@exept.de>
parents:
959
diff
changeset
|
82 |
or:[(sel == #'methodsFor:stamp:') |
9b0994b92e10
parse v'age, squeak and stv changesets
Claus Gittinger <cg@exept.de>
parents:
959
diff
changeset
|
83 |
or:[(sel == #'ignoredMethodsFor:')]]]]]) ifTrue:[ |
930 | 84 |
(sel == #'ignoredMethodsFor:') ifTrue:[ |
85 |
priv := #ignored. |
|
86 |
] ifFalse:[ |
|
87 |
priv := nil |
|
88 |
]. |
|
89 |
(receiver isUnaryMessage |
|
90 |
and:[receiverSelector == #class]) ifTrue:[ |
|
91 |
className := (receiverReceiver name) , ' class'. |
|
92 |
] ifFalse:[ |
|
93 |
className := (receiver name). |
|
94 |
]. |
|
95 |
"/ nameSpace ~~ Smalltalk ifTrue:[ |
|
96 |
"/ className := nameSpace name , '::' , className |
|
97 |
"/ ]. |
|
960
9b0994b92e10
parse v'age, squeak and stv changesets
Claus Gittinger <cg@exept.de>
parents:
959
diff
changeset
|
98 |
sel == #'methods' ifTrue:[ |
9b0994b92e10
parse v'age, squeak and stv changesets
Claus Gittinger <cg@exept.de>
parents:
959
diff
changeset
|
99 |
categoryName := 'uncategorized' |
9b0994b92e10
parse v'age, squeak and stv changesets
Claus Gittinger <cg@exept.de>
parents:
959
diff
changeset
|
100 |
] ifFalse:[ |
9b0994b92e10
parse v'age, squeak and stv changesets
Claus Gittinger <cg@exept.de>
parents:
959
diff
changeset
|
101 |
categoryName := (aTree arguments at:1) evaluate. |
9b0994b92e10
parse v'age, squeak and stv changesets
Claus Gittinger <cg@exept.de>
parents:
959
diff
changeset
|
102 |
]. |
930 | 103 |
aStream skipSeparators. |
104 |
lineNumberOrNil := aStream lineNumber. |
|
105 |
methodSource := aStream nextChunk. |
|
106 |
changes := OrderedCollection new. |
|
107 |
||
108 |
[methodSource notEmpty] whileTrue:[ |
|
109 |
parser := Parser |
|
110 |
parseMethodArgAndVarSpecification:methodSource |
|
111 |
in:nil |
|
112 |
ignoreErrors:true |
|
113 |
ignoreWarnings:true |
|
114 |
parseBody:false. |
|
115 |
||
116 |
parser isNil ifTrue:[ |
|
117 |
"/ something wierd ... |
|
118 |
methodSelector := '????'. |
|
119 |
] ifFalse:[ |
|
120 |
methodSelector := parser selector. |
|
121 |
]. |
|
122 |
||
123 |
change := MethodChange new. |
|
124 |
change |
|
125 |
className:className |
|
126 |
selector:methodSelector |
|
127 |
source:methodSource |
|
128 |
category:categoryName |
|
129 |
privacy:priv. |
|
130 |
aBlock value:change value:lineNumberOrNil. |
|
131 |
||
132 |
aStream skipSeparators. |
|
133 |
lineNumberOrNil := aStream lineNumber. |
|
134 |
methodSource := aStream nextChunk. |
|
135 |
]. |
|
136 |
^ true |
|
137 |
]. |
|
138 |
||
139 |
sel == #'removeSelector:' ifTrue:[ |
|
140 |
(receiver isUnaryMessage |
|
141 |
and:[receiverSelector == #class]) ifTrue:[ |
|
142 |
className := (receiverReceiver name) , ' class'. |
|
143 |
] ifFalse:[ |
|
144 |
className := (receiver name). |
|
145 |
]. |
|
146 |
"/ nameSpace ~~ Smalltalk ifTrue:[ |
|
147 |
"/ className := nameSpace name , '::' , className |
|
148 |
"/ ]. |
|
149 |
methodSelector := (aTree arguments at:1) evaluate. |
|
150 |
change := MethodRemoveChange new. |
|
151 |
change |
|
152 |
className:className |
|
153 |
selector:methodSelector. |
|
154 |
aBlock value:change value:lineNumberOrNil. |
|
155 |
^ true |
|
156 |
]. |
|
157 |
||
158 |
"/ any subclass definiton selector ? |
|
159 |
(Behavior definitionSelectors includes:sel) |
|
160 |
ifTrue:[ |
|
161 |
className := (aTree arguments at:1) evaluate. |
|
162 |
"/ nameSpace ~~ Smalltalk ifTrue:[ |
|
163 |
"/ className := nameSpace name , '::' , className |
|
164 |
"/ ]. |
|
165 |
change := ClassDefinitionChange new. |
|
166 |
change |
|
167 |
className:className; |
|
168 |
source:(aTree printString). |
|
169 |
aBlock value:change value:lineNumberOrNil. |
|
170 |
^ true |
|
171 |
]. |
|
172 |
||
173 |
sel == #'renameCategory:to:' ifTrue:[ |
|
174 |
(receiver isUnaryMessage |
|
175 |
and:[receiverSelector == #class]) ifTrue:[ |
|
176 |
className := (receiverReceiver name) , ' class'. |
|
177 |
] ifFalse:[ |
|
178 |
className := (receiver name). |
|
179 |
]. |
|
180 |
"/ nameSpace ~~ Smalltalk ifTrue:[ |
|
181 |
"/ className := nameSpace name , '::' , className |
|
182 |
"/ ]. |
|
183 |
change := MethodCategoryRenameChange new. |
|
184 |
change |
|
185 |
className:className; |
|
186 |
oldCategoryName:(aTree arguments at:1) evaluate |
|
187 |
newCategoryName:(aTree arguments at:2) evaluate. |
|
188 |
aBlock value:change value:lineNumberOrNil. |
|
189 |
^ true |
|
190 |
]. |
|
191 |
||
192 |
(sel == #'category:' |
|
193 |
or:[sel == #'privacy:']) ifTrue:[ |
|
194 |
(receiver isMessage |
|
195 |
and:[receiverSelector == #'compiledMethodAt:']) ifTrue:[ |
|
196 |
(receiverReceiver isUnaryMessage |
|
197 |
and:[receiverReceiver selector == #class]) ifTrue:[ |
|
198 |
className := (receiverReceiver receiver name) , ' class'. |
|
199 |
] ifFalse:[ |
|
200 |
className := (receiverReceiver name). |
|
201 |
]. |
|
202 |
"/ nameSpace ~~ Smalltalk ifTrue:[ |
|
203 |
"/ className := nameSpace name , '::' , className |
|
204 |
"/ ]. |
|
205 |
methodSelector := (receiver arguments at:1) evaluate. |
|
206 |
||
207 |
sel == #'category:' ifTrue:[ |
|
208 |
change := MethodCategoryChange new. |
|
209 |
change |
|
210 |
className:className |
|
211 |
selector:methodSelector |
|
212 |
category:(aTree arguments at:1) evaluate. |
|
213 |
] ifFalse:[ |
|
214 |
change := MethodPrivacyChange new. |
|
215 |
change |
|
216 |
className:className |
|
217 |
selector:methodSelector |
|
218 |
privacy:(aTree arguments at:1) evaluate. |
|
219 |
]. |
|
220 |
||
221 |
aBlock value:change value:lineNumberOrNil. |
|
222 |
^ true |
|
223 |
] ifFalse:[ |
|
224 |
self halt:'unexpected change' |
|
225 |
]. |
|
226 |
]. |
|
227 |
||
228 |
sel == #'comment:' ifTrue:[ |
|
229 |
(receiver isUnaryMessage |
|
230 |
and:[receiverSelector == #class]) ifTrue:[ |
|
231 |
className := (receiverReceiver name) , ' class'. |
|
232 |
] ifFalse:[ |
|
233 |
className := (receiver name). |
|
234 |
]. |
|
235 |
"/ nameSpace ~~ Smalltalk ifTrue:[ |
|
236 |
"/ className := nameSpace name , '::' , className |
|
237 |
"/ ]. |
|
238 |
||
239 |
change := ClassCommentChange new. |
|
240 |
change |
|
241 |
className:className |
|
242 |
comment:(aTree arguments at:1) evaluate. |
|
243 |
change source:(aTree printString). |
|
244 |
aBlock value:change value:lineNumberOrNil. |
|
245 |
^ true |
|
246 |
]. |
|
247 |
||
248 |
sel == #'instanceVariableNames:' ifTrue:[ |
|
249 |
(receiver isUnaryMessage |
|
250 |
and:[receiverSelector == #class]) ifTrue:[ |
|
251 |
className := (receiverReceiver name) , ' class'. |
|
252 |
] ifFalse:[ |
|
253 |
className := (receiver name). |
|
254 |
]. |
|
255 |
"/ nameSpace ~~ Smalltalk ifTrue:[ |
|
256 |
"/ className := nameSpace name , '::' , className |
|
257 |
"/ ]. |
|
258 |
change := ClassInstVarDefinitionChange new. |
|
259 |
change className:className. |
|
260 |
change source:(aTree printString). |
|
261 |
aBlock value:change value:lineNumberOrNil. |
|
262 |
^ true |
|
263 |
]. |
|
264 |
||
265 |
sel == #'removeClass:' ifTrue:[ |
|
266 |
(receiverVarName == #Smalltalk) ifTrue:[ |
|
267 |
className := (aTree arguments at:1) name. |
|
268 |
"/ nameSpace ~~ Smalltalk ifTrue:[ |
|
269 |
"/ className := nameSpace name , '::' , className |
|
270 |
"/ ]. |
|
271 |
||
272 |
change := ClassRemoveChange new. |
|
273 |
change className:className. |
|
274 |
aBlock value:change value:lineNumberOrNil. |
|
275 |
^ true |
|
276 |
] ifFalse:[ |
|
939 | 277 |
self halt:'unexpected receiver in #name: message' |
930 | 278 |
]. |
279 |
]. |
|
280 |
||
281 |
sel == #'renameClass:to:' ifTrue:[ |
|
282 |
(receiverVarName == #Smalltalk) ifTrue:[ |
|
283 |
oldName := (aTree arguments at:1) name. |
|
284 |
newName := (aTree arguments at:2) evaluate. |
|
285 |
||
286 |
change := ClassRenameChange new. |
|
287 |
change oldName:oldName newName:newName. |
|
288 |
aBlock value:change value:lineNumberOrNil. |
|
289 |
^ true |
|
290 |
] ifFalse:[ |
|
939 | 291 |
self halt:'unexpected receiver in #name: message' |
930 | 292 |
]. |
293 |
]. |
|
294 |
||
295 |
sel == #'name:' ifTrue:[ |
|
296 |
((receiverVarName == #Namespace) |
|
297 |
or:[receiverVarName == #NameSpace]) ifTrue:[ |
|
298 |
className := (aTree arguments at:1) evaluate. |
|
299 |
||
300 |
change := NameSpaceCreationChange new. |
|
301 |
change name:className. |
|
302 |
aBlock value:change value:lineNumberOrNil. |
|
303 |
^ true |
|
304 |
] ifFalse:[ |
|
939 | 305 |
self halt:'unexpected receiver in #name: message' |
930 | 306 |
]. |
307 |
]. |
|
308 |
||
309 |
(sel == #'primitiveDefinitions' |
|
310 |
or:[sel == #'primitiveFunctions' |
|
311 |
or:[sel == #'primitiveVariables']]) ifTrue:[ |
|
312 |
(receiver isUnaryMessage |
|
313 |
and:[receiverSelector == #class]) ifTrue:[ |
|
314 |
className := (receiverReceiver name) , ' class'. |
|
315 |
] ifFalse:[ |
|
316 |
className := (receiver name). |
|
317 |
]. |
|
318 |
"/ nameSpace ~~ Smalltalk ifTrue:[ |
|
319 |
"/ className := nameSpace name , '::' , className |
|
320 |
"/ ]. |
|
321 |
||
322 |
aStream skipSeparators. |
|
323 |
primSource := aStream nextChunk. |
|
324 |
||
325 |
sel == #'primitiveDefinitions' ifTrue:[ |
|
326 |
change := ClassPrimitiveDefinitionsChange new |
|
327 |
] ifFalse:[ |
|
328 |
sel == #'primitiveFunctions' ifTrue:[ |
|
329 |
change := ClassPrimitiveFunctionsChange new |
|
330 |
] ifFalse:[ |
|
331 |
change := ClassPrimitiveVariablesChange new |
|
332 |
] |
|
333 |
]. |
|
334 |
change class:className source:primSource. |
|
335 |
aBlock value:change value:lineNumberOrNil. |
|
336 |
^ true |
|
337 |
]. |
|
338 |
||
339 |
^ false |
|
340 |
||
341 |
"Created: / 16.2.1998 / 13:42:40 / cg" |
|
342 |
"Modified: / 15.12.1999 / 00:29:06 / cg" |
|
343 |
! |
|
344 |
||
345 |
changesFromStream:aStream do:aBlock |
|
346 |
"enumerate changes from a stream and invoke aBlock on each. |
|
347 |
The block is invoked with the change and a lineNumberOrNil as |
|
348 |
arg; the lineNumber is only valid, if the underlying stream |
|
349 |
provides line-numbers; otherwise, nil is passed." |
|
350 |
||
351 |
|chunk sawExcla lastTimeStamp s change nameSpace changes |
|
352 |
lineNumber| |
|
353 |
||
354 |
nameSpace := Smalltalk. |
|
355 |
||
356 |
[aStream atEnd] whileFalse:[ |
|
357 |
aStream skipSeparators. |
|
358 |
sawExcla := aStream peekFor:$!!. |
|
359 |
lineNumber := aStream lineNumber. |
|
360 |
chunk := aStream nextChunk. |
|
361 |
(chunk notNil and:[chunk notEmpty]) ifTrue:[ |
|
362 |
Class nameSpaceQuerySignal answer:nameSpace do:[ |
|
363 |
|parser tree ns| |
|
364 |
||
365 |
parser := Parser for:chunk. |
|
366 |
tree := parser |
|
367 |
parseExpressionWithSelf:nil |
|
368 |
notifying:nil |
|
369 |
ignoreErrors:true |
|
370 |
ignoreWarnings:true |
|
371 |
inNameSpace:nameSpace. |
|
372 |
||
373 |
tree == #Error ifTrue:[ |
|
374 |
change := DoItChange new. |
|
375 |
change source:chunk. |
|
376 |
aBlock value:change value:lineNumber. |
|
377 |
] ifFalse:[ |
|
378 |
(tree notNil and:[tree ~~ #Error]) ifTrue:[ |
|
379 |
"/ if there is any nameSpace directive in there, extract it. |
|
380 |
((ns := parser currentNameSpace) notNil |
|
381 |
and:[ns ~~ nameSpace]) ifTrue:[ |
|
382 |
"/ self halt. |
|
383 |
nameSpace := ns |
|
384 |
]. |
|
385 |
Class nameSpaceQuerySignal answer:nameSpace do:[ |
|
386 |
"/ |
|
387 |
"/ what type of chunk is this ... |
|
388 |
"/ |
|
389 |
tree isConstant ifTrue:[ |
|
390 |
(s := tree evaluate) isString ifTrue:[ |
|
391 |
(s startsWith:'---- timestamp ') ifTrue:[ |
|
392 |
lastTimeStamp := s. |
|
393 |
] |
|
394 |
] ifFalse:[ |
|
395 |
self halt:'unexpected change-chunk' |
|
396 |
] |
|
397 |
] ifFalse:[ |
|
398 |
tree isMessage ifTrue:[ |
|
399 |
(self |
|
400 |
changesFromParseTree:tree |
|
401 |
andStream:aStream |
|
931 | 402 |
lineNumber:lineNumber |
930 | 403 |
do:aBlock) ifFalse:[ |
404 |
change := DoItChange new. |
|
405 |
change source:chunk. |
|
406 |
aBlock value:change value:lineNumber. |
|
407 |
] |
|
408 |
] ifFalse:[ |
|
409 |
self halt:'unexpected change-chunk' |
|
410 |
] |
|
411 |
] |
|
412 |
] |
|
413 |
] |
|
414 |
] |
|
415 |
] |
|
416 |
] |
|
417 |
]. |
|
418 |
||
419 |
" |
|
420 |
ChangeSet fromStream:('changes' asFilename readStream) |
|
421 |
ChangeSet fromStream:('patches' asFilename readStream) |
|
422 |
ChangeSet fromStream:(Object source asString readStream) |
|
423 |
" |
|
424 |
||
425 |
"Created: / 16.2.1998 / 12:19:34 / cg" |
|
426 |
"Modified: / 14.12.1999 / 15:23:16 / cg" |
|
427 |
! |
|
428 |
||
889
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
429 |
forExistingClass:aClass |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
430 |
"build a changeSet for some given class. |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
431 |
That does of course not give deltas, but instead reflects the current |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
432 |
state of the given class. |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
433 |
It is useful in conjunction with the other utility methods, |
965 | 434 |
for example, when building patchLists, diffSets etc." |
889
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
435 |
|
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
436 |
|changeSet chunk sawExcla lastTimeStamp s change nameSpace| |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
437 |
|
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
438 |
changeSet := self new. |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
439 |
nameSpace := Smalltalk. |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
440 |
|
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
441 |
"/ first, a classDefinition change ... |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
442 |
changeSet addClassDefinitionChangeFor:aClass. |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
443 |
"/ are there any class-instVars ? |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
444 |
aClass class instVarNames size > 0 ifTrue:[ |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
445 |
changeSet addInstVarDefinitionChangeFor:aClass class. |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
446 |
]. |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
447 |
"/ a comment ? |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
448 |
aClass comment size > 0 ifTrue:[ |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
449 |
changeSet addClassCommentChangeFor:aClass. |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
450 |
]. |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
451 |
|
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
452 |
"/ class methods first ... |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
453 |
aClass class methodDictionary keysAndValuesDo:[:sel :mthd | |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
454 |
changeSet addMethodChange:mthd in:aClass class. |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
455 |
]. |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
456 |
|
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
457 |
"/ instance methods ... |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
458 |
aClass methodDictionary keysAndValuesDo:[:sel :mthd | |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
459 |
changeSet addMethodChange:mthd in:aClass. |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
460 |
]. |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
461 |
|
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
462 |
^ changeSet |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
463 |
|
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
464 |
" |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
465 |
ChangeSet forExistingClass:ChangeSet |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
466 |
" |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
467 |
|
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
468 |
"Created: / 16.2.1998 / 12:19:34 / cg" |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
469 |
"Modified: / 14.12.1999 / 15:23:16 / cg" |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
470 |
! |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
471 |
|
654 | 472 |
fromStream:aStream |
473 |
"build a changeSet from a stream, containing chunks. |
|
474 |
(i.e. either a classes sourceFile or a change-file). |
|
475 |
Return the changeSet." |
|
476 |
||
930 | 477 |
|changeSet| |
654 | 478 |
|
479 |
changeSet := self new. |
|
930 | 480 |
self changesFromStream:aStream do:[:aChange :lineNumberOrNil | |
481 |
changeSet add:aChange |
|
482 |
]. |
|
921
fa4db05c887b
oops - nameSpace prefix handling needed fix due
Claus Gittinger <cg@exept.de>
parents:
916
diff
changeset
|
483 |
|
654 | 484 |
^ changeSet |
485 |
||
486 |
" |
|
487 |
ChangeSet fromStream:('changes' asFilename readStream) |
|
488 |
ChangeSet fromStream:('patches' asFilename readStream) |
|
489 |
ChangeSet fromStream:(Object source asString readStream) |
|
490 |
" |
|
491 |
||
492 |
"Created: / 16.2.1998 / 12:19:34 / cg" |
|
859 | 493 |
"Modified: / 14.12.1999 / 15:23:16 / cg" |
916 | 494 |
! |
495 |
||
496 |
fromXMLStream:aStream |
|
497 |
"build a changeSet from an XML stream, containing XML definitions. |
|
498 |
Return the changeSet." |
|
499 |
||
500 |
|changeSet builder nameSpace| |
|
501 |
||
502 |
changeSet := self new. |
|
503 |
nameSpace := Smalltalk. |
|
504 |
||
965 | 505 |
builder := XML::SourceScannerNodeBuilder new. |
916 | 506 |
builder scanFile:aStream |
507 |
do:[:change | changeSet add: change. ]. |
|
508 |
^ changeSet |
|
509 |
||
510 |
" |
|
511 |
ChangeSet fromXMLStream:('../../goodies/xml-vw/xmlFileInTests/XMLParser.xml' asFilename readStream) |
|
512 |
ChangeSetBrowser |
|
513 |
openOn:(ChangeSet fromXMLStream:('../../goodies/xml-vw/xmlFileInTests/XMLParser.xml' asFilename readStream)) |
|
514 |
" |
|
654 | 515 |
! ! |
516 |
||
883 | 517 |
!ChangeSet class methodsFor:'Compatibility - ST80'! |
625
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
518 |
|
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
519 |
patches |
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
520 |
^ #() |
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
521 |
|
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
522 |
"Created: / 27.10.1997 / 13:52:54 / cg" |
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
523 |
! ! |
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
524 |
|
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
525 |
!ChangeSet class methodsFor:'queries'! |
27 | 526 |
|
527 |
current |
|
528 |
"ST-80 compatibility: return the current changeSet" |
|
529 |
||
530 |
|p| |
|
531 |
||
532 |
(Project notNil and:[(p := Project current) notNil]) ifTrue:[ |
|
959
ca4fff926135
ChangeSet current: return empty collection if there is no changeSet
Claus Gittinger <cg@exept.de>
parents:
956
diff
changeset
|
533 |
^ p changeSet |
ca4fff926135
ChangeSet current: return empty collection if there is no changeSet
Claus Gittinger <cg@exept.de>
parents:
956
diff
changeset
|
534 |
]. |
ca4fff926135
ChangeSet current: return empty collection if there is no changeSet
Claus Gittinger <cg@exept.de>
parents:
956
diff
changeset
|
535 |
^ #() |
27 | 536 |
|
537 |
" |
|
538 |
ChangeSet current |
|
539 |
" |
|
540 |
! ! |
|
541 |
||
899 | 542 |
!ChangeSet methodsFor:'Compatibility - ST80'! |
378 | 543 |
|
899 | 544 |
changeClass:aClass |
545 |
"dummy here" |
|
100 | 546 |
|
899 | 547 |
"Created: / 4.2.2000 / 18:30:59 / cg" |
901 | 548 |
! |
549 |
||
550 |
reorganizeSystem |
|
551 |
"dummy here" |
|
552 |
||
553 |
"Created: / 6.2.2000 / 20:45:10 / cg" |
|
889
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
554 |
! ! |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
555 |
|
901 | 556 |
!ChangeSet methodsFor:'changes management'! |
889
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
557 |
|
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
558 |
addClassCommentChangeFor:aClass |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
559 |
"add a classComment change to the receiver" |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
560 |
|
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
561 |
|newChange| |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
562 |
|
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
563 |
newChange := ClassCommentChange class:aClass. |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
564 |
newChange comment:aClass comment. |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
565 |
self add:newChange |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
566 |
|
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
567 |
"Modified: 15.7.1996 / 09:27:05 / cg" |
100 | 568 |
! |
569 |
||
570 |
addClassDefinitionChangeFor:aClass |
|
378 | 571 |
"add a classDefinition change to the receiver" |
572 |
||
100 | 573 |
|newChange| |
574 |
||
575 |
newChange := ClassDefinitionChange class:aClass. |
|
787 | 576 |
newChange source:aClass definition. |
100 | 577 |
self add:newChange |
578 |
||
378 | 579 |
"Modified: 15.7.1996 / 09:27:05 / cg" |
100 | 580 |
! |
581 |
||
889
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
582 |
addInstVarDefinitionChangeFor:aClass |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
583 |
"add an instVarDefinition change to the receiver" |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
584 |
|
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
585 |
|newChange| |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
586 |
|
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
587 |
newChange := ClassInstVarDefinitionChange class:aClass. |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
588 |
newChange source:(aClass name , ' instanceVariableNames:' , aClass instanceVariableString storeString). |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
589 |
self add:newChange |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
590 |
|
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
591 |
! |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
592 |
|
16 | 593 |
addMethodCategoryChange:aMethod category:newCategory in:aClass |
378 | 594 |
"add a methodCategory change to the receiver" |
595 |
||
16 | 596 |
|newChange| |
597 |
||
598 |
newChange := MethodCategoryChange class:aClass |
|
879 | 599 |
selector:(aClass selectorAtMethod:aMethod) |
600 |
category:newCategory. |
|
16 | 601 |
self add:newChange |
602 |
||
378 | 603 |
"Modified: 15.7.1996 / 09:27:15 / cg" |
44 | 604 |
! |
605 |
||
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
606 |
addMethodChange:aMethod fromOld:oldMethod in:aClass |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
607 |
"add a method change to the receiver" |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
608 |
|
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
609 |
|newChange| |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
610 |
|
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
611 |
newChange := MethodChange class:aClass |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
612 |
selector:aMethod selector |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
613 |
source:aMethod source |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
614 |
category:aMethod category. |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
615 |
oldMethod notNil ifTrue:[ |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
616 |
newChange previousVersion:oldMethod source. |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
617 |
]. |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
618 |
self add:newChange. |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
619 |
|
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
620 |
"Modified: 15.7.1996 / 09:27:21 / cg" |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
621 |
! |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
622 |
|
85 | 623 |
addMethodChange:aMethod in:aClass |
378 | 624 |
"add a method change to the receiver" |
625 |
||
85 | 626 |
|newChange| |
627 |
||
628 |
newChange := MethodChange class:aClass |
|
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
629 |
selector:aMethod selector |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
630 |
source:aMethod source |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
631 |
category:aMethod category. |
85 | 632 |
self add:newChange |
378 | 633 |
|
634 |
"Modified: 15.7.1996 / 09:27:21 / cg" |
|
85 | 635 |
! |
636 |
||
44 | 637 |
addMethodPrivacyChange:aMethod in:aClass |
378 | 638 |
"add a methodPrivacy change to the receiver" |
639 |
||
44 | 640 |
|newChange| |
641 |
||
642 |
newChange := MethodPrivacyChange class:aClass |
|
879 | 643 |
selector:(aClass selectorAtMethod:aMethod) |
644 |
privacy:aMethod privacy. |
|
44 | 645 |
self add:newChange |
646 |
||
647 |
"Modified: 27.8.1995 / 22:55:22 / claus" |
|
378 | 648 |
"Modified: 15.7.1996 / 09:27:28 / cg" |
235 | 649 |
! |
650 |
||
651 |
addPrimitiveDefinitionsChangeFor:aClass |
|
378 | 652 |
"add a primitiveDefinitions change to the receiver" |
653 |
||
235 | 654 |
|newChange| |
655 |
||
783 | 656 |
newChange := ClassPrimitiveDefinitionsChange new |
879 | 657 |
class:aClass name source:aClass primitiveDefinitionsString. |
235 | 658 |
self add:newChange |
378 | 659 |
|
660 |
"Modified: 15.7.1996 / 09:27:40 / cg" |
|
235 | 661 |
! |
662 |
||
663 |
addPrimitiveFunctionsChangeFor:aClass |
|
378 | 664 |
"add a primitiveFunctions change to the receiver" |
665 |
||
235 | 666 |
|newChange| |
667 |
||
783 | 668 |
newChange := ClassPrimitiveFunctionsChange new |
879 | 669 |
class:aClass name source:aClass primitiveFunctionsString. |
235 | 670 |
self add:newChange |
378 | 671 |
|
672 |
"Modified: 15.7.1996 / 09:27:47 / cg" |
|
235 | 673 |
! |
674 |
||
675 |
addPrimitiveVariablesChangeFor:aClass |
|
378 | 676 |
"add a primitiveVariables change to the receiver" |
677 |
||
235 | 678 |
|newChange| |
679 |
||
783 | 680 |
newChange := ClassPrimitiveVariablesChange new |
879 | 681 |
class:aClass name source:aClass primitiveVariablesString. |
235 | 682 |
self add:newChange |
378 | 683 |
|
684 |
"Modified: 15.7.1996 / 09:27:55 / cg" |
|
654 | 685 |
! |
686 |
||
687 |
addRemoveSelectorChange:aSelector in:aClass |
|
688 |
"add a method-remove change to the receiver" |
|
689 |
||
690 |
|newChange| |
|
691 |
||
692 |
newChange := MethodRemoveChange |
|
879 | 693 |
class:aClass |
694 |
selector:aSelector. |
|
654 | 695 |
self add:newChange |
696 |
||
697 |
"Modified: / 27.8.1995 / 22:55:22 / claus" |
|
698 |
"Modified: / 15.7.1996 / 09:27:28 / cg" |
|
699 |
"Created: / 16.2.1998 / 12:47:07 / cg" |
|
901 | 700 |
! |
701 |
||
702 |
addRenameCategoryChangeIn:aClass from:oldCategory to:newCategory |
|
703 |
"add a category rename change to the receiver" |
|
704 |
||
705 |
|newChange| |
|
706 |
||
707 |
newChange := MethodCategoryRenameChange class:aClass. |
|
708 |
newChange oldCategoryName:oldCategory newCategoryName:newCategory. |
|
709 |
self add:newChange |
|
710 |
||
711 |
"Modified: / 6.2.2000 / 02:30:30 / cg" |
|
0 | 712 |
! ! |
713 |
||
85 | 714 |
!ChangeSet methodsFor:'misc'! |
715 |
||
716 |
addPatch:nameOfPatch |
|
717 |
"ignored for now - allows fileIn of ST-80 patch stuff .." |
|
718 |
||
719 |
^ self |
|
720 |
! ! |
|
721 |
||
857 | 722 |
!ChangeSet methodsFor:'utilities'! |
723 |
||
878 | 724 |
apply |
725 |
"apply all changes in the receivers changeSet" |
|
726 |
||
727 |
self do:[:aChange | |
|
879 | 728 |
aChange apply |
878 | 729 |
] |
730 |
! |
|
731 |
||
732 |
condenseChangesForClass:aClass package:aPackageSymbol |
|
733 |
"remove all changes for aClass and aPackageSymbol |
|
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
734 |
(i.e. leave methodChanges for other packages. |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
735 |
This is invoked when a class is checked into the repository." |
878 | 736 |
|
945
f9e349d38d49
care for metaclasses when condensing changeSet
Claus Gittinger <cg@exept.de>
parents:
944
diff
changeset
|
737 |
|changesToRemove className metaClassName chgCls| |
878 | 738 |
|
739 |
changesToRemove := OrderedCollection new. |
|
945
f9e349d38d49
care for metaclasses when condensing changeSet
Claus Gittinger <cg@exept.de>
parents:
944
diff
changeset
|
740 |
className := aClass theNonMetaclass name. |
f9e349d38d49
care for metaclasses when condensing changeSet
Claus Gittinger <cg@exept.de>
parents:
944
diff
changeset
|
741 |
metaClassName := aClass theMetaclass name. |
f9e349d38d49
care for metaclasses when condensing changeSet
Claus Gittinger <cg@exept.de>
parents:
944
diff
changeset
|
742 |
self do:[:aChange | |chgClassName chgClass| |
f9e349d38d49
care for metaclasses when condensing changeSet
Claus Gittinger <cg@exept.de>
parents:
944
diff
changeset
|
743 |
chgClassName := aChange className. |
f9e349d38d49
care for metaclasses when condensing changeSet
Claus Gittinger <cg@exept.de>
parents:
944
diff
changeset
|
744 |
(chgClassName = className |
f9e349d38d49
care for metaclasses when condensing changeSet
Claus Gittinger <cg@exept.de>
parents:
944
diff
changeset
|
745 |
or:[chgClassName = metaClassName]) ifTrue:[ |
887
3cfdf7d2ba89
oops - must care for unloaded/nonExistent/removed/renamed classes
Claus Gittinger <cg@exept.de>
parents:
883
diff
changeset
|
746 |
changesToRemove add:aChange |
944
f4cb7e9b034b
when condensing, also care for private classes
Claus Gittinger <cg@exept.de>
parents:
939
diff
changeset
|
747 |
] ifFalse:[ |
f4cb7e9b034b
when condensing, also care for private classes
Claus Gittinger <cg@exept.de>
parents:
939
diff
changeset
|
748 |
chgCls := aChange changeClass. |
f4cb7e9b034b
when condensing, also care for private classes
Claus Gittinger <cg@exept.de>
parents:
939
diff
changeset
|
749 |
(chgCls notNil |
f4cb7e9b034b
when condensing, also care for private classes
Claus Gittinger <cg@exept.de>
parents:
939
diff
changeset
|
750 |
and:[chgCls isPrivate |
f4cb7e9b034b
when condensing, also care for private classes
Claus Gittinger <cg@exept.de>
parents:
939
diff
changeset
|
751 |
and:[chgCls owningClass == aClass]]) ifTrue:[ |
f4cb7e9b034b
when condensing, also care for private classes
Claus Gittinger <cg@exept.de>
parents:
939
diff
changeset
|
752 |
changesToRemove add:aChange |
f4cb7e9b034b
when condensing, also care for private classes
Claus Gittinger <cg@exept.de>
parents:
939
diff
changeset
|
753 |
] |
887
3cfdf7d2ba89
oops - must care for unloaded/nonExistent/removed/renamed classes
Claus Gittinger <cg@exept.de>
parents:
883
diff
changeset
|
754 |
] |
878 | 755 |
]. |
756 |
self removeAll:changesToRemove |
|
757 |
! |
|
758 |
||
857 | 759 |
diffSetsAgainst:anotherChangeSet |
760 |
"walk over the receiver and anotherChangeSet, |
|
761 |
add all changes to one of the tree lists: |
|
946 | 762 |
onlyInReceiver, onlyInArg or changed, |
763 |
each being a changeSet containing corresponding changes. |
|
764 |
WARNING: destructive; could modify both the receiver and the argument" |
|
857 | 765 |
|
766 |
|onlyInReceiver onlyInArg changedMethods |
|
767 |
indexFromChangedMethodsToA indexFromChangedMethodsToB |
|
864 | 768 |
"info" ret| |
857 | 769 |
|
770 |
onlyInReceiver := ChangeSet new. |
|
771 |
onlyInArg := ChangeSet new. |
|
772 |
changedMethods := ChangeSet new. |
|
773 |
||
774 |
indexFromChangedMethodsToA := OrderedCollection new. |
|
775 |
indexFromChangedMethodsToB := OrderedCollection new. |
|
776 |
||
777 |
self keysAndValuesDo:[:idxA :aChangeInA | |
|
946 | 778 |
|anyFound ch| |
857 | 779 |
|
946 | 780 |
anyFound := false. |
857 | 781 |
|
946 | 782 |
anotherChangeSet keysAndValuesDo:[:idxB :aChangeInB | |
783 |
(aChangeInA isForSameAs:aChangeInB) ifTrue:[ |
|
784 |
anyFound := true. |
|
857 | 785 |
|
946 | 786 |
"/ also in B - is it different ? |
787 |
(aChangeInA sameAs:aChangeInB) ifFalse:[ |
|
788 |
changedMethods add:aChangeInA. |
|
789 |
indexFromChangedMethodsToA add:idxA. |
|
790 |
indexFromChangedMethodsToB add:idxB. |
|
791 |
] ifTrue:[ |
|
792 |
aChangeInA isMethodChange ifTrue:[ |
|
793 |
aChangeInA methodCategory ~= aChangeInB methodCategory ifTrue:[ |
|
794 |
"/ only the category is different; |
|
795 |
"/ make it a MethodCategory changes. |
|
857 | 796 |
|
946 | 797 |
ch := MethodCategoryChange new |
798 |
className:aChangeInA className |
|
799 |
selector:aChangeInA selector |
|
800 |
category:aChangeInA methodCategory. |
|
801 |
self at:idxA put:ch. |
|
857 | 802 |
|
946 | 803 |
ch := MethodCategoryChange new |
804 |
className:aChangeInB className |
|
805 |
selector:aChangeInB selector |
|
806 |
category:aChangeInB methodCategory. |
|
807 |
anotherChangeSet at:idxB put:ch. |
|
857 | 808 |
|
946 | 809 |
changedMethods add:aChangeInA. |
810 |
indexFromChangedMethodsToA add:idxA. |
|
811 |
indexFromChangedMethodsToB add:idxB. |
|
812 |
] |
|
813 |
]. |
|
814 |
] |
|
815 |
] ifFalse:[ |
|
816 |
(aChangeInA sameAs:aChangeInB) ifTrue:[ |
|
817 |
anyFound := true. |
|
818 |
] ifFalse:[ |
|
819 |
] |
|
820 |
] |
|
821 |
]. |
|
857 | 822 |
|
946 | 823 |
anyFound ifFalse:[ |
824 |
onlyInReceiver add:aChangeInA. |
|
825 |
] |
|
857 | 826 |
]. |
827 |
||
828 |
anotherChangeSet keysAndValuesDo:[:idxB :aChangeInB | |
|
946 | 829 |
|anyFound| |
857 | 830 |
|
946 | 831 |
anyFound := false. |
857 | 832 |
|
946 | 833 |
self do:[:aChangeInA | |
834 |
|idxM| |
|
857 | 835 |
|
946 | 836 |
(aChangeInA isForSameAs:aChangeInB) ifTrue:[ |
837 |
anyFound := true. |
|
857 | 838 |
|
946 | 839 |
"/ also in B - is it different ? |
840 |
(aChangeInA sameAs:aChangeInB) ifFalse:[ |
|
841 |
"/ already there ? |
|
842 |
idxM := changedMethods findFirst:[:c | c isForSameAs:aChangeInB]. |
|
843 |
idxM == 0 ifTrue:[ |
|
844 |
changedMethods add:aChangeInB. |
|
845 |
indexFromChangedMethodsToB add:idxB. |
|
846 |
] ifFalse:[ |
|
847 |
indexFromChangedMethodsToB at:idxM put:idxB |
|
848 |
] |
|
849 |
] |
|
850 |
] ifFalse:[ |
|
851 |
(aChangeInA sameAs:aChangeInB) ifTrue:[ |
|
852 |
anyFound := true. |
|
853 |
] ifFalse:[ |
|
854 |
] |
|
855 |
] |
|
856 |
]. |
|
857 |
anyFound ifFalse:[ |
|
858 |
onlyInArg add:aChangeInB. |
|
859 |
] |
|
857 | 860 |
]. |
861 |
||
864 | 862 |
"/ info := OrderedCollection new:(changedMethods size). |
863 |
"/ changedMethods keysAndValuesDo:[:idx :changedMethod | |
|
864 |
"/ info add:(Array |
|
865 |
"/ with:(indexFromChangedMethodsToA at:idx) |
|
866 |
"/ with:(indexFromChangedMethodsToB at:idx) |
|
867 |
"/ ) |
|
868 |
"/ ]. |
|
857 | 869 |
changedMethods := (1 to:changedMethods size) collect:[:idx | |
946 | 870 |
|cA cB| |
857 | 871 |
|
946 | 872 |
cA := self at:(indexFromChangedMethodsToA at:idx). |
873 |
cB := anotherChangeSet at:(indexFromChangedMethodsToB at:idx). |
|
874 |
Array with:cA with:cB |
|
875 |
]. |
|
857 | 876 |
|
877 |
ret := IdentityDictionary new. |
|
864 | 878 |
"/ ret at:#info put:info. |
857 | 879 |
ret at:#changed put:changedMethods. |
880 |
ret at:#onlyInReceiver put:onlyInReceiver. |
|
881 |
ret at:#onlyInArg put:onlyInArg. |
|
864 | 882 |
^ret |
857 | 883 |
! ! |
884 |
||
625
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
885 |
!ChangeSet class methodsFor:'documentation'! |
100 | 886 |
|
887 |
version |
|
965 | 888 |
^ '$Header: /cvs/stx/stx/libbasic3/ChangeSet.st,v 1.55 2000-08-31 10:23:18 cg Exp $' |
100 | 889 |
! ! |