author | Claus Gittinger <cg@exept.de> |
Thu, 09 Nov 2000 12:52:22 +0100 | |
changeset 985 | d6e52410ac8a |
parent 965 | 38bc91ec40c6 |
child 1034 | cdc9ddc19155 |
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 |
|
985 | 556 |
!ChangeSet methodsFor:'change & update'! |
557 |
||
558 |
changed: anAspectSymbol with: aParameter |
|
559 |
"Allow objects to depend on the ChangeSet class instead of a particular instance |
|
560 |
of ChangeSet (which may be switched using projects)." |
|
561 |
||
562 |
ChangeSet changed: anAspectSymbol with: aParameter. |
|
563 |
super changed: anAspectSymbol with: aParameter |
|
564 |
! ! |
|
565 |
||
901 | 566 |
!ChangeSet methodsFor:'changes management'! |
889
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
567 |
|
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
568 |
addClassCommentChangeFor:aClass |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
569 |
"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
|
570 |
|
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
571 |
|newChange| |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
572 |
|
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
573 |
newChange := ClassCommentChange class:aClass. |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
574 |
newChange comment:aClass comment. |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
575 |
self add:newChange |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
576 |
|
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
577 |
"Modified: 15.7.1996 / 09:27:05 / cg" |
100 | 578 |
! |
579 |
||
580 |
addClassDefinitionChangeFor:aClass |
|
378 | 581 |
"add a classDefinition change to the receiver" |
582 |
||
100 | 583 |
|newChange| |
584 |
||
585 |
newChange := ClassDefinitionChange class:aClass. |
|
787 | 586 |
newChange source:aClass definition. |
100 | 587 |
self add:newChange |
588 |
||
378 | 589 |
"Modified: 15.7.1996 / 09:27:05 / cg" |
100 | 590 |
! |
591 |
||
889
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
592 |
addInstVarDefinitionChangeFor:aClass |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
593 |
"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
|
594 |
|
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
595 |
|newChange| |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
596 |
|
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
597 |
newChange := ClassInstVarDefinitionChange class:aClass. |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
598 |
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
|
599 |
self add:newChange |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
600 |
|
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
601 |
! |
6b05401d7184
more changes (comments, class-instVars) in the changeSet;
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
602 |
|
16 | 603 |
addMethodCategoryChange:aMethod category:newCategory in:aClass |
378 | 604 |
"add a methodCategory change to the receiver" |
605 |
||
16 | 606 |
|newChange| |
607 |
||
608 |
newChange := MethodCategoryChange class:aClass |
|
879 | 609 |
selector:(aClass selectorAtMethod:aMethod) |
610 |
category:newCategory. |
|
16 | 611 |
self add:newChange |
612 |
||
378 | 613 |
"Modified: 15.7.1996 / 09:27:15 / cg" |
44 | 614 |
! |
615 |
||
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
616 |
addMethodChange:aMethod fromOld:oldMethod in:aClass |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
617 |
"add a method change to the receiver" |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
618 |
|
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
619 |
|newChange| |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
620 |
|
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
621 |
newChange := MethodChange class:aClass |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
622 |
selector:aMethod selector |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
623 |
source:aMethod source |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
624 |
category:aMethod category. |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
625 |
oldMethod notNil ifTrue:[ |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
626 |
newChange previousVersion:oldMethod source. |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
627 |
]. |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
628 |
self add:newChange. |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
629 |
|
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
630 |
"Modified: 15.7.1996 / 09:27:21 / cg" |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
631 |
! |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
632 |
|
85 | 633 |
addMethodChange:aMethod in:aClass |
378 | 634 |
"add a method change to the receiver" |
635 |
||
85 | 636 |
|newChange| |
637 |
||
638 |
newChange := MethodChange class:aClass |
|
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
639 |
selector:aMethod selector |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
640 |
source:aMethod source |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
641 |
category:aMethod category. |
85 | 642 |
self add:newChange |
378 | 643 |
|
644 |
"Modified: 15.7.1996 / 09:27:21 / cg" |
|
85 | 645 |
! |
646 |
||
44 | 647 |
addMethodPrivacyChange:aMethod in:aClass |
378 | 648 |
"add a methodPrivacy change to the receiver" |
649 |
||
44 | 650 |
|newChange| |
651 |
||
652 |
newChange := MethodPrivacyChange class:aClass |
|
879 | 653 |
selector:(aClass selectorAtMethod:aMethod) |
654 |
privacy:aMethod privacy. |
|
44 | 655 |
self add:newChange |
656 |
||
657 |
"Modified: 27.8.1995 / 22:55:22 / claus" |
|
378 | 658 |
"Modified: 15.7.1996 / 09:27:28 / cg" |
235 | 659 |
! |
660 |
||
661 |
addPrimitiveDefinitionsChangeFor:aClass |
|
378 | 662 |
"add a primitiveDefinitions change to the receiver" |
663 |
||
235 | 664 |
|newChange| |
665 |
||
783 | 666 |
newChange := ClassPrimitiveDefinitionsChange new |
879 | 667 |
class:aClass name source:aClass primitiveDefinitionsString. |
235 | 668 |
self add:newChange |
378 | 669 |
|
670 |
"Modified: 15.7.1996 / 09:27:40 / cg" |
|
235 | 671 |
! |
672 |
||
673 |
addPrimitiveFunctionsChangeFor:aClass |
|
378 | 674 |
"add a primitiveFunctions change to the receiver" |
675 |
||
235 | 676 |
|newChange| |
677 |
||
783 | 678 |
newChange := ClassPrimitiveFunctionsChange new |
879 | 679 |
class:aClass name source:aClass primitiveFunctionsString. |
235 | 680 |
self add:newChange |
378 | 681 |
|
682 |
"Modified: 15.7.1996 / 09:27:47 / cg" |
|
235 | 683 |
! |
684 |
||
685 |
addPrimitiveVariablesChangeFor:aClass |
|
378 | 686 |
"add a primitiveVariables change to the receiver" |
687 |
||
235 | 688 |
|newChange| |
689 |
||
783 | 690 |
newChange := ClassPrimitiveVariablesChange new |
879 | 691 |
class:aClass name source:aClass primitiveVariablesString. |
235 | 692 |
self add:newChange |
378 | 693 |
|
694 |
"Modified: 15.7.1996 / 09:27:55 / cg" |
|
654 | 695 |
! |
696 |
||
697 |
addRemoveSelectorChange:aSelector in:aClass |
|
698 |
"add a method-remove change to the receiver" |
|
699 |
||
700 |
|newChange| |
|
701 |
||
702 |
newChange := MethodRemoveChange |
|
879 | 703 |
class:aClass |
704 |
selector:aSelector. |
|
654 | 705 |
self add:newChange |
706 |
||
707 |
"Modified: / 27.8.1995 / 22:55:22 / claus" |
|
708 |
"Modified: / 15.7.1996 / 09:27:28 / cg" |
|
709 |
"Created: / 16.2.1998 / 12:47:07 / cg" |
|
901 | 710 |
! |
711 |
||
712 |
addRenameCategoryChangeIn:aClass from:oldCategory to:newCategory |
|
713 |
"add a category rename change to the receiver" |
|
714 |
||
715 |
|newChange| |
|
716 |
||
717 |
newChange := MethodCategoryRenameChange class:aClass. |
|
718 |
newChange oldCategoryName:oldCategory newCategoryName:newCategory. |
|
719 |
self add:newChange |
|
720 |
||
721 |
"Modified: / 6.2.2000 / 02:30:30 / cg" |
|
0 | 722 |
! ! |
723 |
||
85 | 724 |
!ChangeSet methodsFor:'misc'! |
725 |
||
726 |
addPatch:nameOfPatch |
|
727 |
"ignored for now - allows fileIn of ST-80 patch stuff .." |
|
728 |
||
729 |
^ self |
|
730 |
! ! |
|
731 |
||
857 | 732 |
!ChangeSet methodsFor:'utilities'! |
733 |
||
878 | 734 |
apply |
735 |
"apply all changes in the receivers changeSet" |
|
736 |
||
737 |
self do:[:aChange | |
|
879 | 738 |
aChange apply |
878 | 739 |
] |
740 |
! |
|
741 |
||
742 |
condenseChangesForClass:aClass package:aPackageSymbol |
|
743 |
"remove all changes for aClass and aPackageSymbol |
|
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
744 |
(i.e. leave methodChanges for other packages. |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
745 |
This is invoked when a class is checked into the repository." |
878 | 746 |
|
945
f9e349d38d49
care for metaclasses when condensing changeSet
Claus Gittinger <cg@exept.de>
parents:
944
diff
changeset
|
747 |
|changesToRemove className metaClassName chgCls| |
878 | 748 |
|
749 |
changesToRemove := OrderedCollection new. |
|
945
f9e349d38d49
care for metaclasses when condensing changeSet
Claus Gittinger <cg@exept.de>
parents:
944
diff
changeset
|
750 |
className := aClass theNonMetaclass name. |
f9e349d38d49
care for metaclasses when condensing changeSet
Claus Gittinger <cg@exept.de>
parents:
944
diff
changeset
|
751 |
metaClassName := aClass theMetaclass name. |
f9e349d38d49
care for metaclasses when condensing changeSet
Claus Gittinger <cg@exept.de>
parents:
944
diff
changeset
|
752 |
self do:[:aChange | |chgClassName chgClass| |
f9e349d38d49
care for metaclasses when condensing changeSet
Claus Gittinger <cg@exept.de>
parents:
944
diff
changeset
|
753 |
chgClassName := aChange className. |
f9e349d38d49
care for metaclasses when condensing changeSet
Claus Gittinger <cg@exept.de>
parents:
944
diff
changeset
|
754 |
(chgClassName = className |
f9e349d38d49
care for metaclasses when condensing changeSet
Claus Gittinger <cg@exept.de>
parents:
944
diff
changeset
|
755 |
or:[chgClassName = metaClassName]) ifTrue:[ |
887
3cfdf7d2ba89
oops - must care for unloaded/nonExistent/removed/renamed classes
Claus Gittinger <cg@exept.de>
parents:
883
diff
changeset
|
756 |
changesToRemove add:aChange |
944
f4cb7e9b034b
when condensing, also care for private classes
Claus Gittinger <cg@exept.de>
parents:
939
diff
changeset
|
757 |
] ifFalse:[ |
f4cb7e9b034b
when condensing, also care for private classes
Claus Gittinger <cg@exept.de>
parents:
939
diff
changeset
|
758 |
chgCls := aChange changeClass. |
f4cb7e9b034b
when condensing, also care for private classes
Claus Gittinger <cg@exept.de>
parents:
939
diff
changeset
|
759 |
(chgCls notNil |
f4cb7e9b034b
when condensing, also care for private classes
Claus Gittinger <cg@exept.de>
parents:
939
diff
changeset
|
760 |
and:[chgCls isPrivate |
f4cb7e9b034b
when condensing, also care for private classes
Claus Gittinger <cg@exept.de>
parents:
939
diff
changeset
|
761 |
and:[chgCls owningClass == aClass]]) ifTrue:[ |
f4cb7e9b034b
when condensing, also care for private classes
Claus Gittinger <cg@exept.de>
parents:
939
diff
changeset
|
762 |
changesToRemove add:aChange |
f4cb7e9b034b
when condensing, also care for private classes
Claus Gittinger <cg@exept.de>
parents:
939
diff
changeset
|
763 |
] |
887
3cfdf7d2ba89
oops - must care for unloaded/nonExistent/removed/renamed classes
Claus Gittinger <cg@exept.de>
parents:
883
diff
changeset
|
764 |
] |
878 | 765 |
]. |
766 |
self removeAll:changesToRemove |
|
767 |
! |
|
768 |
||
857 | 769 |
diffSetsAgainst:anotherChangeSet |
770 |
"walk over the receiver and anotherChangeSet, |
|
771 |
add all changes to one of the tree lists: |
|
946 | 772 |
onlyInReceiver, onlyInArg or changed, |
773 |
each being a changeSet containing corresponding changes. |
|
774 |
WARNING: destructive; could modify both the receiver and the argument" |
|
857 | 775 |
|
776 |
|onlyInReceiver onlyInArg changedMethods |
|
777 |
indexFromChangedMethodsToA indexFromChangedMethodsToB |
|
864 | 778 |
"info" ret| |
857 | 779 |
|
780 |
onlyInReceiver := ChangeSet new. |
|
781 |
onlyInArg := ChangeSet new. |
|
782 |
changedMethods := ChangeSet new. |
|
783 |
||
784 |
indexFromChangedMethodsToA := OrderedCollection new. |
|
785 |
indexFromChangedMethodsToB := OrderedCollection new. |
|
786 |
||
787 |
self keysAndValuesDo:[:idxA :aChangeInA | |
|
946 | 788 |
|anyFound ch| |
857 | 789 |
|
946 | 790 |
anyFound := false. |
857 | 791 |
|
946 | 792 |
anotherChangeSet keysAndValuesDo:[:idxB :aChangeInB | |
793 |
(aChangeInA isForSameAs:aChangeInB) ifTrue:[ |
|
794 |
anyFound := true. |
|
857 | 795 |
|
946 | 796 |
"/ also in B - is it different ? |
797 |
(aChangeInA sameAs:aChangeInB) ifFalse:[ |
|
798 |
changedMethods add:aChangeInA. |
|
799 |
indexFromChangedMethodsToA add:idxA. |
|
800 |
indexFromChangedMethodsToB add:idxB. |
|
801 |
] ifTrue:[ |
|
802 |
aChangeInA isMethodChange ifTrue:[ |
|
803 |
aChangeInA methodCategory ~= aChangeInB methodCategory ifTrue:[ |
|
804 |
"/ only the category is different; |
|
805 |
"/ make it a MethodCategory changes. |
|
857 | 806 |
|
946 | 807 |
ch := MethodCategoryChange new |
808 |
className:aChangeInA className |
|
809 |
selector:aChangeInA selector |
|
810 |
category:aChangeInA methodCategory. |
|
811 |
self at:idxA put:ch. |
|
857 | 812 |
|
946 | 813 |
ch := MethodCategoryChange new |
814 |
className:aChangeInB className |
|
815 |
selector:aChangeInB selector |
|
816 |
category:aChangeInB methodCategory. |
|
817 |
anotherChangeSet at:idxB put:ch. |
|
857 | 818 |
|
946 | 819 |
changedMethods add:aChangeInA. |
820 |
indexFromChangedMethodsToA add:idxA. |
|
821 |
indexFromChangedMethodsToB add:idxB. |
|
822 |
] |
|
823 |
]. |
|
824 |
] |
|
825 |
] ifFalse:[ |
|
826 |
(aChangeInA sameAs:aChangeInB) ifTrue:[ |
|
827 |
anyFound := true. |
|
828 |
] ifFalse:[ |
|
829 |
] |
|
830 |
] |
|
831 |
]. |
|
857 | 832 |
|
946 | 833 |
anyFound ifFalse:[ |
834 |
onlyInReceiver add:aChangeInA. |
|
835 |
] |
|
857 | 836 |
]. |
837 |
||
838 |
anotherChangeSet keysAndValuesDo:[:idxB :aChangeInB | |
|
946 | 839 |
|anyFound| |
857 | 840 |
|
946 | 841 |
anyFound := false. |
857 | 842 |
|
946 | 843 |
self do:[:aChangeInA | |
844 |
|idxM| |
|
857 | 845 |
|
946 | 846 |
(aChangeInA isForSameAs:aChangeInB) ifTrue:[ |
847 |
anyFound := true. |
|
857 | 848 |
|
946 | 849 |
"/ also in B - is it different ? |
850 |
(aChangeInA sameAs:aChangeInB) ifFalse:[ |
|
851 |
"/ already there ? |
|
852 |
idxM := changedMethods findFirst:[:c | c isForSameAs:aChangeInB]. |
|
853 |
idxM == 0 ifTrue:[ |
|
854 |
changedMethods add:aChangeInB. |
|
855 |
indexFromChangedMethodsToB add:idxB. |
|
856 |
] ifFalse:[ |
|
857 |
indexFromChangedMethodsToB at:idxM put:idxB |
|
858 |
] |
|
859 |
] |
|
860 |
] ifFalse:[ |
|
861 |
(aChangeInA sameAs:aChangeInB) ifTrue:[ |
|
862 |
anyFound := true. |
|
863 |
] ifFalse:[ |
|
864 |
] |
|
865 |
] |
|
866 |
]. |
|
867 |
anyFound ifFalse:[ |
|
868 |
onlyInArg add:aChangeInB. |
|
869 |
] |
|
857 | 870 |
]. |
871 |
||
864 | 872 |
"/ info := OrderedCollection new:(changedMethods size). |
873 |
"/ changedMethods keysAndValuesDo:[:idx :changedMethod | |
|
874 |
"/ info add:(Array |
|
875 |
"/ with:(indexFromChangedMethodsToA at:idx) |
|
876 |
"/ with:(indexFromChangedMethodsToB at:idx) |
|
877 |
"/ ) |
|
878 |
"/ ]. |
|
857 | 879 |
changedMethods := (1 to:changedMethods size) collect:[:idx | |
946 | 880 |
|cA cB| |
857 | 881 |
|
946 | 882 |
cA := self at:(indexFromChangedMethodsToA at:idx). |
883 |
cB := anotherChangeSet at:(indexFromChangedMethodsToB at:idx). |
|
884 |
Array with:cA with:cB |
|
885 |
]. |
|
857 | 886 |
|
887 |
ret := IdentityDictionary new. |
|
864 | 888 |
"/ ret at:#info put:info. |
857 | 889 |
ret at:#changed put:changedMethods. |
890 |
ret at:#onlyInReceiver put:onlyInReceiver. |
|
891 |
ret at:#onlyInArg put:onlyInArg. |
|
864 | 892 |
^ret |
857 | 893 |
! ! |
894 |
||
625
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
895 |
!ChangeSet class methodsFor:'documentation'! |
100 | 896 |
|
897 |
version |
|
985 | 898 |
^ '$Header: /cvs/stx/stx/libbasic3/ChangeSet.st,v 1.56 2000-11-09 11:52:22 cg Exp $' |
100 | 899 |
! ! |