author | Claus Gittinger <cg@exept.de> |
Mon, 10 Sep 2001 19:33:44 +0200 | |
changeset 3146 | 48a9a73adf8b |
parent 3138 | 6089b290d243 |
child 3147 | 6977e4703d1a |
permissions | -rw-r--r-- |
2626 | 1 |
" |
2 |
COPYRIGHT (c) 2000 by eXept Software AG |
|
3 |
All Rights Reserved |
|
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 |
||
2650
447c99ac6f76
oops - inspect & browse menu was broken.
Claus Gittinger <cg@exept.de>
parents:
2626
diff
changeset
|
14 |
"{ Package: 'stx:libtool' }" |
447c99ac6f76
oops - inspect & browse menu was broken.
Claus Gittinger <cg@exept.de>
parents:
2626
diff
changeset
|
15 |
|
2221 | 16 |
ApplicationModel subclass:#VersionDiffBrowser |
2856 | 17 |
instanceVariableNames:'classChangeSet diffTextView boxAVisible boxBVisible boxMVisible |
18 |
classIfSingleClassDiff versionAIfSingleClassDiff |
|
19 |
versionBIfSingleClassDiff' |
|
2221 | 20 |
classVariableNames:'' |
21 |
poolDictionaries:'' |
|
22 |
category:'Interface-Browsers' |
|
23 |
! |
|
24 |
||
2497 | 25 |
HierarchicalItem subclass:#ClassChangeSet |
2695 | 26 |
instanceVariableNames:'classBeingCompared labelA labelB diffSet onlyInA onlyInB |
2856 | 27 |
changedMethods versionA versionB' |
2497 | 28 |
classVariableNames:'' |
29 |
poolDictionaries:'' |
|
30 |
privateIn:VersionDiffBrowser |
|
31 |
! |
|
32 |
||
2626 | 33 |
!VersionDiffBrowser class methodsFor:'documentation'! |
34 |
||
35 |
copyright |
|
36 |
" |
|
37 |
COPYRIGHT (c) 2000 by eXept Software AG |
|
38 |
All Rights Reserved |
|
39 |
||
40 |
This software is furnished under a license and may be used |
|
41 |
only in accordance with the terms of that license and with the |
|
42 |
inclusion of the above copyright notice. This software may not |
|
43 |
be provided or otherwise made available to, or used by, any |
|
44 |
other person. No title to or ownership of the software is |
|
45 |
hereby transferred. |
|
46 |
" |
|
47 |
||
48 |
! |
|
49 |
||
50 |
documentation |
|
51 |
" |
|
52 |
This is not yet finished (work in progress). |
|
53 |
||
54 |
A browser to show differences between class versions, |
|
55 |
allowing easy comparison; will also eventually add capabilities |
|
56 |
to checkIn / load classes into / from the repository. |
|
57 |
||
58 |
[see also:] |
|
59 |
||
60 |
[instance variables:] |
|
61 |
||
62 |
[class variables:] |
|
63 |
" |
|
64 |
||
65 |
||
66 |
! ! |
|
2221 | 67 |
|
68 |
!VersionDiffBrowser class methodsFor:'interface specs'! |
|
69 |
||
70 |
windowSpec |
|
71 |
"This resource specification was automatically generated |
|
72 |
by the UIPainter of ST/X." |
|
73 |
||
74 |
"Do not manually edit this!! If it is corrupted, |
|
75 |
the UIPainter may not be able to read the specification." |
|
76 |
||
77 |
" |
|
78 |
UIPainter new openOnClass:VersionDiffBrowser andSelector:#windowSpec |
|
79 |
VersionDiffBrowser new openInterface:#windowSpec |
|
80 |
VersionDiffBrowser open |
|
81 |
" |
|
82 |
||
83 |
<resource: #canvas> |
|
84 |
||
85 |
^ |
|
86 |
#(#FullSpec |
|
87 |
#name: #windowSpec |
|
88 |
#window: |
|
89 |
#(#WindowSpec |
|
90 |
#label: 'Version DiffBrowser' |
|
91 |
#name: 'Version DiffBrowser' |
|
92 |
#min: #(#Point 10 10) |
|
93 |
#max: #(#Point nil nil) |
|
2695 | 94 |
#bounds: #(#Rectangle 12 22 877 526) |
2221 | 95 |
#menu: #mainMenu |
96 |
) |
|
97 |
#component: |
|
98 |
#(#SpecCollection |
|
99 |
#collection: #( |
|
100 |
#(#VariableVerticalPanelSpec |
|
101 |
#name: 'VariableVerticalPanel1' |
|
102 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
103 |
#component: |
|
104 |
#(#SpecCollection |
|
105 |
#collection: #( |
|
106 |
#(#HorizontalPanelViewSpec |
|
107 |
#name: 'TopHorizontalPanel' |
|
108 |
#horizontalLayout: #fit |
|
109 |
#verticalLayout: #fit |
|
110 |
#horizontalSpace: 3 |
|
111 |
#verticalSpace: 3 |
|
112 |
#component: |
|
113 |
#(#SpecCollection |
|
114 |
#collection: #( |
|
115 |
#(#ViewSpec |
|
116 |
#name: 'BoxA' |
|
117 |
#level: 0 |
|
2585 | 118 |
#visibilityChannel: #boxAVisible |
2221 | 119 |
#component: |
120 |
#(#SpecCollection |
|
121 |
#collection: #( |
|
122 |
#(#LabelSpec |
|
2726 | 123 |
#label: 'Only in A' |
2224 | 124 |
#name: 'OnlyInALabel' |
2221 | 125 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 20 0) |
126 |
#translateLabel: true |
|
127 |
#labelChannel: #onlyInALabelHolder |
|
128 |
) |
|
129 |
#(#SequenceViewSpec |
|
130 |
#name: 'ListA' |
|
131 |
#layout: #(#LayoutFrame 0 0.0 20 0.0 0 1.0 -3 1.0) |
|
132 |
#model: #methodsOnlyInASelection |
|
133 |
#menu: #menuA |
|
134 |
#hasHorizontalScrollBar: true |
|
135 |
#hasVerticalScrollBar: true |
|
136 |
#miniScrollerHorizontal: true |
|
137 |
#valueChangeSelector: #methodsOnlyInASelectionChanged |
|
138 |
#useIndex: true |
|
139 |
#sequenceList: #methodsOnlyInA |
|
140 |
) |
|
141 |
) |
|
142 |
||
143 |
) |
|
2497 | 144 |
#extent: #(#Point 286 252) |
2221 | 145 |
) |
146 |
#(#ViewSpec |
|
147 |
#name: 'BoxM' |
|
2585 | 148 |
#visibilityChannel: #boxMVisible |
2221 | 149 |
#component: |
150 |
#(#SpecCollection |
|
151 |
#collection: #( |
|
152 |
#(#LabelSpec |
|
153 |
#label: 'Changed' |
|
154 |
#name: 'Label2' |
|
155 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 20 0) |
|
156 |
#translateLabel: true |
|
157 |
#labelChannel: #changedLabelHolder |
|
158 |
) |
|
159 |
#(#SequenceViewSpec |
|
160 |
#name: 'ListM' |
|
161 |
#layout: #(#LayoutFrame 0 0.0 20 0.0 0 1.0 -3 1.0) |
|
162 |
#model: #methodsChangedSelection |
|
163 |
#menu: #menuM |
|
164 |
#hasHorizontalScrollBar: true |
|
165 |
#hasVerticalScrollBar: true |
|
166 |
#miniScrollerHorizontal: true |
|
167 |
#valueChangeSelector: #methodsChangedSelectionChanged |
|
168 |
#useIndex: true |
|
169 |
#sequenceList: #methodsChanged |
|
170 |
) |
|
171 |
) |
|
172 |
||
173 |
) |
|
2497 | 174 |
#extent: #(#Point 286 252) |
2221 | 175 |
) |
176 |
#(#ViewSpec |
|
177 |
#name: 'BoxB' |
|
2585 | 178 |
#visibilityChannel: #boxBVisible |
2221 | 179 |
#component: |
180 |
#(#SpecCollection |
|
181 |
#collection: #( |
|
182 |
#(#LabelSpec |
|
2726 | 183 |
#label: 'Only in B' |
2224 | 184 |
#name: 'OnlyInBLabel' |
2221 | 185 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 20 0) |
186 |
#translateLabel: true |
|
187 |
#labelChannel: #onlyInBLabelHolder |
|
188 |
) |
|
189 |
#(#SequenceViewSpec |
|
190 |
#name: 'ListB' |
|
191 |
#layout: #(#LayoutFrame 0 0.0 20 0.0 0 1.0 -3 1.0) |
|
192 |
#model: #methodsOnlyInBSelection |
|
193 |
#menu: #menuB |
|
194 |
#hasHorizontalScrollBar: true |
|
195 |
#hasVerticalScrollBar: true |
|
196 |
#miniScrollerHorizontal: true |
|
197 |
#valueChangeSelector: #methodsOnlyInBSelectionChanged |
|
198 |
#useIndex: true |
|
199 |
#sequenceList: #methodsOnlyInB |
|
200 |
) |
|
201 |
) |
|
202 |
||
203 |
) |
|
2497 | 204 |
#extent: #(#Point 287 252) |
2221 | 205 |
) |
206 |
) |
|
207 |
||
208 |
) |
|
209 |
) |
|
210 |
#(#ViewSpec |
|
211 |
#name: 'Box4' |
|
212 |
#component: |
|
213 |
#(#SpecCollection |
|
214 |
#collection: #( |
|
215 |
#(#ViewSpec |
|
216 |
#name: 'diffTextViewBox' |
|
217 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
218 |
#initiallyInvisible: true |
|
219 |
#component: |
|
220 |
#(#SpecCollection |
|
221 |
#collection: #( |
|
222 |
#(#LabelSpec |
|
223 |
#label: 'A' |
|
224 |
#name: 'DiffTextLabelA' |
|
225 |
#layout: #(#LayoutFrame 0 0 0 0 0 0.5 20 0) |
|
226 |
#translateLabel: true |
|
227 |
#labelChannel: #diffTextLabelA |
|
228 |
) |
|
229 |
#(#LabelSpec |
|
230 |
#label: 'B' |
|
231 |
#name: 'DiffTextLabelB' |
|
232 |
#layout: #(#LayoutFrame 0 0.5 0 0 0 1 20 0) |
|
233 |
#translateLabel: true |
|
234 |
#labelChannel: #diffTextLabelB |
|
235 |
) |
|
236 |
#(#ArbitraryComponentSpec |
|
237 |
#name: 'diffTextView' |
|
238 |
#layout: #(#LayoutFrame 0 0.0 20 0.0 0 1.0 0 1.0) |
|
239 |
#hasBorder: false |
|
240 |
#component: #diffTextView |
|
241 |
) |
|
242 |
) |
|
243 |
||
244 |
) |
|
245 |
) |
|
246 |
#(#TextEditorSpec |
|
247 |
#name: 'singleTextView' |
|
248 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
249 |
#model: #methodText |
|
250 |
#hasHorizontalScrollBar: true |
|
251 |
#hasVerticalScrollBar: true |
|
252 |
#miniScrollerHorizontal: true |
|
253 |
) |
|
254 |
) |
|
255 |
||
256 |
) |
|
257 |
) |
|
258 |
) |
|
259 |
||
260 |
) |
|
2497 | 261 |
#handles: #(#Any 0.5 1.0) |
2221 | 262 |
) |
263 |
) |
|
264 |
||
265 |
) |
|
266 |
) |
|
267 |
! ! |
|
268 |
||
269 |
!VersionDiffBrowser class methodsFor:'menu specs'! |
|
270 |
||
271 |
mainMenu |
|
272 |
"This resource specification was automatically generated |
|
273 |
by the MenuEditor of ST/X." |
|
274 |
||
275 |
"Do not manually edit this!! If it is corrupted, |
|
276 |
the MenuEditor may not be able to read the specification." |
|
277 |
||
278 |
" |
|
279 |
MenuEditor new openOnClass:VersionDiffBrowser andSelector:#mainMenu |
|
280 |
(Menu new fromLiteralArrayEncoding:(VersionDiffBrowser mainMenu)) startUp |
|
281 |
" |
|
282 |
||
283 |
<resource: #menu> |
|
284 |
||
285 |
^ |
|
286 |
#(#Menu |
|
287 |
#( |
|
288 |
#(#MenuItem |
|
289 |
#label: 'File' |
|
290 |
#translateLabel: true |
|
291 |
#submenu: |
|
292 |
#(#Menu |
|
293 |
#( |
|
294 |
#(#MenuItem |
|
2856 | 295 |
#label: 'Create PatchFile...' |
2469 | 296 |
#translateLabel: true |
297 |
#value: #createPatchFile |
|
298 |
) |
|
299 |
#(#MenuItem |
|
300 |
#label: '-' |
|
301 |
) |
|
302 |
#(#MenuItem |
|
2221 | 303 |
#label: 'Exit' |
304 |
#translateLabel: true |
|
305 |
#value: #closeRequest |
|
306 |
) |
|
307 |
) |
|
308 |
nil |
|
309 |
nil |
|
310 |
) |
|
311 |
) |
|
312 |
#(#MenuItem |
|
313 |
#label: 'Help' |
|
314 |
#translateLabel: true |
|
315 |
#startGroup: #right |
|
316 |
#submenu: |
|
317 |
#(#Menu |
|
318 |
#( |
|
319 |
#(#MenuItem |
|
320 |
#label: 'Documentation' |
|
321 |
#translateLabel: true |
|
322 |
#value: #openDocumentation |
|
323 |
) |
|
324 |
#(#MenuItem |
|
325 |
#label: '-' |
|
326 |
) |
|
327 |
#(#MenuItem |
|
328 |
#label: 'About this Application' |
|
329 |
#translateLabel: true |
|
330 |
#value: #openAboutThisApplication |
|
331 |
) |
|
332 |
) |
|
333 |
nil |
|
334 |
nil |
|
335 |
) |
|
336 |
) |
|
337 |
) |
|
338 |
nil |
|
339 |
nil |
|
340 |
) |
|
341 |
! |
|
342 |
||
343 |
menuA |
|
344 |
"This resource specification was automatically generated |
|
345 |
by the MenuEditor of ST/X." |
|
346 |
||
347 |
"Do not manually edit this!! If it is corrupted, |
|
348 |
the MenuEditor may not be able to read the specification." |
|
349 |
||
350 |
" |
|
351 |
MenuEditor new openOnClass:VersionDiffBrowser andSelector:#menu1 |
|
352 |
(Menu new fromLiteralArrayEncoding:(VersionDiffBrowser menu1)) startUp |
|
353 |
" |
|
354 |
||
355 |
<resource: #menu> |
|
356 |
||
357 |
^ |
|
358 |
#(#Menu |
|
359 |
#( |
|
360 |
#(#MenuItem |
|
361 |
#label: 'Inspect' |
|
362 |
#translateLabel: true |
|
363 |
#value: #inspectSelectedChangeInA |
|
364 |
#choiceValue: 'nil "UndefinedObject" ' |
|
365 |
) |
|
2465 | 366 |
#(#MenuItem |
367 |
#label: '-' |
|
368 |
) |
|
369 |
#(#MenuItem |
|
370 |
#label: 'Browse' |
|
371 |
#translateLabel: true |
|
372 |
#value: #browseClassInA |
|
373 |
) |
|
2221 | 374 |
) |
375 |
nil |
|
376 |
nil |
|
377 |
) |
|
378 |
! |
|
379 |
||
380 |
menuB |
|
381 |
"This resource specification was automatically generated |
|
382 |
by the MenuEditor of ST/X." |
|
383 |
||
384 |
"Do not manually edit this!! If it is corrupted, |
|
385 |
the MenuEditor may not be able to read the specification." |
|
386 |
||
387 |
" |
|
388 |
MenuEditor new openOnClass:VersionDiffBrowser andSelector:#menuB |
|
389 |
(Menu new fromLiteralArrayEncoding:(VersionDiffBrowser menuB)) startUp |
|
390 |
" |
|
391 |
||
392 |
<resource: #menu> |
|
393 |
||
394 |
^ |
|
395 |
#(#Menu |
|
396 |
#( |
|
397 |
#(#MenuItem |
|
398 |
#label: 'Inspect' |
|
399 |
#translateLabel: true |
|
400 |
#value: #inspectSelectedChangeInB |
|
401 |
#choiceValue: 'nil "UndefinedObject" ' |
|
402 |
) |
|
2465 | 403 |
#(#MenuItem |
404 |
#label: '-' |
|
405 |
) |
|
406 |
#(#MenuItem |
|
407 |
#label: 'Browse' |
|
408 |
#translateLabel: true |
|
409 |
#value: #browseClassInB |
|
410 |
) |
|
2221 | 411 |
) |
412 |
nil |
|
413 |
nil |
|
414 |
) |
|
415 |
! |
|
416 |
||
417 |
menuM |
|
418 |
"This resource specification was automatically generated |
|
419 |
by the MenuEditor of ST/X." |
|
420 |
||
421 |
"Do not manually edit this!! If it is corrupted, |
|
422 |
the MenuEditor may not be able to read the specification." |
|
423 |
||
424 |
" |
|
425 |
MenuEditor new openOnClass:VersionDiffBrowser andSelector:#menu1 |
|
426 |
(Menu new fromLiteralArrayEncoding:(VersionDiffBrowser menu1)) startUp |
|
427 |
" |
|
428 |
||
429 |
<resource: #menu> |
|
430 |
||
431 |
^ |
|
432 |
#(#Menu |
|
433 |
#( |
|
434 |
#(#MenuItem |
|
2224 | 435 |
#label: 'Inspect both' |
2221 | 436 |
#translateLabel: true |
437 |
#value: #inspectSelectedChangeInM |
|
438 |
#choiceValue: 'nil "UndefinedObject" ' |
|
439 |
) |
|
2465 | 440 |
#(#MenuItem |
441 |
#label: '-' |
|
442 |
) |
|
443 |
#(#MenuItem |
|
444 |
#label: 'Browse' |
|
445 |
#translateLabel: true |
|
446 |
#value: #browseClassInM |
|
447 |
) |
|
2221 | 448 |
) |
449 |
nil |
|
450 |
nil |
|
451 |
) |
|
452 |
! ! |
|
453 |
||
2695 | 454 |
!VersionDiffBrowser class methodsFor:'plugIn spec'! |
455 |
||
456 |
aspectSelectors |
|
457 |
"This resource specification was automatically generated |
|
458 |
by the UIPainter of ST/X." |
|
459 |
||
460 |
"Do not manually edit this. If it is corrupted, |
|
461 |
the UIPainter may not be able to read the specification." |
|
462 |
||
463 |
"Return a description of exported aspects; |
|
464 |
these can be connected to aspects of an embedding application |
|
465 |
(if this app is embedded in a subCanvas)." |
|
466 |
||
467 |
^ #( |
|
468 |
#changedLabelHolder |
|
469 |
#onlyInALabelHolder |
|
470 |
#onlyInBLabelHolder |
|
471 |
). |
|
472 |
||
473 |
! ! |
|
474 |
||
2221 | 475 |
!VersionDiffBrowser class methodsFor:'startup'! |
476 |
||
2695 | 477 |
openOnClass:aClass againstVersion:aVersionA |
2507 | 478 |
" |
479 |
create an VersionDiffBrowser instance and set the class change set of the |
|
2695 | 480 |
browser. The class diff set is generated from classes current against some version |
481 |
via the source code manager . |
|
2507 | 482 |
|
483 |
<return: VersionDiffBrowser> |
|
484 |
" |
|
2497 | 485 |
|theBrowser| |
2224 | 486 |
|
2497 | 487 |
theBrowser := self new. |
488 |
theBrowser allButOpen. |
|
2695 | 489 |
theBrowser setupForClass:aClass againstVersion:aVersionA. |
2497 | 490 |
theBrowser openWindow. |
491 |
^ theBrowser. |
|
2224 | 492 |
|
2695 | 493 |
" |
494 |
self openOnClass:Array againstVersion:'1.116' |
|
495 |
self openOnClass:Array againstVersion:nil - against the version on which Array is based upon |
|
496 |
self openOnClass:Array againstVersion:#newest - against the newest repository version |
|
497 |
||
498 |
self openOnClass:VersionDiffBrowser againstVersion:nil |
|
499 |
self openOnClass:VersionDiffBrowser againstVersion:#newest |
|
500 |
" |
|
501 |
! |
|
502 |
||
2949 | 503 |
openOnClass:classA labelA:aLabelA andClass:classB labelB:aLabelB title:ignoredTitle |
504 |
" |
|
505 |
create an VersionDiffBrowser instance and set the class change set of the |
|
506 |
browser. The class diff set is generated from two classes. |
|
507 |
||
508 |
<return: VersionDiffBrowser> |
|
509 |
" |
|
510 |
^ self |
|
511 |
openOnClass:classA labelA:aLabelA andClass:classB labelB:aLabelB title:ignoredTitle ifSame:nil |
|
512 |
! |
|
513 |
||
514 |
openOnClass:classA labelA:aLabelA andClass:classB labelB:aLabelB title:ignoredTitle ifSame:sameAction |
|
515 |
" |
|
516 |
create an VersionDiffBrowser instance and set the class change set of the |
|
517 |
browser. The class diff set is generated from two classes. |
|
518 |
||
519 |
<return: VersionDiffBrowser> |
|
520 |
" |
|
521 |
|theBrowser| |
|
522 |
||
523 |
theBrowser := self new. |
|
524 |
theBrowser allButOpen. |
|
525 |
theBrowser setupForClass:classA labelA:aLabelA andClass:classB labelB:aLabelB. |
|
526 |
||
527 |
sameAction notNil ifTrue:[ |
|
528 |
"/ check if same ... |
|
529 |
(theBrowser classChangeSet methodsOnlyInA isEmpty |
|
530 |
and:[theBrowser classChangeSet methodsOnlyInB isEmpty |
|
531 |
and:[theBrowser classChangeSet diffSet isEmpty]]) ifTrue:[ |
|
532 |
sameAction value. |
|
533 |
^ self "/ do not open |
|
534 |
] |
|
535 |
]. |
|
536 |
theBrowser openWindow. |
|
537 |
^ theBrowser. |
|
538 |
! |
|
539 |
||
2695 | 540 |
openOnClass:aClass labelA:aLabelA sourceA:aSourceA labelB:aLabelB sourceB:aSourceB |
541 |
" |
|
542 |
create an VersionDiffBrowser instance and set the class change set of the |
|
543 |
browser. The class diff set is generated from two source files. |
|
544 |
||
545 |
<return: VersionDiffBrowser> |
|
546 |
" |
|
2716
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2714
diff
changeset
|
547 |
^ self |
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2714
diff
changeset
|
548 |
openOnClass:aClass labelA:aLabelA sourceA:aSourceA labelB:aLabelB sourceB:aSourceB |
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2714
diff
changeset
|
549 |
title:nil |
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2714
diff
changeset
|
550 |
! |
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2714
diff
changeset
|
551 |
|
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2714
diff
changeset
|
552 |
openOnClass:aClass labelA:aLabelA sourceA:aSourceA labelB:aLabelB sourceB:aSourceB title:ignoredTitle |
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2714
diff
changeset
|
553 |
" |
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2714
diff
changeset
|
554 |
create an VersionDiffBrowser instance and set the class change set of the |
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2714
diff
changeset
|
555 |
browser. The class diff set is generated from two source files. |
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2714
diff
changeset
|
556 |
|
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2714
diff
changeset
|
557 |
<return: VersionDiffBrowser> |
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2714
diff
changeset
|
558 |
" |
2849 | 559 |
^ self openOnClass:aClass labelA:aLabelA sourceA:aSourceA labelB:aLabelB sourceB:aSourceB title:ignoredTitle ifSame:nil |
560 |
! |
|
561 |
||
562 |
openOnClass:aClass labelA:aLabelA sourceA:aSourceA labelB:aLabelB sourceB:aSourceB title:ignoredTitle ifSame:sameAction |
|
563 |
" |
|
564 |
create an VersionDiffBrowser instance and set the class change set of the |
|
565 |
browser. The class diff set is generated from two source files. |
|
566 |
||
567 |
<return: VersionDiffBrowser> |
|
568 |
" |
|
2695 | 569 |
|theBrowser| |
570 |
||
571 |
theBrowser := self new. |
|
572 |
theBrowser allButOpen. |
|
573 |
theBrowser setupForClass:aClass labelA:aLabelA sourceA:aSourceA labelB:aLabelB sourceB:aSourceB. |
|
2849 | 574 |
sameAction notNil ifTrue:[ |
2853 | 575 |
"/ check if same ... |
576 |
(theBrowser classChangeSet methodsOnlyInA isEmpty |
|
577 |
and:[theBrowser classChangeSet methodsOnlyInB isEmpty |
|
578 |
and:[theBrowser classChangeSet diffSet isEmpty]]) ifTrue:[ |
|
579 |
sameAction value. |
|
580 |
^ self "/ do not open |
|
581 |
] |
|
2849 | 582 |
]. |
2695 | 583 |
theBrowser openWindow. |
584 |
^ theBrowser. |
|
2224 | 585 |
! |
586 |
||
2497 | 587 |
openOnClass:aClass versionA:aVersionA versionB:aVersionB |
2507 | 588 |
" |
589 |
create an VersionDiffBrowser instance and set the class change set of the |
|
2695 | 590 |
browser. The class diff set is generated from two class versions via |
2507 | 591 |
the source code manager . |
592 |
||
593 |
<return: VersionDiffBrowser> |
|
594 |
" |
|
2497 | 595 |
|theBrowser| |
2221 | 596 |
|
2497 | 597 |
theBrowser := self new. |
598 |
theBrowser allButOpen. |
|
2695 | 599 |
theBrowser setupForClass:aClass versionA:aVersionA versionB:aVersionB. |
2497 | 600 |
theBrowser openWindow. |
601 |
^ theBrowser. |
|
2221 | 602 |
|
603 |
" |
|
604 |
self openOnClass:Array versionA:'1.116' versionB:'1.113' |
|
605 |
" |
|
606 |
! ! |
|
607 |
||
608 |
!VersionDiffBrowser methodsFor:'accessing'! |
|
609 |
||
2497 | 610 |
changeSetA |
611 |
" |
|
612 |
gets the change set which contains only the new methods |
|
613 |
in versionA of the class |
|
2221 | 614 |
|
2497 | 615 |
<return: ChangeSet> |
616 |
" |
|
2221 | 617 |
|
2497 | 618 |
^ self classChangeSet methodsOnlyInA |
2221 | 619 |
! |
620 |
||
2497 | 621 |
changeSetB |
622 |
" |
|
623 |
gets the change set which contains only the new methods |
|
624 |
in versionB of the class |
|
625 |
||
626 |
<return: ChangeSet> |
|
627 |
" |
|
628 |
||
629 |
^ self classChangeSet methodsOnlyInB |
|
630 |
! |
|
631 |
||
2856 | 632 |
class:aClass versionA:revA versionB:revB |
633 |
classIfSingleClassDiff := aClass. |
|
634 |
versionAIfSingleClassDiff := revA. |
|
635 |
versionBIfSingleClassDiff := revB. |
|
636 |
! |
|
637 |
||
2497 | 638 |
classBeingCompared |
2507 | 639 |
" |
640 |
gets the class from the change set which is compared. |
|
2224 | 641 |
|
2507 | 642 |
<return: Class> |
643 |
" |
|
2497 | 644 |
^ self classChangeSet classBeingCompared |
645 |
! |
|
646 |
||
647 |
classChangeSet |
|
2507 | 648 |
" |
649 |
returns the class change set which is the model of the version diff browser. |
|
2224 | 650 |
|
2507 | 651 |
<return: ClassChangeSet> |
652 |
" |
|
653 |
^ classChangeSet |
|
654 |
! |
|
2497 | 655 |
|
2507 | 656 |
classChangeSet:aClassChangeSet |
2501 | 657 |
" |
2507 | 658 |
sets the class change set which is the model of the version diff browser. |
659 |
The labels, the lists, the visibility and the selection of the lists must be reseted |
|
660 |
when a new change set is given. |
|
2497 | 661 |
|
2507 | 662 |
<return: self> |
2501 | 663 |
" |
2507 | 664 |
classChangeSet := aClassChangeSet. |
2501 | 665 |
self updateLabels. |
666 |
self updateLists. |
|
667 |
self resetSelectionHolders. |
|
668 |
! |
|
2224 | 669 |
|
2507 | 670 |
selectedChangeInA |
671 |
" |
|
672 |
gets the selected method change for the 'method only in version A'. |
|
673 |
||
674 |
<return: MethodChange | nil> |
|
675 |
" |
|
676 |
|sel change| |
|
677 |
||
678 |
sel := self methodsOnlyInASelection value. |
|
679 |
sel notNil ifTrue:[ |
|
680 |
change := (self changeSetA at:sel). |
|
2650
447c99ac6f76
oops - inspect & browse menu was broken.
Claus Gittinger <cg@exept.de>
parents:
2626
diff
changeset
|
681 |
^ change |
2507 | 682 |
]. |
683 |
^ nil |
|
684 |
! |
|
685 |
||
686 |
selectedChangeInB |
|
687 |
" |
|
688 |
gets the selected method change for the 'method only in version B'. |
|
689 |
||
690 |
<return: MethodChange | nil> |
|
691 |
" |
|
692 |
|sel change| |
|
693 |
||
694 |
sel := self methodsOnlyInBSelection value. |
|
695 |
sel notNil ifTrue:[ |
|
696 |
change := (self changeSetB at:sel). |
|
2650
447c99ac6f76
oops - inspect & browse menu was broken.
Claus Gittinger <cg@exept.de>
parents:
2626
diff
changeset
|
697 |
^ change |
2507 | 698 |
]. |
699 |
^ nil |
|
700 |
! |
|
701 |
||
702 |
selectedChangesInM |
|
703 |
" |
|
704 |
get the two method changes for the selected 'changed method'. |
|
705 |
||
706 |
<return: <Array with:MethodChange with:MethodChange | nil>> |
|
707 |
" |
|
2745 | 708 |
|sel changeA changeB theTwoChanges| |
2507 | 709 |
|
710 |
sel := self methodsChangedSelection value. |
|
711 |
sel notNil ifTrue:[ |
|
2745 | 712 |
theTwoChanges := self classChangeSet methodsChanged at:sel. |
713 |
changeA := theTwoChanges first. |
|
714 |
changeB := theTwoChanges second. |
|
715 |
^ Array with:changeA with:changeB |
|
2507 | 716 |
]. |
717 |
^ nil |
|
718 |
! |
|
719 |
||
2221 | 720 |
versionA |
2507 | 721 |
" |
722 |
gets the first class version to be compared |
|
2221 | 723 |
|
2507 | 724 |
<return: String> |
725 |
" |
|
2731 | 726 |
classChangeSet isNil ifTrue:[^ 'A']. |
727 |
^ classChangeSet labelA |
|
2221 | 728 |
! |
729 |
||
730 |
versionB |
|
2507 | 731 |
" |
732 |
gets the second class version to be compared |
|
2221 | 733 |
|
2507 | 734 |
<return: String> |
735 |
" |
|
2731 | 736 |
classChangeSet isNil ifTrue:[^ 'B']. |
737 |
^ classChangeSet labelB |
|
2221 | 738 |
! ! |
739 |
||
740 |
!VersionDiffBrowser methodsFor:'actions'! |
|
741 |
||
742 |
methodsChangedSelectionChanged |
|
2507 | 743 |
" |
744 |
the selection in the list of the 'changed methods' changed. |
|
745 |
Reset the selection of the two other lists and calc the method change. |
|
746 |
||
747 |
<return: self> |
|
748 |
" |
|
2695 | 749 |
|sel idxA idxB changeA changeB methodsChanged| |
2221 | 750 |
|
751 |
sel := self methodsChangedSelection value. |
|
752 |
sel notNil ifTrue:[ |
|
753 |
self methodsOnlyInASelection value:nil. |
|
754 |
self methodsOnlyInBSelection value:nil. |
|
2695 | 755 |
methodsChanged := self classChangeSet methodsChanged. |
756 |
changeA := (methodsChanged at:sel) first. |
|
757 |
changeB := (methodsChanged at:sel) second. |
|
2501 | 758 |
self withReadCursorDo:[ |
3051 | 759 |
self diffTextView text1:changeA prettyPrintedSource text2:changeB prettyPrintedSource. |
2501 | 760 |
self diffTextView moveToNextChanged |
2377 | 761 |
]. |
2221 | 762 |
self showDiffTextView. |
763 |
] |
|
2377 | 764 |
|
765 |
"Modified: / 3.9.1999 / 15:01:30 / ps" |
|
2221 | 766 |
! |
767 |
||
768 |
methodsOnlyInASelectionChanged |
|
2507 | 769 |
" |
770 |
the selection in the list of the 'method only in version A' changed. |
|
771 |
Reset the selection of the two other lists and show the method in |
|
772 |
the text view. |
|
773 |
||
774 |
<return: self> |
|
775 |
" |
|
2221 | 776 |
|change sel| |
777 |
||
778 |
sel := self methodsOnlyInASelection value. |
|
779 |
sel notNil ifTrue:[ |
|
780 |
self methodsOnlyInBSelection value:nil. |
|
781 |
self methodsChangedSelection value:nil. |
|
2497 | 782 |
change := self changeSetA at:sel. |
3051 | 783 |
self methodText value:(change prettyPrintedSource). |
2221 | 784 |
self showSingleTextView. |
785 |
] |
|
786 |
! |
|
787 |
||
788 |
methodsOnlyInBSelectionChanged |
|
2507 | 789 |
" |
790 |
the selection in the list of the 'method only in version B' changed. |
|
791 |
Reset the selection of the two other lists and show the method in |
|
792 |
the text view. |
|
793 |
||
794 |
<return: self> |
|
795 |
" |
|
2221 | 796 |
|change sel| |
797 |
||
798 |
sel := self methodsOnlyInBSelection value. |
|
799 |
sel notNil ifTrue:[ |
|
800 |
self methodsOnlyInASelection value:nil. |
|
801 |
self methodsChangedSelection value:nil. |
|
2497 | 802 |
change := self changeSetB at:sel. |
3051 | 803 |
self methodText value:(change prettyPrintedSource). |
2221 | 804 |
self showSingleTextView. |
805 |
] |
|
806 |
! ! |
|
807 |
||
808 |
!VersionDiffBrowser methodsFor:'aspects'! |
|
809 |
||
2585 | 810 |
boxAVisible |
2745 | 811 |
boxAVisible isNil ifTrue:[ |
812 |
boxAVisible := true asValue. |
|
2585 | 813 |
]. |
2745 | 814 |
^ boxAVisible. |
2585 | 815 |
! |
816 |
||
817 |
boxBVisible |
|
2745 | 818 |
boxBVisible isNil ifTrue:[ |
819 |
boxBVisible := true asValue. |
|
2585 | 820 |
]. |
2745 | 821 |
^ boxBVisible. |
2585 | 822 |
! |
823 |
||
824 |
boxMVisible |
|
2745 | 825 |
boxMVisible isNil ifTrue:[ |
826 |
boxMVisible := true asValue. |
|
2585 | 827 |
]. |
2745 | 828 |
^ boxMVisible. |
2585 | 829 |
! |
830 |
||
2221 | 831 |
changedLabelHolder |
2507 | 832 |
" |
833 |
aspect for the label of the changed method box. |
|
2221 | 834 |
|
2507 | 835 |
<return: ValueHolder on: nil> |
836 |
" |
|
2221 | 837 |
|holder| |
838 |
||
839 |
(holder := builder bindingAt:#changedLabelHolder) isNil ifTrue:[ |
|
840 |
builder aspectAt:#changedLabelHolder put:(holder := ValueHolder new). |
|
841 |
]. |
|
842 |
^ holder. |
|
843 |
! |
|
844 |
||
845 |
diffTextLabelA |
|
2507 | 846 |
" |
847 |
aspect for the label for version A. |
|
2221 | 848 |
|
2507 | 849 |
<return: ValueHolder on: nil> |
850 |
" |
|
2221 | 851 |
|
852 |
|holder| |
|
853 |
||
854 |
(holder := builder bindingAt:#diffTextLabelA) isNil ifTrue:[ |
|
855 |
builder aspectAt:#diffTextLabelA put:(holder := ValueHolder new). |
|
856 |
]. |
|
857 |
^ holder. |
|
858 |
! |
|
859 |
||
860 |
diffTextLabelB |
|
2507 | 861 |
" |
862 |
aspect for the label for version B. |
|
2221 | 863 |
|
2507 | 864 |
<return: ValueHolder on: nil> |
865 |
" |
|
2221 | 866 |
|
867 |
|holder| |
|
868 |
||
869 |
(holder := builder bindingAt:#diffTextLabelB) isNil ifTrue:[ |
|
870 |
builder aspectAt:#diffTextLabelB put:(holder := ValueHolder new). |
|
871 |
]. |
|
872 |
^ holder. |
|
873 |
! |
|
874 |
||
2497 | 875 |
diffTextView |
2507 | 876 |
" |
877 |
return the component for the diff text view. |
|
2497 | 878 |
|
2507 | 879 |
<return: HVScrollableView> |
880 |
" |
|
2497 | 881 |
diffTextView isNil ifTrue:[ |
882 |
diffTextView := HVScrollableView |
|
883 |
for:DiffTextView |
|
884 |
miniScrollerH:true miniScrollerV:false. |
|
885 |
diffTextView addNextPreviousButtons. |
|
886 |
]. |
|
887 |
^ diffTextView |
|
888 |
! |
|
889 |
||
2221 | 890 |
methodText |
2507 | 891 |
" |
892 |
aspect for the text in the method text view. |
|
2221 | 893 |
|
2507 | 894 |
<return: ValueHolder on: nil> |
895 |
" |
|
2221 | 896 |
|holder| |
897 |
||
898 |
(holder := builder bindingAt:#methodText) isNil ifTrue:[ |
|
899 |
builder aspectAt:#methodText put:(holder := ValueHolder new). |
|
900 |
]. |
|
901 |
^ holder. |
|
902 |
! |
|
903 |
||
904 |
methodsChanged |
|
2507 | 905 |
" |
906 |
aspect for the 'changed method' list. |
|
2221 | 907 |
|
2507 | 908 |
<return: List> |
909 |
" |
|
2221 | 910 |
|
911 |
|holder| |
|
912 |
||
913 |
(holder := builder bindingAt:#methodsChanged) isNil ifTrue:[ |
|
914 |
builder aspectAt:#methodsChanged put:(holder := List new). |
|
915 |
]. |
|
916 |
^ holder. |
|
917 |
! |
|
918 |
||
919 |
methodsChangedSelection |
|
2507 | 920 |
" |
921 |
aspect for the selection holder of 'changed method'-list. |
|
2221 | 922 |
|
2507 | 923 |
<return: ValueHolder on: nil> |
924 |
" |
|
2221 | 925 |
|
926 |
|holder| |
|
927 |
||
928 |
(holder := builder bindingAt:#methodsChangedSelection) isNil ifTrue:[ |
|
929 |
builder aspectAt:#methodsChangedSelection put:(holder := ValueHolder new). |
|
930 |
]. |
|
931 |
^ holder. |
|
932 |
! |
|
933 |
||
934 |
methodsOnlyInA |
|
2507 | 935 |
" |
936 |
aspect for the 'method only in version A' list. |
|
2221 | 937 |
|
2507 | 938 |
<return: List> |
939 |
" |
|
2221 | 940 |
|
941 |
|holder| |
|
942 |
||
943 |
(holder := builder bindingAt:#methodsOnlyInA) isNil ifTrue:[ |
|
944 |
builder aspectAt:#methodsOnlyInA put:(holder := List new). |
|
945 |
]. |
|
946 |
^ holder. |
|
947 |
! |
|
948 |
||
949 |
methodsOnlyInASelection |
|
2507 | 950 |
" |
951 |
aspect for the selection holder of 'method only in version A'-list. |
|
2221 | 952 |
|
2507 | 953 |
<return: ValueHolder on: nil> |
954 |
" |
|
2221 | 955 |
|
956 |
|holder| |
|
957 |
||
958 |
(holder := builder bindingAt:#methodsOnlyInASelection) isNil ifTrue:[ |
|
959 |
builder aspectAt:#methodsOnlyInASelection put:(holder := ValueHolder new). |
|
960 |
]. |
|
961 |
^ holder. |
|
962 |
! |
|
963 |
||
964 |
methodsOnlyInB |
|
2507 | 965 |
" |
966 |
aspect for the 'method only in version B' list. |
|
2221 | 967 |
|
2507 | 968 |
<return: List> |
969 |
" |
|
2221 | 970 |
|
971 |
|holder| |
|
972 |
||
973 |
(holder := builder bindingAt:#methodsOnlyInB) isNil ifTrue:[ |
|
974 |
builder aspectAt:#methodsOnlyInB put:(holder := List new). |
|
975 |
]. |
|
976 |
^ holder. |
|
977 |
! |
|
978 |
||
979 |
methodsOnlyInBSelection |
|
2507 | 980 |
" |
981 |
aspect for the selection holder of 'method only in version B'-list. |
|
2221 | 982 |
|
2507 | 983 |
<return: ValueHolder on: nil> |
984 |
" |
|
2221 | 985 |
|
986 |
|holder| |
|
987 |
||
988 |
(holder := builder bindingAt:#methodsOnlyInBSelection) isNil ifTrue:[ |
|
989 |
builder aspectAt:#methodsOnlyInBSelection put:(holder := ValueHolder new). |
|
990 |
]. |
|
991 |
^ holder. |
|
992 |
! |
|
993 |
||
994 |
onlyInALabelHolder |
|
2507 | 995 |
" |
996 |
aspect for the label for 'method only in version A'. |
|
2221 | 997 |
|
2507 | 998 |
<return: ValueHolder on: nil> |
999 |
" |
|
2221 | 1000 |
|
1001 |
|holder| |
|
1002 |
||
1003 |
(holder := builder bindingAt:#onlyInALabelHolder) isNil ifTrue:[ |
|
1004 |
builder aspectAt:#onlyInALabelHolder put:(holder := ValueHolder new). |
|
1005 |
]. |
|
1006 |
^ holder. |
|
1007 |
! |
|
1008 |
||
1009 |
onlyInBLabelHolder |
|
2507 | 1010 |
" |
1011 |
aspect for the label for 'method only in version B'. |
|
2221 | 1012 |
|
2507 | 1013 |
<return: ValueHolder on: nil> |
1014 |
" |
|
2221 | 1015 |
|
1016 |
|holder| |
|
1017 |
||
1018 |
(holder := builder bindingAt:#onlyInBLabelHolder) isNil ifTrue:[ |
|
1019 |
builder aspectAt:#onlyInBLabelHolder put:(holder := ValueHolder new). |
|
1020 |
]. |
|
1021 |
^ holder. |
|
1022 |
! ! |
|
1023 |
||
2725 | 1024 |
!VersionDiffBrowser methodsFor:'aspects-exported'! |
2695 | 1025 |
|
1026 |
changedLabelHolder:aValueHolder |
|
1027 |
builder aspectAt:#changedLabelHolder put:aValueHolder. |
|
1028 |
||
1029 |
! |
|
1030 |
||
1031 |
classHolder:aValueHolder |
|
1032 |
|holder| |
|
1033 |
||
1034 |
(holder := builder bindingAt:#classHolder) notNil ifTrue:[ |
|
1035 |
holder removeDependent:self |
|
1036 |
]. |
|
1037 |
builder aspectAt:#classHolder put:aValueHolder. |
|
1038 |
aValueHolder notNil ifTrue:[ |
|
1039 |
aValueHolder addDependent:self |
|
1040 |
] |
|
1041 |
! |
|
1042 |
||
1043 |
onlyInALabelHolder:aValueHolder |
|
1044 |
builder aspectAt:#onlyInALabelHolder put:aValueHolder. |
|
1045 |
! |
|
1046 |
||
1047 |
onlyInBLabelHolder:aValueHolder |
|
1048 |
builder aspectAt:#onlyInBLabelHolder put:aValueHolder. |
|
1049 |
! |
|
1050 |
||
1051 |
versionAHolder:aValueHolder |
|
1052 |
|holder| |
|
1053 |
||
1054 |
(holder := builder bindingAt:#versionAHolder) notNil ifTrue:[ |
|
1055 |
holder removeDependent:self |
|
1056 |
]. |
|
1057 |
builder aspectAt:#versionAHolder put:aValueHolder. |
|
1058 |
aValueHolder notNil ifTrue:[ |
|
1059 |
aValueHolder addDependent:self |
|
1060 |
] |
|
1061 |
! |
|
1062 |
||
1063 |
versionBHolder:aValueHolder |
|
1064 |
|holder| |
|
1065 |
||
1066 |
(holder := builder bindingAt:#versionBHolder) notNil ifTrue:[ |
|
1067 |
holder removeDependent:self |
|
1068 |
]. |
|
1069 |
builder aspectAt:#versionBHolder put:aValueHolder. |
|
1070 |
aValueHolder notNil ifTrue:[ |
|
1071 |
aValueHolder addDependent:self |
|
1072 |
] |
|
1073 |
! ! |
|
1074 |
||
1075 |
!VersionDiffBrowser methodsFor:'change & update'! |
|
1076 |
||
1077 |
update:something with:parameter from:changedObject |
|
1078 |
|classHolder versionAHolder versionBHolder| |
|
1079 |
||
1080 |
classHolder := self classHolder. |
|
1081 |
versionAHolder := self versionAHolder. |
|
1082 |
versionBHolder := self versionBHolder. |
|
1083 |
||
1084 |
(changedObject == classHolder |
|
1085 |
or:[changedObject == versionAHolder |
|
1086 |
or:[changedObject == versionBHolder]]) ifTrue:[ |
|
1087 |
self setupForClass:(classHolder value) versionA:(versionAHolder value) versionB:(versionBHolder value) |
|
1088 |
. ^ self |
|
1089 |
]. |
|
1090 |
super update:something with:parameter from:changedObject |
|
1091 |
! ! |
|
1092 |
||
2221 | 1093 |
!VersionDiffBrowser methodsFor:'initialization & release'! |
1094 |
||
1095 |
postBuildWith:aBuilder |
|
2507 | 1096 |
" |
1097 |
components which are invisible should be ignored by the panel. |
|
1098 |
Cannot be set via the interface builder. |
|
2221 | 1099 |
|
2507 | 1100 |
<return: self> |
1101 |
" |
|
2221 | 1102 |
(aBuilder componentAt:#TopHorizontalPanel) ignoreInvisibleComponents:true. |
1103 |
^ super postBuildWith:aBuilder |
|
1104 |
! ! |
|
1105 |
||
1106 |
!VersionDiffBrowser methodsFor:'menu action'! |
|
1107 |
||
2465 | 1108 |
browseChange:aChange |
2507 | 1109 |
" |
1110 |
browse the change in aChange |
|
1111 |
||
1112 |
<return: self> |
|
1113 |
" |
|
2650
447c99ac6f76
oops - inspect & browse menu was broken.
Claus Gittinger <cg@exept.de>
parents:
2626
diff
changeset
|
1114 |
|cls sel m| |
447c99ac6f76
oops - inspect & browse menu was broken.
Claus Gittinger <cg@exept.de>
parents:
2626
diff
changeset
|
1115 |
|
2578
29264fb3847e
avoid debugger in browse-menu
Claus Gittinger <cg@exept.de>
parents:
2536
diff
changeset
|
1116 |
aChange isNil ifTrue:[^ self]. |
2650
447c99ac6f76
oops - inspect & browse menu was broken.
Claus Gittinger <cg@exept.de>
parents:
2626
diff
changeset
|
1117 |
cls := aChange changeClass. |
447c99ac6f76
oops - inspect & browse menu was broken.
Claus Gittinger <cg@exept.de>
parents:
2626
diff
changeset
|
1118 |
sel := aChange changeSelector. |
447c99ac6f76
oops - inspect & browse menu was broken.
Claus Gittinger <cg@exept.de>
parents:
2626
diff
changeset
|
1119 |
(cls compiledMethodAt:sel) isNil ifTrue:[ |
447c99ac6f76
oops - inspect & browse menu was broken.
Claus Gittinger <cg@exept.de>
parents:
2626
diff
changeset
|
1120 |
self information:'Method does not exist.' |
447c99ac6f76
oops - inspect & browse menu was broken.
Claus Gittinger <cg@exept.de>
parents:
2626
diff
changeset
|
1121 |
]. |
447c99ac6f76
oops - inspect & browse menu was broken.
Claus Gittinger <cg@exept.de>
parents:
2626
diff
changeset
|
1122 |
|
3138 | 1123 |
UserPreferences systemBrowserClass openInClass:cls selector:sel. |
2465 | 1124 |
! |
1125 |
||
1126 |
browseClassInA |
|
2507 | 1127 |
" |
1128 |
browse the selected method. |
|
1129 |
||
1130 |
<return: self> |
|
1131 |
" |
|
2465 | 1132 |
self browseChange:(self selectedChangeInA). |
1133 |
! |
|
2221 | 1134 |
|
2465 | 1135 |
browseClassInB |
2507 | 1136 |
" |
1137 |
browse the selected method. |
|
1138 |
||
1139 |
<return: self> |
|
1140 |
" |
|
2465 | 1141 |
self browseChange:(self selectedChangeInB). |
1142 |
! |
|
1143 |
||
1144 |
browseClassInM |
|
2507 | 1145 |
" |
1146 |
browse the selected method. |
|
1147 |
||
1148 |
<return: self> |
|
1149 |
" |
|
2465 | 1150 |
self browseChange:(self selectedChangesInM first). |
1151 |
! |
|
1152 |
||
2469 | 1153 |
createPatchFile |
2856 | 1154 |
"create a patchFile, to patch the old version (versionB) into the new version (versionA). |
1155 |
I.e. a little changeFile to transport those changes." |
|
1156 |
||
1157 |
|defaultName f oldVersion newVersion vsnMthdA vsnMthdB vsnA vsnB info| |
|
1158 |
||
1159 |
defaultName := 'patchFile.chg'. |
|
2469 | 1160 |
|
2856 | 1161 |
classChangeSet classBeingCompared notNil ifTrue:[ |
1162 |
defaultName := classChangeSet classBeingCompared nameWithoutPrefix. |
|
1163 |
classChangeSet versionA notNil ifTrue:[ |
|
1164 |
defaultName := defaultName , '-'. |
|
1165 |
defaultName := defaultName , classChangeSet versionA. |
|
1166 |
classChangeSet versionB notNil ifTrue:[ |
|
1167 |
defaultName := defaultName , '-'. |
|
1168 |
defaultName := defaultName , classChangeSet versionB. |
|
1169 |
]. |
|
1170 |
]. |
|
1171 |
defaultName := defaultName , '.chg'. |
|
1172 |
]. |
|
1173 |
f := Dialog |
|
1174 |
requestFileName:'Name of patchFile:' |
|
1175 |
default:defaultName. |
|
1176 |
self warn:'Sorry: This function is not yet implemented'. |
|
2730 | 1177 |
^ self. |
1178 |
||
3103 | 1179 |
"/ vsnMthdA := self changeSetA |
1180 |
"/ detect:[:ch | ch isMethodChange |
|
1181 |
"/ and:[ch changeClass isMeta |
|
1182 |
"/ and:[ch changeSelector = #version]]] |
|
1183 |
"/ ifNone:nil. |
|
1184 |
"/ vsnMthdB := self changeSetA |
|
1185 |
"/ detect:[:ch | ch isMethodChange |
|
1186 |
"/ and:[ch changeClass isMeta |
|
1187 |
"/ and:[ch changeSelector = #version]]] |
|
1188 |
"/ ifNone:nil. |
|
1189 |
"/ |
|
1190 |
"/ vsnMthdA notNil ifTrue:[ |
|
1191 |
"/ "/ extract the version |
|
1192 |
"/ vsnA := Class revisionStringFromSource:vsnMthdA source. |
|
1193 |
"/ vsnA notNil ifTrue:[ |
|
1194 |
"/ info := Class revisionInfoFromString:vsnA. |
|
1195 |
"/ info notNil ifTrue:[ |
|
1196 |
"/ vsnA := info at:#revision ifAbsent:nil. |
|
1197 |
"/ ] ifFalse:[ |
|
1198 |
"/ vsnA := nil. |
|
1199 |
"/ ]. |
|
1200 |
"/ ]. |
|
1201 |
"/ ]. |
|
1202 |
"/ vsnMthdB notNil ifTrue:[ |
|
1203 |
"/ "/ extract the version |
|
1204 |
"/ vsnB := Class revisionStringFromSource:vsnMthdB source. |
|
1205 |
"/ vsnB notNil ifTrue:[ |
|
1206 |
"/ info := Class revisionInfoFromString:vsnB. |
|
1207 |
"/ info notNil ifTrue:[ |
|
1208 |
"/ vsnB := info at:#revision ifAbsent:nil. |
|
1209 |
"/ ] ifFalse:[ |
|
1210 |
"/ vsnB := nil. |
|
1211 |
"/ ]. |
|
1212 |
"/ ]. |
|
1213 |
"/ ]. |
|
1214 |
"/ |
|
1215 |
"/ (vsnA isNil or:[vsnB isNil or:[vsnA = vsnB]]) ifTrue:[ |
|
1216 |
"/ self warn:'The generated patch file will not be able to validate/update the class version'. |
|
1217 |
"/ ]. |
|
1218 |
"/ |
|
1219 |
"/self halt:'not yet finished'. |
|
2469 | 1220 |
! |
1221 |
||
2465 | 1222 |
inspectSelectedChangeInA |
2507 | 1223 |
" |
1224 |
inspect the selected method change for the 'method only in version A'. |
|
1225 |
||
1226 |
<return: self> |
|
1227 |
" |
|
2465 | 1228 |
self selectedChangeInA inspect. |
2221 | 1229 |
! |
1230 |
||
1231 |
inspectSelectedChangeInB |
|
2507 | 1232 |
" |
1233 |
inspect the selected method change for the 'method only in version B'. |
|
1234 |
||
1235 |
<return: self> |
|
1236 |
" |
|
2465 | 1237 |
self selectedChangeInB inspect. |
1238 |
! |
|
1239 |
||
1240 |
inspectSelectedChangeInM |
|
2507 | 1241 |
" |
1242 |
inspect the two method changes for the selected 'changed method'. |
|
1243 |
||
1244 |
<return: self> |
|
1245 |
" |
|
2465 | 1246 |
|changes| |
1247 |
||
1248 |
changes := self selectedChangesInM. |
|
1249 |
changes do:[:change | |
|
1250 |
change inspect |
|
1251 |
]. |
|
1252 |
! |
|
1253 |
||
2501 | 1254 |
mainMenu |
2507 | 1255 |
" |
1256 |
if this application runs as an subapplication, |
|
1257 |
the menu bar should not be used. |
|
1258 |
||
1259 |
<return: self> |
|
1260 |
" |
|
2501 | 1261 |
self masterApplication isNil ifTrue:[ |
1262 |
^ self class mainMenu |
|
1263 |
]. |
|
1264 |
^ nil |
|
2221 | 1265 |
! ! |
1266 |
||
1267 |
!VersionDiffBrowser methodsFor:'private'! |
|
1268 |
||
2745 | 1269 |
addAcceptToTextViewMenus |
1270 |
" |
|
1271 |
add to the standard diff text view or single text views menu an accept entry. |
|
1272 |
The acceptAction will fetch the corresponding change and apply it |
|
1273 |
(not the shown text) |
|
1274 |
||
1275 |
<return: self> |
|
1276 |
" |
|
1277 |
||
1278 |
|m v diffTextView leftView rightView singleView| |
|
1279 |
||
1280 |
diffTextView := self diffTextView. |
|
1281 |
leftView := diffTextView leftTextView. |
|
1282 |
rightView := diffTextView rightTextView. |
|
1283 |
singleView := self builder componentAt:#singleTextView. |
|
1284 |
||
1285 |
(Array |
|
1286 |
with:leftView |
|
1287 |
with:rightView |
|
1288 |
with:singleView) |
|
1289 |
do:[:v | |
|
1290 |
m := v editMenu. |
|
1291 |
(m selectorAt:#accept) isNil ifTrue:[ |
|
2776 | 1292 |
m addLabels:(resources array:#('-' 'accept')) |
2745 | 1293 |
selectors:(Array with:nil with:#accept) |
1294 |
after:#copySelection. |
|
1295 |
]. |
|
1296 |
m |
|
1297 |
actionAt:#accept |
|
1298 |
put:[ |
|
1299 |
|idx idx2 text change changeSet| |
|
1300 |
||
1301 |
changeSet := self classChangeSet. |
|
1302 |
||
1303 |
v == singleView ifTrue:[ |
|
1304 |
self methodsOnlyInASelection value notNil |
|
1305 |
ifTrue: [ |
|
1306 |
change := (changeSet methodsOnlyInA at: self methodsOnlyInASelection value) |
|
1307 |
] ifFalse:[ |
|
1308 |
change := (changeSet methodsOnlyInB at: self methodsOnlyInBSelection value) |
|
1309 |
]. |
|
1310 |
] ifFalse:[ |
|
1311 |
idx := self methodsChangedSelection value. |
|
1312 |
||
1313 |
v == self diffTextView leftTextView ifTrue:[ |
|
1314 |
change := (changeSet methodsChanged at:idx) first. |
|
1315 |
] ifFalse:[ |
|
1316 |
change := (changeSet methodsChanged at:idx) second. |
|
1317 |
]. |
|
1318 |
]. |
|
1319 |
change apply |
|
1320 |
]. |
|
1321 |
m selectorAt:#accept put:nil. |
|
1322 |
v menuHolder:m. |
|
1323 |
v menuMessage:#value. |
|
1324 |
] |
|
1325 |
! |
|
1326 |
||
2497 | 1327 |
generator |
2507 | 1328 |
" |
1329 |
generate a print string for a change. |
|
2497 | 1330 |
|
2507 | 1331 |
<return: Block> |
1332 |
" |
|
1333 |
^[:aChange | |
|
2585 | 1334 |
|result mPkg cPkg cls m changeClassName| |
1335 |
||
2507 | 1336 |
aChange isClassDefinitionChange ifTrue:[ |
2585 | 1337 |
result := aChange printStringWithoutClassName |
2497 | 1338 |
] ifFalse:[ |
2507 | 1339 |
aChange isDoIt ifTrue:[ |
1340 |
result := aChange source , ' (doIt)' |
|
2497 | 1341 |
] ifFalse:[ |
2585 | 1342 |
changeClassName := aChange className. |
1343 |
changeClassName = self classBeingCompared name ifTrue:[ |
|
1344 |
result := aChange printStringWithoutClassName. |
|
2745 | 1345 |
|
1346 |
aChange isMethodCategoryChange ifTrue:[ |
|
1347 |
result := result , ' (category)' |
|
1348 |
] ifFalse:[ |
|
1349 |
aChange isMethodChange ifTrue:[ |
|
1350 |
cls := aChange changeClass. |
|
1351 |
cls notNil ifTrue:[ |
|
1352 |
m := cls compiledMethodAt:aChange selector. |
|
1353 |
(m notNil |
|
1354 |
and:[m package ~= cls package]) ifTrue:[ |
|
1355 |
result := aChange printStringWithoutClassName , ' [' , m package , ']'. |
|
1356 |
]. |
|
2497 | 1357 |
]. |
2745 | 1358 |
] |
2497 | 1359 |
] |
1360 |
] ifFalse:[ |
|
1361 |
"/ include name in private class changes |
|
2585 | 1362 |
(changeClassName startsWith:(self classBeingCompared name , '::')) ifTrue:[ |
1363 |
result := (changeClassName copyFrom:(self classBeingCompared name size + 3)) , ' ' , aChange printStringWithoutClassName |
|
2497 | 1364 |
] ifFalse:[ |
2507 | 1365 |
result := aChange printString |
2497 | 1366 |
] |
1367 |
] |
|
1368 |
] |
|
1369 |
]. |
|
1370 |
result |
|
1371 |
]. |
|
1372 |
! |
|
1373 |
||
2501 | 1374 |
resetSelectionHolders |
2507 | 1375 |
" |
1376 |
reset all selection holders when a new change set is given. |
|
1377 |
First set the selection to nil. |
|
1378 |
||
1379 |
<return: self> |
|
1380 |
" |
|
2501 | 1381 |
|
1382 |
self methodsChangedSelection value:nil. |
|
1383 |
self methodsOnlyInASelection value:nil. |
|
1384 |
self methodsOnlyInBSelection value:nil. |
|
2507 | 1385 |
self diffTextView text1:'' text2:''. |
1386 |
self methodText value:''. |
|
1387 |
||
1388 |
"/ self methodsChangedSelectionChanged. |
|
1389 |
"/ self methodsOnlyInASelectionChanged. |
|
1390 |
"/ self methodsOnlyInBSelectionChanged. |
|
2501 | 1391 |
|
1392 |
! |
|
1393 |
||
2221 | 1394 |
showDiffTextView |
2507 | 1395 |
" |
1396 |
if a method change is selected, then show the diff text view. |
|
1397 |
Add an accept entry to the popup menu. |
|
1398 |
||
1399 |
<return: self> |
|
1400 |
" |
|
2694 | 1401 |
|builder| |
1402 |
||
1403 |
builder := self builder. |
|
1404 |
(builder componentAt:#diffTextViewBox) raise; beVisible. |
|
1405 |
(builder componentAt:#singleTextView) beInvisible. |
|
1406 |
(builder componentAt:#diffTextView) realizeAllSubViews. |
|
1407 |
||
2465 | 1408 |
self addAcceptToTextViewMenus. |
2221 | 1409 |
! |
1410 |
||
1411 |
showSingleTextView |
|
2507 | 1412 |
" |
1413 |
if a method is selected which is only in version A or B of the class, |
|
1414 |
then show the text view. |
|
1415 |
Add an accept entry to the popup menu. |
|
1416 |
||
1417 |
<return: self> |
|
1418 |
" |
|
1419 |
||
2694 | 1420 |
|builder| |
1421 |
||
1422 |
builder := self builder. |
|
1423 |
(builder componentAt:#singleTextView) raise; beVisible. |
|
1424 |
(builder componentAt:#diffTextViewBox) beInvisible. |
|
2501 | 1425 |
self addAcceptToTextViewMenus. |
2221 | 1426 |
! |
1427 |
||
2497 | 1428 |
updateLabels |
2507 | 1429 |
" |
1430 |
update the labels of the diff text view. Show the version numbers |
|
1431 |
of the class. |
|
2221 | 1432 |
|
2507 | 1433 |
<return: self> |
1434 |
" |
|
2221 | 1435 |
|
2694 | 1436 |
|theVersionA theVersionB builder| |
2224 | 1437 |
|
2694 | 1438 |
builder := self builder. |
2497 | 1439 |
(theVersionA := self versionA) notNil ifTrue:[ |
1440 |
self diffTextLabelA value:theVersionA. |
|
2726 | 1441 |
self onlyInALabelHolder value:('Only in ' , theVersionA). |
2694 | 1442 |
(builder componentAt:#OnlyInALabel) backgroundColor:Color green darkened. |
2224 | 1443 |
]. |
2497 | 1444 |
(theVersionB :=self versionB) notNil ifTrue:[ |
1445 |
self diffTextLabelB value:theVersionB. |
|
2726 | 1446 |
self onlyInBLabelHolder value:('Only in ' , theVersionB). |
2694 | 1447 |
(builder componentAt:#OnlyInBLabel) backgroundColor:Color red darkened. |
2224 | 1448 |
]. |
1449 |
! |
|
1450 |
||
1451 |
updateLists |
|
2507 | 1452 |
"walk over the two changeSets and add change to one of the tree lists. |
1453 |
Methods which belong to the version A of the class or version B go |
|
1454 |
to the list methodsOnlyInA or methodsOnlyInB. |
|
1455 |
Methods which are changed from version A to B go to the list methodsChanged. |
|
1456 |
||
1457 |
<return: self> |
|
1458 |
" |
|
2731 | 1459 |
|classChangeSet listOnlyInA listOnlyInB listChanged| |
2230
5e10eebb1de2
move change-compare code to where it belongs (Change-hierarchy)
Claus Gittinger <cg@exept.de>
parents:
2229
diff
changeset
|
1460 |
|
2585 | 1461 |
classChangeSet := self classChangeSet. |
1462 |
||
2731 | 1463 |
listOnlyInA := self methodsOnlyInA. |
1464 |
listOnlyInA removeAll. |
|
1465 |
classChangeSet notNil ifTrue:[ |
|
1466 |
listOnlyInA addAll: (classChangeSet methodsOnlyInA collect:self generator). |
|
1467 |
]. |
|
2585 | 1468 |
|
2731 | 1469 |
listOnlyInB := self methodsOnlyInB. |
1470 |
listOnlyInB removeAll. |
|
1471 |
classChangeSet notNil ifTrue:[ |
|
1472 |
listOnlyInB addAll: (classChangeSet methodsOnlyInB collect:self generator). |
|
1473 |
]. |
|
2221 | 1474 |
|
2731 | 1475 |
listChanged := self methodsChanged. |
1476 |
listChanged removeAll. |
|
1477 |
classChangeSet notNil ifTrue:[ |
|
1478 |
listChanged addAll: (classChangeSet methodsChanged collect:[:arr| self generator value:(arr first)]). |
|
1479 |
]. |
|
2221 | 1480 |
|
2731 | 1481 |
self boxAVisible value:(listOnlyInA notEmpty). |
1482 |
self boxBVisible value:(listOnlyInB notEmpty). |
|
2221 | 1483 |
|
2731 | 1484 |
self boxMVisible value:(listChanged isEmpty |
1485 |
and: [(listOnlyInA notEmpty |
|
1486 |
or:[listOnlyInB notEmpty])]) not. |
|
2221 | 1487 |
! ! |
1488 |
||
2501 | 1489 |
!VersionDiffBrowser methodsFor:'setup'! |
1490 |
||
2695 | 1491 |
setupForClass:aClass againstVersion:aVersionA |
1492 |
" |
|
1493 |
compute the class change set for the class aClass of its current version against the repository version A. |
|
1494 |
When setting the class change set, the labels, list etc. of the receiver |
|
1495 |
are updated. |
|
1496 |
||
1497 |
<return: self> |
|
1498 |
" |
|
2731 | 1499 |
|changeSet| |
1500 |
||
2745 | 1501 |
aClass isNil ifTrue:[ |
1502 |
changeSet := nil |
|
1503 |
] ifFalse:[ |
|
1504 |
aClass isNameSpace ifFalse:[ |
|
1505 |
aClass isLoaded ifTrue:[ |
|
1506 |
changeSet := (ClassChangeSet newForClass:aClass againstVersion:aVersionA). |
|
1507 |
] |
|
1508 |
]. |
|
2731 | 1509 |
]. |
2856 | 1510 |
self classChangeSet:changeSet. |
2857
0c467f6b1741
handle case if invoked without versionString
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
1511 |
aVersionA isNil ifTrue:[ |
0c467f6b1741
handle case if invoked without versionString
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
1512 |
self class:aClass versionA:'rep' versionB:'current'. |
0c467f6b1741
handle case if invoked without versionString
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
1513 |
] ifFalse:[ |
0c467f6b1741
handle case if invoked without versionString
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
1514 |
self class:aClass versionA:aVersionA versionB:(aVersionA , 'm'). |
0c467f6b1741
handle case if invoked without versionString
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
1515 |
] |
2695 | 1516 |
! |
1517 |
||
2949 | 1518 |
setupForClass:classA labelA:aLabelA andClass:classB labelB:aLabelB |
1519 |
" |
|
1520 |
generate the class change set from the two classes A and B. |
|
1521 |
When setting the class change set, the labels, list etc. of the receiver |
|
1522 |
are updated. |
|
1523 |
||
1524 |
<return: self> |
|
1525 |
" |
|
1526 |
|changeSet| |
|
1527 |
||
1528 |
changeSet := (ClassChangeSet newForClass:classA labelA:aLabelA andClass:classB labelB:aLabelB). |
|
1529 |
self classChangeSet:changeSet |
|
1530 |
||
1531 |
||
1532 |
||
1533 |
||
1534 |
||
1535 |
! |
|
1536 |
||
2510 | 1537 |
setupForClass:aClass labelA:aLabelA sourceA:aSourceA labelB:aLabelB sourceB:aSourceB |
1538 |
" |
|
1539 |
generate the class change set from the two source files A and B. |
|
1540 |
When setting the class change set, the labels, list etc. of the receiver |
|
1541 |
are updated. |
|
1542 |
||
1543 |
<return: self> |
|
1544 |
" |
|
2731 | 1545 |
|changeSet| |
1546 |
||
2751
f2fbe11e166a
oops - isNameSpace query prevented Smalltalk-diffs from beeing shown
Claus Gittinger <cg@exept.de>
parents:
2745
diff
changeset
|
1547 |
(aClass isNameSpace not or:[aClass == Smalltalk]) ifTrue:[ |
2731 | 1548 |
aClass isLoaded ifTrue:[ |
1549 |
changeSet := (ClassChangeSet newForClass:aClass labelA:aLabelA sourceA:aSourceA labelB:aLabelB sourceB:aSourceB). |
|
1550 |
] |
|
1551 |
]. |
|
1552 |
self classChangeSet:changeSet |
|
2510 | 1553 |
! |
1554 |
||
2501 | 1555 |
setupForClass:aClass versionA:aVersionA versionB:aVersionB |
2507 | 1556 |
" |
1557 |
compute the class change set for the class aClass and the versions A and B. |
|
1558 |
When setting the class change set, the labels, list etc. of the receiver |
|
1559 |
are updated. |
|
2501 | 1560 |
|
2507 | 1561 |
<return: self> |
1562 |
" |
|
2731 | 1563 |
|changeSet| |
1564 |
||
1565 |
aClass isNameSpace ifFalse:[ |
|
1566 |
aClass isLoaded ifTrue:[ |
|
1567 |
changeSet := (ClassChangeSet newForClass:aClass versionA:aVersionA versionB:aVersionB). |
|
1568 |
] |
|
1569 |
]. |
|
2856 | 1570 |
self classChangeSet:changeSet. |
1571 |
self class:aClass versionA:aVersionA versionB:aVersionB. |
|
2501 | 1572 |
! ! |
1573 |
||
2497 | 1574 |
!VersionDiffBrowser::ClassChangeSet class methodsFor:'instance creation'! |
1575 |
||
2695 | 1576 |
changeSetForClass:aClass |
1577 |
"return a ChangeSet for the class aClass and its current source. |
|
1578 |
The source is generated into a stream and then the change set is generated |
|
1579 |
from the source stream. |
|
1580 |
||
1581 |
<return: ChangeSet|nil> |
|
1582 |
" |
|
1583 |
|theChangeSet source s| |
|
1584 |
||
1585 |
s := '' writeStream. |
|
1586 |
aClass fileOutOn:s. |
|
1587 |
source := s contents. |
|
1588 |
||
1589 |
theChangeSet := ChangeSet fromStream:(source readStream). |
|
1590 |
^theChangeSet |
|
1591 |
! |
|
1592 |
||
2497 | 1593 |
changeSetForClass:aClass andRevision:aVersion |
1594 |
"return a ChangeSet for the class aClass and version aVersion. |
|
1595 |
The version from the class source stream is checked out from the repositiory |
|
1596 |
into a source stream. Then the change set is generated from the source stream. |
|
1597 |
||
1598 |
<return: ChangeSet|nil> |
|
1599 |
" |
|
1600 |
|theSourceCodeManager theSourceStream theChangeSet| |
|
1601 |
||
1602 |
theSourceCodeManager := aClass sourceCodeManager. |
|
1603 |
[theSourceStream := theSourceCodeManager getSourceStreamFor:aClass revision:aVersion. |
|
1604 |
theSourceStream notNil |
|
1605 |
ifTrue:[theChangeSet:=ChangeSet fromStream:theSourceStream]] |
|
1606 |
valueNowOrOnUnwindDo: |
|
1607 |
[theSourceStream notNil ifTrue:[theSourceStream close]]. |
|
1608 |
^theChangeSet |
|
1609 |
! |
|
1610 |
||
1611 |
changeSetForClass:aClass andSource:aSource |
|
1612 |
"return a ChangeSet for the class aClass and source aSource. |
|
1613 |
The source is converted to a stream and then the change set is generated |
|
1614 |
from the source stream. |
|
1615 |
||
1616 |
<return: ChangeSet|nil> |
|
1617 |
" |
|
1618 |
|theChangeSet theSourceStream| |
|
1619 |
||
1620 |
[(theSourceStream := aSource readStream) notNil |
|
1621 |
ifTrue:[theChangeSet:=ChangeSet fromStream:(theSourceStream := aSource readStream)]] |
|
1622 |
valueNowOrOnUnwindDo: |
|
1623 |
[theSourceStream notNil |
|
1624 |
ifTrue:[theSourceStream close]]. |
|
1625 |
^theChangeSet |
|
1626 |
! |
|
1627 |
||
2695 | 1628 |
newForClass:aClass againstVersion:aVersionA |
1629 |
"return a ClassChangeSet for the class aClass against some verison in the repository. |
|
1630 |
A new instance of ClassChangeSet is generated containing |
|
1631 |
the correspondenting changes. |
|
1632 |
||
1633 |
<return: ClassChangeSet> |
|
1634 |
" |
|
2710
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1635 |
|theChangeSetA theChangeSetB theClassChangeSet versionCompared diffSet| |
2695 | 1636 |
|
1637 |
theClassChangeSet := self new. |
|
1638 |
theClassChangeSet classBeingCompared:aClass. |
|
1639 |
versionCompared := aVersionA. |
|
1640 |
aVersionA isNil ifTrue:[ |
|
1641 |
theClassChangeSet labelA:(versionCompared := aClass revision). |
|
2856 | 1642 |
theClassChangeSet versionA:versionCompared. |
2695 | 1643 |
] ifFalse:[ |
1644 |
aVersionA == #newest ifTrue:[ |
|
2776 | 1645 |
theClassChangeSet labelA:(VersionDiffBrowser resources string:'newest'). |
2695 | 1646 |
] ifFalse:[ |
1647 |
theClassChangeSet labelA:versionCompared. |
|
2856 | 1648 |
theClassChangeSet versionA:versionCompared. |
2695 | 1649 |
] |
1650 |
]. |
|
2776 | 1651 |
theClassChangeSet labelB:(VersionDiffBrowser resources string:'current'). |
2695 | 1652 |
theChangeSetA := self changeSetForClass: aClass andRevision: versionCompared. |
1653 |
theChangeSetB := self changeSetForClass: aClass. |
|
1654 |
theChangeSetA isNil |
|
1655 |
ifTrue: [theChangeSetA := ChangeSet new]. |
|
1656 |
theChangeSetB isNil |
|
1657 |
ifTrue: [theChangeSetB := ChangeSet new]. |
|
2710
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1658 |
"/ if we are comparing a private class, prune out other changes |
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1659 |
aClass isPrivate ifTrue:[ |
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1660 |
theChangeSetA removeAllSuchThat:[:aChange | |
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1661 |
aChange className ~= aClass name |
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1662 |
]. |
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1663 |
theChangeSetB removeAllSuchThat:[:aChange | |
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1664 |
aChange className ~= aClass name |
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1665 |
]. |
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1666 |
]. |
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1667 |
self activityNotification:'generating diff-set...'. |
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1668 |
diffSet := theClassChangeSet diffSet:(theChangeSetA diffSetsAgainst:theChangeSetB). |
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1669 |
self activityNotification:nil. |
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1670 |
^ diffSet |
2695 | 1671 |
! |
1672 |
||
2949 | 1673 |
newForClass:classA labelA:aLabelA andClass:classB labelB:aLabelB |
1674 |
"return a ClassChangeSet for two classes. |
|
1675 |
A new instance of ClassChangeSet is generated containing the correspondenting changes. |
|
1676 |
||
1677 |
<return: ClassChangeSet> |
|
1678 |
" |
|
1679 |
|aStream sourceA sourceB theChangeSetA theChangeSetB theClassChangeSet| |
|
1680 |
||
1681 |
theClassChangeSet := self new. |
|
1682 |
theClassChangeSet classBeingCompared:classA. |
|
1683 |
theClassChangeSet labelA:aLabelA. |
|
1684 |
theClassChangeSet labelB:aLabelB. |
|
1685 |
||
1686 |
aStream := '' writeStream. |
|
1687 |
Method flushSourceStreamCache. |
|
1688 |
classA fileOutOn:aStream withTimeStamp:false. |
|
1689 |
sourceA := aStream contents asString. |
|
1690 |
||
1691 |
aStream := '' writeStream. |
|
1692 |
Method flushSourceStreamCache. |
|
1693 |
classB fileOutOn:aStream withTimeStamp:false. |
|
1694 |
sourceB := aStream contents asString. |
|
1695 |
||
1696 |
theChangeSetA:=self changeSetForClass:classA andSource:sourceA. |
|
1697 |
theChangeSetB:=self changeSetForClass:classB andSource:sourceB. |
|
1698 |
theChangeSetA isNil |
|
1699 |
ifTrue: [theChangeSetA := ChangeSet new]. |
|
1700 |
theChangeSetB isNil |
|
1701 |
ifTrue: [theChangeSetB := ChangeSet new]. |
|
1702 |
||
1703 |
"/ just in case (if comparing a class against another), |
|
1704 |
"/ unify the classes of the changes (to avoid that all changes are detected as different) |
|
1705 |
||
1706 |
theChangeSetB do:[:eachChange | |
|
1707 |
eachChange isMethodChange ifTrue:[ |
|
1708 |
eachChange changeClass isMeta ifTrue:[ |
|
1709 |
eachChange changeClass ~~ classA theMetaclass ifTrue:[ |
|
1710 |
eachChange changeClass:classA theMetaclass. |
|
1711 |
] |
|
1712 |
] ifFalse:[ |
|
1713 |
eachChange changeClass ~~ classA theNonMetaclass ifTrue:[ |
|
1714 |
eachChange changeClass:classA theNonMetaclass. |
|
1715 |
] |
|
1716 |
]. |
|
1717 |
]. |
|
1718 |
]. |
|
1719 |
"/ remove all #initialize doIts |
|
1720 |
theChangeSetA := theChangeSetA select:[:eachChange | eachChange isDoIt not or:[eachChange isInitialize not]]. |
|
1721 |
theChangeSetB := theChangeSetB select:[:eachChange | eachChange isDoIt not or:[eachChange isInitialize not]]. |
|
1722 |
||
1723 |
^theClassChangeSet diffSet:(theChangeSetA diffSetsAgainst:theChangeSetB) |
|
1724 |
! |
|
1725 |
||
2497 | 1726 |
newForClass:aClass labelA:aLabelA sourceA:aSourceA labelB:aLabelB sourceB:aSourceB |
1727 |
"return a ClassChangeSet for the class aClass and the two sources. |
|
1728 |
The two classes are compared via the source files. A new instance of |
|
1729 |
ClassChangeSet is generated containing the correspondenting changes. |
|
1730 |
||
1731 |
<return: ClassChangeSet> |
|
1732 |
" |
|
1733 |
|theChangeSetA theChangeSetB theClassChangeSet| |
|
1734 |
||
1735 |
theClassChangeSet := self new. |
|
1736 |
theClassChangeSet classBeingCompared:aClass. |
|
1737 |
theClassChangeSet labelA:aLabelA. |
|
1738 |
theClassChangeSet labelB:aLabelB. |
|
1739 |
theChangeSetA:=self changeSetForClass:aClass andSource:aSourceA. |
|
1740 |
theChangeSetB:=self changeSetForClass:aClass andSource:aSourceB. |
|
1741 |
theChangeSetA isNil |
|
1742 |
ifTrue: [theChangeSetA := ChangeSet new]. |
|
1743 |
theChangeSetB isNil |
|
1744 |
ifTrue: [theChangeSetB := ChangeSet new]. |
|
2947 | 1745 |
|
2695 | 1746 |
^theClassChangeSet diffSet:(theChangeSetA diffSetsAgainst:theChangeSetB) |
2465 | 1747 |
! |
1748 |
||
2497 | 1749 |
newForClass:aClass versionA:aVersionA versionB:aVersionB |
1750 |
"return a ClassChangeSet for the class aClass and the two versions. |
|
1751 |
The two class version are checked out from the repository and then being |
|
1752 |
compared. A new instance of ClassChangeSet is generated containing |
|
1753 |
the correspondenting changes. |
|
1754 |
||
1755 |
<return: ClassChangeSet> |
|
1756 |
" |
|
1757 |
|theChangeSetA theChangeSetB theClassChangeSet| |
|
1758 |
||
1759 |
theClassChangeSet := self new. |
|
1760 |
theClassChangeSet classBeingCompared:aClass. |
|
2856 | 1761 |
theClassChangeSet versionA:aVersionA. |
1762 |
theClassChangeSet versionB:aVersionB. |
|
2497 | 1763 |
theClassChangeSet labelA:aVersionA. |
1764 |
theClassChangeSet labelB:aVersionB. |
|
1765 |
theChangeSetA := self changeSetForClass: aClass andRevision: aVersionA. |
|
1766 |
theChangeSetB := self changeSetForClass: aClass andRevision: aVersionB. |
|
1767 |
theChangeSetA isNil |
|
1768 |
ifTrue: [theChangeSetA := ChangeSet new]. |
|
1769 |
theChangeSetB isNil |
|
1770 |
ifTrue: [theChangeSetB := ChangeSet new]. |
|
2695 | 1771 |
^theClassChangeSet diffSet:(theChangeSetA diffSetsAgainst:theChangeSetB) |
2497 | 1772 |
! ! |
1773 |
||
1774 |
!VersionDiffBrowser::ClassChangeSet methodsFor:'accessing'! |
|
1775 |
||
1776 |
classBeingCompared |
|
1777 |
"returns the value of the class which is compared |
|
1778 |
||
1779 |
<return: Behavior> |
|
1780 |
" |
|
1781 |
||
1782 |
^ classBeingCompared |
|
1783 |
! |
|
2221 | 1784 |
|
2497 | 1785 |
classBeingCompared:something |
1786 |
"set the value of the class which is compared |
|
1787 |
||
1788 |
<return: self>" |
|
1789 |
||
1790 |
classBeingCompared := something. |
|
1791 |
! |
|
1792 |
||
2695 | 1793 |
diffSet |
1794 |
"returns a identity dictionary containing the different changes. |
|
1795 |
key: value: |
|
1796 |
#changed OrderedCollection of arrays containing ChangeSets for methods |
|
1797 |
which are changed and exists in the class versionA and versionB |
|
1798 |
#onlyInArg ChangeSet for the methods which exists only in the class versionB |
|
1799 |
#onlyInReceiver ChangeSet for the methods which exists only in the class versionA |
|
1800 |
||
1801 |
<return: IdentityDictionary> |
|
1802 |
" |
|
1803 |
^ diffSet |
|
1804 |
! |
|
1805 |
||
1806 |
diffSet:something |
|
1807 |
"sets a identity dictionary containing the different changes. |
|
1808 |
key: value: |
|
1809 |
#changed OrderedCollection of arrays containing ChangeSets for methods |
|
1810 |
which are changed and exists in the class versionA and versionB |
|
1811 |
#onlyInArg ChangeSet for the methods which exists only in the class versionB |
|
1812 |
#onlyInReceiver ChangeSet for the methods which exists only in the class versionA |
|
1813 |
||
1814 |
<return: self> |
|
1815 |
" |
|
1816 |
||
1817 |
diffSet := something. |
|
1818 |
! |
|
1819 |
||
2497 | 1820 |
labelA |
1821 |
"returns the label for the class versionA |
|
1822 |
||
1823 |
<return: String> |
|
1824 |
" |
|
1825 |
^ labelA |
|
1826 |
! |
|
1827 |
||
1828 |
labelA:something |
|
1829 |
"sets the label for the class versionA |
|
1830 |
||
1831 |
<return: self> |
|
1832 |
" |
|
1833 |
labelA := something. |
|
1834 |
! |
|
1835 |
||
1836 |
labelB |
|
1837 |
"returns the label for the class versionB |
|
1838 |
||
1839 |
<return: String> |
|
1840 |
" |
|
1841 |
^ labelB |
|
1842 |
! |
|
2465 | 1843 |
|
2497 | 1844 |
labelB:something |
1845 |
"sets the label for the class versionB |
|
1846 |
||
1847 |
<return: self> |
|
1848 |
" |
|
1849 |
||
1850 |
labelB := something. |
|
1851 |
! |
|
1852 |
||
1853 |
methodsChanged |
|
1854 |
"returns a OrderedCollection of arrays containing ChangeSets for methods |
|
1855 |
which are changed and exists in the class versionA and versionB |
|
1856 |
||
1857 |
<return: OrderedCollection> |
|
1858 |
" |
|
2695 | 1859 |
^ self diffSet at:#changed |
2497 | 1860 |
! |
1861 |
||
1862 |
methodsOnlyInA |
|
1863 |
"returns a ChangeSet for the methods which exists only in the class versionA |
|
1864 |
||
1865 |
<return: ChangeSet> |
|
1866 |
" |
|
1867 |
||
2695 | 1868 |
^ self diffSet at:#onlyInReceiver |
2497 | 1869 |
! |
1870 |
||
1871 |
methodsOnlyInB |
|
1872 |
"returns a ChangeSet for the methods which exists only in the class versionB |
|
1873 |
||
1874 |
<return: ChangeSet> |
|
1875 |
" |
|
1876 |
||
2695 | 1877 |
^ self diffSet at:#onlyInArg |
2856 | 1878 |
! |
1879 |
||
1880 |
versionA |
|
1881 |
"return the value of the instance variable 'versionA' (automatically generated)" |
|
1882 |
||
1883 |
^ versionA |
|
1884 |
! |
|
1885 |
||
1886 |
versionA:something |
|
1887 |
"set the value of the instance variable 'versionA' (automatically generated)" |
|
1888 |
||
1889 |
versionA := something. |
|
1890 |
! |
|
1891 |
||
1892 |
versionB |
|
1893 |
"return the value of the instance variable 'versionB' (automatically generated)" |
|
1894 |
||
1895 |
^ versionB |
|
1896 |
! |
|
1897 |
||
1898 |
versionB:something |
|
1899 |
"set the value of the instance variable 'versionB' (automatically generated)" |
|
1900 |
||
1901 |
versionB := something. |
|
2221 | 1902 |
! ! |
1903 |
||
1904 |
!VersionDiffBrowser class methodsFor:'documentation'! |
|
1905 |
||
1906 |
version |
|
3146 | 1907 |
^ '$Header: /cvs/stx/stx/libtool/VersionDiffBrowser.st,v 1.45 2001-09-10 17:33:44 cg Exp $' |
2221 | 1908 |
! ! |