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