author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Thu, 28 Mar 2013 12:22:48 +0000 | |
branch | jv |
changeset 3158 | f8c56a311307 |
parent 3128 | 87750af738dc |
parent 3145 | e59d8d1ab71a |
child 3208 | e8bdf898d7ac |
permissions | -rw-r--r-- |
2848 | 1 |
" |
2 |
COPYRIGHT (c) 2012 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 |
"{ Package: 'stx:libbasic3' }" |
|
13 |
||
14 |
SourceCodeManagerUtilities subclass:#SourceCodeManagerUtilitiesForContainerBasedManagers |
|
15 |
instanceVariableNames:'' |
|
16 |
classVariableNames:'' |
|
17 |
poolDictionaries:'' |
|
18 |
category:'System-SourceCodeManagement' |
|
19 |
! |
|
20 |
||
21 |
!SourceCodeManagerUtilitiesForContainerBasedManagers class methodsFor:'documentation'! |
|
22 |
||
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 2012 eXept Software AG |
|
26 |
All Rights Reserved |
|
27 |
||
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
! ! |
|
36 |
||
3158
f8c56a311307
Merged 87750af738dc and 72ca7e81fbbf (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
37 |
|
2848 | 38 |
!SourceCodeManagerUtilitiesForContainerBasedManagers methodsFor:'utilities-cvs'! |
39 |
||
40 |
checkinBuildSupportFilesForPackage:packageID |
|
41 |
|anyFailure module directory mgr defClass | |
|
42 |
||
43 |
mgr := self sourceCodeManagerFor: packageID. |
|
44 |
defClass := ProjectDefinition definitionClassForPackage: packageID. |
|
45 |
||
3141
25cd1cd26450
class: SourceCodeManagerUtilitiesForContainerBasedManagers
Claus Gittinger <cg@exept.de>
parents:
3133
diff
changeset
|
46 |
"/ already done elsewhere now |
25cd1cd26450
class: SourceCodeManagerUtilitiesForContainerBasedManagers
Claus Gittinger <cg@exept.de>
parents:
3133
diff
changeset
|
47 |
"/ defClass validateDescription. |
2848 | 48 |
|
49 |
anyFailure := false. |
|
50 |
||
51 |
module := packageID asPackageId module. |
|
52 |
directory := packageID asPackageId directory. |
|
53 |
||
54 |
self activityNotification:(resources string:'checking in build-support files...'). |
|
55 |
(mgr checkForExistingModule:module directory:directory) ifFalse:[ |
|
56 |
mgr createModule:module directory:directory |
|
57 |
]. |
|
58 |
||
59 |
defClass forEachFileNameAndGeneratedContentsDo:[:fileName :fileContents | |
|
60 |
|realFileName realDirectory| |
|
61 |
||
62 |
"/ care for subdirectories |
|
63 |
(fileName includes:$/) ifTrue:[ |
|
64 |
realDirectory := (directory asFilename construct:(fileName asFilename directoryName)) name. |
|
65 |
realFileName := fileName asFilename baseName. |
|
66 |
] ifFalse:[ |
|
67 |
realDirectory := directory. |
|
68 |
realFileName := fileName. |
|
69 |
]. |
|
70 |
realDirectory := realDirectory replaceAll:$\ with:$/. |
|
71 |
||
72 |
self activityNotification:(resources string:'checking in %1...' with:realFileName). |
|
73 |
||
74 |
UserInformation |
|
75 |
handle:[:ex | Transcript showCR:ex description ] |
|
76 |
do:[ |
|
77 |
(mgr isContainerBased |
|
78 |
and:[ |
|
79 |
(mgr checkForExistingContainer:realFileName inModule:module directory:realDirectory) not |
|
80 |
]) ifTrue:[ |
|
81 |
realDirectory ~= directory ifTrue:[ |
|
82 |
(mgr checkForExistingModule:module directory:realDirectory) ifFalse:[ |
|
83 |
mgr createModule:module directory:realDirectory |
|
84 |
]. |
|
85 |
]. |
|
86 |
(mgr |
|
87 |
createContainerForText:fileContents |
|
88 |
inModule:module |
|
89 |
package:realDirectory |
|
90 |
container:realFileName) |
|
91 |
ifFalse:[ |
|
92 |
Dialog warn:(resources |
|
93 |
stringWithCRs:'Cannot create new container: ''%3'' (in %1:%2)' |
|
94 |
with:module |
|
95 |
with:realDirectory |
|
96 |
with:realFileName) |
|
97 |
]. |
|
98 |
] ifFalse:[ |
|
99 |
(mgr |
|
100 |
checkin:realFileName |
|
101 |
text:fileContents |
|
102 |
directory:realDirectory |
|
103 |
module:module |
|
104 |
logMessage:'automatically generated by browser' |
|
105 |
force:false) |
|
106 |
ifFalse:[ |
|
107 |
Transcript showCR:'checkin of ' , realFileName , ' failed'. |
|
108 |
anyFailure := true. |
|
109 |
]. |
|
110 |
]. |
|
111 |
]. |
|
112 |
]. |
|
113 |
||
114 |
defClass instAndClassMethodsDo:[:m | m package:defClass package]. |
|
115 |
||
116 |
self |
|
117 |
checkinClasses:(Array with:defClass) |
|
118 |
withInfo:'automatic checkIn' |
|
119 |
withCheck:false. |
|
120 |
||
121 |
||
122 |
self activityNotification:nil. |
|
123 |
||
124 |
anyFailure ifTrue:[ |
|
125 |
self warn:'Checkin failed - see Transcript.'. |
|
126 |
self activityNotification:'Checkin of build-support files failed - see Transcript.'. |
|
127 |
] ifFalse:[ |
|
128 |
self activityNotification:'Build-support files checked into the repository.'. |
|
129 |
]. |
|
130 |
||
131 |
"Created: / 09-08-2006 / 18:59:42 / fm" |
|
132 |
"Modified: / 12-10-2011 / 11:36:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
133 |
"Modified: / 25-07-2012 / 14:27:30 / cg" |
|
134 |
"Modified (format): / 25-07-2012 / 22:25:48 / cg" |
|
135 |
! |
|
136 |
||
137 |
checkinClass:aClass |
|
138 |
"check a class into the source repository. |
|
139 |
Asks interactively for a log-message." |
|
140 |
||
141 |
^ self checkinClass:aClass withInfo:nil |
|
142 |
! |
|
143 |
||
144 |
checkinClass:aClass withInfo:aLogInfoOrNil |
|
145 |
"check a class into the source repository. |
|
146 |
If the argument, aLogInfoOrNil isNil, ask interactively for a log-message." |
|
147 |
||
148 |
^ self checkinClass:aClass withInfo:aLogInfoOrNil withCheck:true |
|
149 |
! |
|
150 |
||
151 |
checkinClass:aClass withInfo:aLogInfoOrNil withCheck:doCheckClass |
|
152 |
"check a class into the source repository. |
|
153 |
If the argument, aLogInfoOrNil isNil, ask interactively for log-message. |
|
154 |
If doCheckClass is true, the class is checked for send of halts etc." |
|
155 |
||
156 |
^ self |
|
157 |
checkinClass:aClass |
|
158 |
withInfo:aLogInfoOrNil |
|
159 |
withCheck:doCheckClass |
|
160 |
usingManager:(self sourceCodeManagerFor:aClass) |
|
161 |
||
162 |
"Modified: / 21-12-2011 / 18:19:55 / cg" |
|
163 |
! |
|
164 |
||
165 |
checkinClass:aClass withInfo:aLogInfoOrNil withCheck:doCheckClass usingManager:managerOrNil |
|
166 |
"check a class into the source repository. |
|
167 |
If the argument, aLogInfoOrNil isNil, ask interactively for log-message. |
|
168 |
If doCheckClass is true, the class is checked for send of halts etc." |
|
169 |
||
2946 | 170 |
|logMessage checkinInfo mgr pri| |
2848 | 171 |
|
172 |
aClass isLoaded ifFalse:[ |
|
173 |
self information:(resources string:'Cannot checkin unloaded classes (%1)' with:aClass name). |
|
174 |
^ false. |
|
175 |
]. |
|
176 |
||
177 |
mgr := managerOrNil. |
|
178 |
mgr isNil ifTrue:[ |
|
179 |
mgr := self sourceCodeManagerFor:aClass. |
|
180 |
mgr isNil ifTrue:[ |
|
181 |
^ false |
|
182 |
] |
|
183 |
]. |
|
184 |
||
185 |
self ensureCorrectVersionMethodsInClass:aClass usingManager:mgr. |
|
186 |
mgr supportsCheckinLogMessages ifTrue:[ |
|
187 |
(self |
|
188 |
getLogMessageForClassCheckinTakingDefaultsFromPreviousLogInfo:aLogInfoOrNil |
|
189 |
forClass:aClass |
|
190 |
valuesInto:[:logMessageRet :checkinInfoRet | |
|
191 |
logMessage := logMessageRet. |
|
192 |
checkinInfo := checkinInfoRet. |
|
193 |
] |
|
194 |
) ifFalse:[^ false]. |
|
195 |
]. |
|
196 |
||
197 |
(self classIsNotYetInRepository:aClass withManager:mgr) ifTrue:[ |
|
198 |
(self createSourceContainerForClass:aClass usingManager:mgr) ifFalse:[ |
|
199 |
"/ self warn:'did not create a container for ''' , aClass name , ''''. |
|
200 |
^ false |
|
201 |
]. |
|
202 |
^ true. |
|
203 |
]. |
|
204 |
||
205 |
self activityNotification:(resources string:'checking in %1' with:aClass name). |
|
206 |
pri := Processor activePriority. |
|
207 |
Processor activeProcess withPriority:pri-1 to:pri |
|
208 |
do:[ |
|
209 |
|revision aborted freshCreated| |
|
210 |
||
211 |
freshCreated := false. |
|
212 |
revision := aClass revision. |
|
213 |
revision isNil ifTrue:[ |
|
214 |
mgr isContainerBased ifTrue:[ |
|
215 |
"/ mhmh - check if it has a container. |
|
216 |
(mgr checkForExistingContainerForClass:aClass) ifFalse:[ |
|
217 |
(self createSourceContainerForClass:aClass usingManager:mgr) ifFalse:[ |
|
218 |
self warn:'Did not create/change repository container for ''' , aClass name allBold , ''''. |
|
219 |
^ false. |
|
220 |
]. |
|
221 |
freshCreated := true. |
|
222 |
] |
|
223 |
] |
|
224 |
]. |
|
225 |
||
226 |
doCheckClass value ifTrue:[ |
|
227 |
"/ check if the class contains halts, error-sends etc. |
|
228 |
(self checkAndWarnAboutBadMessagesInClass:aClass checkAgainHolder:doCheckClass) ifFalse:[ |
|
229 |
^ false |
|
230 |
]. |
|
231 |
]. |
|
232 |
||
233 |
freshCreated ifFalse:[ |
|
234 |
aborted := false. |
|
235 |
AbortOperationRequest handle:[:ex | |
|
236 |
aborted := true. |
|
237 |
ex return. |
|
238 |
] do:[ |
|
239 |
|checkinState cause| |
|
240 |
checkinState := false. |
|
241 |
cause := ''. |
|
242 |
[ |
|
243 |
checkinState := mgr checkinClass:aClass logMessage:logMessage |
|
244 |
] on:SourceCodeManagerError do:[:ex| |
|
245 |
cause := ex description. |
|
246 |
ex proceed. |
|
247 |
]. |
|
248 |
||
249 |
checkinState ifFalse:[ |
|
250 |
Transcript showCR:'checkin of ''' , aClass name , ''' failed - ', cause. |
|
251 |
self warn:(resources stringWithCRs:'Checkin of "%1" failed\\' with:aClass name allBold),cause. |
|
252 |
^ false. |
|
253 |
]. |
|
254 |
checkinInfo notNil ifTrue:[ |
|
255 |
checkinInfo isStable ifTrue:[ |
|
256 |
"set stable tag for class that has been checked in" |
|
257 |
self tagClass:aClass as:#stable. |
|
258 |
]. |
|
259 |
checkinInfo tagIt ifTrue:[ |
|
260 |
"set an additional tag for class that has been checked in" |
|
261 |
self tagClass:aClass as:(checkinInfo tag). |
|
262 |
]. |
|
263 |
]. |
|
264 |
]. |
|
265 |
aborted ifTrue:[ |
|
266 |
Transcript showCR:'Checkin of ''' , aClass name , ''' aborted'. |
|
267 |
||
268 |
AbortAllOperationWantedQuery query ifTrue:[ |
|
269 |
(Dialog |
|
270 |
confirm:(resources stringWithCRs:'Checkin of "%1" aborted.\\Cancel all ?' with:aClass name) |
|
271 |
default:false) |
|
272 |
ifTrue:[ |
|
273 |
AbortAllOperationRequest raise. |
|
274 |
] |
|
275 |
]. |
|
276 |
^ false. |
|
277 |
]. |
|
278 |
]. |
|
279 |
]. |
|
280 |
^ true |
|
281 |
||
282 |
"Created: / 21-12-2011 / 18:19:14 / cg" |
|
283 |
! |
|
284 |
||
285 |
checkinClasses:aCollectionOfClass |
|
286 |
"check a collection of classes into the source repository. |
|
287 |
Asks interactively for log-message." |
|
288 |
||
289 |
^ self checkinClasses:aCollectionOfClass withInfo:nil |
|
290 |
! |
|
291 |
||
292 |
checkinClasses:aCollectionOfClasses withInfo:aLogInfoOrNil |
|
293 |
"check a bunch of classes into the source repository. |
|
294 |
If the argument, aLogInfoOrNil isNil, ask interactively for log-message." |
|
295 |
||
296 |
^ self |
|
297 |
checkinClasses:aCollectionOfClasses |
|
298 |
withInfo:aLogInfoOrNil |
|
299 |
withCheck:(UserPreferences current at:#checkClassesWhenCheckingIn ifAbsent:true) |
|
300 |
! |
|
301 |
||
302 |
checkinClasses:aCollectionOfClasses withInfo:aLogInfoOrStringNil withCheck:doCheckClasses |
|
303 |
"check a bunch of classes into the source repository. |
|
304 |
If the argument, aLogInfoOrStringNil isNil, ask interactively for log-message." |
|
305 |
||
306 |
self checkinClasses:aCollectionOfClasses withInfo:aLogInfoOrStringNil withCheck:doCheckClasses usingManager:nil |
|
307 |
||
308 |
"Modified: / 21-12-2011 / 18:24:47 / cg" |
|
309 |
! |
|
310 |
||
311 |
checkinClasses:aCollectionOfClasses withInfo:aLogInfoOrStringNil withCheck:doCheckClasses usingManager:aManagerOrNil |
|
312 |
"check a bunch of classes into the source repository. |
|
313 |
If the argument, aLogInfoOrStringNil isNil, ask interactively for log-message." |
|
314 |
||
2946 | 315 |
|classes allClasses checkinInfoOrString yesOrNoToAll unchangedClasses| |
2848 | 316 |
|
317 |
"/ ignore private classes |
|
318 |
classes := aCollectionOfClasses select:[:aClass | aClass owningClass isNil]. |
|
319 |
classes isEmpty ifTrue:[ |
|
320 |
self information:'Only private classes given - nothing checked in.'. |
|
321 |
^ self |
|
322 |
]. |
|
323 |
classes := classes select:[:aClass | aClass isLoaded]. |
|
324 |
classes isEmpty ifTrue:[ |
|
325 |
self information:'Only unloaded classes given - nothing checked in.'. |
|
326 |
^ self |
|
327 |
]. |
|
328 |
||
329 |
classes size == 1 ifTrue:[ |
|
330 |
^ self checkinClass:classes first withInfo:aLogInfoOrStringNil withCheck:doCheckClasses usingManager:aManagerOrNil. |
|
331 |
]. |
|
332 |
||
333 |
"ask once, for all classes" |
|
334 |
aLogInfoOrStringNil isNil ifTrue:[ |
|
335 |
checkinInfoOrString := self |
|
336 |
getCheckinInfoFor:(resources string:'%1 classes to checkin' with:aCollectionOfClasses size) |
|
337 |
initialAnswer:nil |
|
338 |
withQuickOption:true. |
|
339 |
checkinInfoOrString isNil ifTrue:[^ self]. |
|
340 |
] ifFalse:[ |
|
341 |
checkinInfoOrString := aLogInfoOrStringNil. |
|
342 |
]. |
|
343 |
||
344 |
allClasses := classes. |
|
345 |
checkinInfoOrString quickCheckIn ifTrue:[ |
|
346 |
classes := classes select:[:aClass | aClass hasUnsavedChanges]. |
|
347 |
classes isEmpty ifTrue:[ Dialog information:'no changes to checkin (quickCheckIn)' ] |
|
348 |
]. |
|
349 |
||
350 |
"abortAll is handled, and also asked for here!!" |
|
351 |
AbortAllOperationRequest handleAndAnswerQueryIn:[ |
|
352 |
classes notEmpty ifTrue:[ |
|
353 |
self yesToAllNotification handle:[:ex | |
|
354 |
yesOrNoToAll := ex parameter. |
|
355 |
ex proceed |
|
356 |
] do:[ |
|
357 |
self yesToAllQuery handle:[:ex | |
|
358 |
ex proceedWith:yesOrNoToAll |
|
359 |
] do:[ |
|
360 |
classes do:[:aClass | |
|
361 |
self activityNotification:(resources string:'checking in %1' with:aClass name). |
|
362 |
"/ ca does not want boxes to pop up all over ... |
|
363 |
UserInformation handle:[:ex | |
|
364 |
Transcript showCR:ex description. |
|
365 |
ex proceed. |
|
366 |
] do:[ |
|
367 |
AbortOperationRequest catch:[ |
|
368 |
self |
|
369 |
checkinClass:aClass |
|
370 |
withInfo:checkinInfoOrString |
|
371 |
withCheck:doCheckClasses |
|
372 |
usingManager:aManagerOrNil |
|
373 |
] |
|
374 |
]. |
|
375 |
]. |
|
376 |
] |
|
377 |
]. |
|
378 |
]. |
|
379 |
||
380 |
(checkinInfoOrString isStable or:[checkinInfoOrString tagIt]) |
|
381 |
ifTrue:[ |
|
382 |
"/mhmh - but tag should be set on all (even unchanged ones) |
|
383 |
"/ the other onces have already been tagged |
|
384 |
unchangedClasses := allClasses select:[:eachClass | (classes includes:eachClass) not]. |
|
385 |
||
386 |
"mhmh - could still have to tag them" |
|
387 |
checkinInfoOrString isStable ifTrue:[ |
|
388 |
unchangedClasses do:[:eachClass | |
|
389 |
self tagClass:eachClass as:#stable. |
|
390 |
]. |
|
391 |
]. |
|
392 |
checkinInfoOrString tagIt ifTrue:[ |
|
393 |
unchangedClasses do:[:eachClass | |
|
394 |
self tagClass:eachClass as:(checkinInfoOrString tag). |
|
395 |
]. |
|
396 |
]. |
|
397 |
]. |
|
398 |
]. |
|
399 |
||
400 |
"Created: / 21-12-2011 / 18:24:25 / cg" |
|
401 |
! |
|
402 |
||
403 |
checkinExtensionMethods:aCollectionOfMethods forPackage:aPackageID withInfo:aLogInfoOrStringOrNil |
|
404 |
"checkin a projects extensions into the source repository. |
|
405 |
If the argument, aLogInfoOrStringOrNil isNil, ask interactively for log-message." |
|
406 |
||
3133 | 407 |
|logMessage checkinInfo mgr pri module directory containerFileName extensionsSource| |
2848 | 408 |
|
409 |
"/ the following is wrong - must ask the projectDefinition !! |
|
410 |
aPackageID asPackageId projectDefinitionClass notNil ifTrue:[ |
|
411 |
mgr := self sourceCodeManagerFor:aPackageID asPackageId projectDefinitionClass. |
|
412 |
] ifFalse:[ |
|
413 |
mgr := self sourceCodeManagerFor:aCollectionOfMethods first mclass. |
|
414 |
]. |
|
415 |
mgr isNil ifTrue:[ ^ false ]. |
|
416 |
||
417 |
module := aPackageID asPackageId module. |
|
418 |
directory := aPackageID asPackageId directory. |
|
419 |
containerFileName := self nameOfExtensionsContainer. |
|
420 |
||
421 |
aLogInfoOrStringOrNil isNil ifTrue:[ |
|
422 |
checkinInfo := self getCheckinInfoFor:containerFileName allBold initialAnswer:nil. |
|
423 |
checkinInfo isNil ifTrue:[^ false]. |
|
424 |
logMessage := checkinInfo logMessage. |
|
425 |
] ifFalse:[ |
|
426 |
aLogInfoOrStringOrNil isString ifTrue:[ |
|
427 |
logMessage := aLogInfoOrStringOrNil |
|
428 |
] ifFalse:[ |
|
429 |
checkinInfo := aLogInfoOrStringOrNil. |
|
430 |
logMessage := checkinInfo logMessage. |
|
431 |
]. |
|
432 |
]. |
|
433 |
||
434 |
(mgr checkForExistingContainer:containerFileName inModule:module directory:directory) ifFalse:[ |
|
435 |
(self checkForExistingModule:module usingManager:mgr allowCreate:true) ifFalse:[^ false]. |
|
436 |
LastModule := module. |
|
437 |
||
438 |
(self checkForExistingModule:module directory:directory usingManager:mgr allowCreate:true) ifFalse:[^ false]. |
|
439 |
LastPackage := directory. |
|
440 |
||
441 |
(self checkForExistingModule:module directory:directory container:containerFileName usingManager:mgr allowCreate:true) ifFalse:[^ false]. |
|
442 |
]. |
|
443 |
||
444 |
self activityNotification:(resources string:'Checking in %1' with:containerFileName). |
|
445 |
pri := Processor activePriority. |
|
446 |
Processor activeProcess |
|
447 |
withPriority:pri-1 to:pri |
|
448 |
do:[ |
|
3133 | 449 |
extensionsSource := self sourceCodeForExtensions:aCollectionOfMethods package:aPackageID forManager:mgr. |
450 |
"Care for non-ASCII/non-ISO-8859 characters in extension methods" |
|
451 |
extensionsSource isWideString ifTrue:[ |
|
452 |
extensionsSource := '"{ Encoding: utf8 }"' , Character cr asString , Character cr asString , extensionsSource. |
|
453 |
extensionsSource := extensionsSource utf8Encoded. |
|
454 |
]. |
|
2848 | 455 |
|
456 |
UserInformation handle:[:ex | |
|
457 |
Transcript showCR:ex description. |
|
458 |
ex proceed. |
|
459 |
] do:[ |
|
460 |
Transcript showCR:('checking in ',containerFileName,' ...'). |
|
461 |
(mgr |
|
462 |
checkin:containerFileName |
|
3133 | 463 |
text:extensionsSource |
2848 | 464 |
directory:directory |
465 |
module:module |
|
466 |
logMessage:logMessage |
|
467 |
force:false) |
|
468 |
ifFalse:[ |
|
469 |
Transcript showCR:'Checkin of ''' , containerFileName , ''' failed'. |
|
470 |
self warn:'Checkin of ''' , containerFileName allBold , ''' failed'. |
|
471 |
^ false. |
|
472 |
]. |
|
473 |
checkinInfo notNil ifTrue:[ |
|
474 |
|path| |
|
475 |
||
476 |
path := (module, '/', directory, '/', containerFileName). |
|
477 |
checkinInfo isStable ifTrue:[ |
|
478 |
"set stable tag for class that has been checked in" |
|
479 |
self tagPath:path as:#stable usingManager:mgr. |
|
480 |
]. |
|
481 |
checkinInfo tagIt ifTrue:[ |
|
482 |
"set an additional tag for class that has been checked in" |
|
483 |
self tagPath:path as:(checkinInfo tag) usingManager:mgr. |
|
484 |
]. |
|
485 |
]. |
|
486 |
mgr postCheckInExtensionsForPackage:aPackageID |
|
487 |
]. |
|
488 |
]. |
|
489 |
^ true |
|
490 |
||
491 |
"Modified: / 25-07-2012 / 18:38:40 / cg" |
|
492 |
! |
|
493 |
||
494 |
checkinPackage:packageToCheckIn classes:doClasses extensions:doExtensions buildSupport:doBuild askForMethodsInOtherPackages:askForMethodsInOtherPackages |
|
495 |
|mgr classes classesToCheckIn methodsToCheckIn |
|
496 |
methodsInOtherPackages looseMethods otherPackages |
|
497 |
msg classesInChangeSet checkinInfo originalCheckinInfo classesToTag| |
|
498 |
||
499 |
mgr := self sourceCodeManagerFor: packageToCheckIn. |
|
500 |
classes := Smalltalk allClasses. |
|
501 |
||
502 |
classesToCheckIn := IdentitySet new. |
|
503 |
methodsToCheckIn := IdentitySet new. |
|
504 |
methodsInOtherPackages := IdentitySet new. |
|
505 |
looseMethods := IdentitySet new. |
|
506 |
||
507 |
"/ classes ... |
|
3141
25cd1cd26450
class: SourceCodeManagerUtilitiesForContainerBasedManagers
Claus Gittinger <cg@exept.de>
parents:
3133
diff
changeset
|
508 |
classes do:[:aClass | |
25cd1cd26450
class: SourceCodeManagerUtilitiesForContainerBasedManagers
Claus Gittinger <cg@exept.de>
parents:
3133
diff
changeset
|
509 |
|owner classPackage| |
25cd1cd26450
class: SourceCodeManagerUtilitiesForContainerBasedManagers
Claus Gittinger <cg@exept.de>
parents:
3133
diff
changeset
|
510 |
|
2848 | 511 |
(owner := aClass owningClass) notNil ifTrue:[ |
512 |
classPackage := aClass topOwningClass package |
|
513 |
] ifFalse:[ |
|
514 |
classPackage := aClass package |
|
515 |
]. |
|
516 |
(classPackage = packageToCheckIn) ifTrue:[ |
|
517 |
classesToCheckIn add:aClass. |
|
518 |
]. |
|
519 |
]. |
|
520 |
||
521 |
"/ cg: O(n^2) algorithm |
|
522 |
"/ classesInChangeSet := classesToCheckIn select:[:cls | cls hasUnsavedChanges]. |
|
523 |
"/ replaced by: O(n) algorithm |
|
2906 | 524 |
classesInChangeSet := ChangeSet current selectClassesForWhichIncludesChangeForClassOrMetaclassOrPrivateClassFrom:classesToCheckIn. |
2848 | 525 |
|
526 |
"/ individual methods ... |
|
527 |
classes do:[:aClass | |
|
528 |
aClass isMeta ifFalse:[ |
|
529 |
"/ ... whose class is not in the chechIn-set |
|
530 |
(classesToCheckIn includes:aClass) ifFalse:[ |
|
531 |
aClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
|
532 |
"/ methods in this project ... |
|
533 |
(mthd package = packageToCheckIn) ifTrue:[ |
|
534 |
methodsToCheckIn add:mthd |
|
535 |
] |
|
536 |
] |
|
537 |
]. |
|
538 |
]. |
|
539 |
]. |
|
540 |
||
541 |
doExtensions ifTrue:[ |
|
542 |
methodsToCheckIn notEmpty ifTrue:[ |
|
543 |
doClasses ifTrue:[ |
|
544 |
msg := '%1 classes (%4 changed) '. |
|
545 |
] ifFalse:[ |
|
546 |
msg := ''. |
|
547 |
]. |
|
548 |
doExtensions ifTrue:[ |
|
549 |
doClasses ifTrue:[ |
|
550 |
msg := msg , 'and '. |
|
551 |
]. |
|
552 |
msg := msg , '%2 extensions '. |
|
553 |
]. |
|
554 |
msg := msg , 'of project "%3"'. |
|
555 |
||
556 |
checkinInfo := self |
|
557 |
getCheckinInfoFor:(msg |
|
558 |
bindWith:classesToCheckIn size |
|
559 |
with:methodsToCheckIn size |
|
560 |
with:packageToCheckIn allBold |
|
561 |
with:classesInChangeSet size) |
|
562 |
initialAnswer:nil |
|
3141
25cd1cd26450
class: SourceCodeManagerUtilitiesForContainerBasedManagers
Claus Gittinger <cg@exept.de>
parents:
3133
diff
changeset
|
563 |
withQuickOption:(classesToCheckIn size > 0) |
25cd1cd26450
class: SourceCodeManagerUtilitiesForContainerBasedManagers
Claus Gittinger <cg@exept.de>
parents:
3133
diff
changeset
|
564 |
withValidateConsistencyOption:true. |
2848 | 565 |
checkinInfo isNil ifTrue:[ |
566 |
^ self. |
|
567 |
]. |
|
3145
e59d8d1ab71a
class: SourceCodeManagerUtilitiesForContainerBasedManagers
Claus Gittinger <cg@exept.de>
parents:
3141
diff
changeset
|
568 |
|
e59d8d1ab71a
class: SourceCodeManagerUtilitiesForContainerBasedManagers
Claus Gittinger <cg@exept.de>
parents:
3141
diff
changeset
|
569 |
checkinInfo validateConsistency ifTrue:[ |
e59d8d1ab71a
class: SourceCodeManagerUtilitiesForContainerBasedManagers
Claus Gittinger <cg@exept.de>
parents:
3141
diff
changeset
|
570 |
self validateConsistencyOfPackage:packageToCheckIn doClasses:doClasses doExtensions:doExtensions. |
e59d8d1ab71a
class: SourceCodeManagerUtilitiesForContainerBasedManagers
Claus Gittinger <cg@exept.de>
parents:
3141
diff
changeset
|
571 |
]. |
e59d8d1ab71a
class: SourceCodeManagerUtilitiesForContainerBasedManagers
Claus Gittinger <cg@exept.de>
parents:
3141
diff
changeset
|
572 |
|
2848 | 573 |
(self |
574 |
checkinExtensionMethods:methodsToCheckIn |
|
575 |
forPackage:packageToCheckIn |
|
576 |
withInfo:checkinInfo) |
|
577 |
ifFalse:[ |
|
578 |
Dialog warn:(resources string:'Could not check in extensions for project %1' with:packageToCheckIn). |
|
579 |
^ self. |
|
580 |
] |
|
581 |
] ifFalse:[ |
|
582 |
"/ there may have been extension-methods previously - if so, remove them |
|
583 |
(mgr |
|
584 |
checkForExistingContainer:'extensions.st' inPackage:packageToCheckIn) |
|
585 |
ifTrue:[ |
|
586 |
"/ self halt. |
|
587 |
(self |
|
588 |
checkinExtensionMethods:#() |
|
589 |
forPackage:packageToCheckIn |
|
590 |
withInfo:'No extensions any more') |
|
591 |
ifFalse:[ |
|
592 |
Dialog warn:(resources string:'Could not check in extensions for project %1' with:packageToCheckIn). |
|
593 |
^ self. |
|
594 |
] |
|
595 |
] |
|
596 |
]. |
|
597 |
]. |
|
598 |
||
599 |
checkinInfo isNil ifTrue:[ |
|
600 |
checkinInfo := self |
|
601 |
getCheckinInfoFor:('%1 classes (%4 changed) and %2 extensions for project "%3"' |
|
602 |
bindWith:classesToCheckIn size |
|
603 |
with:methodsToCheckIn size |
|
604 |
with:packageToCheckIn allBold |
|
605 |
with:classesInChangeSet size) |
|
606 |
initialAnswer:nil |
|
3141
25cd1cd26450
class: SourceCodeManagerUtilitiesForContainerBasedManagers
Claus Gittinger <cg@exept.de>
parents:
3133
diff
changeset
|
607 |
withQuickOption:(classesToCheckIn size > 0) |
25cd1cd26450
class: SourceCodeManagerUtilitiesForContainerBasedManagers
Claus Gittinger <cg@exept.de>
parents:
3133
diff
changeset
|
608 |
withValidateConsistencyOption:true. |
2848 | 609 |
checkinInfo isNil ifTrue:[ |
610 |
^ self. |
|
611 |
]. |
|
3145
e59d8d1ab71a
class: SourceCodeManagerUtilitiesForContainerBasedManagers
Claus Gittinger <cg@exept.de>
parents:
3141
diff
changeset
|
612 |
checkinInfo validateConsistency ifTrue:[ |
e59d8d1ab71a
class: SourceCodeManagerUtilitiesForContainerBasedManagers
Claus Gittinger <cg@exept.de>
parents:
3141
diff
changeset
|
613 |
self validateConsistencyOfPackage:packageToCheckIn doClasses:doClasses doExtensions:doExtensions. |
e59d8d1ab71a
class: SourceCodeManagerUtilitiesForContainerBasedManagers
Claus Gittinger <cg@exept.de>
parents:
3141
diff
changeset
|
614 |
]. |
3141
25cd1cd26450
class: SourceCodeManagerUtilitiesForContainerBasedManagers
Claus Gittinger <cg@exept.de>
parents:
3133
diff
changeset
|
615 |
]. |
25cd1cd26450
class: SourceCodeManagerUtilitiesForContainerBasedManagers
Claus Gittinger <cg@exept.de>
parents:
3133
diff
changeset
|
616 |
|
2848 | 617 |
checkinInfo quickCheckIn ifTrue:[ |
618 |
(checkinInfo isStable or:[checkinInfo tagIt]) ifTrue:[ |
|
619 |
classesToTag := classesToCheckIn. |
|
620 |
originalCheckinInfo := checkinInfo. |
|
621 |
checkinInfo := checkinInfo copy. |
|
622 |
checkinInfo isStable:false. |
|
623 |
checkinInfo tag:nil. |
|
624 |
]. |
|
625 |
classesToCheckIn := classesInChangeSet. |
|
626 |
]. |
|
627 |
||
628 |
"/ check if any of the classes contains methods for other packages ... |
|
629 |
classesToCheckIn do:[:eachClass | |
|
630 |
eachClass instAndClassMethodsDo:[:eachMethod | |
|
631 |
|mPgk| |
|
632 |
||
633 |
mPgk := eachMethod package. |
|
634 |
(mPgk = packageToCheckIn) ifFalse:[ |
|
635 |
mPgk == PackageId noProjectID ifTrue:[ |
|
636 |
looseMethods add:eachMethod |
|
637 |
] ifFalse:[ |
|
638 |
methodsInOtherPackages add:eachMethod |
|
639 |
] |
|
640 |
] |
|
641 |
]. |
|
642 |
]. |
|
643 |
||
644 |
askForMethodsInOtherPackages ifTrue:[ |
|
645 |
methodsInOtherPackages notEmpty ifTrue:[ |
|
646 |
otherPackages := Set new. |
|
647 |
methodsInOtherPackages do:[:eachMethod | otherPackages add:eachMethod package]. |
|
648 |
||
649 |
methodsInOtherPackages size == 1 ifTrue:[ |
|
650 |
msg := 'The ''%4'' method in ''%5'' is contained in the ''%2'' package.'. |
|
651 |
msg := msg , '\\This method will remain in its package.'. |
|
652 |
] ifFalse:[ |
|
653 |
otherPackages size == 1 ifTrue:[ |
|
654 |
msg := 'The %1 methods from the %2 package will remain in its package.' |
|
655 |
] ifFalse:[ |
|
656 |
msg := 'The %1 methods from %3 other packages will remain in their packages.' |
|
657 |
]. |
|
658 |
msg := msg , '\\Hint: if these are meant to belong to this package,'. |
|
659 |
msg := msg , '\move them first, then repeat the checkin operation.'. |
|
660 |
]. |
|
661 |
msg := msg withCRs. |
|
662 |
msg := msg bindWith:methodsInOtherPackages size |
|
663 |
with:otherPackages first allBold |
|
664 |
with:otherPackages size |
|
665 |
with:methodsInOtherPackages first selector allBold |
|
666 |
with:methodsInOtherPackages first mclass name allBold. |
|
667 |
(Dialog confirm:msg noLabel:(resources string:'Cancel')) ifFalse:[^ self]. |
|
668 |
]. |
|
669 |
]. |
|
670 |
||
671 |
doClasses ifTrue:[ |
|
672 |
classesToCheckIn notEmpty ifTrue:[ |
|
673 |
looseMethods notEmpty ifTrue:[ |
|
674 |
looseMethods size == 1 ifTrue:[ |
|
675 |
msg := 'The ''%2'' method in ''%3'' is unassigned (loose).'. |
|
676 |
msg := msg , '\\If you proceed, this method will be moved to the ''%4'' package'. |
|
677 |
msg := msg , '\\Hint: if this is meant to be an extension of another package,'. |
|
678 |
msg := msg , '\cancel and move it to the appropriate package first.'. |
|
679 |
] ifFalse:[ |
|
680 |
msg := 'There are %1 unassigned (loose) methods in classes from this project.'. |
|
681 |
msg := msg , '\\If you proceed, those will be moved to the ''%4'' package ?'. |
|
682 |
msg := msg , '\\Hint: if these are meant to be extensions of another package,'. |
|
683 |
msg := msg , '\cancel and move them to the appropriate package first.'. |
|
684 |
]. |
|
685 |
doClasses ifTrue:[ |
|
686 |
msg := msg , '\\If you answer with "No" here, you will be asked for each class individually.'. |
|
687 |
]. |
|
688 |
msg := msg withCRs. |
|
689 |
msg := msg bindWith:looseMethods size |
|
690 |
with:(looseMethods isEmpty ifTrue:[''] ifFalse:[looseMethods first selector allBold]) |
|
691 |
with:(looseMethods isEmpty ifTrue:[''] ifFalse:[looseMethods first mclass name allBold]) |
|
692 |
with:packageToCheckIn allBold. |
|
693 |
(Dialog confirm:msg noLabel:(resources string:'Cancel')) ifFalse:[^ self]. |
|
694 |
||
695 |
looseMethods do:[:mthd | |
|
696 |
mthd package:packageToCheckIn |
|
697 |
]. |
|
698 |
]. |
|
699 |
self checkinClasses:classesToCheckIn withInfo:checkinInfo. |
|
700 |
]. |
|
701 |
||
702 |
originalCheckinInfo notNil ifTrue:[ |
|
703 |
originalCheckinInfo isStable ifTrue:[ |
|
704 |
classesToTag do:[:eachClass | |
|
705 |
self tagClass:eachClass as:#stable |
|
706 |
]. |
|
707 |
]. |
|
708 |
originalCheckinInfo tagIt ifTrue:[ |
|
709 |
classesToTag do:[:eachClass | |
|
710 |
self tagClass:eachClass as:(originalCheckinInfo tag) |
|
711 |
]. |
|
712 |
]. |
|
713 |
]. |
|
714 |
]. |
|
715 |
||
716 |
doBuild ifTrue:[ |
|
717 |
self checkinBuildSupportFilesForPackage:packageToCheckIn |
|
718 |
]. |
|
719 |
||
720 |
"Created: / 13-10-2011 / 11:15:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2906 | 721 |
"Modified: / 04-09-2012 / 14:05:36 / cg" |
2848 | 722 |
! ! |
723 |
||
3158
f8c56a311307
Merged 87750af738dc and 72ca7e81fbbf (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
724 |
|
2848 | 725 |
!SourceCodeManagerUtilitiesForContainerBasedManagers class methodsFor:'documentation'! |
726 |
||
727 |
version |
|
3145
e59d8d1ab71a
class: SourceCodeManagerUtilitiesForContainerBasedManagers
Claus Gittinger <cg@exept.de>
parents:
3141
diff
changeset
|
728 |
^ '$Header: /cvs/stx/stx/libbasic3/SourceCodeManagerUtilitiesForContainerBasedManagers.st,v 1.6 2013-03-27 16:38:54 cg Exp $' |
2848 | 729 |
! |
730 |
||
731 |
version_CVS |
|
3145
e59d8d1ab71a
class: SourceCodeManagerUtilitiesForContainerBasedManagers
Claus Gittinger <cg@exept.de>
parents:
3141
diff
changeset
|
732 |
^ '$Header: /cvs/stx/stx/libbasic3/SourceCodeManagerUtilitiesForContainerBasedManagers.st,v 1.6 2013-03-27 16:38:54 cg Exp $' |
3067
580931ccfea6
fixed bug in changeset reading (info changes were lost)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3065
diff
changeset
|
733 |
! |
580931ccfea6
fixed bug in changeset reading (info changes were lost)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3065
diff
changeset
|
734 |
|
3121
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
735 |
version_HG |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
736 |
|
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
737 |
^ '$Changeset: <not expanded> $' |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
738 |
! |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
739 |
|
3067
580931ccfea6
fixed bug in changeset reading (info changes were lost)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3065
diff
changeset
|
740 |
version_SVN |
3121
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
741 |
^ '§Id:: SourceCodeManagerUtilitiesForContainerBasedManagers.st 1981 2012-11-30 17:20:01Z vranyj1 §' |
2848 | 742 |
! ! |
3133 | 743 |