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