author | Claus Gittinger <cg@exept.de> |
Fri, 24 Nov 1995 14:32:50 +0100 | |
changeset 206 | 5d1e6d46ecbd |
parent 202 | 468378999911 |
child 207 | 8729533e8607 |
permissions | -rw-r--r-- |
0 | 1 |
" |
4 | 2 |
COPYRIGHT (c) 1990 by Claus Gittinger |
45 | 3 |
All Rights Reserved |
0 | 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 |
" |
|
12 |
||
13 |
StandardSystemView subclass:#ChangesBrowser |
|
45 | 14 |
instanceVariableNames:'changeListView codeView changeFileName changeChunks |
202 | 15 |
changePositions changeClassNames changeHeaderLines anyChanges |
16 |
changeNrShown changeNrProcessed skipSignal compareChanges |
|
17 |
compareCheckBox changeFileSize changeFileTimestamp checkBlock |
|
18 |
changeTimeStamps tabSpec' |
|
58 | 19 |
classVariableNames:'CompressSnapshotInfo' |
45 | 20 |
poolDictionaries:'' |
21 |
category:'Interface-Browsers' |
|
0 | 22 |
! |
23 |
||
29 | 24 |
!ChangesBrowser class methodsFor:'documentation'! |
25 |
||
26 |
copyright |
|
27 |
" |
|
28 |
COPYRIGHT (c) 1990 by Claus Gittinger |
|
45 | 29 |
All Rights Reserved |
0 | 30 |
|
29 | 31 |
This software is furnished under a license and may be used |
32 |
only in accordance with the terms of that license and with the |
|
33 |
inclusion of the above copyright notice. This software may not |
|
34 |
be provided or otherwise made available to, or used by, any |
|
35 |
other person. No title to or ownership of the software is |
|
36 |
hereby transferred. |
|
37 |
" |
|
38 |
! |
|
39 |
||
40 |
documentation |
|
41 |
" |
|
42 |
this implements a browser for the changes-file. |
|
43 |
See the extra document 'doc/misc/cbrowser.doc' for how to use this browser. |
|
44 |
||
45 |
written jan 90 by claus |
|
51 | 46 |
|
58 | 47 |
Class variables: |
48 |
CompressSnapshotInfo if true (the default), snapshot entries |
|
49 |
are also compressed in the compress function. |
|
50 |
Some users prefer them to be not compressed. |
|
51 |
Set it to false for this. |
|
52 |
||
51 | 53 |
Notice: |
54 |
this needs a total rewrite, to build up a changeSet from the file |
|
123 | 55 |
(which did not exist when the ChangesBrowser was originally written) |
56 |
and manipulate that changeSet. |
|
57 |
||
58 | 58 |
This way, we get a browser for any upcoming incore changeSets for |
59 |
free. Also, this will put the chunk analyzation code into Change and |
|
60 |
subclasses (where it belongs) and give a better encapsulation and |
|
61 |
overall structure. Do not take this as an example for good style ;-) |
|
29 | 62 |
" |
63 |
! ! |
|
0 | 64 |
|
45 | 65 |
!ChangesBrowser class methodsFor:'instance creation'! |
66 |
||
67 |
new |
|
68 |
"create a new changes browser" |
|
69 |
||
70 |
^ super label:'Changes Browser' |
|
71 |
icon:(Form fromFile:'CBrowser.xbm' resolution:100) |
|
72 |
! |
|
73 |
||
74 |
openOn:aFileName |
|
75 |
"create c changes browser on a change file" |
|
76 |
||
49 | 77 |
^ ((self new label:'Changes Browser: ', aFileName) changeFileName:aFileName) open |
45 | 78 |
! ! |
79 |
||
0 | 80 |
!ChangesBrowser class methodsFor:'behavior'! |
81 |
||
82 |
autoSelectNext |
|
83 |
"returning true here, makes a Delete operation automatically |
|
84 |
select the next change" |
|
85 |
||
86 |
^ true |
|
87 |
! ! |
|
88 |
||
73 | 89 |
!ChangesBrowser class methodsFor:'defaults'! |
0 | 90 |
|
73 | 91 |
defaultLabel |
92 |
^ 'Changes Browser' |
|
28 | 93 |
! ! |
94 |
||
202 | 95 |
!ChangesBrowser methodsFor:'compiler interface'! |
96 |
||
97 |
wantChangeLog |
|
98 |
"sent by the compiler to ask if a changeLog entry should |
|
99 |
be written. Return false here." |
|
100 |
||
101 |
^ false |
|
102 |
! ! |
|
103 |
||
104 |
!ChangesBrowser methodsFor:'error handling'! |
|
105 |
||
106 |
correctableError:aString position:relPos to:relEndPos from:aCompiler |
|
107 |
"compiler notifys us of an error - this should really not happen since |
|
108 |
changes ought to be correct (did someone edit the changes file ??). |
|
109 |
Show the bad change in the codeView and let codeView hilight the error; |
|
110 |
no corrections allowed here therefore return false" |
|
111 |
||
112 |
self error:aString position:relPos to:relEndPos from:aCompiler. |
|
113 |
^ false |
|
114 |
! |
|
115 |
||
116 |
error:aString position:relPos to:relEndPos from:aCompiler |
|
117 |
"compiler notifys us of an error - this should really not happen since |
|
118 |
changes ought to be correct (did someone edit the changes file ??). |
|
119 |
Show the bad change in the codeView and let codeView hilight the error" |
|
120 |
||
121 |
|action| |
|
122 |
||
123 |
(changeNrProcessed ~~ changeNrShown) ifTrue:[ |
|
124 |
self changeSelection:changeNrProcessed |
|
125 |
]. |
|
126 |
(skipSignal notNil) ifTrue:[ |
|
127 |
||
128 |
codeView highlightingErrorPosition:relPos to:relEndPos do:[ |
|
129 |
|box| |
|
0 | 130 |
|
202 | 131 |
" |
132 |
start dialog - make certain cleanup is done |
|
133 |
" |
|
134 |
action := OptionBox |
|
135 |
request:aString |
|
136 |
label:'Error' |
|
137 |
form:(WarningBox iconBitmap) |
|
138 |
buttonLabels:#('abort' 'skip' 'continue') |
|
139 |
values:#(#abort #skip #continue) |
|
140 |
default:#continue. |
|
141 |
]. |
|
0 | 142 |
|
202 | 143 |
action == #abort ifTrue:[ |
144 |
Object abortSignal raise. |
|
145 |
^ false |
|
146 |
]. |
|
147 |
action == #skip ifTrue:[ |
|
148 |
skipSignal raise. |
|
149 |
^ false |
|
150 |
]. |
|
151 |
^ false |
|
152 |
]. |
|
153 |
^ codeView error:aString position:relPos to:relEndPos from:aCompiler |
|
154 |
! |
|
155 |
||
156 |
warning:aString position:relPos to:relEndPos from:aCompiler |
|
157 |
"compiler notifys us of a warning - ignore it" |
|
158 |
||
159 |
^ self |
|
160 |
! ! |
|
161 |
||
162 |
!ChangesBrowser methodsFor:'event handling '! |
|
163 |
||
164 |
handlesKeyPress:key inView:view |
|
165 |
"this method is reached via delegation: are we prepared to handle |
|
166 |
a keyPress in some other view ?" |
|
167 |
||
168 |
view == changeListView ifTrue:[ |
|
169 |
(key == #Delete or:[key == #BackSpace]) ifTrue:[^ true]. |
|
170 |
]. |
|
171 |
^ false |
|
0 | 172 |
! |
173 |
||
202 | 174 |
keyPress:key x:x y:y view:view |
175 |
"this method is reached via delegation from the changeListView" |
|
176 |
||
177 |
(key == #Delete or:[key == #BackSpace]) ifTrue:[ |
|
178 |
self doDelete. |
|
179 |
^ self |
|
180 |
]. |
|
181 |
changeListView keyPress:key x:x y:y |
|
182 |
! ! |
|
183 |
||
184 |
!ChangesBrowser methodsFor:'help '! |
|
185 |
||
186 |
helpTextFor:aComponent |
|
187 |
|s| |
|
188 |
||
189 |
aComponent == codeView ifTrue:[ |
|
190 |
s := 'HELP_CODEVIEW' |
|
191 |
]. |
|
192 |
aComponent == changeListView ifTrue:[ |
|
193 |
s := 'HELP_CHANGELIST' |
|
194 |
]. |
|
195 |
((aComponent == compareCheckBox) |
|
196 |
or:[aComponent superView == compareCheckBox]) ifTrue:[ |
|
197 |
s := 'HELP_CHECK_COMPARE' |
|
198 |
]. |
|
199 |
s notNil ifTrue:[ |
|
200 |
^ resources string:s |
|
201 |
]. |
|
202 |
^ nil |
|
203 |
! ! |
|
204 |
||
205 |
!ChangesBrowser methodsFor:'initialize / release'! |
|
206 |
||
207 |
changeListMenu |
|
208 |
|labels selectors m| |
|
209 |
||
210 |
labels := #( |
|
211 |
'apply change' |
|
212 |
'apply changes to end' |
|
213 |
'apply changes for this class to end' |
|
214 |
'apply all changes' |
|
215 |
'-' |
|
216 |
'delete' |
|
217 |
'delete to end' |
|
218 |
'delete changes for this class to end' |
|
219 |
'delete all changes for this class' |
|
220 |
'-' |
|
221 |
'update' |
|
222 |
'compress' |
|
223 |
'compare with current version' |
|
224 |
'browse class' |
|
225 |
'-' |
|
226 |
'make change a patch' |
|
227 |
"/ 'update sourcefile from change' |
|
228 |
"/ '-' |
|
229 |
'fileout & delete changes for this class' |
|
230 |
'-' |
|
231 |
'save change in file ...' |
|
232 |
'save changes to end in file ...' |
|
233 |
'save changes for this class to end in file ...' |
|
234 |
'save all changes for this class in file ...' |
|
235 |
'-' |
|
236 |
'writeback changeFile'). |
|
237 |
||
238 |
selectors := #( |
|
239 |
doApply |
|
240 |
doApplyRest |
|
241 |
doApplyClassRest |
|
242 |
doApplyAll |
|
243 |
nil |
|
244 |
doDelete |
|
245 |
doDeleteRest |
|
246 |
doDeleteClassRest |
|
247 |
doDeleteClassAll |
|
248 |
nil |
|
249 |
doUpdate |
|
250 |
doCompress |
|
251 |
doCompare |
|
252 |
doBrowse |
|
253 |
nil |
|
254 |
doMakePatch |
|
255 |
"/ doMakePermanent |
|
256 |
"/ nil |
|
257 |
doFileoutAndDeleteClassAll |
|
258 |
nil |
|
259 |
doSave |
|
260 |
doSaveRest |
|
261 |
doSaveClassRest |
|
262 |
doSaveClassAll |
|
263 |
nil |
|
264 |
doWriteBack |
|
265 |
). |
|
266 |
||
267 |
m := PopUpMenu |
|
268 |
labels:(resources array:labels) |
|
269 |
selectors:selectors. |
|
270 |
||
271 |
changeListView hasSelection ifFalse:[ |
|
272 |
m disableAll:#(doApply doApplyClassRest doApplyRest doDelete doDeleteRest doDeleteClassRest |
|
273 |
doDeleteClassAll doCompare doMakePatch doSaveChangeInFile doMakePermanent |
|
274 |
doSave doSaveRest doSaveClassAll doSaveClassRest doBrowse) |
|
275 |
]. |
|
276 |
^ m |
|
277 |
||
278 |
"Modified: 6.9.1995 / 17:14:22 / claus" |
|
279 |
! |
|
280 |
||
281 |
compare:aBoolean |
|
282 |
"sent from the compare-toggle" |
|
73 | 283 |
|
202 | 284 |
aBoolean ~~ compareChanges ifTrue:[ |
285 |
compareChanges := aBoolean. |
|
286 |
compareChanges ifTrue:[ |
|
287 |
tabSpec positions:#(0 0.15 5 8.5 ). |
|
288 |
self doUpdate |
|
289 |
] ifFalse:[ |
|
290 |
"/ |
|
291 |
"/ set tabs to hide compare-column |
|
292 |
"/ |
|
293 |
tabSpec positions:#(-1 0 5 8.5 ). |
|
294 |
changeListView clear; redraw. |
|
295 |
] |
|
296 |
] |
|
297 |
||
298 |
"Modified: 18.11.1995 / 17:30:20 / cg" |
|
299 |
! |
|
300 |
||
301 |
focusSequence |
|
302 |
^ Array with:changeListView with:codeView |
|
303 |
! |
|
304 |
||
305 |
initialize |
|
306 |
|panel v upperFrame buttonPanel| |
|
307 |
||
308 |
super initialize. |
|
309 |
||
310 |
changeFileName := ObjectMemory nameForChanges. "/ 'changes'. |
|
311 |
compareChanges := false. |
|
312 |
checkBlock := [self checkIfFileHasChanged]. |
|
313 |
||
314 |
panel := VariableVerticalPanel origin:(0.0 @ 0.0) |
|
315 |
corner:(1.0 @ 1.0) |
|
316 |
borderWidth:0 |
|
317 |
in:self. |
|
318 |
||
319 |
upperFrame := View origin:(0.0 @ 0.0) corner:(1.0 @ 0.3) in:panel. |
|
320 |
||
321 |
v := HVScrollableView for:SelectionInListView miniScrollerH:true in:upperFrame. |
|
322 |
v origin:(0.0 @ 0.0) corner:(0.8 @ 1.0). |
|
323 |
changeListView := v scrolledView. |
|
324 |
changeListView delegate:self. |
|
325 |
changeListView menuHolder:self; menuPerformer:self; menuMessage:#changeListMenu. |
|
326 |
||
327 |
buttonPanel := VerticalPanelView in:upperFrame. |
|
328 |
buttonPanel origin:(0.8 @ 0.0) corner:(1.0 @ 1.0). |
|
329 |
buttonPanel verticalLayout:#topSpace. |
|
330 |
||
331 |
compareCheckBox := CheckBox new. |
|
332 |
compareCheckBox label:(resources string:'compare'). |
|
333 |
compareCheckBox action:[:val | self compare:val]. |
|
334 |
buttonPanel addSubView:compareCheckBox. |
|
335 |
||
336 |
v := HVScrollableView for:CodeView miniScrollerH:true miniScrollerV:false in:panel. |
|
337 |
v origin:(0.0 @ 0.3) corner:(1.0 @ 1.0). |
|
338 |
codeView := v scrolledView. |
|
339 |
codeView readOnly. |
|
340 |
||
341 |
anyChanges := false. |
|
342 |
ObjectMemory addDependent:self. "to get shutdown-update" |
|
343 |
||
344 |
tabSpec := TabulatorSpecification new. |
|
345 |
tabSpec unit:#inch. |
|
346 |
tabSpec positions:#(-1 0 5 8.5 ). |
|
347 |
" +/- cls>>sel type info" |
|
348 |
tabSpec align: #(#left #left #left #left). |
|
349 |
||
350 |
"Modified: 18.11.1995 / 17:30:59 / cg" |
|
351 |
! |
|
352 |
||
353 |
realize |
|
354 |
super realize. |
|
355 |
self readChangesFileInBackground:true. |
|
356 |
self setChangeList. |
|
357 |
changeListView action:[:lineNr | self changeSelection:lineNr]. |
|
358 |
Processor addTimedBlock:checkBlock afterSeconds:5. |
|
359 |
! |
|
360 |
||
361 |
update:what |
|
362 |
|box| |
|
363 |
||
364 |
(what == #aboutToExit) ifTrue:[ |
|
365 |
" |
|
366 |
smalltalk is about to shut down - |
|
367 |
- if change list was modified, ask user and save if requested. |
|
368 |
" |
|
369 |
anyChanges ifTrue:[ |
|
370 |
self raiseDeiconified. |
|
371 |
||
372 |
box := YesNoBox new. |
|
373 |
box title:(resources at:'changefile has not been updated from the modified changelist.\\Update before exiting ?') withCRs. |
|
374 |
box noText:(resources at:'don''t update'). |
|
375 |
box okText:(resources at:'update'). |
|
376 |
box yesAction:[self writeBackChanges] |
|
377 |
noAction:[]. |
|
378 |
box showAtPointer |
|
379 |
]. |
|
380 |
^ self |
|
381 |
]. |
|
382 |
super update:what |
|
383 |
! ! |
|
384 |
||
385 |
!ChangesBrowser methodsFor:'private'! |
|
386 |
||
387 |
appendChange:changeNr toFile:fileName |
|
388 |
"append change to a file. return true if ok." |
|
389 |
||
390 |
|aStream outStream chunk sawExcla separator| |
|
391 |
||
392 |
outStream := FileStream oldFileNamed:fileName. |
|
393 |
outStream isNil ifTrue:[ |
|
394 |
outStream isNil ifTrue:[ |
|
395 |
outStream := FileStream newFileNamed:fileName. |
|
396 |
outStream isNil ifTrue:[ |
|
397 |
self warn:'cannot update file ''%1''' with:fileName. |
|
398 |
^ false |
|
399 |
] |
|
73 | 400 |
] |
401 |
]. |
|
202 | 402 |
|
403 |
outStream setToEnd. |
|
404 |
||
405 |
aStream := self streamForChange:changeNr. |
|
406 |
aStream isNil ifTrue:[ |
|
407 |
self warn:'oops cannot read change'. |
|
408 |
^ false |
|
409 |
]. |
|
73 | 410 |
|
202 | 411 |
separator := aStream class chunkSeparator. |
412 |
sawExcla := aStream peekFor:separator. |
|
413 |
sawExcla ifTrue:[ |
|
414 |
outStream nextPut:separator |
|
415 |
]. |
|
416 |
chunk := aStream nextChunk. |
|
417 |
outStream nextChunkPut:chunk. |
|
418 |
outStream cr. |
|
419 |
sawExcla ifTrue:[ |
|
420 |
chunk := aStream nextChunk. |
|
421 |
outStream nextChunkPut:chunk. |
|
422 |
outStream space |
|
423 |
]. |
|
424 |
sawExcla ifTrue:[ |
|
425 |
outStream nextPut:separator |
|
426 |
]. |
|
427 |
outStream cr. |
|
428 |
aStream close. |
|
429 |
outStream close. |
|
430 |
^ true |
|
73 | 431 |
! |
432 |
||
51 | 433 |
applyChange:changeNr |
434 |
"fileIn a change" |
|
435 |
||
163
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
436 |
|aStream nm| |
45 | 437 |
|
51 | 438 |
aStream := self streamForChange:changeNr. |
439 |
aStream isNil ifTrue:[^ self]. |
|
440 |
||
441 |
nm := self classNameOfChange:changeNr. |
|
442 |
nm notNil ifTrue:[ |
|
443 |
|cls| |
|
45 | 444 |
|
51 | 445 |
cls := Smalltalk at:(nm asSymbol) ifAbsent:[]. |
446 |
cls notNil ifTrue:[ |
|
447 |
cls isLoaded ifFalse:[ |
|
448 |
cls autoload |
|
449 |
] |
|
450 |
] |
|
451 |
]. |
|
45 | 452 |
|
51 | 453 |
changeNrProcessed := changeNr. |
45 | 454 |
|
132 | 455 |
Class withoutUpdatingChangesDo:[ |
51 | 456 |
|sig| |
45 | 457 |
|
51 | 458 |
(skipSignal notNil) ifTrue:[ |
459 |
sig := skipSignal |
|
460 |
] ifFalse:[ |
|
461 |
sig := Object abortSignal |
|
462 |
]. |
|
463 |
sig catch:[ |
|
464 |
aStream fileInNextChunkNotifying:self |
|
465 |
]. |
|
466 |
changeNrProcessed := nil. |
|
45 | 467 |
]. |
132 | 468 |
aStream close |
45 | 469 |
! |
470 |
||
202 | 471 |
autoSelect:changeNr |
472 |
"select a change" |
|
73 | 473 |
|
202 | 474 |
self class autoSelectNext ifTrue:[ |
475 |
(changeNr <= changePositions size) ifTrue:[ |
|
476 |
changeListView selection:changeNr. |
|
477 |
self changeSelection:changeNr. |
|
478 |
^ self |
|
479 |
] |
|
480 |
]. |
|
481 |
self clearCodeView. |
|
482 |
changeListView selection:nil. |
|
73 | 483 |
! |
484 |
||
202 | 485 |
autoSelectLast |
486 |
"select the last change" |
|
0 | 487 |
|
202 | 488 |
self autoSelect:(changePositions size) |
489 |
! |
|
107 | 490 |
|
202 | 491 |
autoSelectOrEnd:changeNr |
492 |
"select the next change or the last" |
|
493 |
||
494 |
|last| |
|
50 | 495 |
|
202 | 496 |
last := changePositions size. |
497 |
changeNr < last ifTrue:[ |
|
498 |
self autoSelect:changeNr |
|
133 | 499 |
] ifFalse:[ |
202 | 500 |
changeListView selection:last . |
501 |
self changeSelection:last. |
|
502 |
] |
|
503 |
! |
|
133 | 504 |
|
202 | 505 |
changeFileName:aFileName |
506 |
changeFileName := aFileName |
|
133 | 507 |
! |
508 |
||
509 |
checkIfFileHasChanged |
|
510 |
|f info | |
|
511 |
||
512 |
Processor removeTimedBlock:checkBlock. |
|
513 |
f := changeFileName asFilename. |
|
514 |
(info := f info) isNil ifTrue:[ |
|
515 |
self newLabel:'(unaccessable)' |
|
516 |
] ifFalse:[ |
|
517 |
(info at:#modified) > changeFileTimestamp ifTrue:[ |
|
518 |
self newLabel:'(outdated)' |
|
519 |
] ifFalse:[ |
|
520 |
self newLabel:'' |
|
521 |
] |
|
522 |
]. |
|
523 |
Processor addTimedBlock:checkBlock afterSeconds:5. |
|
524 |
||
525 |
"Created: 8.9.1995 / 19:30:19 / claus" |
|
526 |
"Modified: 8.9.1995 / 19:38:18 / claus" |
|
527 |
! |
|
528 |
||
202 | 529 |
classNameOfChange:changeNr |
530 |
"return the classname of a change (for xxx class - changes xxx is returned) |
|
531 |
- since parsing ascii methods is slow, keep result cached in |
|
532 |
changeClassNames for the next query" |
|
533 |
||
534 |
|chunk aParseTree recTree sel name arg1Tree| |
|
535 |
||
536 |
changeNr isNil ifTrue:[^ nil]. |
|
537 |
||
538 |
" |
|
539 |
first look, if not already known |
|
540 |
" |
|
541 |
name := changeClassNames at:changeNr. |
|
542 |
name notNil ifTrue:[^ name]. |
|
543 |
||
544 |
" |
|
545 |
get the chunk |
|
546 |
" |
|
547 |
chunk := changeChunks at:changeNr. |
|
548 |
chunk isNil ifTrue:[^ nil]. "mhmh - empty" |
|
549 |
||
550 |
" |
|
551 |
use parser to construct a parseTree |
|
552 |
" |
|
553 |
aParseTree := Parser parseExpression:chunk. |
|
554 |
(aParseTree isNil or:[aParseTree == #Error]) ifTrue:[ |
|
555 |
^ nil "seems strange ... (could be a comment)" |
|
556 |
]. |
|
557 |
aParseTree isMessage ifFalse:[ |
|
558 |
^ nil "very strange ... (whats that ?)" |
|
559 |
]. |
|
560 |
||
561 |
" |
|
562 |
ask parser for selector |
|
563 |
" |
|
564 |
sel := aParseTree selector. |
|
565 |
recTree := aParseTree receiver. |
|
566 |
||
567 |
" |
|
568 |
is it a method-change, methodRemove or comment-change ? |
|
569 |
" |
|
570 |
(#(#'methodsFor:' |
|
571 |
#'privateMethodsFor:' |
|
572 |
#'protectedMethodsFor:' |
|
573 |
#'publicMethodsFor:' |
|
574 |
#'removeSelector:' |
|
575 |
#'comment:' |
|
576 |
#'primitiveDefinitions:' |
|
577 |
#'primitiveFunctions:' |
|
578 |
#'primitiveVariables:' |
|
579 |
#'renameCategory:to:' |
|
580 |
#'instanceVariableNames:' |
|
581 |
) includes:sel) ifTrue:[ |
|
582 |
" |
|
583 |
yes, the className is the receiver |
|
584 |
" |
|
585 |
(recTree notNil and:[recTree ~~ #Error]) ifTrue:[ |
|
586 |
recTree isUnaryMessage ifTrue:[ |
|
587 |
(recTree selector ~~ #class) ifTrue:[^ nil]. |
|
588 |
"id class methodsFor:..." |
|
589 |
recTree := recTree receiver |
|
590 |
]. |
|
591 |
recTree isPrimary ifTrue:[ |
|
592 |
name := recTree name. |
|
593 |
changeClassNames at:changeNr put:name. |
|
594 |
^ name |
|
595 |
] |
|
596 |
]. |
|
597 |
"more strange things" |
|
598 |
^ nil |
|
599 |
]. |
|
600 |
||
601 |
" |
|
602 |
is it a change in a class-description ? |
|
603 |
" |
|
604 |
(('subclass:*' match:sel) |
|
605 |
or:[('variable*subclass:*' match:sel)]) ifTrue:[ |
|
606 |
arg1Tree := aParseTree arg1. |
|
607 |
(arg1Tree notNil and:[arg1Tree isConstant]) ifTrue:[ |
|
608 |
name := arg1Tree value asString. |
|
609 |
changeClassNames at:changeNr put:name. |
|
610 |
^ name |
|
611 |
]. |
|
612 |
"very strange" |
|
613 |
^ nil |
|
614 |
]. |
|
615 |
||
616 |
" |
|
617 |
is it a class remove ? |
|
618 |
" |
|
619 |
(sel == #removeClass:) ifTrue:[ |
|
620 |
(recTree notNil |
|
621 |
and:[recTree ~~ #Error |
|
622 |
and:[recTree isPrimary |
|
623 |
and:[recTree name = 'Smalltalk']]]) ifTrue:[ |
|
624 |
arg1Tree := aParseTree arg1. |
|
625 |
(arg1Tree notNil and:[arg1Tree isPrimary]) ifTrue:[ |
|
626 |
name := arg1Tree name. |
|
627 |
changeClassNames at:changeNr put:name. |
|
628 |
^ name |
|
629 |
]. |
|
630 |
] |
|
631 |
]. |
|
632 |
||
633 |
" |
|
634 |
is it a method category change ? |
|
635 |
" |
|
636 |
(sel == #category:) ifTrue:[ |
|
637 |
(recTree notNil |
|
638 |
and:[recTree ~~ #Error |
|
639 |
and:[recTree isMessage |
|
640 |
and:[recTree selector == #compiledMethodAt:]]]) ifTrue:[ |
|
641 |
recTree := recTree receiver. |
|
642 |
recTree isUnaryMessage ifTrue:[ |
|
643 |
(recTree selector ~~ #class) ifTrue:[^ nil]. |
|
644 |
"id class " |
|
645 |
recTree := recTree receiver |
|
646 |
]. |
|
647 |
recTree isPrimary ifTrue:[ |
|
648 |
name := recTree name. |
|
649 |
changeClassNames at:changeNr put:name. |
|
650 |
^ name |
|
651 |
] |
|
652 |
] |
|
653 |
]. |
|
654 |
^ nil |
|
655 |
! |
|
656 |
||
657 |
clearCodeView |
|
658 |
self unselect "changeListView deselect". |
|
659 |
codeView contents:nil. |
|
660 |
changeNrShown := nil |
|
661 |
! |
|
662 |
||
663 |
compareChange:changeNr |
|
664 |
"compare a change with current version" |
|
665 |
||
666 |
|aStream chunk sawExcla parseTree thisClass cat oldSource newSource |
|
667 |
parser sel oldMethod outcome showDiff d t1 t2| |
|
668 |
||
669 |
aStream := self streamForChange:changeNr. |
|
670 |
aStream isNil ifTrue:[^ self]. |
|
671 |
||
672 |
sawExcla := aStream peekFor:(aStream class chunkSeparator). |
|
673 |
chunk := aStream nextChunk. |
|
674 |
sawExcla ifFalse:[ |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
675 |
outcome := 'not comparable ...' |
202 | 676 |
] ifTrue:[ |
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
677 |
parseTree := Parser parseExpression:chunk. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
678 |
(parseTree notNil and:[parseTree isMessage]) ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
679 |
(parseTree selector == #methodsFor:) ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
680 |
thisClass := (parseTree receiver evaluate). |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
681 |
thisClass isBehavior ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
682 |
showDiff := false. |
202 | 683 |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
684 |
cat := parseTree arg1 evaluate. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
685 |
newSource := aStream nextChunk. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
686 |
parser := Parser parseMethod:newSource in:thisClass. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
687 |
(parser notNil and:[parser ~~ #Error]) ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
688 |
sel := parser selector. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
689 |
oldMethod := thisClass compiledMethodAt:sel. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
690 |
oldMethod notNil ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
691 |
(oldMethod category = cat) ifFalse:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
692 |
Transcript showCr:'category changed.'. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
693 |
]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
694 |
oldSource := oldMethod source. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
695 |
(oldSource = newSource) ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
696 |
outcome := 'same source' |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
697 |
] ifFalse:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
698 |
oldSource isNil ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
699 |
outcome := 'no source for compare.' |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
700 |
] ifFalse:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
701 |
"/ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
702 |
"/ compare for tabulator <-> space changes |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
703 |
"/ before showing diff ... |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
704 |
"/ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
705 |
t1 := oldSource asCollectionOfLines collect:[:s | s withTabsExpanded]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
706 |
t2 := newSource asCollectionOfLines collect:[:s | s withTabsExpanded]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
707 |
t1 = t2 ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
708 |
outcome := 'same source' |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
709 |
] ifFalse:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
710 |
outcome := 'source changed.'. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
711 |
showDiff := true |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
712 |
] |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
713 |
] |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
714 |
] |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
715 |
] ifFalse:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
716 |
outcome := 'method does not exist.' |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
717 |
] |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
718 |
] ifFalse:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
719 |
outcome := 'change unparsable.' |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
720 |
]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
721 |
(showDiff and:[oldSource notNil and:[newSource notNil]]) ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
722 |
d := DiffTextView |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
723 |
openOn:oldSource label:'current version' |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
724 |
and:newSource label:'changeFile version'. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
725 |
d label:'method differences'. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
726 |
] |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
727 |
] ifFalse:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
728 |
outcome := 'class does not exist.' |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
729 |
] |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
730 |
] ifFalse:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
731 |
outcome := 'not comparable.' |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
732 |
] |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
733 |
] ifFalse:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
734 |
outcome := 'not comparable.' |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
735 |
] |
202 | 736 |
]. |
737 |
aStream close. |
|
738 |
showDiff ifFalse:[ |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
739 |
self information:outcome. |
202 | 740 |
"/ Transcript showCr:outcome. |
741 |
]. |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
742 |
|
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
743 |
"Created: 24.11.1995 / 14:30:46 / cg" |
202 | 744 |
! |
745 |
||
746 |
contractClass:className selector:selector to:maxLen |
|
747 |
|s l| |
|
748 |
||
749 |
s := className , ' ', selector. |
|
750 |
s size > maxLen ifTrue:[ |
|
751 |
l := maxLen - 1 - selector size max:20. |
|
752 |
s := (className contractTo:l) , ' ' , selector. |
|
753 |
||
754 |
s size > maxLen ifTrue:[ |
|
755 |
l := maxLen - 1 - className size max:20. |
|
756 |
s := className , ' ', (selector contractTo:l). |
|
757 |
||
758 |
s size > maxLen ifTrue:[ |
|
759 |
s := (className contractTo:(maxLen // 2 - 1)) , ' ' , (selector contractTo:maxLen // 2) |
|
760 |
] |
|
761 |
] |
|
762 |
]. |
|
763 |
^ s |
|
764 |
! |
|
765 |
||
766 |
deleteChange:changeNr |
|
767 |
"delete a change" |
|
768 |
||
769 |
changeListView deselect. |
|
770 |
self silentDeleteChange:changeNr. |
|
771 |
self setChangeList |
|
772 |
||
773 |
! |
|
774 |
||
775 |
deleteChangesFrom:start to:stop |
|
776 |
"delete a range of changes" |
|
777 |
||
778 |
changeListView deselect. |
|
779 |
stop to:start by:-1 do:[:changeNr | |
|
780 |
self silentDeleteChange:changeNr |
|
781 |
]. |
|
782 |
self setChangeList |
|
783 |
||
784 |
! |
|
785 |
||
786 |
makeChangeAPatch:changeNr |
|
787 |
"append change to patchfile" |
|
788 |
||
789 |
self appendChange:changeNr toFile:'patches' |
|
790 |
! |
|
791 |
||
792 |
makeChangePermanent:changeNr |
|
793 |
"rewrite the source file where change changeNr lies" |
|
794 |
||
795 |
self notify:'this is not yet implemented' |
|
796 |
! |
|
797 |
||
798 |
newLabel:how |
|
799 |
|l| |
|
800 |
||
801 |
(changeFileName ~= 'changes') ifTrue:[ |
|
802 |
l := 'Changes Browser: ', changeFileName |
|
803 |
] ifFalse:[ |
|
804 |
l := 'Changes Browser' |
|
805 |
]. |
|
806 |
l := l , ' ' , how. |
|
807 |
self label:l |
|
808 |
||
809 |
"Created: 8.9.1995 / 19:32:04 / claus" |
|
810 |
"Modified: 8.9.1995 / 19:39:29 / claus" |
|
811 |
! |
|
812 |
||
813 |
queryCloseText |
|
814 |
"made this a method for easy redefinition in subclasses" |
|
815 |
||
816 |
^ 'Quit without updating changeFile ?' |
|
817 |
! |
|
818 |
||
819 |
readChangesFile |
|
820 |
"read the changes file, create a list of header-lines (changeChunks) |
|
821 |
and a list of chunk-positions (changePositions)" |
|
822 |
||
823 |
^ self readChangesFileInBackground:false |
|
824 |
! |
|
825 |
||
37 | 826 |
readChangesFileInBackground:inBackground |
827 |
"read the changes file, create a list of header-lines (changeChunks) |
|
51 | 828 |
and a list of chunk-positions (changePositions). |
829 |
Starting with 2.10.3, the entries are multi-col entries; |
|
830 |
the cols are: |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
831 |
1 delta (only if comparing) |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
832 |
'+' -> new method (w.r.t. current state) |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
833 |
'-' -> removed method (w.r.t. current state) |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
834 |
'?' -> class does not exist currently |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
835 |
'=' -> change is same as current methods source |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
836 |
2 class/selector |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
837 |
3 type of change |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
838 |
doit |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
839 |
method |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
840 |
category change |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
841 |
4 timestamp |
89 | 842 |
|
843 |
since comparing slows down startup time, it is now disabled by |
|
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
844 |
default and can be enabled via a toggle." |
37 | 845 |
|
133 | 846 |
|aStream maxLen f| |
50 | 847 |
|
848 |
maxLen := 60. |
|
0 | 849 |
|
133 | 850 |
f := changeFileName asFilename. |
851 |
aStream := f readStream. |
|
0 | 852 |
aStream isNil ifTrue:[^ nil]. |
853 |
||
133 | 854 |
changeFileSize := f info at:#size. |
855 |
changeFileTimestamp := f info at:#modified. |
|
856 |
||
0 | 857 |
self withCursor:(Cursor read) do:[ |
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
858 |
|myProcess myPriority| |
49 | 859 |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
860 |
" |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
861 |
this is a time consuming operation (especially, if reading an |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
862 |
NFS-mounted directory; therefore lower my priority ... |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
863 |
" |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
864 |
inBackground ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
865 |
myProcess := Processor activeProcess. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
866 |
myPriority := myProcess priority. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
867 |
myProcess priority:(Processor userBackgroundPriority). |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
868 |
]. |
51 | 869 |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
870 |
[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
871 |
|excla timeStampInfo| |
50 | 872 |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
873 |
changeChunks := OrderedCollection new. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
874 |
changeHeaderLines := OrderedCollection new. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
875 |
changePositions := OrderedCollection new. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
876 |
changeTimeStamps := OrderedCollection new. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
877 |
excla := aStream class chunkSeparator. |
0 | 878 |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
879 |
[aStream atEnd] whileFalse:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
880 |
|entry changeDelta changeString changeType |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
881 |
line s l changeClass sawExcla category |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
882 |
chunkText chunkPos| |
51 | 883 |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
884 |
" |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
885 |
get a chunk (separated by excla) |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
886 |
" |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
887 |
aStream skipSeparators. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
888 |
chunkPos := aStream position. |
73 | 889 |
|
890 |
||
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
891 |
sawExcla := aStream peekFor:excla. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
892 |
chunkText := aStream nextChunk. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
893 |
chunkText notNil ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
894 |
|index headerLine| |
51 | 895 |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
896 |
(chunkText startsWith:'''---- timestamp ') ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
897 |
timeStampInfo := (chunkText copyFrom:16 to:(chunkText size - 6)) withoutSpaces. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
898 |
] ifFalse:[ |
45 | 899 |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
900 |
" |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
901 |
only first line is saved in changeChunks ... |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
902 |
" |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
903 |
index := chunkText indexOf:(Character cr). |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
904 |
(index ~~ 0) ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
905 |
chunkText := chunkText copyTo:(index - 1). |
50 | 906 |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
907 |
"take care for comment changes - must still be a |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
908 |
valid expression for classNameOfChange: to work" |
51 | 909 |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
910 |
(chunkText endsWith:'comment:''') ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
911 |
chunkText := chunkText , '...''' |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
912 |
]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
913 |
(chunkText endsWith:'primitiveDefinitions:''%{') ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
914 |
chunkText := chunkText , '... %}''' |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
915 |
]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
916 |
(chunkText endsWith:'primitiveVariables:''%{') ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
917 |
chunkText := chunkText , '... %}''' |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
918 |
]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
919 |
(chunkText endsWith:'primitiveFunctions:''%{') ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
920 |
chunkText := chunkText , '... %}''' |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
921 |
]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
922 |
]. |
51 | 923 |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
924 |
changeChunks add:chunkText. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
925 |
changePositions add:chunkPos. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
926 |
changeTimeStamps add:timeStampInfo. |
37 | 927 |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
928 |
headerLine := nil. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
929 |
changeDelta := ' '. |
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
930 |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
931 |
sawExcla ifFalse:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
932 |
(chunkText startsWith:'''---- snap') ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
933 |
changeType := ''. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
934 |
headerLine := chunkText. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
935 |
changeString := (chunkText contractTo:maxLen). |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
936 |
] ifFalse:[ |
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
937 |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
938 |
|p sel cls| |
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
939 |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
940 |
headerLine := chunkText , ' (doIt)'. |
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
941 |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
942 |
" |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
943 |
first, assume doIt - then lets have a more detailed look ... |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
944 |
" |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
945 |
(chunkText startsWith:'''---- file') ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
946 |
changeType := ''. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
947 |
] ifFalse:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
948 |
changeType := '(doIt)'. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
949 |
]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
950 |
changeString := (chunkText contractTo:maxLen). |
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
951 |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
952 |
p := Parser parseExpression:chunkText. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
953 |
(p notNil |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
954 |
and:[p ~~ #Error |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
955 |
and:[p isMessage]]) ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
956 |
sel := p selector. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
957 |
]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
958 |
(sel == #removeSelector:) ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
959 |
p receiver isUnaryMessage ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
960 |
cls := p receiver receiver name. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
961 |
changeClass := (Smalltalk classNamed:cls) class. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
962 |
cls := cls , ' class'. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
963 |
] ifFalse:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
964 |
cls := p receiver name. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
965 |
changeClass := (Smalltalk classNamed:cls) |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
966 |
]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
967 |
sel := (p args at:1) evaluate. |
50 | 968 |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
969 |
compareChanges ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
970 |
(changeClass isNil or:[changeClass isLoaded not]) ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
971 |
changeDelta := '?' |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
972 |
] ifFalse:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
973 |
(changeClass implements:sel asSymbol) ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
974 |
changeDelta := '-'. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
975 |
] |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
976 |
] |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
977 |
]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
978 |
changeType := '(remove)'. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
979 |
changeString := self contractClass:cls selector:sel to:maxLen. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
980 |
]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
981 |
(p isMessage |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
982 |
and:[p receiver isMessage |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
983 |
and:[p receiver selector == #compiledMethodAt:]]) ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
984 |
p receiver receiver isUnaryMessage ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
985 |
cls := p receiver receiver receiver name. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
986 |
changeClass := (Smalltalk classNamed:cls) class. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
987 |
cls := cls , ' class'. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
988 |
] ifFalse:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
989 |
cls := p receiver receiver name. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
990 |
changeClass := (Smalltalk classNamed:cls) |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
991 |
]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
992 |
(sel == #category:) ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
993 |
sel := (p receiver args at:1) evaluate. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
994 |
changeType := '(category change)'. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
995 |
changeString := self contractClass:cls selector:sel to:maxLen. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
996 |
]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
997 |
(sel == #privacy:) ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
998 |
sel := (p receiver args at:1) evaluate. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
999 |
changeType := '(privacy change)'. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1000 |
changeString := self contractClass:cls selector:sel to:maxLen. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1001 |
]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1002 |
]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1003 |
(#(#'subclass:' |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1004 |
#'variableSubclass:' |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1005 |
#'variableByteSubclass:' |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1006 |
#'variableWordSubclass:' |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1007 |
#'variableLongSubclass:' |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1008 |
#'variableFloatSubclass:' |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1009 |
#'variableDoubleSubclass:' |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1010 |
) includes:sel) ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1011 |
changeType := '(class definition)'. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1012 |
]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1013 |
] |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1014 |
] ifTrue:[ "sawExcla" |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1015 |
|done first p sel cls text| |
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1016 |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1017 |
" |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1018 |
method definitions actually consist of |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1019 |
two (or more) chunks; skip next chunk(s) |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1020 |
up to an empty one. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1021 |
The system only writes one chunk, |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1022 |
and we cannot handle more in this ChangesBrowser .... |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1023 |
" |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1024 |
cls := nil. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1025 |
p := Parser parseExpression:chunkText. |
89 | 1026 |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1027 |
(p notNil and:[p ~~ #Error]) ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1028 |
sel := p selector. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1029 |
(sel == #methodsFor:) ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1030 |
p receiver isUnaryMessage ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1031 |
cls := p receiver receiver name. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1032 |
changeClass := (Smalltalk classNamed:cls) class. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1033 |
cls := cls , ' class'. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1034 |
] ifFalse:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1035 |
cls := p receiver name. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1036 |
changeClass := Smalltalk classNamed:cls |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1037 |
]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1038 |
category := (p args at:1) evaluate. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1039 |
]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1040 |
]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1041 |
done := false. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1042 |
first := true. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1043 |
[done] whileFalse:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1044 |
text := aStream nextChunk. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1045 |
text isNil ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1046 |
done := true |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1047 |
] ifFalse:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1048 |
done := text isEmpty |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1049 |
]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1050 |
done ifFalse:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1051 |
first ifFalse:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1052 |
Transcript showCr:'only one method per ''methodsFor:'' handled'. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1053 |
] ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1054 |
first := false. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1055 |
" |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1056 |
try to find the selector |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1057 |
" |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1058 |
sel := nil. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1059 |
cls notNil ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1060 |
p := Parser |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1061 |
parseMethodSpecification:text |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1062 |
in:nil |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1063 |
ignoreErrors:true |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1064 |
ignoreWarnings:true. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1065 |
(p notNil and:[p ~~ #Error]) ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1066 |
sel := p selector. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1067 |
] |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1068 |
]. |
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1069 |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1070 |
sel isNil ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1071 |
changeString := (chunkText contractTo:maxLen). |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1072 |
changeType := '(change)'. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1073 |
] ifFalse:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1074 |
changeString := self contractClass:cls selector:sel to:maxLen. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1075 |
changeType := '(method in: ''' , category , ''')'. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1076 |
]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1077 |
sel isNil ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1078 |
headerLine := chunkText , ' (change)'. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1079 |
] ifFalse:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1080 |
headerLine := cls , ' ' , sel , ' ' , '(change category: ''' , category , ''')'. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1081 |
]. |
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1082 |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1083 |
compareChanges ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1084 |
(changeClass isNil or:[changeClass isLoaded not]) ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1085 |
changeDelta := '?' |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1086 |
] ifFalse:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1087 |
(changeClass implements:sel asSymbol) ifFalse:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1088 |
changeDelta := '+'. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1089 |
] ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1090 |
|m currentText t1 t2| |
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1091 |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1092 |
m := changeClass compiledMethodAt:sel asSymbol. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1093 |
currentText := m source. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1094 |
currentText notNil ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1095 |
text asString = currentText asString ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1096 |
changeDelta := '=' |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1097 |
] ifFalse:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1098 |
t1 := currentText asCollectionOfLines collect:[:s | s withTabsExpanded]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1099 |
t2 := text asCollectionOfLines collect:[:s | s withTabsExpanded]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1100 |
t1 = t2 ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1101 |
changeDelta := '=' |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1102 |
] |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1103 |
] |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1104 |
] |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1105 |
] |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1106 |
] |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1107 |
] |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1108 |
] |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1109 |
] |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1110 |
] |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1111 |
]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1112 |
changeString notNil ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1113 |
entry := MultiColListEntry new. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1114 |
entry tabulatorSpecification:tabSpec. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1115 |
entry colAt:1 put:changeDelta. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1116 |
entry colAt:2 put:changeString. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1117 |
entry colAt:3 put:changeType. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1118 |
entry colAt:4 put:timeStampInfo. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1119 |
changeHeaderLines add:entry |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1120 |
] ifFalse:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1121 |
headerLine notNil ifTrue:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1122 |
changeHeaderLines add:headerLine |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1123 |
] |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1124 |
] |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1125 |
] |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1126 |
] |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1127 |
]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1128 |
changeClassNames := OrderedCollection new grow:(changeChunks size). |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1129 |
aStream close. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1130 |
anyChanges := false |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1131 |
] valueNowOrOnUnwindDo:[ |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1132 |
inBackground ifTrue:[myProcess priority:myPriority]. |
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1133 |
]. |
133 | 1134 |
]. |
1135 |
||
1136 |
self checkIfFileHasChanged |
|
123 | 1137 |
|
1138 |
"Modified: 27.8.1995 / 23:06:55 / claus" |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1139 |
"Modified: 24.11.1995 / 14:29:51 / cg" |
45 | 1140 |
! |
37 | 1141 |
|
202 | 1142 |
setChangeList |
1143 |
"extract type-information from changes and stuff into top selection |
|
1144 |
view" |
|
51 | 1145 |
|
202 | 1146 |
changeListView setList:changeHeaderLines expandTabs:false. |
1147 |
"/ changeListView deselect. |
|
51 | 1148 |
! |
1149 |
||
73 | 1150 |
silentDeleteChange:changeNr |
1151 |
"delete a change do not update changeListView" |
|
57 | 1152 |
|
73 | 1153 |
anyChanges := true. |
1154 |
changeChunks removeIndex:changeNr. |
|
1155 |
changePositions removeIndex:changeNr. |
|
1156 |
changeClassNames removeIndex:changeNr. |
|
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1157 |
changeHeaderLines removeIndex:changeNr. |
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1158 |
changeTimeStamps removeIndex:changeNr |
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1159 |
|
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1160 |
"Modified: 18.11.1995 / 17:08:44 / cg" |
45 | 1161 |
! |
1162 |
||
202 | 1163 |
silentDeleteChangesFor:aClassName from:start to:stop |
1164 |
"delete changes for a given class in a range" |
|
45 | 1165 |
|
202 | 1166 |
|thisClassName index| |
45 | 1167 |
|
202 | 1168 |
index := stop. |
1169 |
[index >= start] whileTrue:[ |
|
1170 |
thisClassName := self classNameOfChange:index. |
|
1171 |
thisClassName = aClassName ifTrue:[ |
|
1172 |
self silentDeleteChange:index |
|
51 | 1173 |
]. |
202 | 1174 |
index := index - 1 |
1175 |
] |
|
51 | 1176 |
|
45 | 1177 |
! |
1178 |
||
202 | 1179 |
streamForChange:changeNr |
1180 |
"answer a stream for change" |
|
1181 |
||
1182 |
|aStream| |
|
73 | 1183 |
|
202 | 1184 |
(changeNr between:1 and:changePositions size) ifFalse:[^ nil]. |
1185 |
aStream := FileStream readonlyFileNamed:changeFileName. |
|
1186 |
aStream isNil ifTrue:[^ nil]. |
|
1187 |
aStream position:(changePositions at:changeNr). |
|
1188 |
^ aStream |
|
1189 |
! |
|
1190 |
||
1191 |
unselect |
|
1192 |
"common unselect" |
|
1193 |
||
1194 |
changeListView deselect. |
|
73 | 1195 |
! |
1196 |
||
1197 |
withSelectedChangeDo:aBlock |
|
1198 |
"just a helper, check for a selected change and evaluate aBlock |
|
1199 |
with busy cursor" |
|
1200 |
||
1201 |
|changeNr| |
|
1202 |
||
1203 |
changeNr := changeListView selection. |
|
1204 |
changeNr notNil ifTrue:[ |
|
1205 |
self withCursor:(Cursor execute) do:[ |
|
1206 |
aBlock value:changeNr |
|
1207 |
] |
|
1208 |
] |
|
1209 |
! |
|
1210 |
||
45 | 1211 |
writeBackChanges |
163
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1212 |
"write back the changes file. To avoid problems when the disk is full |
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1213 |
or a crash occurs while writing (well, or someone kills us), |
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1214 |
first write the stuff to a new temporary file. If this works ok, |
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1215 |
rename the old change-file to a .bak file and finally rename the |
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1216 |
tempfile back to the change-file. |
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1217 |
That way, if anything happens, either the original file is left unchanged, |
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1218 |
or we have at least a backup of the previous change file." |
45 | 1219 |
|
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1220 |
|inStream outStream tempfile stamp| |
163
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1221 |
|
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1222 |
tempfile := Filename newTemporaryIn:nil. |
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1223 |
tempfile exists ifTrue:[tempfile remove]. |
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1224 |
|
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1225 |
outStream := tempfile writeStream. |
45 | 1226 |
outStream isNil ifTrue:[ |
163
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1227 |
self warn:'cannot create temporary file in current directory.'. |
45 | 1228 |
^ self |
1229 |
]. |
|
1230 |
||
1231 |
inStream := FileStream readonlyFileNamed:changeFileName. |
|
1232 |
inStream isNil ifTrue:[^ nil]. |
|
1233 |
||
1234 |
self withCursor:(Cursor write) do:[ |
|
51 | 1235 |
|excla sawExcla done dir chunk |
1236 |
nChanges "{Class:SmallInteger}" | |
|
1237 |
||
45 | 1238 |
excla := inStream class chunkSeparator. |
51 | 1239 |
nChanges := changePositions size. |
1240 |
||
1241 |
1 to:nChanges do:[:index | |
|
45 | 1242 |
inStream position:(changePositions at:index). |
1243 |
sawExcla := inStream peekFor:excla. |
|
1244 |
chunk := inStream nextChunk. |
|
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1245 |
(stamp := changeTimeStamps at:index) notNil ifTrue:[ |
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1246 |
outStream nextPutAll:'''---- timestamp ' , stamp , ' ----'''. |
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1247 |
outStream nextPut:excla; cr. |
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1248 |
]. |
45 | 1249 |
|
1250 |
sawExcla ifTrue:[ |
|
1251 |
outStream nextPut:excla. |
|
1252 |
outStream nextChunkPut:chunk. |
|
1253 |
outStream cr. |
|
51 | 1254 |
" |
1255 |
a method-definition chunk - skip followups |
|
1256 |
" |
|
45 | 1257 |
done := false. |
1258 |
[done] whileFalse:[ |
|
1259 |
chunk := inStream nextChunk. |
|
1260 |
chunk isNil ifTrue:[ |
|
1261 |
done := true |
|
1262 |
] ifFalse:[ |
|
1263 |
outStream nextChunkPut:chunk. |
|
1264 |
outStream cr. |
|
1265 |
done := chunk isEmpty |
|
1266 |
] |
|
1267 |
]. |
|
1268 |
] ifFalse:[ |
|
1269 |
outStream nextChunkPut:chunk. |
|
1270 |
outStream cr |
|
1271 |
] |
|
1272 |
]. |
|
1273 |
outStream close. |
|
1274 |
inStream close. |
|
1275 |
dir := FileDirectory currentDirectory. |
|
163
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1276 |
dir renameFile:changeFileName newName:(changeFileName , '.bak'). |
3aa2b2e7db65
handle different change-file-name; use unique temporary filenames
Claus Gittinger <cg@exept.de>
parents:
133
diff
changeset
|
1277 |
dir renameFile:tempfile name newName:changeFileName. |
45 | 1278 |
anyChanges := false |
1279 |
] |
|
182
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1280 |
|
0c2f9214d531
handle & display timestamp records
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1281 |
"Modified: 18.11.1995 / 17:12:37 / cg" |
202 | 1282 |
! ! |
0 | 1283 |
|
202 | 1284 |
!ChangesBrowser methodsFor:'termination'! |
51 | 1285 |
|
202 | 1286 |
destroy |
1287 |
"destroy the receiver; make certain, that boxes are destroyed too" |
|
73 | 1288 |
|
202 | 1289 |
Processor removeTimedBlock:checkBlock. |
1290 |
ObjectMemory removeDependent:self. |
|
1291 |
super destroy |
|
51 | 1292 |
! |
1293 |
||
202 | 1294 |
saveAndTerminate |
1295 |
"update the changes file and quit. |
|
1296 |
Dont depend on this being sent, not all window managers |
|
1297 |
send it; instead, they simply destroy the view." |
|
28 | 1298 |
|
202 | 1299 |
anyChanges ifTrue:[ |
1300 |
self writeBackChanges. |
|
0 | 1301 |
]. |
202 | 1302 |
self destroy |
0 | 1303 |
! |
1304 |
||
202 | 1305 |
terminate |
1306 |
"window manager wants us to go away" |
|
28 | 1307 |
|
202 | 1308 |
|action| |
0 | 1309 |
|
202 | 1310 |
anyChanges ifTrue:[ |
1311 |
action := OptionBox |
|
1312 |
request:(resources at:'changefile has not been updated from the modified changelist.\\Update before closing ?') withCRs |
|
1313 |
label:'ChangesBrowser' |
|
1314 |
form:(WarningBox iconBitmap) |
|
1315 |
buttonLabels:(resources array:#('abort' 'don''t update' 'update')) |
|
1316 |
values:#(#abort #ignore #save) |
|
1317 |
default:#save. |
|
1318 |
action == #abort ifTrue:[^ self]. |
|
1319 |
action == #save ifTrue:[ |
|
1320 |
self writeBackChanges |
|
45 | 1321 |
]. |
202 | 1322 |
]. |
1323 |
self destroy |
|
0 | 1324 |
! ! |
1325 |
||
73 | 1326 |
!ChangesBrowser methodsFor:'user interaction'! |
51 | 1327 |
|
0 | 1328 |
changeSelection:lineNr |
1329 |
"show a change in the codeView" |
|
1330 |
||
1331 |
|aStream sawExcla chunk| |
|
1332 |
||
1333 |
aStream := self streamForChange:lineNr. |
|
1334 |
aStream isNil ifTrue:[^ self]. |
|
1335 |
sawExcla := aStream peekFor:(aStream class chunkSeparator). |
|
1336 |
chunk := aStream nextChunk. |
|
1337 |
sawExcla ifTrue:[ |
|
45 | 1338 |
chunk := aStream nextChunk |
0 | 1339 |
]. |
1340 |
aStream close. |
|
1341 |
codeView contents:chunk. |
|
13 | 1342 |
codeView acceptAction:[:theCode | self doApply "noChangesAllowed"]. |
15 | 1343 |
changeNrShown := lineNr. |
0 | 1344 |
|
51 | 1345 |
! |
1346 |
||
202 | 1347 |
doApply |
1348 |
"user wants a change to be applied" |
|
45 | 1349 |
|
202 | 1350 |
self withSelectedChangeDo:[:changeNr | |
1351 |
skipSignal := nil. |
|
1352 |
self applyChange:changeNr. |
|
1353 |
self autoSelect:(changeNr + 1) |
|
1354 |
] |
|
45 | 1355 |
! |
1356 |
||
202 | 1357 |
doApplyAll |
1358 |
"user wants all changes to be applied" |
|
37 | 1359 |
|
202 | 1360 |
self withCursor:(Cursor execute) do:[ |
1361 |
self clearCodeView. |
|
1362 |
skipSignal isNil ifTrue:[skipSignal := Signal new]. |
|
1363 |
1 to:(changePositions size) do:[:changeNr | |
|
1364 |
changeListView selection:changeNr. |
|
1365 |
self applyChange:changeNr |
|
1366 |
]. |
|
1367 |
self autoSelectLast |
|
1368 |
] |
|
37 | 1369 |
! |
1370 |
||
202 | 1371 |
doApplyClassRest |
1372 |
"user wants all changes for this class from changeNr to be applied" |
|
1373 |
||
1374 |
self withSelectedChangeDo:[:changeNr | |
|
1375 |
|thisClassName classNameToApply lastChange| |
|
37 | 1376 |
|
202 | 1377 |
classNameToApply := self classNameOfChange:changeNr. |
1378 |
classNameToApply notNil ifTrue:[ |
|
1379 |
self clearCodeView. |
|
1380 |
skipSignal isNil ifTrue:[skipSignal := Signal new]. |
|
1381 |
changeNr to:(changePositions size) do:[:changeNr | |
|
1382 |
thisClassName := self classNameOfChange:changeNr. |
|
1383 |
thisClassName = classNameToApply ifTrue:[ |
|
1384 |
changeListView selection:changeNr. |
|
1385 |
self applyChange:changeNr. |
|
1386 |
lastChange := changeNr |
|
1387 |
]. |
|
1388 |
]. |
|
1389 |
self autoSelect:lastChange. |
|
1390 |
] |
|
1391 |
] |
|
37 | 1392 |
! |
1393 |
||
202 | 1394 |
doApplyRest |
1395 |
"user wants all changes from changeNr to be applied" |
|
28 | 1396 |
|
202 | 1397 |
self withSelectedChangeDo:[:changeNr | |
1398 |
self clearCodeView. |
|
1399 |
skipSignal isNil ifTrue:[skipSignal := Signal new]. |
|
1400 |
changeNr to:(changePositions size) do:[:changeNr | |
|
1401 |
changeListView selection:changeNr. |
|
1402 |
self applyChange:changeNr |
|
1403 |
]. |
|
1404 |
self autoSelect:changePositions size. |
|
37 | 1405 |
] |
1406 |
! |
|
1407 |
||
45 | 1408 |
doBrowse |
1409 |
"user wants a browser on the class of a change" |
|
1410 |
||
1411 |
|changeNr className cls| |
|
1412 |
||
1413 |
changeNr := changeListView selection. |
|
1414 |
changeNr notNil ifTrue:[ |
|
1415 |
className := self classNameOfChange:changeNr. |
|
1416 |
className notNil ifTrue:[ |
|
1417 |
(cls := Smalltalk classNamed:className) notNil ifTrue:[ |
|
1418 |
SystemBrowser browseClass:cls |
|
1419 |
] |
|
1420 |
] |
|
37 | 1421 |
] |
1422 |
! |
|
1423 |
||
73 | 1424 |
doCompare |
1425 |
"compare change with current system version |
|
1426 |
- give a note in transcript" |
|
1427 |
||
1428 |
|changeNr| |
|
1429 |
||
1430 |
changeNr := changeListView selection. |
|
1431 |
changeNr notNil ifTrue:[ |
|
1432 |
self withCursor:(Cursor execute) do:[ |
|
1433 |
self compareChange:changeNr |
|
1434 |
] |
|
1435 |
] |
|
1436 |
! |
|
1437 |
||
45 | 1438 |
doCompress |
1439 |
"compress the change-set; this replaces multiple method-changes by the last |
|
1440 |
(i.e. the most recent) change" |
|
1441 |
||
51 | 1442 |
|aStream searchIndex anyMore deleteSet index |
1443 |
str snapshotProto snapshotPrefix snapshotNameIndex fileName| |
|
45 | 1444 |
|
1445 |
aStream := FileStream readonlyFileNamed:changeFileName. |
|
1446 |
aStream isNil ifTrue:[^ self]. |
|
1447 |
||
58 | 1448 |
CompressSnapshotInfo == true ifTrue:[ |
1449 |
" |
|
1450 |
get a prototype snapshot record (to be independent of |
|
1451 |
the actual format .. |
|
1452 |
" |
|
1453 |
str := WriteStream on:String new. |
|
1454 |
Class addChangeRecordForSnapshot:'foo' to:str. |
|
1455 |
snapshotProto := str contents. |
|
1456 |
snapshotPrefix := snapshotProto copyTo:10. |
|
1457 |
snapshotNameIndex := snapshotProto findString:'foo'. |
|
1458 |
]. |
|
45 | 1459 |
|
1460 |
self withCursor:(Cursor execute) do:[ |
|
51 | 1461 |
|numChanges classes selectors types excla sawExcla |
1462 |
changeNr chunk aParseTree parseTreeChunk |
|
1463 |
thisClass thisSelector codeChunk codeParser| |
|
1464 |
||
45 | 1465 |
numChanges := changePositions size. |
1466 |
classes := Array new:numChanges. |
|
1467 |
selectors := Array new:numChanges. |
|
1468 |
types := Array new:numChanges. |
|
1469 |
||
1470 |
"starting at the end, get the change class and change selector; |
|
1471 |
collect all in classes / selectors" |
|
1472 |
||
1473 |
changeNr := numChanges. |
|
1474 |
excla := aStream class chunkSeparator. |
|
1475 |
||
1476 |
[changeNr >= 1] whileTrue:[ |
|
1477 |
aStream position:(changePositions at:changeNr). |
|
1478 |
sawExcla := aStream peekFor:excla. |
|
1479 |
chunk := aStream nextChunk. |
|
1480 |
sawExcla ifTrue:[ |
|
1481 |
"optimize a bit if multiple methods for same category arrive" |
|
1482 |
(chunk = parseTreeChunk) ifFalse:[ |
|
1483 |
aParseTree := Parser parseExpression:chunk. |
|
1484 |
parseTreeChunk := chunk |
|
1485 |
]. |
|
1486 |
(aParseTree notNil |
|
1487 |
and:[(aParseTree ~~ #Error) |
|
1488 |
and:[aParseTree isMessage]]) ifTrue:[ |
|
1489 |
(aParseTree selector == #methodsFor:) ifTrue:[ |
|
1490 |
thisClass := (aParseTree receiver evaluate). |
|
1491 |
codeChunk := aStream nextChunk. |
|
1492 |
codeParser := Parser |
|
1493 |
parseMethodSpecification:codeChunk |
|
1494 |
in:thisClass |
|
1495 |
ignoreErrors:true |
|
1496 |
ignoreWarnings:true. |
|
120 | 1497 |
(codeParser notNil and:[codeParser ~~ #Error]) ifTrue:[ |
45 | 1498 |
selectors at:changeNr put:(codeParser selector). |
1499 |
classes at:changeNr put:thisClass. |
|
1500 |
types at:changeNr put:#methodsFor |
|
1501 |
] |
|
1502 |
] |
|
1503 |
] |
|
1504 |
] ifFalse:[ |
|
1505 |
aParseTree := Parser parseExpression:chunk. |
|
1506 |
parseTreeChunk := chunk. |
|
1507 |
(aParseTree notNil |
|
1508 |
and:[(aParseTree ~~ #Error) |
|
1509 |
and:[aParseTree isMessage]]) ifTrue:[ |
|
1510 |
(aParseTree selector == #removeSelector:) ifTrue:[ |
|
1511 |
selectors at:changeNr put:(aParseTree arg1 value ). |
|
1512 |
classes at:changeNr put:(aParseTree receiver evaluate). |
|
1513 |
types at:changeNr put:#removeSelector |
|
1514 |
] |
|
1515 |
] ifFalse:[ |
|
58 | 1516 |
CompressSnapshotInfo == true ifTrue:[ |
1517 |
(chunk startsWith:snapshotPrefix) ifTrue:[ |
|
1518 |
str := chunk readStream position:snapshotNameIndex. |
|
1519 |
fileName := str upTo:(Character space). |
|
1520 |
" |
|
1521 |
kludge to allow use of match-check below |
|
1522 |
" |
|
1523 |
selectors at:changeNr put:snapshotPrefix. |
|
1524 |
classes at:changeNr put:fileName. |
|
1525 |
] |
|
45 | 1526 |
] |
1527 |
] |
|
1528 |
]. |
|
1529 |
changeNr := changeNr - 1 |
|
1530 |
]. |
|
1531 |
aStream close. |
|
1532 |
||
1533 |
"for all changes, look for another class/selector occurence later |
|
1534 |
in the list and, if there is one, add change number to the delete set" |
|
1535 |
||
1536 |
deleteSet := OrderedCollection new. |
|
1537 |
changeNr := 1. |
|
1538 |
[changeNr < changePositions size] whileTrue:[ |
|
1539 |
thisClass := classes at:changeNr. |
|
1540 |
thisSelector := selectors at:changeNr. |
|
1541 |
searchIndex := changeNr. |
|
1542 |
anyMore := true. |
|
1543 |
[anyMore] whileTrue:[ |
|
1544 |
searchIndex := classes indexOf:thisClass |
|
1545 |
startingAt:(searchIndex + 1). |
|
1546 |
(searchIndex ~~ 0) ifTrue:[ |
|
1547 |
((selectors at:searchIndex) == thisSelector) ifTrue:[ |
|
1548 |
thisClass notNil ifTrue:[ |
|
1549 |
deleteSet add:changeNr. |
|
1550 |
anyMore := false |
|
1551 |
] |
|
1552 |
] |
|
1553 |
] ifFalse:[ |
|
1554 |
anyMore := false |
|
1555 |
] |
|
1556 |
]. |
|
1557 |
changeNr := changeNr + 1 |
|
1558 |
]. |
|
1559 |
||
1560 |
"finally delete what has been found" |
|
1561 |
||
1562 |
(deleteSet size > 0) ifTrue:[ |
|
51 | 1563 |
changeListView deselect. |
45 | 1564 |
index := deleteSet size. |
1565 |
[index > 0] whileTrue:[ |
|
1566 |
self silentDeleteChange:(deleteSet at:index). |
|
1567 |
index := index - 1 |
|
1568 |
]. |
|
1569 |
self setChangeList. |
|
51 | 1570 |
" |
1571 |
scroll back a bit, if we are left way behind the list |
|
1572 |
" |
|
49 | 1573 |
changeListView firstLineShown > changePositions size ifTrue:[ |
1574 |
changeListView makeLineVisible:changePositions size |
|
45 | 1575 |
]. |
1576 |
self clearCodeView |
|
1577 |
] |
|
1578 |
] |
|
1579 |
! |
|
1580 |
||
202 | 1581 |
doDelete |
1582 |
"delete currently selected change" |
|
1583 |
||
1584 |
|changeNr| |
|
73 | 1585 |
|
202 | 1586 |
changeNr := changeListView selection. |
1587 |
changeNr notNil ifTrue:[ |
|
1588 |
self deleteChange:changeNr. |
|
1589 |
self autoSelectOrEnd:changeNr |
|
73 | 1590 |
] |
1591 |
! |
|
1592 |
||
202 | 1593 |
doDeleteClassAll |
1594 |
"delete all changes with same class as currently selected change" |
|
1595 |
||
1596 |
self withSelectedChangeDo:[:changeNr | |
|
1597 |
| classNameToDelete | |
|
45 | 1598 |
|
202 | 1599 |
classNameToDelete := self classNameOfChange:changeNr. |
1600 |
classNameToDelete notNil ifTrue:[ |
|
1601 |
changeListView selection:nil. |
|
1602 |
self silentDeleteChangesFor:classNameToDelete |
|
1603 |
from:1 |
|
1604 |
to:(changePositions size). |
|
1605 |
self setChangeList. |
|
1606 |
self autoSelectOrEnd:changeNr |
|
51 | 1607 |
] |
1608 |
] |
|
1609 |
! |
|
1610 |
||
73 | 1611 |
doDeleteClassRest |
1612 |
"delete rest of changes with same class as currently selected change" |
|
1613 |
||
1614 |
self withSelectedChangeDo:[:changeNr | |
|
1615 |
| classNameToDelete | |
|
1616 |
||
1617 |
classNameToDelete := self classNameOfChange:changeNr. |
|
1618 |
classNameToDelete notNil ifTrue:[ |
|
1619 |
changeListView selection:nil. |
|
1620 |
self silentDeleteChangesFor:classNameToDelete |
|
1621 |
from:changeNr |
|
1622 |
to:(changePositions size). |
|
1623 |
self setChangeList. |
|
1624 |
self autoSelectOrEnd:changeNr |
|
1625 |
] |
|
1626 |
] |
|
1627 |
! |
|
1628 |
||
202 | 1629 |
doDeleteRest |
1630 |
"delete all changes from current to the end" |
|
51 | 1631 |
|
202 | 1632 |
|changeNr| |
51 | 1633 |
|
202 | 1634 |
changeNr := changeListView selection. |
1635 |
changeNr notNil ifTrue:[ |
|
1636 |
self deleteChangesFrom:changeNr to:(changePositions size). |
|
1637 |
self clearCodeView. |
|
1638 |
self autoSelectOrEnd:changeNr-1 |
|
51 | 1639 |
] |
132 | 1640 |
! |
1641 |
||
1642 |
doFileoutAndDeleteClassAll |
|
1643 |
"first fileOut the selected changes class then delete all changes |
|
1644 |
for it." |
|
1645 |
||
1646 |
self withSelectedChangeDo:[:changeNr | |
|
1647 |
| className class | |
|
1648 |
||
1649 |
className := self classNameOfChange:changeNr. |
|
1650 |
className notNil ifTrue:[ |
|
1651 |
class := Smalltalk classNamed:className. |
|
1652 |
class notNil ifTrue:[ |
|
1653 |
Class fileOutErrorSignal handle:[:ex | |
|
1654 |
self warn:('fileout failed: ' , ex errorString). |
|
1655 |
] do:[ |
|
1656 |
class fileOut. |
|
1657 |
self doDeleteClassAll |
|
1658 |
]. |
|
1659 |
]. |
|
1660 |
||
1661 |
]. |
|
1662 |
] |
|
1663 |
||
1664 |
"Modified: 6.9.1995 / 17:11:16 / claus" |
|
202 | 1665 |
! |
73 | 1666 |
|
202 | 1667 |
doMakePatch |
1668 |
"user wants a change to be made a patch |
|
1669 |
- copy it over to the patches file" |
|
89 | 1670 |
|
202 | 1671 |
|changeNr| |
89 | 1672 |
|
202 | 1673 |
changeNr := changeListView selection. |
1674 |
changeNr notNil ifTrue:[ |
|
1675 |
self makeChangeAPatch:changeNr. |
|
1676 |
self autoSelect:(changeNr + 1) |
|
1677 |
] |
|
73 | 1678 |
! |
1679 |
||
202 | 1680 |
doMakePermanent |
1681 |
"user wants a change to be made permanent |
|
1682 |
- rewrite the source file where this change has to go" |
|
1683 |
||
1684 |
|yesNoBox| |
|
73 | 1685 |
|
202 | 1686 |
yesNoBox := YesNoBox new. |
1687 |
yesNoBox title:(resources at:'Warning: this operation cannot be undone'). |
|
1688 |
yesNoBox okText:(resources at:'continue'). |
|
1689 |
yesNoBox noText:(resources at:'abort'). |
|
1690 |
yesNoBox okAction:[ |changeNr| |
|
1691 |
||
1692 |
changeNr := changeListView selection. |
|
1693 |
changeNr notNil ifTrue:[ |
|
1694 |
self makeChangePermanent:changeNr. |
|
1695 |
self autoSelect:(changeNr + 1) |
|
1696 |
] |
|
1697 |
]. |
|
1698 |
yesNoBox showAtPointer |
|
73 | 1699 |
! |
1700 |
||
202 | 1701 |
doSave |
1702 |
"user wants a change to be appended to a file" |
|
73 | 1703 |
|
202 | 1704 |
|changeNr fileName| |
73 | 1705 |
|
202 | 1706 |
changeNr := changeListView selection. |
1707 |
changeNr notNil ifTrue:[ |
|
1708 |
fileName := Dialog |
|
1709 |
requestFileName:'append change to:' |
|
1710 |
default:'' |
|
1711 |
ok:'append' |
|
1712 |
abort:'abort' |
|
1713 |
pattern:'*.chg'. |
|
1714 |
||
1715 |
fileName notNil ifTrue:[ |
|
1716 |
self withCursor:(Cursor write) do:[ |
|
1717 |
self appendChange:changeNr toFile:fileName. |
|
1718 |
]. |
|
1719 |
self autoSelect:(changeNr + 1) |
|
73 | 1720 |
]. |
202 | 1721 |
] |
73 | 1722 |
! |
1723 |
||
202 | 1724 |
doSaveClass |
1725 |
"user wants changes for some class from current to end to be appended to a file" |
|
89 | 1726 |
|
202 | 1727 |
self doSaveClassFrom:1 |
89 | 1728 |
! |
1729 |
||
202 | 1730 |
doSaveClassAll |
1731 |
"user wants changes for some class from current to end to be appended to a file" |
|
73 | 1732 |
|
202 | 1733 |
self doSaveClassFrom:1 |
1734 |
! |
|
1735 |
||
1736 |
doSaveClassFrom:startNr |
|
1737 |
"user wants changes from current to end to be appended to a file" |
|
1738 |
||
1739 |
|changeNr classNameToSave| |
|
73 | 1740 |
|
202 | 1741 |
changeNr := changeListView selection. |
1742 |
changeNr notNil ifTrue:[ |
|
1743 |
classNameToSave := self classNameOfChange:changeNr. |
|
1744 |
classNameToSave notNil ifTrue:[ |
|
1745 |
self saveClass:classNameToSave from:startNr |
|
1746 |
] |
|
1747 |
] |
|
1748 |
! |
|
73 | 1749 |
|
202 | 1750 |
doSaveClassRest |
1751 |
"user wants changes for some class from current to end to be appended to a file" |
|
73 | 1752 |
|
202 | 1753 |
|changeNr| |
132 | 1754 |
|
202 | 1755 |
changeNr := changeListView selection. |
1756 |
changeNr notNil ifTrue:[ |
|
1757 |
self doSaveClassFrom:changeNr |
|
1758 |
] |
|
81 | 1759 |
! |
1760 |
||
202 | 1761 |
doSaveRest |
1762 |
"user wants changes from current to end to be appended to a file" |
|
73 | 1763 |
|
202 | 1764 |
|changeNr fileName| |
51 | 1765 |
|
202 | 1766 |
changeNr := changeListView selection. |
1767 |
changeNr notNil ifTrue:[ |
|
1768 |
fileName := Dialog |
|
1769 |
requestFileName:'append changes to:' |
|
1770 |
default:'' |
|
1771 |
ok:'append' |
|
1772 |
abort:'abort' |
|
1773 |
pattern:'*.chg'. |
|
51 | 1774 |
|
202 | 1775 |
fileName notNil ifTrue:[ |
1776 |
self withCursor:(Cursor write) do:[ |
|
1777 |
changeNr to:(changePositions size) do:[:changeNr | |
|
1778 |
changeListView selection:changeNr. |
|
1779 |
(self appendChange:changeNr toFile:fileName) ifFalse:[ |
|
1780 |
^ self |
|
1781 |
] |
|
1782 |
] |
|
1783 |
] |
|
73 | 1784 |
]. |
202 | 1785 |
] |
51 | 1786 |
! |
1787 |
||
202 | 1788 |
doUpdate |
1789 |
"reread the changes-file" |
|
51 | 1790 |
|
202 | 1791 |
self readChangesFileInBackground:true. |
1792 |
realized ifTrue:[ |
|
1793 |
self setChangeList. |
|
1794 |
] |
|
1795 |
||
51 | 1796 |
! |
1797 |
||
202 | 1798 |
doWriteBack |
1799 |
"write back the list onto the changes file" |
|
51 | 1800 |
|
1801 |
anyChanges ifTrue:[ |
|
1802 |
self writeBackChanges. |
|
202 | 1803 |
realized ifTrue:[ |
1804 |
self readChangesFileInBackground:false. |
|
1805 |
realized ifTrue:[ |
|
1806 |
self setChangeList |
|
1807 |
] |
|
1808 |
] |
|
1809 |
] |
|
1810 |
! |
|
126 | 1811 |
|
202 | 1812 |
noChangesAllowed |
1813 |
"show a warning that changes cannot be changed" |
|
93 | 1814 |
|
202 | 1815 |
self warn:'changes are not allowed to be changed' |
0 | 1816 |
! |
1817 |
||
202 | 1818 |
saveClass:aClassName from:startNr |
1819 |
"user wants changes from current to end to be appended to a file" |
|
51 | 1820 |
|
202 | 1821 |
|changeNr fileName| |
51 | 1822 |
|
202 | 1823 |
changeNr := changeListView selection. |
1824 |
changeNr notNil ifTrue:[ |
|
1825 |
fileName := Dialog |
|
1826 |
requestFileName:'append changes for class to:' |
|
1827 |
default:'' |
|
1828 |
ok:'append' |
|
1829 |
abort:'abort' |
|
1830 |
pattern:'*.chg'. |
|
0 | 1831 |
|
202 | 1832 |
fileName notNil ifTrue:[ |
1833 |
self withCursor:(Cursor write) do:[ |
|
1834 |
startNr to:(changePositions size) do:[:changeNr | |
|
1835 |
|thisClassName| |
|
0 | 1836 |
|
202 | 1837 |
thisClassName := self classNameOfChange:changeNr. |
1838 |
thisClassName = aClassName ifTrue:[ |
|
1839 |
changeListView selection:changeNr. |
|
1840 |
(self appendChange:changeNr toFile:fileName) ifFalse:[ |
|
1841 |
^ self |
|
1842 |
] |
|
1843 |
] |
|
1844 |
] |
|
1845 |
] |
|
45 | 1846 |
]. |
202 | 1847 |
] |
1848 |
! ! |
|
0 | 1849 |
|
202 | 1850 |
!ChangesBrowser class methodsFor:'documentation'! |
1851 |
||
1852 |
version |
|
206
5d1e6d46ecbd
expand tabs when comparing (to show '=' in left col)
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1853 |
^ '$Header: /cvs/stx/stx/libtool/ChangesBrowser.st,v 1.51 1995-11-24 13:32:50 cg Exp $'! ! |