author | Claus Gittinger <cg@exept.de> |
Wed, 15 Dec 1999 00:28:10 +0100 | |
changeset 860 | 4e159afd172a |
parent 859 | 5d50d068c63b |
child 864 | 4f35b96a799e |
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 |
|
13 |
OrderedCollection subclass:#ChangeSet |
|
235 | 14 |
instanceVariableNames:'' |
15 |
classVariableNames:'' |
|
16 |
poolDictionaries:'' |
|
17 |
category:'System-Changes' |
|
0 | 18 |
! |
19 |
||
625
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
20 |
!ChangeSet class methodsFor:'documentation'! |
9 | 21 |
|
22 |
copyright |
|
23 |
" |
|
24 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
16 | 25 |
All Rights Reserved |
9 | 26 |
|
27 |
This software is furnished under a license and may be used |
|
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
34 |
! |
|
35 |
||
36 |
documentation |
|
37 |
" |
|
38 |
used in the changes management to keep track of changes |
|
235 | 39 |
|
40 |
[author:] |
|
41 |
Claus Gittinger |
|
9 | 42 |
" |
43 |
! ! |
|
44 |
||
654 | 45 |
!ChangeSet class methodsFor:'instance creation'! |
46 |
||
47 |
fromStream:aStream |
|
48 |
"build a changeSet from a stream, containing chunks. |
|
49 |
(i.e. either a classes sourceFile or a change-file). |
|
50 |
Return the changeSet." |
|
51 |
||
859 | 52 |
|changeSet chunk sawExcla lastTimeStamp s change nameSpace| |
654 | 53 |
|
54 |
changeSet := self new. |
|
859 | 55 |
nameSpace := Smalltalk. |
654 | 56 |
|
57 |
[aStream atEnd] whileFalse:[ |
|
58 |
aStream skipSeparators. |
|
59 |
sawExcla := aStream peekFor:$!!. |
|
60 |
chunk := aStream nextChunk. |
|
61 |
(chunk notNil and:[chunk notEmpty]) ifTrue:[ |
|
859 | 62 |
Class nameSpaceQuerySignal answer:nameSpace do:[ |
63 |
|parser tree| |
|
64 |
||
65 |
parser := Parser for:chunk. |
|
66 |
tree := parser |
|
67 |
parseExpressionWithSelf:nil |
|
68 |
notifying:nil |
|
69 |
ignoreErrors:true |
|
70 |
ignoreWarnings:true |
|
71 |
inNameSpace:nameSpace. |
|
72 |
tree == #Error ifTrue:[ |
|
73 |
change := DoItChange new. |
|
74 |
change source:chunk. |
|
75 |
changeSet add: change. |
|
76 |
] ifFalse:[ |
|
77 |
(tree notNil and:[tree ~~ #Error]) ifTrue:[ |
|
78 |
"/ if there is any nameSPace directoive in there, extract it. |
|
79 |
parser currentNameSpace notNil ifTrue:[ |
|
80 |
nameSpace := parser currentNameSpace |
|
81 |
]. |
|
82 |
Class nameSpaceQuerySignal answer:nameSpace do:[ |
|
83 |
"/ |
|
84 |
"/ what type of chunk is this ... |
|
85 |
"/ |
|
86 |
tree isConstant ifTrue:[ |
|
87 |
(s := tree evaluate) isString ifTrue:[ |
|
88 |
(s startsWith:'---- timestamp ') ifTrue:[ |
|
89 |
lastTimeStamp := s. |
|
90 |
] |
|
91 |
] ifFalse:[ |
|
92 |
self halt:'unexpected change-chunk' |
|
93 |
] |
|
94 |
] ifFalse:[ |
|
95 |
tree isMessage ifTrue:[ |
|
96 |
(changeSet addFromParseTree:tree andStream:aStream) ifFalse:[ |
|
97 |
change := DoItChange new. |
|
98 |
change source:chunk. |
|
99 |
changeSet add: change. |
|
100 |
] |
|
101 |
] ifFalse:[ |
|
102 |
self halt:'unexpected change-chunk' |
|
103 |
] |
|
654 | 104 |
] |
105 |
] |
|
106 |
] |
|
107 |
] |
|
108 |
] |
|
109 |
] |
|
110 |
]. |
|
111 |
^ changeSet |
|
112 |
||
113 |
" |
|
114 |
ChangeSet fromStream:('changes' asFilename readStream) |
|
115 |
ChangeSet fromStream:('patches' asFilename readStream) |
|
116 |
ChangeSet fromStream:(Object source asString readStream) |
|
117 |
" |
|
118 |
||
119 |
"Created: / 16.2.1998 / 12:19:34 / cg" |
|
859 | 120 |
"Modified: / 14.12.1999 / 15:23:16 / cg" |
654 | 121 |
! ! |
122 |
||
625
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
123 |
!ChangeSet class methodsFor:'ST80 compatibility'! |
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
124 |
|
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
125 |
patches |
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
126 |
^ #() |
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
127 |
|
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
128 |
"Created: / 27.10.1997 / 13:52:54 / cg" |
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
129 |
! ! |
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
130 |
|
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
131 |
!ChangeSet class methodsFor:'queries'! |
27 | 132 |
|
133 |
current |
|
134 |
"ST-80 compatibility: return the current changeSet" |
|
135 |
||
136 |
|p| |
|
137 |
||
138 |
(Project notNil and:[(p := Project current) notNil]) ifTrue:[ |
|
139 |
^ p changeSet |
|
140 |
] |
|
141 |
||
142 |
" |
|
143 |
ChangeSet current |
|
144 |
" |
|
145 |
! ! |
|
146 |
||
0 | 147 |
!ChangeSet methodsFor:'change management'! |
148 |
||
100 | 149 |
addClassCategoryChange:newCategory for:aClass |
378 | 150 |
"add a classCategory change to the receiver" |
151 |
||
100 | 152 |
|newChange| |
153 |
||
154 |
newChange := ClassCategoryChange class:aClass category:newCategory. |
|
155 |
self add:newChange |
|
156 |
||
157 |
"Created: 3.12.1995 / 13:45:53 / cg" |
|
378 | 158 |
"Modified: 15.7.1996 / 09:26:52 / cg" |
100 | 159 |
! |
160 |
||
161 |
addClassDefinitionChangeFor:aClass |
|
378 | 162 |
"add a classDefinition change to the receiver" |
163 |
||
100 | 164 |
|newChange| |
165 |
||
166 |
newChange := ClassDefinitionChange class:aClass. |
|
787 | 167 |
newChange source:aClass definition. |
100 | 168 |
self add:newChange |
169 |
||
378 | 170 |
"Modified: 15.7.1996 / 09:27:05 / cg" |
100 | 171 |
! |
172 |
||
16 | 173 |
addMethodCategoryChange:aMethod category:newCategory in:aClass |
378 | 174 |
"add a methodCategory change to the receiver" |
175 |
||
16 | 176 |
|newChange| |
177 |
||
178 |
newChange := MethodCategoryChange class:aClass |
|
378 | 179 |
selector:(aClass selectorAtMethod:aMethod) |
180 |
category:newCategory. |
|
16 | 181 |
self add:newChange |
182 |
||
378 | 183 |
"Modified: 15.7.1996 / 09:27:15 / cg" |
44 | 184 |
! |
185 |
||
85 | 186 |
addMethodChange:aMethod in:aClass |
378 | 187 |
"add a method change to the receiver" |
188 |
||
85 | 189 |
|newChange| |
190 |
||
191 |
newChange := MethodChange class:aClass |
|
378 | 192 |
selector:(aClass selectorAtMethod:aMethod) |
193 |
source:aMethod source |
|
194 |
category:aMethod category. |
|
85 | 195 |
self add:newChange |
378 | 196 |
|
197 |
"Modified: 15.7.1996 / 09:27:21 / cg" |
|
85 | 198 |
! |
199 |
||
44 | 200 |
addMethodPrivacyChange:aMethod in:aClass |
378 | 201 |
"add a methodPrivacy change to the receiver" |
202 |
||
44 | 203 |
|newChange| |
204 |
||
205 |
newChange := MethodPrivacyChange class:aClass |
|
378 | 206 |
selector:(aClass selectorAtMethod:aMethod) |
207 |
privacy:aMethod privacy. |
|
44 | 208 |
self add:newChange |
209 |
||
210 |
"Modified: 27.8.1995 / 22:55:22 / claus" |
|
378 | 211 |
"Modified: 15.7.1996 / 09:27:28 / cg" |
235 | 212 |
! |
213 |
||
214 |
addPrimitiveDefinitionsChangeFor:aClass |
|
378 | 215 |
"add a primitiveDefinitions change to the receiver" |
216 |
||
235 | 217 |
|newChange| |
218 |
||
783 | 219 |
newChange := ClassPrimitiveDefinitionsChange new |
220 |
class:aClass name source:aClass primitiveDefinitionsString. |
|
235 | 221 |
self add:newChange |
378 | 222 |
|
223 |
"Modified: 15.7.1996 / 09:27:40 / cg" |
|
235 | 224 |
! |
225 |
||
226 |
addPrimitiveFunctionsChangeFor:aClass |
|
378 | 227 |
"add a primitiveFunctions change to the receiver" |
228 |
||
235 | 229 |
|newChange| |
230 |
||
783 | 231 |
newChange := ClassPrimitiveFunctionsChange new |
232 |
class:aClass name source:aClass primitiveFunctionsString. |
|
235 | 233 |
self add:newChange |
378 | 234 |
|
235 |
"Modified: 15.7.1996 / 09:27:47 / cg" |
|
235 | 236 |
! |
237 |
||
238 |
addPrimitiveVariablesChangeFor:aClass |
|
378 | 239 |
"add a primitiveVariables change to the receiver" |
240 |
||
235 | 241 |
|newChange| |
242 |
||
783 | 243 |
newChange := ClassPrimitiveVariablesChange new |
244 |
class:aClass name source:aClass primitiveVariablesString. |
|
235 | 245 |
self add:newChange |
378 | 246 |
|
247 |
"Modified: 15.7.1996 / 09:27:55 / cg" |
|
654 | 248 |
! |
249 |
||
250 |
addRemoveSelectorChange:aSelector in:aClass |
|
251 |
"add a method-remove change to the receiver" |
|
252 |
||
253 |
|newChange| |
|
254 |
||
255 |
newChange := MethodRemoveChange |
|
256 |
class:aClass |
|
257 |
selector:aSelector. |
|
258 |
self add:newChange |
|
259 |
||
260 |
"Modified: / 27.8.1995 / 22:55:22 / claus" |
|
261 |
"Modified: / 15.7.1996 / 09:27:28 / cg" |
|
262 |
"Created: / 16.2.1998 / 12:47:07 / cg" |
|
0 | 263 |
! ! |
264 |
||
85 | 265 |
!ChangeSet methodsFor:'misc'! |
266 |
||
267 |
addPatch:nameOfPatch |
|
268 |
"ignored for now - allows fileIn of ST-80 patch stuff .." |
|
269 |
||
270 |
^ self |
|
271 |
! ! |
|
272 |
||
654 | 273 |
!ChangeSet methodsFor:'private'! |
274 |
||
275 |
addFromParseTree:aTree andStream:aStream |
|
276 |
|sel className categoryName |
|
277 |
methodSource methodSelector change parser |
|
775 | 278 |
oldName newName priv receiver receiverVarName |
859 | 279 |
receiverSelector receiverReceiver primSource |
280 |
nameSpace| |
|
281 |
||
860 | 282 |
nameSpace := Class nameSpaceQuerySignal query. |
859 | 283 |
nameSpace isNil ifTrue:[nameSpace := Smalltalk]. |
654 | 284 |
|
285 |
sel := aTree selector. |
|
775 | 286 |
receiver := aTree receiver. |
287 |
receiver isMessage ifTrue:[ |
|
288 |
receiverSelector := receiver selector. |
|
289 |
receiverReceiver := receiver receiver. |
|
290 |
] ifFalse:[ |
|
291 |
receiver isVariable ifTrue:[ |
|
292 |
receiverVarName := receiver name |
|
293 |
] |
|
294 |
]. |
|
295 |
||
654 | 296 |
(sel == #'methodsFor:' |
297 |
or:[(sel == #'ignoredMethodsFor:')]) ifTrue:[ |
|
298 |
(sel == #'ignoredMethodsFor:') ifTrue:[ |
|
299 |
priv := #ignored. |
|
300 |
] ifFalse:[ |
|
301 |
priv := nil |
|
302 |
]. |
|
775 | 303 |
(receiver isUnaryMessage |
304 |
and:[receiverSelector == #class]) ifTrue:[ |
|
305 |
className := (receiverReceiver name) , ' class'. |
|
654 | 306 |
] ifFalse:[ |
775 | 307 |
className := (receiver name). |
654 | 308 |
]. |
859 | 309 |
nameSpace ~~ Smalltalk ifTrue:[ |
310 |
className := nameSpace name , '::' , className |
|
311 |
]. |
|
654 | 312 |
categoryName := (aTree arguments at:1) evaluate. |
313 |
||
314 |
aStream skipSeparators. |
|
315 |
methodSource := aStream nextChunk. |
|
316 |
[methodSource notEmpty] whileTrue:[ |
|
317 |
parser := Parser |
|
789
f5dd39d0653e
dont parse the methods body, if all we need is the selector.
Claus Gittinger <cg@exept.de>
parents:
787
diff
changeset
|
318 |
parseMethodArgAndVarSpecification:methodSource |
f5dd39d0653e
dont parse the methods body, if all we need is the selector.
Claus Gittinger <cg@exept.de>
parents:
787
diff
changeset
|
319 |
in:nil |
f5dd39d0653e
dont parse the methods body, if all we need is the selector.
Claus Gittinger <cg@exept.de>
parents:
787
diff
changeset
|
320 |
ignoreErrors:true |
f5dd39d0653e
dont parse the methods body, if all we need is the selector.
Claus Gittinger <cg@exept.de>
parents:
787
diff
changeset
|
321 |
ignoreWarnings:true |
f5dd39d0653e
dont parse the methods body, if all we need is the selector.
Claus Gittinger <cg@exept.de>
parents:
787
diff
changeset
|
322 |
parseBody:false. |
654 | 323 |
|
829
1e701ca3c59f
care for unparsable stuff (java methods)
Claus Gittinger <cg@exept.de>
parents:
802
diff
changeset
|
324 |
parser isNil ifTrue:[ |
1e701ca3c59f
care for unparsable stuff (java methods)
Claus Gittinger <cg@exept.de>
parents:
802
diff
changeset
|
325 |
"/ something wierd ... |
1e701ca3c59f
care for unparsable stuff (java methods)
Claus Gittinger <cg@exept.de>
parents:
802
diff
changeset
|
326 |
methodSelector := '????'. |
1e701ca3c59f
care for unparsable stuff (java methods)
Claus Gittinger <cg@exept.de>
parents:
802
diff
changeset
|
327 |
] ifFalse:[ |
1e701ca3c59f
care for unparsable stuff (java methods)
Claus Gittinger <cg@exept.de>
parents:
802
diff
changeset
|
328 |
methodSelector := parser selector. |
1e701ca3c59f
care for unparsable stuff (java methods)
Claus Gittinger <cg@exept.de>
parents:
802
diff
changeset
|
329 |
]. |
654 | 330 |
|
331 |
change := MethodChange new. |
|
332 |
change |
|
333 |
className:className |
|
334 |
selector:methodSelector |
|
335 |
source:methodSource |
|
336 |
category:categoryName |
|
337 |
privacy:priv. |
|
338 |
self add: change. |
|
339 |
||
340 |
aStream skipSeparators. |
|
341 |
methodSource := aStream nextChunk. |
|
342 |
]. |
|
343 |
^ true |
|
344 |
]. |
|
345 |
||
346 |
sel == #'removeSelector:' ifTrue:[ |
|
775 | 347 |
(receiver isUnaryMessage |
348 |
and:[receiverSelector == #class]) ifTrue:[ |
|
349 |
className := (receiverReceiver name) , ' class'. |
|
654 | 350 |
] ifFalse:[ |
775 | 351 |
className := (receiver name). |
654 | 352 |
]. |
859 | 353 |
nameSpace ~~ Smalltalk ifTrue:[ |
354 |
className := nameSpace name , '::' , className |
|
355 |
]. |
|
654 | 356 |
methodSelector := (aTree arguments at:1) evaluate. |
357 |
change := MethodRemoveChange new. |
|
358 |
change |
|
359 |
className:className |
|
360 |
selector:methodSelector. |
|
361 |
self add: change. |
|
362 |
^ true |
|
363 |
]. |
|
364 |
||
787 | 365 |
"/ any subclass definiton selector ? |
802 | 366 |
(Behavior definitionSelectors includes:sel) |
787 | 367 |
ifTrue:[ |
654 | 368 |
className := (aTree arguments at:1) evaluate. |
859 | 369 |
nameSpace ~~ Smalltalk ifTrue:[ |
370 |
className := nameSpace name , '::' , className |
|
371 |
]. |
|
654 | 372 |
change := ClassDefinitionChange new. |
373 |
change |
|
374 |
className:className; |
|
375 |
source:(aTree printString). |
|
376 |
self add: change. |
|
377 |
^ true |
|
378 |
]. |
|
379 |
||
380 |
sel == #'renameCategory:to:' ifTrue:[ |
|
775 | 381 |
(receiver isUnaryMessage |
382 |
and:[receiverSelector == #class]) ifTrue:[ |
|
383 |
className := (receiverReceiver name) , ' class'. |
|
654 | 384 |
] ifFalse:[ |
775 | 385 |
className := (receiver name). |
654 | 386 |
]. |
859 | 387 |
nameSpace ~~ Smalltalk ifTrue:[ |
388 |
className := nameSpace name , '::' , className |
|
389 |
]. |
|
654 | 390 |
change := MethodCategoryRenameChange new. |
391 |
change |
|
392 |
className:className; |
|
393 |
oldCategoryName:(aTree arguments at:1) evaluate |
|
394 |
newCategoryName:(aTree arguments at:2) evaluate. |
|
395 |
self add: change. |
|
396 |
^ true |
|
397 |
]. |
|
398 |
||
399 |
(sel == #'category:' |
|
400 |
or:[sel == #'privacy:']) ifTrue:[ |
|
775 | 401 |
(receiver isMessage |
402 |
and:[receiverSelector == #'compiledMethodAt:']) ifTrue:[ |
|
403 |
(receiverReceiver isUnaryMessage |
|
404 |
and:[receiverReceiver selector == #class]) ifTrue:[ |
|
405 |
className := (receiverReceiver receiver name) , ' class'. |
|
654 | 406 |
] ifFalse:[ |
775 | 407 |
className := (receiverReceiver name). |
654 | 408 |
]. |
859 | 409 |
nameSpace ~~ Smalltalk ifTrue:[ |
410 |
className := nameSpace name , '::' , className |
|
411 |
]. |
|
775 | 412 |
methodSelector := (receiver arguments at:1) evaluate. |
654 | 413 |
|
414 |
sel == #'category:' ifTrue:[ |
|
415 |
change := MethodCategoryChange new. |
|
416 |
change |
|
417 |
className:className |
|
418 |
selector:methodSelector |
|
419 |
category:(aTree arguments at:1) evaluate. |
|
420 |
] ifFalse:[ |
|
421 |
change := MethodPrivacyChange new. |
|
422 |
change |
|
423 |
className:className |
|
424 |
selector:methodSelector |
|
425 |
privacy:(aTree arguments at:1) evaluate. |
|
426 |
]. |
|
427 |
||
428 |
self add: change. |
|
429 |
^ true |
|
430 |
] ifFalse:[ |
|
798 | 431 |
self halt:'unexpected change' |
654 | 432 |
]. |
433 |
]. |
|
434 |
||
435 |
sel == #'comment:' ifTrue:[ |
|
775 | 436 |
(receiver isUnaryMessage |
437 |
and:[receiverSelector == #class]) ifTrue:[ |
|
438 |
className := (receiverReceiver name) , ' class'. |
|
654 | 439 |
] ifFalse:[ |
775 | 440 |
className := (receiver name). |
654 | 441 |
]. |
859 | 442 |
nameSpace ~~ Smalltalk ifTrue:[ |
443 |
className := nameSpace name , '::' , className |
|
444 |
]. |
|
654 | 445 |
|
446 |
change := ClassCommentChange new. |
|
447 |
change |
|
448 |
className:className |
|
449 |
comment:(aTree arguments at:1) evaluate. |
|
775 | 450 |
change source:(aTree printString). |
654 | 451 |
self add: change. |
452 |
^ true |
|
453 |
]. |
|
454 |
||
798 | 455 |
sel == #'instanceVariableNames:' ifTrue:[ |
456 |
(receiver isUnaryMessage |
|
457 |
and:[receiverSelector == #class]) ifTrue:[ |
|
458 |
className := (receiverReceiver name) , ' class'. |
|
459 |
] ifFalse:[ |
|
460 |
className := (receiver name). |
|
461 |
]. |
|
859 | 462 |
nameSpace ~~ Smalltalk ifTrue:[ |
463 |
className := nameSpace name , '::' , className |
|
464 |
]. |
|
798 | 465 |
change := ClassInstVarDefinitionChange new. |
466 |
change className:className. |
|
467 |
change source:(aTree printString). |
|
468 |
self add: change. |
|
469 |
^ true |
|
470 |
]. |
|
471 |
||
654 | 472 |
sel == #'removeClass:' ifTrue:[ |
775 | 473 |
(receiverVarName == #Smalltalk) ifTrue:[ |
654 | 474 |
className := (aTree arguments at:1) name. |
859 | 475 |
nameSpace ~~ Smalltalk ifTrue:[ |
476 |
className := nameSpace name , '::' , className |
|
477 |
]. |
|
654 | 478 |
|
479 |
change := ClassRemoveChange new. |
|
480 |
change className:className. |
|
481 |
self add: change. |
|
482 |
^ true |
|
483 |
] ifFalse:[ |
|
484 |
self halt |
|
485 |
]. |
|
486 |
]. |
|
487 |
||
488 |
sel == #'renameClass:to:' ifTrue:[ |
|
775 | 489 |
(receiverVarName == #Smalltalk) ifTrue:[ |
654 | 490 |
oldName := (aTree arguments at:1) name. |
491 |
newName := (aTree arguments at:2) evaluate. |
|
492 |
||
493 |
change := ClassRenameChange new. |
|
494 |
change oldName:oldName newName:newName. |
|
495 |
self add: change. |
|
496 |
^ true |
|
497 |
] ifFalse:[ |
|
498 |
self halt |
|
499 |
]. |
|
500 |
]. |
|
501 |
||
502 |
sel == #'name:' ifTrue:[ |
|
775 | 503 |
(receiverVarName == #Namespace) ifTrue:[ |
654 | 504 |
className := (aTree arguments at:1) evaluate. |
505 |
||
506 |
change := NameSpaceCreationChange new. |
|
507 |
change name:className. |
|
508 |
self add: change. |
|
509 |
^ true |
|
510 |
] ifFalse:[ |
|
511 |
self halt |
|
512 |
]. |
|
513 |
]. |
|
514 |
||
781 | 515 |
(sel == #'primitiveDefinitions' |
516 |
or:[sel == #'primitiveFunctions' |
|
517 |
or:[sel == #'primitiveVariables']]) ifTrue:[ |
|
518 |
(receiver isUnaryMessage |
|
519 |
and:[receiverSelector == #class]) ifTrue:[ |
|
520 |
className := (receiverReceiver name) , ' class'. |
|
521 |
] ifFalse:[ |
|
522 |
className := (receiver name). |
|
523 |
]. |
|
859 | 524 |
nameSpace ~~ Smalltalk ifTrue:[ |
525 |
className := nameSpace name , '::' , className |
|
526 |
]. |
|
781 | 527 |
|
528 |
aStream skipSeparators. |
|
529 |
primSource := aStream nextChunk. |
|
530 |
||
531 |
sel == #'primitiveDefinitions' ifTrue:[ |
|
532 |
change := ClassPrimitiveDefinitionsChange new |
|
533 |
] ifFalse:[ |
|
534 |
sel == #'primitiveFunctions' ifTrue:[ |
|
535 |
change := ClassPrimitiveFunctionsChange new |
|
536 |
] ifFalse:[ |
|
537 |
change := ClassPrimitiveVariablesChange new |
|
538 |
] |
|
539 |
]. |
|
783 | 540 |
change class:className source:primSource. |
781 | 541 |
self add: change. |
542 |
||
543 |
^ true |
|
544 |
]. |
|
545 |
||
654 | 546 |
^ false |
547 |
||
548 |
"Created: / 16.2.1998 / 13:42:40 / cg" |
|
860 | 549 |
"Modified: / 15.12.1999 / 00:29:06 / cg" |
654 | 550 |
! ! |
551 |
||
857 | 552 |
!ChangeSet methodsFor:'utilities'! |
553 |
||
554 |
diffSetsAgainst:anotherChangeSet |
|
555 |
"walk over the receiver and anotherChangeSet, |
|
556 |
add all changes to one of the tree lists: |
|
557 |
onlyInReceiver, onlyInArg or changed, |
|
558 |
each being a changeSet containing corresponding changes. |
|
559 |
In addition, an info collection is returned, which provides |
|
560 |
indexing informatiom, for " |
|
561 |
||
562 |
|onlyInReceiver onlyInArg changedMethods |
|
563 |
indexFromChangedMethodsToA indexFromChangedMethodsToB |
|
564 |
info ret| |
|
565 |
||
566 |
onlyInReceiver := ChangeSet new. |
|
567 |
onlyInArg := ChangeSet new. |
|
568 |
changedMethods := ChangeSet new. |
|
569 |
||
570 |
indexFromChangedMethodsToA := OrderedCollection new. |
|
571 |
indexFromChangedMethodsToB := OrderedCollection new. |
|
572 |
||
573 |
self keysAndValuesDo:[:idxA :aChangeInA | |
|
574 |
|anyFound ch| |
|
575 |
||
576 |
anyFound := false. |
|
577 |
||
578 |
anotherChangeSet keysAndValuesDo:[:idxB :aChangeInB | |
|
579 |
(aChangeInA isForSameAs:aChangeInB) ifTrue:[ |
|
580 |
anyFound := true. |
|
581 |
||
582 |
"/ also in B - is it different ? |
|
583 |
(aChangeInA sameAs:aChangeInB) ifFalse:[ |
|
584 |
changedMethods add:aChangeInA. |
|
585 |
indexFromChangedMethodsToA add:idxA. |
|
586 |
indexFromChangedMethodsToB add:idxB. |
|
587 |
] ifTrue:[ |
|
588 |
aChangeInA isMethodChange ifTrue:[ |
|
589 |
aChangeInA methodCategory ~= aChangeInB methodCategory ifTrue:[ |
|
590 |
"/ only the category is different; |
|
591 |
"/ make it a MethodCategory changes. |
|
592 |
||
593 |
ch := MethodCategoryChange new |
|
594 |
className:aChangeInA className |
|
595 |
selector:aChangeInA selector |
|
596 |
category:aChangeInA methodCategory. |
|
597 |
self at:idxA put:ch. |
|
598 |
||
599 |
ch := MethodCategoryChange new |
|
600 |
className:aChangeInB className |
|
601 |
selector:aChangeInB selector |
|
602 |
category:aChangeInB methodCategory. |
|
603 |
anotherChangeSet at:idxB put:ch. |
|
604 |
||
605 |
changedMethods add:aChangeInA. |
|
606 |
indexFromChangedMethodsToA add:idxA. |
|
607 |
indexFromChangedMethodsToB add:idxB. |
|
608 |
] |
|
609 |
]. |
|
610 |
] |
|
611 |
] ifFalse:[ |
|
612 |
(aChangeInA sameAs:aChangeInB) ifTrue:[ |
|
613 |
anyFound := true. |
|
614 |
] ifFalse:[ |
|
615 |
] |
|
616 |
] |
|
617 |
]. |
|
618 |
||
619 |
anyFound ifFalse:[ |
|
620 |
onlyInReceiver add:aChangeInA. |
|
621 |
] |
|
622 |
]. |
|
623 |
||
624 |
anotherChangeSet keysAndValuesDo:[:idxB :aChangeInB | |
|
625 |
|anyFound| |
|
626 |
||
627 |
anyFound := false. |
|
628 |
||
629 |
self do:[:aChangeInA | |
|
630 |
|idxM| |
|
631 |
||
632 |
(aChangeInA isForSameAs:aChangeInB) ifTrue:[ |
|
633 |
anyFound := true. |
|
634 |
||
635 |
"/ also in B - is it different ? |
|
636 |
(aChangeInA sameAs:aChangeInB) ifFalse:[ |
|
637 |
"/ already there ? |
|
638 |
idxM := changedMethods findFirst:[:c | c isForSameAs:aChangeInB]. |
|
639 |
idxM == 0 ifTrue:[ |
|
640 |
changedMethods add:aChangeInB. |
|
641 |
indexFromChangedMethodsToB add:idxB. |
|
642 |
] ifFalse:[ |
|
643 |
indexFromChangedMethodsToB at:idxM put:idxB |
|
644 |
] |
|
645 |
] |
|
646 |
] ifFalse:[ |
|
647 |
(aChangeInA sameAs:aChangeInB) ifTrue:[ |
|
648 |
anyFound := true. |
|
649 |
] ifFalse:[ |
|
650 |
] |
|
651 |
] |
|
652 |
]. |
|
653 |
anyFound ifFalse:[ |
|
654 |
onlyInArg add:aChangeInB. |
|
655 |
] |
|
656 |
]. |
|
657 |
||
658 |
info := OrderedCollection new:(changedMethods size). |
|
659 |
changedMethods keysAndValuesDo:[:idx :changedMethod | |
|
660 |
info add:(Array |
|
661 |
with:(indexFromChangedMethodsToA at:idx) |
|
662 |
with:(indexFromChangedMethodsToB at:idx) |
|
663 |
) |
|
664 |
]. |
|
665 |
changedMethods := (1 to:changedMethods size) collect:[:idx | |
|
666 |
|cA cB| |
|
667 |
||
668 |
cA := self at:(indexFromChangedMethodsToA at:idx). |
|
669 |
cB := anotherChangeSet at:(indexFromChangedMethodsToB at:idx). |
|
670 |
Array with:cA with:cB |
|
671 |
]. |
|
672 |
||
673 |
ret := IdentityDictionary new. |
|
674 |
ret at:#info put:info. |
|
675 |
ret at:#changed put:changedMethods. |
|
676 |
ret at:#onlyInReceiver put:onlyInReceiver. |
|
677 |
ret at:#onlyInArg put:onlyInArg. |
|
678 |
! ! |
|
679 |
||
625
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
680 |
!ChangeSet class methodsFor:'documentation'! |
100 | 681 |
|
682 |
version |
|
860 | 683 |
^ '$Header: /cvs/stx/stx/libbasic3/ChangeSet.st,v 1.32 1999-12-14 23:28:10 cg Exp $' |
100 | 684 |
! ! |