author | Claus Gittinger <cg@exept.de> |
Fri, 15 Dec 1995 13:09:05 +0100 | |
changeset 154 | 0478e111188d |
parent 149 | f7d66ab71259 |
child 178 | daae23ef8c93 |
permissions | -rw-r--r-- |
46 | 1 |
" |
2 |
COPYRIGHT (c) 1995 by AEG Industry Automation |
|
3 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
4 |
All Rights Reserved |
|
5 |
||
6 |
This software is furnished under a license and may be used |
|
7 |
only in accordance with the terms of that license and with the |
|
8 |
inclusion of the above copyright notice. This software may not |
|
9 |
be provided or otherwise made available to, or used by, any |
|
10 |
other person. No title to or ownership of the software is |
|
11 |
hereby transferred. |
|
12 |
" |
|
13 |
||
120 | 14 |
Object subclass:#HistoryManager |
149
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
15 |
instanceVariableNames:'historyMode' |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
16 |
classVariableNames:'TheOneAndOnlyInstance' |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
17 |
poolDictionaries:'' |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
18 |
category:'System-Changes-History' |
41 | 19 |
! |
20 |
||
21 |
!HistoryManager class methodsFor:'documentation'! |
|
22 |
||
46 | 23 |
copyright |
24 |
" |
|
25 |
COPYRIGHT (c) 1995 by AEG Industry Automation |
|
26 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
27 |
All Rights Reserved |
|
28 |
||
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
! |
|
37 |
||
41 | 38 |
documentation |
39 |
" |
|
40 |
This class is part of the |
|
41 |
----------------------- |
|
42 |
HistoryManagerProject. |
|
43 |
----------------------- |
|
44 |
It is used to create a multi user Smalltalk developers Environemt. |
|
45 |
||
46 |
All Methods and Classes in the system get a HistroyLine which contains a timestamp |
|
47 |
and the name of the Editor. This is acually the UniX loginname. |
|
48 |
The Manager registers all Classes in the System to get notifications on change. |
|
49 |
||
46 | 50 |
Author: Robert Sailer - AEG |
41 | 51 |
" |
52 |
! |
|
53 |
||
54 |
examples |
|
55 |
" |
|
56 |
HistoryManager new |
|
57 |
" |
|
58 |
"Modified: 11.08.1995 / 16:50:47 / robert" |
|
59 |
! ! |
|
60 |
||
61 |
!HistoryManager class methodsFor:'initialization'! |
|
62 |
||
87 | 63 |
initMe |
64 |
"setup TheOneAndOnlyInstance (if not already present" |
|
65 |
^self new. |
|
66 |
||
67 |
"Modified: 14.08.1995 / 9:52:40 / robert" |
|
68 |
! |
|
69 |
||
41 | 70 |
initialize |
71 |
"" |
|
72 |
ObjectMemory addDependent: self. |
|
73 |
||
74 |
"Modified: 14.08.1995 / 9:49:56 / robert" |
|
75 |
! ! |
|
76 |
||
77 |
!HistoryManager class methodsFor:'instance creation'! |
|
78 |
||
79 |
new |
|
46 | 80 |
"because there can be only ONE HistoryManager, new must me redefiend" |
41 | 81 |
|
82 |
TheOneAndOnlyInstance isNil ifTrue:[ |
|
83 |
TheOneAndOnlyInstance := super new initialize. |
|
84 |
HistoryLine initialize. |
|
85 |
]. |
|
86 |
||
87 |
^ TheOneAndOnlyInstance |
|
88 |
||
89 |
" |
|
90 |
||
91 |
HistoryManager new. |
|
92 |
" |
|
93 |
||
94 |
"Modified: 11.08.1995 / 17:01:29 / robert" |
|
95 |
! ! |
|
96 |
||
97 |
!HistoryManager class methodsFor:'accessing'! |
|
98 |
||
99 |
instance |
|
100 |
"return the class variable" |
|
101 |
||
102 |
^TheOneAndOnlyInstance |
|
103 |
! |
|
104 |
||
105 |
isActive |
|
106 |
^TheOneAndOnlyInstance notNil |
|
107 |
||
108 |
"Modified: 27.8.1995 / 00:32:12 / claus" |
|
109 |
! ! |
|
110 |
||
111 |
!HistoryManager class methodsFor:'activation / deactivation'! |
|
112 |
||
113 |
activate |
|
114 |
self new "/ creating an instance activates me |
|
115 |
! |
|
116 |
||
117 |
deactivate |
|
118 |
Smalltalk allClassesDo:[:aClass | |
|
119 |
aClass removeDependent:TheOneAndOnlyInstance. |
|
120 |
aClass class removeDependent:TheOneAndOnlyInstance. |
|
121 |
]. |
|
122 |
TheOneAndOnlyInstance := nil. |
|
123 |
||
124 |
" |
|
125 |
HistoryManager release |
|
126 |
" |
|
127 |
! ! |
|
128 |
||
87 | 129 |
!HistoryManager class methodsFor:'change and update'! |
130 |
||
131 |
update: what |
|
132 |
(what == #restarted) ifTrue:[ |
|
133 |
TheOneAndOnlyInstance notNil ifTrue:[ |
|
134 |
" |
|
135 |
smalltalk is about to restart from an Image - |
|
136 |
" |
|
137 |
"/ 'HistoryManager initialize (via update)' infoPrintNL. |
|
138 |
self initMe. |
|
139 |
] |
|
140 |
]. |
|
141 |
||
142 |
"Modified: 27.8.1995 / 16:33:02 / claus" |
|
143 |
! ! |
|
144 |
||
47 | 145 |
!HistoryManager class methodsFor:'helpers'! |
146 |
||
147 |
getAllHistoriesFrom:someString |
|
148 |
"returns anArray of HistoryLines" |
|
149 |
||
150 |
|position aReadWriteStream firstFound nextFound aHistoryString rcOC h| |
|
151 |
||
152 |
"read begining from the end and look there for the first comment character. If there's none return" |
|
153 |
||
154 |
rcOC := OrderedCollection new. |
|
155 |
position := someString size. |
|
156 |
firstFound := false. |
|
157 |
nextFound := false. |
|
158 |
||
159 |
someString reverseDo:[ :aChar| |
|
160 |
position := position - 1. |
|
161 |
aChar = $" ifTrue:[ |
|
162 |
firstFound ifTrue:[ |
|
163 |
firstFound := false. |
|
164 |
nextFound := true. |
|
165 |
] ifFalse:[ |
|
166 |
aReadWriteStream := ReadWriteStream on: String new. |
|
167 |
firstFound := true. |
|
168 |
nextFound := false. |
|
169 |
]. |
|
170 |
]. |
|
171 |
(firstFound and: [nextFound not]) ifTrue:[ |
|
172 |
"now collect all up to the next comment character" |
|
173 |
aChar = $" ifFalse:[ |
|
174 |
aReadWriteStream nextPut: aChar. |
|
175 |
]. |
|
176 |
]. |
|
177 |
nextFound ifTrue:[ |
|
178 |
"End reached - now try to make a HistoryLine" |
|
179 |
aHistoryString := (aReadWriteStream contents) reverse. |
|
180 |
" |
|
181 |
Transcript showCr: aHistoryString. |
|
182 |
" |
|
183 |
h := HistoryLine fromString: aHistoryString at: position. |
|
184 |
h notNil ifTrue:[ |
|
185 |
rcOC add:h. |
|
186 |
]. |
|
187 |
"/ (aHistoryString startsWith: 'Modified:') ifTrue:[ |
|
188 |
"/ "a history line was found - now make a NewInstance of HistoryLine" |
|
189 |
"/ rcOC add: ( HistoryLine fromString: aHistoryString at: position). |
|
190 |
"/ ]. |
|
191 |
nextFound := false. |
|
192 |
]. |
|
193 |
]. |
|
194 |
||
195 |
^rcOC reverse "the OrderedCollection with HistoryLines in the right order" |
|
196 |
||
197 |
"Modified: 21.12.1993 / 18:32:30 / M.Noell" |
|
198 |
"Modified: 9.8.1995 / 22:45:30 / R.Sailer" |
|
199 |
"Modified: 8.9.1995 / 17:54:33 / claus" |
|
200 |
! ! |
|
201 |
||
41 | 202 |
!HistoryManager methodsFor:'accessing'! |
203 |
||
204 |
historyMode |
|
205 |
"return historyMode" |
|
206 |
||
207 |
^ historyMode |
|
208 |
||
209 |
"Modified: 11.08.1995 / 16:51:56 / robert" |
|
210 |
! |
|
211 |
||
212 |
historyMode:something |
|
213 |
"set historyMode" |
|
214 |
||
215 |
historyMode := something. |
|
216 |
||
217 |
"Modified: 11.08.1995 / 16:52:12 / robert" |
|
218 |
! ! |
|
219 |
||
220 |
!HistoryManager methodsFor:'initialization'! |
|
221 |
||
222 |
exclude |
|
46 | 223 |
"public - return an exclusionlist for some smalltalk classes which should not be notified or historisized" |
41 | 224 |
|
225 |
| oc | |
|
226 |
||
227 |
oc := OrderedCollection new. |
|
228 |
oc add: self. |
|
229 |
||
230 |
^oc |
|
231 |
||
232 |
"Modified: 11.08.1995 / 17:02:18 / robert" |
|
233 |
! |
|
234 |
||
235 |
initialize |
|
46 | 236 |
"public - make me depend on all smalltalk classes (except the exclusionList) |
237 |
to be notified later about changes. This intercepts source installation and allows |
|
238 |
be to patch the source-string with a historyLine." |
|
41 | 239 |
|
53 | 240 |
|exclusionlist| |
41 | 241 |
|
242 |
super initialize. |
|
243 |
historyMode := true. |
|
244 |
exclusionlist := self exclude. |
|
245 |
||
246 |
Smalltalk allClasses do:[:aClass| |
|
247 |
"all classes should send a notification if changed" |
|
248 |
"aClass = self " false ifFalse: [ |
|
249 |
(exclusionlist includes: aClass) ifFalse:[ |
|
250 |
aClass addDependent: self. |
|
251 |
aClass class addDependent: self. "for class methods" |
|
252 |
]. |
|
253 |
]. |
|
254 |
]. |
|
255 |
||
256 |
^self |
|
257 |
||
258 |
"Modified: 11.08.1995 / 17:12:51 / robert" |
|
259 |
! ! |
|
260 |
||
261 |
!HistoryManager methodsFor:'updateHistory'! |
|
262 |
||
149
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
263 |
addHistoryTo:someString forceModification:forceModification forceCreation:forceCreation |
41 | 264 |
"private - add a historyLine at end to the sourceCode; |
140
8c22b3cf100d
changed methods which had no history get a Modified string (instead of Created)
Claus Gittinger <cg@exept.de>
parents:
120
diff
changeset
|
265 |
check for multiple lines of the same user and merge into one. |
8c22b3cf100d
changed methods which had no history get a Modified string (instead of Created)
Claus Gittinger <cg@exept.de>
parents:
120
diff
changeset
|
266 |
If forceModification is true or a history already exists in someString, |
8c22b3cf100d
changed methods which had no history get a Modified string (instead of Created)
Claus Gittinger <cg@exept.de>
parents:
120
diff
changeset
|
267 |
add a 'Modified' line; otherwise, add a 'Created' line." |
41 | 268 |
|
53 | 269 |
| histLines pos wStream sourceCode previousHistories |
47 | 270 |
newLine | |
41 | 271 |
|
53 | 272 |
"Check whether we want a history to be added" |
273 |
historyMode ifFalse:[ |
|
149
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
274 |
^ someString |
53 | 275 |
]. |
47 | 276 |
previousHistories := self class getAllHistoriesFrom:someString. |
41 | 277 |
|
278 |
"extract source body." |
|
279 |
previousHistories isEmpty ifTrue: [ |
|
149
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
280 |
sourceCode := someString withoutSeparators. |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
281 |
forceModification ifTrue:[ |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
282 |
newLine := (HistoryLine new) |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
283 |
] ifFalse:[ |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
284 |
newLine := (HistoryLine newCreated). |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
285 |
] |
41 | 286 |
] ifFalse: [ |
149
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
287 |
pos := (previousHistories first) firstPositionInSourceCode. |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
288 |
sourceCode := (someString copyFrom: 1 to: pos - 1) withoutSeparators. |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
289 |
forceCreation ifTrue:[ |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
290 |
newLine := (HistoryLine newCreated). |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
291 |
] ifFalse:[ |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
292 |
newLine := (HistoryLine new) |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
293 |
] |
41 | 294 |
]. |
295 |
||
296 |
"add the actual user's historyLine." |
|
47 | 297 |
previousHistories add:newLine. |
41 | 298 |
|
140
8c22b3cf100d
changed methods which had no history get a Modified string (instead of Created)
Claus Gittinger <cg@exept.de>
parents:
120
diff
changeset
|
299 |
"Filtering historyLines (each user with one entry)." |
41 | 300 |
histLines := HistoryLine filterHistoryLines: previousHistories. |
301 |
||
302 |
"create new body with added historyLine" |
|
303 |
wStream := WriteStream on: String new. |
|
304 |
wStream nextPutAll: sourceCode; cr. |
|
305 |
||
306 |
"append the historyLines to the source" |
|
307 |
wStream cr. |
|
308 |
histLines do: [:hl | |
|
140
8c22b3cf100d
changed methods which had no history get a Modified string (instead of Created)
Claus Gittinger <cg@exept.de>
parents:
120
diff
changeset
|
309 |
wStream nextPutAll:hl printString; cr. |
41 | 310 |
]. |
311 |
||
312 |
^wStream contents. |
|
313 |
||
47 | 314 |
"Modified: 11.8.1995 / 16:51:50 / robert" |
315 |
"Modified: 8.9.1995 / 17:55:38 / claus" |
|
149
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
316 |
"Modified: 13.12.1995 / 14:07:03 / cg" |
41 | 317 |
! |
318 |
||
53 | 319 |
addHistoryToHistoryMethodOf:aClass |
320 |
|cls historyMethod oldSource newSource| |
|
321 |
||
322 |
aClass isMeta ifFalse:[ |
|
149
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
323 |
cls := aClass class. |
53 | 324 |
] ifTrue:[ |
149
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
325 |
cls := aClass |
53 | 326 |
]. |
327 |
historyMethod := cls compiledMethodAt: #history. |
|
328 |
historyMethod notNil ifTrue:[ |
|
149
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
329 |
oldSource := historyMethod source. |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
330 |
oldSource notNil ifTrue:[ |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
331 |
newSource := self addHistoryTo:oldSource forceModification:false forceCreation:false. |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
332 |
historyMethod source:newSource. |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
333 |
] |
53 | 334 |
] |
149
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
335 |
|
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
336 |
"Modified: 13.12.1995 / 14:05:30 / cg" |
53 | 337 |
! |
338 |
||
140
8c22b3cf100d
changed methods which had no history get a Modified string (instead of Created)
Claus Gittinger <cg@exept.de>
parents:
120
diff
changeset
|
339 |
update:something with:someArgument from:changedObject |
8c22b3cf100d
changed methods which had no history get a Modified string (instead of Created)
Claus Gittinger <cg@exept.de>
parents:
120
diff
changeset
|
340 |
"arrive here, whenever any class changed somehow. |
8c22b3cf100d
changed methods which had no history get a Modified string (instead of Created)
Claus Gittinger <cg@exept.de>
parents:
120
diff
changeset
|
341 |
(something contains aSymbol describing what happened)" |
41 | 342 |
|
140
8c22b3cf100d
changed methods which had no history get a Modified string (instead of Created)
Claus Gittinger <cg@exept.de>
parents:
120
diff
changeset
|
343 |
| sourceCode newMethod fileInOrRecompiling ignore selector oldMethod| |
41 | 344 |
|
345 |
"/ changedObject == self ifTrue:[ "for development only" |
|
346 |
"/ self halt. |
|
347 |
"/ ^self. |
|
348 |
"/ ]. |
|
46 | 349 |
|
140
8c22b3cf100d
changed methods which had no history get a Modified string (instead of Created)
Claus Gittinger <cg@exept.de>
parents:
120
diff
changeset
|
350 |
fileInOrRecompiling := Class updateChangeFileQuerySignal raise. |
41 | 351 |
|
53 | 352 |
"/ changedObject isMeta ifTrue:[ |
43 | 353 |
"/ Transcript showCr: 'metaClass = ', changedObject printString. |
53 | 354 |
"/ ]. |
41 | 355 |
|
356 |
fileInOrRecompiling ifFalse:[ |
|
42 | 357 |
"/ Transcript showCr: '* noChange in history'. |
149
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
358 |
^ self |
53 | 359 |
]. |
360 |
historyMode ifFalse:[ |
|
149
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
361 |
^ self |
41 | 362 |
]. |
363 |
||
364 |
" |
|
365 |
Class Variables |
|
366 |
" |
|
367 |
(something == #definition) ifTrue:[ |
|
149
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
368 |
"add handling for classes here ..." |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
369 |
"/ self addHistoryToHistoryMethodOf:changedObject. |
41 | 370 |
]. |
371 |
||
372 |
"this is a sub item of #definition" |
|
373 |
(something == #classVariables) ifTrue:[ |
|
149
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
374 |
" |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
375 |
Transcript showCr: 'classVariables changed'. |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
376 |
" |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
377 |
"/ does not yet work; |
154
0478e111188d
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
149
diff
changeset
|
378 |
"/ (someArgument does not contain the class we are interested in) |
140
8c22b3cf100d
changed methods which had no history get a Modified string (instead of Created)
Claus Gittinger <cg@exept.de>
parents:
120
diff
changeset
|
379 |
|
149
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
380 |
self addHistoryToHistoryMethodOf:changedObject. |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
381 |
^ self |
41 | 382 |
]. |
383 |
||
384 |
" |
|
140
8c22b3cf100d
changed methods which had no history get a Modified string (instead of Created)
Claus Gittinger <cg@exept.de>
parents:
120
diff
changeset
|
385 |
new Class creation |
41 | 386 |
" |
140
8c22b3cf100d
changed methods which had no history get a Modified string (instead of Created)
Claus Gittinger <cg@exept.de>
parents:
120
diff
changeset
|
387 |
((changedObject == Smalltalk) and:[something == #newClass]) ifTrue:[ |
149
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
388 |
"/ |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
389 |
"/ add myself as dependents in order to get future change notifications |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
390 |
"/ |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
391 |
someArgument addDependent: self. |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
392 |
someArgument class addDependent: self. "for class methods" |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
393 |
someArgument history:(self addHistoryTo:String new forceModification:false forceCreation:false). "append historyString for new class" |
41 | 394 |
]. |
395 |
||
396 |
" |
|
140
8c22b3cf100d
changed methods which had no history get a Modified string (instead of Created)
Claus Gittinger <cg@exept.de>
parents:
120
diff
changeset
|
397 |
changed methods |
41 | 398 |
" |
399 |
changedObject isBehavior ifTrue:[ |
|
149
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
400 |
something = #methodDictionary ifTrue:[ |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
401 |
someArgument isArray ifTrue:[ |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
402 |
selector := someArgument at:1. |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
403 |
oldMethod := someArgument at:2 |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
404 |
] ifFalse:[ |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
405 |
selector := someArgument |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
406 |
]. |
140
8c22b3cf100d
changed methods which had no history get a Modified string (instead of Created)
Claus Gittinger <cg@exept.de>
parents:
120
diff
changeset
|
407 |
|
149
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
408 |
"/ |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
409 |
"/ fetch sourceString of the method |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
410 |
"/ |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
411 |
sourceCode := changedObject sourceCodeAt:selector. |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
412 |
sourceCode isNil ifTrue:[ |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
413 |
"method has been deleted" |
43 | 414 |
"/ Transcript showCr: 'method has been deleted'. |
149
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
415 |
] ifFalse:[ |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
416 |
newMethod := changedObject compiledMethodAt:selector. |
140
8c22b3cf100d
changed methods which had no history get a Modified string (instead of Created)
Claus Gittinger <cg@exept.de>
parents:
120
diff
changeset
|
417 |
|
149
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
418 |
oldMethod notNil ifTrue:[ |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
419 |
(oldMethod source asString withTabsExpanded = sourceCode asString withTabsExpanded) ifTrue:[ |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
420 |
"/ no change (accepted same code again ?) |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
421 |
^ self |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
422 |
]. |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
423 |
]. |
140
8c22b3cf100d
changed methods which had no history get a Modified string (instead of Created)
Claus Gittinger <cg@exept.de>
parents:
120
diff
changeset
|
424 |
|
149
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
425 |
"/ |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
426 |
"/ dont add historylines to documentation methods ... |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
427 |
"/ |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
428 |
(changedObject isMeta not |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
429 |
or:[newMethod category ~= 'documentation']) ifTrue:[ |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
430 |
sourceCode := self addHistoryTo:sourceCode forceModification:(oldMethod notNil) forceCreation:(oldMethod isNil). |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
431 |
newMethod source: sourceCode. |
43 | 432 |
"/ Transcript showCr: 'history updated / added'. |
149
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
433 |
] |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
434 |
]. |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
435 |
^self |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
436 |
]. |
41 | 437 |
|
149
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
438 |
something == #comment ifTrue:[ |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
439 |
"in someArgument steht jetzt der alte kommentar" |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
440 |
^ self. |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
441 |
] ifFalse:[ |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
442 |
"it is a class definition" |
43 | 443 |
"/ Transcript show: 'Class definition: ', changedObject printString;cr. |
149
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
444 |
self addHistoryToHistoryMethodOf:changedObject. |
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
445 |
]. |
41 | 446 |
]. |
447 |
||
448 |
^self |
|
449 |
||
43 | 450 |
"Modified: 27.8.1995 / 02:14:43 / claus" |
149
f7d66ab71259
filter out previous Created line after a copy (get 2 of them after copyCategory in browser)
Claus Gittinger <cg@exept.de>
parents:
142
diff
changeset
|
451 |
"Modified: 13.12.1995 / 14:06:20 / cg" |
41 | 452 |
! ! |
453 |
||
119 | 454 |
!HistoryManager class methodsFor:'documentation'! |
455 |
||
456 |
version |
|
154
0478e111188d
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
149
diff
changeset
|
457 |
^ '$Header: /cvs/stx/stx/libbasic3/HistoryManager.st,v 1.18 1995-12-15 12:09:05 cg Exp $' |
119 | 458 |
! ! |
41 | 459 |
HistoryManager initialize! |