author | Claus Gittinger <cg@exept.de> |
Tue, 18 May 2004 15:30:31 +0200 | |
changeset 1391 | 68432469745f |
parent 1381 | 9a44354883b8 |
child 1401 | 102c0c12b66b |
permissions | -rw-r--r-- |
906 | 1 |
" |
2 |
COPYRIGHT (c) 2000 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 |
||
920 | 14 |
"{ Package: 'stx:libbasic3' }" |
15 |
||
873 | 16 |
Object subclass:#SourceCodeManagerUtilities |
1053
bbf6a1d5d3f7
Raise query signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
1051
diff
changeset
|
17 |
instanceVariableNames:'' |
bbf6a1d5d3f7
Raise query signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
1051
diff
changeset
|
18 |
classVariableNames:'LastSourceLogMessage LastModule LastPackage YesToAllQuery |
bbf6a1d5d3f7
Raise query signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
1051
diff
changeset
|
19 |
YesToAllNotification' |
bbf6a1d5d3f7
Raise query signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
1051
diff
changeset
|
20 |
poolDictionaries:'' |
bbf6a1d5d3f7
Raise query signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
1051
diff
changeset
|
21 |
category:'System-SourceCodeManagement' |
873 | 22 |
! |
23 |
||
24 |
!SourceCodeManagerUtilities class methodsFor:'documentation'! |
|
25 |
||
906 | 26 |
copyright |
27 |
" |
|
28 |
COPYRIGHT (c) 2000 eXept Software AG |
|
29 |
All Rights Reserved |
|
30 |
||
31 |
This software is furnished under a license and may be used |
|
32 |
only in accordance with the terms of that license and with the |
|
33 |
inclusion of the above copyright notice. This software may not |
|
34 |
be provided or otherwise made available to, or used by, any |
|
35 |
other person. No title to or ownership of the software is |
|
36 |
hereby transferred. |
|
37 |
" |
|
38 |
||
39 |
! |
|
40 |
||
873 | 41 |
documentation |
42 |
" |
|
43 |
utility code which is useful at more than one place |
|
44 |
(extracted from the browser) |
|
45 |
||
46 |
[author:] |
|
47 |
Claus Gittinger (cg@exept) |
|
48 |
||
49 |
[see also:] |
|
50 |
||
51 |
[instance variables:] |
|
52 |
||
53 |
[class variables:] |
|
54 |
" |
|
55 |
! ! |
|
56 |
||
992 | 57 |
!SourceCodeManagerUtilities class methodsFor:'Signal constants'! |
58 |
||
59 |
yesToAllNotification |
|
60 |
YesToAllNotification isNil ifTrue:[ |
|
61 |
YesToAllNotification := QuerySignal new. |
|
62 |
]. |
|
63 |
^ YesToAllNotification |
|
64 |
! |
|
65 |
||
66 |
yesToAllQuery |
|
67 |
YesToAllQuery isNil ifTrue:[ |
|
68 |
YesToAllQuery := QuerySignal new. |
|
69 |
]. |
|
70 |
^ YesToAllQuery |
|
71 |
! ! |
|
72 |
||
1084 | 73 |
!SourceCodeManagerUtilities class methodsFor:'accessing'! |
74 |
||
75 |
lastModule |
|
76 |
"return the value of the static variable 'LastModule' (automatically generated)" |
|
77 |
||
78 |
^ LastModule |
|
79 |
! |
|
80 |
||
81 |
lastModule:something |
|
82 |
"set the value of the static variable 'LastModule' (automatically generated)" |
|
83 |
||
84 |
LastModule := something. |
|
85 |
! |
|
86 |
||
87 |
lastPackage |
|
88 |
"return the value of the static variable 'LastPackage' (automatically generated)" |
|
89 |
||
90 |
^ LastPackage |
|
91 |
! |
|
92 |
||
93 |
lastPackage:something |
|
94 |
"set the value of the static variable 'LastPackage' (automatically generated)" |
|
95 |
||
96 |
LastPackage := something. |
|
97 |
! ! |
|
98 |
||
873 | 99 |
!SourceCodeManagerUtilities class methodsFor:'utilities'! |
100 |
||
1375 | 101 |
setPackageOfAllMethodsIn:aClass to:aPackage |
102 |
"make all methods belong to the classes project" |
|
933
84fd7806afaf
offer existing modules/packages in source-container dialog
Claus Gittinger <cg@exept.de>
parents:
923
diff
changeset
|
103 |
|
1375 | 104 |
|anyChange anyChangeHere| |
893 | 105 |
|
1375 | 106 |
anyChange := false. |
107 |
aClass withAllPrivateClassesDo:[:eachClass | |
|
108 |
anyChangeHere := false. |
|
109 |
eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
|
110 |
mthd package ~= aPackage ifTrue:[ |
|
111 |
mthd setPackage:aPackage. |
|
112 |
anyChangeHere := true. |
|
113 |
]. |
|
114 |
]. |
|
115 |
anyChangeHere ifTrue:[ |
|
116 |
eachClass changed:#projectOrganization |
|
117 |
]. |
|
118 |
anyChangeHere ifTrue:[anyChange := true]. |
|
893 | 119 |
]. |
1375 | 120 |
anyChange ifTrue:[ |
121 |
Smalltalk changed:#projectOrganization |
|
1185 | 122 |
]. |
1375 | 123 |
^ anyChange |
893 | 124 |
! |
125 |
||
1375 | 126 |
sourceCodeManagerFor:aClass |
127 |
|mgr| |
|
934
4f06b1db2ca1
better user interface when asking for a revision to compare.
Claus Gittinger <cg@exept.de>
parents:
933
diff
changeset
|
128 |
|
1375 | 129 |
mgr := (aClass sourceCodeManager). |
130 |
mgr isNil ifTrue:[ |
|
131 |
SourceCodeManager isNil ifTrue:[ |
|
132 |
(self warn:'SourceCodeManagement is disabled or not configured.\\Please setup in the Launcher.' withCRs) ifFalse:[ |
|
133 |
^ nil |
|
1012
92c4719178de
faster search for halts etc.
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
134 |
]. |
973
b9004b37290a
check for #halt and #error when checking in
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
135 |
]. |
1375 | 136 |
(self confirm:'Class does not seem to provide a valid sourceCodeManager.\\Assume CVS ?' withCRs) ifFalse:[ |
137 |
^ nil |
|
973
b9004b37290a
check for #halt and #error when checking in
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
138 |
]. |
1375 | 139 |
mgr := CVSSourceCodeManager. |
140 |
]. |
|
141 |
^ mgr |
|
142 |
! ! |
|
1160 | 143 |
|
1375 | 144 |
!SourceCodeManagerUtilities class methodsFor:'utilities-cvs'! |
973
b9004b37290a
check for #halt and #error when checking in
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
145 |
|
1158 | 146 |
checkForExistingModule:module package:package container:containerFileName using:mgr allowCreate:allowCreate |
147 |
|resources moduleName packageName containerName| |
|
148 |
||
1377
0fd99dd003f6
classResources now understood by all classes
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
149 |
resources := self classResources. |
1158 | 150 |
moduleName := module allBold. |
151 |
packageName := package allBold. |
|
152 |
containerName := containerFileName allBold. |
|
153 |
||
154 |
"/ |
|
155 |
"/ check for the container |
|
156 |
"/ |
|
157 |
(mgr checkForExistingContainerInModule:module package:package container:containerFileName) ifFalse:[ |
|
158 |
allowCreate ifFalse:[ |
|
159 |
self warn:(resources string:'A container for ''%1'' does not exist in ''%2:%3''' |
|
160 |
with:containerName with:moduleName with:packageName) withCRs. |
|
161 |
^ false |
|
162 |
]. |
|
163 |
(Dialog |
|
164 |
confirm:(resources string:'''%1'' is a new container (in ''%2:%3'').\\Create it ?' |
|
165 |
with:containerName with:moduleName with:packageName) withCRs |
|
166 |
noLabel:'Cancel') |
|
167 |
ifFalse:[ |
|
168 |
^ false. |
|
169 |
]. |
|
170 |
(mgr createContainerForText:'' inModule:module package:package container:containerFileName) ifFalse:[ |
|
171 |
self warn:(resources string:'Cannot create new container: ''%1'' (in ''%2:%3'')' |
|
172 |
with:containerName with:moduleName with:packageName). |
|
173 |
^ false. |
|
174 |
] |
|
175 |
]. |
|
176 |
^ true. |
|
177 |
! |
|
178 |
||
179 |
checkForExistingModule:module package:package using:mgr allowCreate:allowCreate |
|
180 |
|resources moduleName packageName| |
|
181 |
||
1377
0fd99dd003f6
classResources now understood by all classes
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
182 |
resources := self classResources. |
1158 | 183 |
moduleName := module allBold. |
184 |
packageName := package allBold. |
|
185 |
||
186 |
"/ |
|
187 |
"/ check for the package |
|
188 |
"/ |
|
189 |
(mgr checkForExistingModule:module package:package) ifFalse:[ |
|
190 |
allowCreate ifFalse:[ |
|
191 |
self warn:(resources string:'A package named ''%1'' does not exist in module ''%2''' |
|
192 |
with:packageName with:moduleName) withCRs. |
|
193 |
^ false |
|
194 |
]. |
|
195 |
(Dialog |
|
196 |
confirm:(resources string:'''%1'' is a new package in module ''%2''.\\create it ?' |
|
197 |
with:packageName with:moduleName) withCRs |
|
198 |
noLabel:'Cancel') |
|
199 |
ifFalse:[ |
|
200 |
^ false. |
|
201 |
]. |
|
202 |
(mgr createModule:module package:package) ifFalse:[ |
|
203 |
self warn:(resources string:'Cannot create new package: ''%1'' in module ''%2''' |
|
204 |
with:packageName with:moduleName) withCRs. |
|
205 |
^ false. |
|
206 |
] |
|
207 |
]. |
|
208 |
^ true. |
|
209 |
! |
|
210 |
||
211 |
checkForExistingModule:module using:mgr allowCreate:allowCreate |
|
212 |
|resources moduleName| |
|
213 |
||
214 |
(mgr checkForExistingModule:module) ifFalse:[ |
|
1377
0fd99dd003f6
classResources now understood by all classes
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
215 |
resources := self classResources. |
1158 | 216 |
moduleName := module allBold. |
217 |
||
218 |
allowCreate ifFalse:[ |
|
219 |
self warn:(resources string:'A module named ''%1'' does not exist in the repository' |
|
220 |
with:moduleName) withCRs. |
|
221 |
^ false |
|
222 |
]. |
|
223 |
||
224 |
(Dialog |
|
225 |
confirm:(resources string:'''%1'' is a new module.\\create it ?' with:moduleName) withCRs |
|
226 |
noLabel:'Cancel') |
|
227 |
ifFalse:[ |
|
228 |
^ false. |
|
229 |
]. |
|
230 |
(mgr createModule:module) ifFalse:[ |
|
231 |
self warn:(resources string:'Cannot create new module: ''%1''' with:moduleName) withCRs. |
|
232 |
^ false. |
|
233 |
] |
|
234 |
]. |
|
235 |
^ true. |
|
236 |
! |
|
237 |
||
886 | 238 |
checkinClass:aClass |
239 |
"check a class into the source repository. |
|
240 |
Asks interactively for log-message." |
|
882 | 241 |
|
242 |
^ self checkinClass:aClass withLog:nil |
|
243 |
! |
|
244 |
||
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
245 |
checkinClass:aClass withLog:aLogMessageOrNil |
886 | 246 |
"check a class into the source repository. |
247 |
If the argument, aLogMessageOrNil isNil, ask interactively for log-message." |
|
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
248 |
|
977 | 249 |
^ self checkinClass:aClass withLog:aLogMessageOrNil withCheck:true |
250 |
! |
|
251 |
||
252 |
checkinClass:aClass withLog:aLogMessageOrNil withCheck:doCheckClass |
|
253 |
"check a class into the source repository. |
|
254 |
If the argument, aLogMessageOrNil isNil, ask interactively for log-message." |
|
255 |
||
1078 | 256 |
|logMessage info mgr pri resources newSelectors initialLog| |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
257 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
258 |
aClass isLoaded ifFalse:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
259 |
self information:'cannot checkin unloaded classes (' , aClass name , ').'. |
881 | 260 |
^ false. |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
261 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
262 |
|
1189
fdc5e747c184
refactored check for a valid sourceCodeManager into one place
Claus Gittinger <cg@exept.de>
parents:
1185
diff
changeset
|
263 |
mgr := self sourceCodeManagerFor:aClass. |
954 | 264 |
mgr isNil ifTrue:[ |
1189
fdc5e747c184
refactored check for a valid sourceCodeManager into one place
Claus Gittinger <cg@exept.de>
parents:
1185
diff
changeset
|
265 |
^ false |
954 | 266 |
]. |
267 |
||
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
268 |
aLogMessageOrNil isNil ifTrue:[ |
1078 | 269 |
newSelectors := aClass selectors asSet. |
270 |
newSelectors addAll:(aClass class selectors). |
|
271 |
newSelectors size == 1 ifTrue:[ |
|
272 |
initialLog := 'Added/changed #' , newSelectors first |
|
273 |
"/ ] ifFalse:[ |
|
274 |
"/ newSelectors size > 1 ifTrue:[ |
|
275 |
"/ initialLog := 'Added/changed some methods' |
|
276 |
"/ ] |
|
277 |
]. |
|
278 |
||
279 |
logMessage := self |
|
1207 | 280 |
getLogMessageFor:aClass name |
1078 | 281 |
initialAnswer:initialLog. |
1048 | 282 |
logMessage isNil ifTrue:[^ false]. |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
283 |
] ifFalse:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
284 |
logMessage := aLogMessageOrNil |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
285 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
286 |
|
1377
0fd99dd003f6
classResources now understood by all classes
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
287 |
resources := self classResources. |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
288 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
289 |
info := mgr sourceInfoOfClass:aClass. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
290 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
291 |
(info isNil |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
292 |
or:[(info at:#fileName ifAbsent:nil) isNil |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
293 |
or:[(info at:#module ifAbsent:nil) isNil |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
294 |
or:[(info at:#directory ifAbsent:nil) isNil]]]) ifTrue:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
295 |
(self createSourceContainerForClass:aClass) ifFalse:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
296 |
"/ self warn:'did not create a container for ''' , aClass name , ''''. |
881 | 297 |
^ false |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
298 |
]. |
881 | 299 |
^ true. |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
300 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
301 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
302 |
self activityNotification:(resources string:'checking in %1' with:aClass name). |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
303 |
pri := Processor activePriority. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
304 |
Processor activeProcess withPriority:pri-1 to:pri |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
305 |
do:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
306 |
|revision aborted freshCreated| |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
307 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
308 |
freshCreated := false. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
309 |
revision := aClass revision. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
310 |
revision isNil ifTrue:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
311 |
"/ mhmh - check if it has a container. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
312 |
(mgr checkForExistingContainerForClass:aClass) ifFalse:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
313 |
(self createSourceContainerForClass:aClass) ifFalse:[ |
1030 | 314 |
self warn:'Did not create/change repository container for ''' , aClass name allBold , ''''. |
315 |
^ false. |
|
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
316 |
] ifTrue:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
317 |
freshCreated := true. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
318 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
319 |
] |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
320 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
321 |
|
977 | 322 |
doCheckClass ifTrue:[ |
323 |
"/ check if the class contains halts, error-sends etc. |
|
324 |
(self checkAndWarnAboutBadMessagesInClass:aClass) ifFalse:[ |
|
325 |
^ false |
|
326 |
]. |
|
973
b9004b37290a
check for #halt and #error when checking in
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
327 |
]. |
b9004b37290a
check for #halt and #error when checking in
Claus Gittinger <cg@exept.de>
parents:
958
diff
changeset
|
328 |
|
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
329 |
freshCreated ifFalse:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
330 |
aborted := false. |
1113
30540d5fc3b7
class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents:
1095
diff
changeset
|
331 |
AbortOperationRequest handle:[:ex | |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
332 |
aborted := true. |
881 | 333 |
ex return. |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
334 |
] do:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
335 |
(mgr checkinClass:aClass logMessage:logMessage) ifFalse:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
336 |
Transcript showCR:'checkin of ''' , aClass name , ''' failed'. |
1019 | 337 |
self warn:'checkin of ''' , aClass name allBold , ''' failed'. |
881 | 338 |
^ false. |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
339 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
340 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
341 |
aborted ifTrue:[ |
1158 | 342 |
Transcript showCR:'Checkin of ''' , aClass name , ''' aborted'. |
1032 | 343 |
AbortAllSignal isHandled ifTrue:[ |
344 |
(Dialog |
|
1158 | 345 |
confirm:('Checkin of ''' , aClass name , ''' aborted.\\Cancel all ?')withCRs |
1032 | 346 |
default:false) |
347 |
ifTrue:[ |
|
1022 | 348 |
AbortAllSignal raise. |
1032 | 349 |
] |
1016 | 350 |
]. |
881 | 351 |
^ false. |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
352 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
353 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
354 |
]. |
881 | 355 |
^ true |
1113
30540d5fc3b7
class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents:
1095
diff
changeset
|
356 |
|
30540d5fc3b7
class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents:
1095
diff
changeset
|
357 |
"Modified: / 16.11.2001 / 17:39:21 / cg" |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
358 |
! |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
359 |
|
920 | 360 |
checkinClasses:aCollectionOfClass |
886 | 361 |
"check a collection of classes into the source repository. |
362 |
Asks interactively for log-message." |
|
363 |
||
920 | 364 |
^ self checkinClasses:aCollectionOfClass withLog:nil |
886 | 365 |
! |
366 |
||
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
367 |
checkinClasses:aCollectionOfClasses withLog:aLogMessageOrNil |
886 | 368 |
"check a bunch of classes into the source repository. |
369 |
If the argument, aLogMessageOrNil isNil, ask interactively for log-message." |
|
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
370 |
|
992 | 371 |
^ self |
1142
cba1ede48a4a
allow check for halt/error to be turned off via userPrefs
Claus Gittinger <cg@exept.de>
parents:
1137
diff
changeset
|
372 |
checkinClasses:aCollectionOfClasses |
cba1ede48a4a
allow check for halt/error to be turned off via userPrefs
Claus Gittinger <cg@exept.de>
parents:
1137
diff
changeset
|
373 |
withLog:aLogMessageOrNil |
cba1ede48a4a
allow check for halt/error to be turned off via userPrefs
Claus Gittinger <cg@exept.de>
parents:
1137
diff
changeset
|
374 |
withCheck:(UserPreferences current at:#checkClassesWhenCheckingIn ifAbsent:true) |
992 | 375 |
! |
376 |
||
377 |
checkinClasses:aCollectionOfClasses withLog:aLogMessageOrNil withCheck:doCheckClasses |
|
378 |
"check a bunch of classes into the source repository. |
|
379 |
If the argument, aLogMessageOrNil isNil, ask interactively for log-message." |
|
380 |
||
381 |
|classes logMessage resources yesOrNoToAll| |
|
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
382 |
|
920 | 383 |
"/ ignore private classes |
384 |
classes := aCollectionOfClasses select:[:aClass | aClass owningClass isNil]. |
|
385 |
classes isEmpty ifTrue:[ |
|
386 |
self information:'Only private classes given - nothing checked in.'. |
|
387 |
^ self |
|
388 |
]. |
|
389 |
classes := classes select:[:aClass | aClass isLoaded]. |
|
390 |
classes isEmpty ifTrue:[ |
|
391 |
self information:'Only unloaded classes given - nothing checked in.'. |
|
392 |
^ self |
|
393 |
]. |
|
958 | 394 |
classes size == 1 ifTrue:[ |
992 | 395 |
^ self checkinClass:classes first withLog:aLogMessageOrNil withCheck:doCheckClasses. |
958 | 396 |
]. |
920 | 397 |
|
1377
0fd99dd003f6
classResources now understood by all classes
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
398 |
resources := self classResources. |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
399 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
400 |
(logMessage := aLogMessageOrNil) isNil ifTrue:[ |
957 | 401 |
logMessage := SourceCodeManagerUtilities getLogMessageFor:(resources string:'%1 classes to checkin' with:aCollectionOfClasses size). |
402 |
||
403 |
logMessage isNil ifTrue:[ |
|
404 |
^ self |
|
405 |
]. |
|
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
406 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
407 |
|
1016 | 408 |
AbortAllSignal handle:[:ex | |
409 |
ex return |
|
992 | 410 |
] do:[ |
1016 | 411 |
self yesToAllNotification handle:[:ex | |
412 |
yesOrNoToAll := ex parameter. |
|
413 |
ex proceed |
|
992 | 414 |
] do:[ |
1016 | 415 |
self yesToAllQuery handle:[:ex | |
416 |
ex proceedWith:yesOrNoToAll |
|
417 |
] do:[ |
|
418 |
classes do:[:aClass | |
|
1137
239b07db4478
dont check twice for bad messages (halt etc.)
Claus Gittinger <cg@exept.de>
parents:
1131
diff
changeset
|
419 |
self activityNotification:(resources string:'checking in %1' with:aClass name). |
239b07db4478
dont check twice for bad messages (halt etc.)
Claus Gittinger <cg@exept.de>
parents:
1131
diff
changeset
|
420 |
"/ ca does not want boxes to pop up all over ... |
1245 | 421 |
UserInformation handle:[:ex | |
422 |
Transcript showCR:ex description |
|
1137
239b07db4478
dont check twice for bad messages (halt etc.)
Claus Gittinger <cg@exept.de>
parents:
1131
diff
changeset
|
423 |
] do:[ |
1160 | 424 |
AbortSignal handle:[:ex | |
425 |
] do:[ |
|
426 |
self checkinClass:aClass withLog:logMessage withCheck:doCheckClasses |
|
427 |
] |
|
992 | 428 |
]. |
1016 | 429 |
] |
992 | 430 |
] |
1016 | 431 |
]. |
992 | 432 |
]. |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
433 |
! |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
434 |
|
922
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
435 |
checkinExtensionMethods:aCollectionOfMethods forPackage:aPackageID withLog:aLogMessageOrNil |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
436 |
"checkin a projects extensions into the source repository. |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
437 |
If the argument, aLogMessageOrNil isNil, ask interactively for log-message." |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
438 |
|
1120 | 439 |
|logMessage mgr pri resources module package i containerFileName s |
1015 | 440 |
methodSource methodsSortedByName| |
922
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
441 |
|
1377
0fd99dd003f6
classResources now understood by all classes
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
442 |
resources := self classResources. |
957 | 443 |
|
958 | 444 |
mgr := aCollectionOfMethods first mclass theNonMetaclass sourceCodeManager. |
957 | 445 |
mgr isNil ifTrue:[ |
446 |
self warn:'No sourceCode manager defined - cannot checkin.'. |
|
447 |
"/ self error:'No sourceCode manager defined' mayProceed:true. |
|
448 |
^ false. |
|
449 |
]. |
|
450 |
i := aPackageID indexOf:$:. |
|
451 |
i == 0 ifTrue:[ |
|
452 |
self warn:'Cannot extract module/package from the packageID (invalid format)\\Please change the packageID to be of the form <module>:<subdirectory>,\and try again.\Or, alternatively, move the extensions to their classes project and checkIn the class(es).' withCRs. |
|
453 |
"/ self error:'cannot extract module/package from packageID' mayProceed:true. |
|
454 |
^ false. |
|
455 |
]. |
|
456 |
module := aPackageID copyTo:i-1. |
|
457 |
package := aPackageID copyFrom:i+1. |
|
1120 | 458 |
(package startsWith:$:) ifTrue:[ |
459 |
package := package copyFrom:2. |
|
460 |
]. |
|
957 | 461 |
|
922
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
462 |
containerFileName := 'extensions.st'. |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
463 |
|
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
464 |
aLogMessageOrNil isNil ifTrue:[ |
1019 | 465 |
logMessage := SourceCodeManagerUtilities getLogMessageFor:containerFileName allBold. |
1120 | 466 |
logMessage isNil ifTrue:[^ false]. |
922
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
467 |
] ifFalse:[ |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
468 |
logMessage := aLogMessageOrNil |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
469 |
]. |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
470 |
|
1158 | 471 |
(self checkForExistingModule:module using:mgr allowCreate:true) ifFalse:[^ false]. |
922
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
472 |
LastModule := module. |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
473 |
|
1158 | 474 |
(self checkForExistingModule:module package:package using:mgr allowCreate:true) ifFalse:[^ false]. |
475 |
LastPackage := package. |
|
1015 | 476 |
|
1158 | 477 |
(self checkForExistingModule:module package:package container:containerFileName using:mgr allowCreate:true) ifFalse:[^ false]. |
922
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
478 |
|
1120 | 479 |
self activityNotification:(resources string:'Checking in %1' with:containerFileName). |
922
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
480 |
pri := Processor activePriority. |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
481 |
Processor activeProcess withPriority:pri-1 to:pri |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
482 |
do:[ |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
483 |
s := '' writeStream. |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
484 |
|
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
485 |
s nextPutAll:'"{ Package: '''. |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
486 |
s nextPutAll:aPackageID asString. |
923 | 487 |
s nextPutAll:''' }"'; cr; nextPutChunkSeparator; cr; cr. |
922
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
488 |
|
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
489 |
"/ s nextPutAll:(Smalltalk timeStamp). |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
490 |
"/ s nextPutChunkSeparator. |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
491 |
"/ s cr; cr. |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
492 |
|
1015 | 493 |
"/ sort them by name (to avoid conflict due to CVS merge) |
494 |
methodsSortedByName := aCollectionOfMethods asOrderedCollection. |
|
495 |
methodsSortedByName sort:[:a :b | |
|
496 |
|clsA clsB| |
|
497 |
||
498 |
clsA := a mclass name. |
|
499 |
clsB := b mclass name. |
|
500 |
clsA < clsB ifTrue:[ |
|
501 |
true |
|
502 |
] ifFalse:[ |
|
503 |
clsA > clsB ifTrue:[ |
|
504 |
false |
|
505 |
] ifFalse:[ |
|
506 |
a selector < b selector |
|
507 |
] |
|
508 |
] |
|
509 |
]. |
|
510 |
methodsSortedByName do:[:aMethod | |
|
922
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
511 |
aMethod mclass fileOutMethod:aMethod on:s. |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
512 |
s cr. |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
513 |
]. |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
514 |
methodSource := s contents. |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
515 |
|
1245 | 516 |
UserInformation handle:[:ex | |
1323 | 517 |
Transcript showCR:ex description. |
518 |
ex proceed. |
|
922
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
519 |
] do:[ |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
520 |
(mgr |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
521 |
checkin:containerFileName |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
522 |
text:methodSource |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
523 |
directory:package |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
524 |
module:module |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
525 |
logMessage:aLogMessageOrNil |
1090
8608e5b91fa7
condense changeSet after checking in an extensions container
Claus Gittinger <cg@exept.de>
parents:
1084
diff
changeset
|
526 |
force:false) |
8608e5b91fa7
condense changeSet after checking in an extensions container
Claus Gittinger <cg@exept.de>
parents:
1084
diff
changeset
|
527 |
ifFalse:[ |
1120 | 528 |
Transcript showCR:'Checkin of ''' , containerFileName , ''' failed'. |
529 |
self warn:'Checkin of ''' , containerFileName allBold , ''' failed'. |
|
1090
8608e5b91fa7
condense changeSet after checking in an extensions container
Claus Gittinger <cg@exept.de>
parents:
1084
diff
changeset
|
530 |
^ false. |
922
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
531 |
]. |
1090
8608e5b91fa7
condense changeSet after checking in an extensions container
Claus Gittinger <cg@exept.de>
parents:
1084
diff
changeset
|
532 |
mgr postCheckInExtensionsForPackage:aPackageID |
922
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
533 |
]. |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
534 |
]. |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
535 |
^ true |
1090
8608e5b91fa7
condense changeSet after checking in an extensions container
Claus Gittinger <cg@exept.de>
parents:
1084
diff
changeset
|
536 |
|
8608e5b91fa7
condense changeSet after checking in an extensions container
Claus Gittinger <cg@exept.de>
parents:
1084
diff
changeset
|
537 |
"Modified: / 5.11.2001 / 17:06:00 / cg" |
922
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
538 |
! |
24cfcd3043a2
file based operations added (to check in extensions etc.)
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
539 |
|
986
78d2a098bc81
support to checkout/merge a class from the repository
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
540 |
checkoutClass:aClass askForMerge:askForMerge |
78d2a098bc81
support to checkout/merge a class from the repository
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
541 |
"check-out a class from the source repository." |
78d2a098bc81
support to checkout/merge a class from the repository
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
542 |
|
1006 | 543 |
self |
544 |
checkoutClass:aClass |
|
545 |
askForRevision:true |
|
546 |
askForMerge:askForMerge |
|
547 |
! |
|
548 |
||
549 |
checkoutClass:aClass askForRevision:askForRevision askForMerge:askForMerge |
|
550 |
"check-out a class from the source repository. |
|
551 |
If askForRevision is false, check-out the newest version." |
|
552 |
||
1084 | 553 |
|mgr resources sourceInfo |
1339 | 554 |
currentClass inChangeSet |
1055
f44b12442c58
version update after load from rep.
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
555 |
aStream sourceToLoad currentSource rev revString |
986
78d2a098bc81
support to checkout/merge a class from the repository
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
556 |
nm msg rev2 newestRev |
1030 | 557 |
containerModule containerPackage containerFile rslt |
558 |
pkg listHere listRep diffSet |
|
1054 | 559 |
changed onlyHere onlyInRep answer labels values singleChangeSelector |
1051 | 560 |
changedClasses default versionMethodsHere versionMethodsRep changedClassDefinitions| |
986
78d2a098bc81
support to checkout/merge a class from the repository
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
561 |
|
1189
fdc5e747c184
refactored check for a valid sourceCodeManager into one place
Claus Gittinger <cg@exept.de>
parents:
1185
diff
changeset
|
562 |
aClass isNil ifTrue:[self error:'nil class']. |
1158 | 563 |
|
1377
0fd99dd003f6
classResources now understood by all classes
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
564 |
resources := self classResources. |
986
78d2a098bc81
support to checkout/merge a class from the repository
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
565 |
|
78d2a098bc81
support to checkout/merge a class from the repository
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
566 |
currentClass := aClass theNonMetaclass. |
78d2a098bc81
support to checkout/merge a class from the repository
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
567 |
|
78d2a098bc81
support to checkout/merge a class from the repository
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
568 |
nm := currentClass name. |
1189
fdc5e747c184
refactored check for a valid sourceCodeManager into one place
Claus Gittinger <cg@exept.de>
parents:
1185
diff
changeset
|
569 |
mgr := self sourceCodeManagerFor:currentClass. |
986
78d2a098bc81
support to checkout/merge a class from the repository
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
570 |
mgr isNil ifTrue:[ |
78d2a098bc81
support to checkout/merge a class from the repository
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
571 |
^ self |
78d2a098bc81
support to checkout/merge a class from the repository
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
572 |
]. |
1084 | 573 |
|
574 |
sourceInfo := mgr sourceInfoOfClass:currentClass. |
|
575 |
sourceInfo notNil ifTrue:[ |
|
576 |
currentClass package ~= Project defaultProject package ifTrue:[ |
|
577 |
containerPackage := mgr packageFromSourceInfo:sourceInfo. |
|
578 |
containerModule := mgr moduleFromSourceInfo:sourceInfo. |
|
579 |
]. |
|
580 |
containerFile := mgr containerFromSourceInfo:sourceInfo. |
|
581 |
]. |
|
582 |
||
989
bb70a0f30e98
care for autoloaded classes when checking out
Claus Gittinger <cg@exept.de>
parents:
987
diff
changeset
|
583 |
currentClass isLoaded ifTrue:[ |
bb70a0f30e98
care for autoloaded classes when checking out
Claus Gittinger <cg@exept.de>
parents:
987
diff
changeset
|
584 |
rev := currentClass binaryRevision. |
bb70a0f30e98
care for autoloaded classes when checking out
Claus Gittinger <cg@exept.de>
parents:
987
diff
changeset
|
585 |
rev2 := currentClass revision. |
bb70a0f30e98
care for autoloaded classes when checking out
Claus Gittinger <cg@exept.de>
parents:
987
diff
changeset
|
586 |
rev isNil ifTrue:[ |
bb70a0f30e98
care for autoloaded classes when checking out
Claus Gittinger <cg@exept.de>
parents:
987
diff
changeset
|
587 |
rev := rev2 |
bb70a0f30e98
care for autoloaded classes when checking out
Claus Gittinger <cg@exept.de>
parents:
987
diff
changeset
|
588 |
]. |
bb70a0f30e98
care for autoloaded classes when checking out
Claus Gittinger <cg@exept.de>
parents:
987
diff
changeset
|
589 |
rev isNil ifTrue:[ |
1084 | 590 |
pkg := currentClass package. |
591 |
(pkg notNil and:[pkg ~= Project defaultProject package]) ifTrue:[ |
|
1019 | 592 |
containerModule := pkg upTo:$:. |
593 |
containerPackage := pkg copyFrom:(containerModule size + 2). |
|
594 |
]. |
|
595 |
containerModule size == 0 ifTrue:[ |
|
1084 | 596 |
containerModule := (SourceCodeManagerUtilities lastModule ) ? Project current repositoryModule. |
1019 | 597 |
]. |
598 |
containerPackage size == 0 ifTrue:[ |
|
1084 | 599 |
containerPackage := (SourceCodeManagerUtilities lastPackage ) ? Project current package. |
1019 | 600 |
]. |
1030 | 601 |
answer := self confirmWithCancel:(resources |
1035 | 602 |
string:'The class %3 seems to have no (valid) repository information.\\I assume you want to check it out from: %1/%2.' |
1030 | 603 |
with:containerModule allBold |
1035 | 604 |
with:containerPackage allBold |
1084 | 605 |
with:currentClass name allBold) withCRs. |
1030 | 606 |
answer isNil ifTrue:[^ self "cancelled"]. |
607 |
answer ifFalse:[ |
|
608 |
rslt := SourceCodeManagerUtilities |
|
609 |
askForContainer:(resources string:'The class seems to have no repository information.\\Do you want to checkOut from an existing containers contents ?') |
|
610 |
title:'Container to load from' note:nil |
|
611 |
initialModule:containerModule |
|
612 |
initialPackage:containerPackage |
|
1158 | 613 |
initialFileName:(currentClass nameWithoutPrefix , '.st') |
1030 | 614 |
forNewContainer:false. |
1084 | 615 |
|
1030 | 616 |
rslt isNil ifTrue:[ |
617 |
"/ canel |
|
618 |
^ self |
|
619 |
]. |
|
620 |
containerModule := "lastModule :=" rslt at:#module. |
|
621 |
containerPackage := "lastPackage :=" rslt at:#package. |
|
622 |
containerFile := rslt at:#fileName. |
|
623 |
]. |
|
1019 | 624 |
|
625 |
"/ rslt := SourceCodeManagerUtilities |
|
626 |
"/ askForContainer:(resources string:'The class seems to have no (valid) repository information.\\Do you want to check it out from an existing container ?') |
|
627 |
"/ title:'Container to checkOut' note:nil |
|
628 |
"/ initialModule:containerModule |
|
629 |
"/ initialPackage:containerPackage |
|
630 |
"/ initialFileName:(currentClass name , '.st'). |
|
1030 | 631 |
"/ forNewContainer:false. |
1019 | 632 |
"/ rslt isNil ifTrue:[^ self]. |
633 |
"/ self warn:(resources string:'Class %1 seems to be not yet in the repository' with:currentClass name allBold). |
|
634 |
"/ ^ self |
|
989
bb70a0f30e98
care for autoloaded classes when checking out
Claus Gittinger <cg@exept.de>
parents:
987
diff
changeset
|
635 |
]. |
986
78d2a098bc81
support to checkout/merge a class from the repository
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
636 |
]. |
78d2a098bc81
support to checkout/merge a class from the repository
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
637 |
|
78d2a098bc81
support to checkout/merge a class from the repository
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
638 |
"/ |
78d2a098bc81
support to checkout/merge a class from the repository
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
639 |
"/ class in repository - ask for revision |
78d2a098bc81
support to checkout/merge a class from the repository
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
640 |
"/ |
1084 | 641 |
"/ newestRev := mgr newestRevisionOf:currentClass. |
642 |
newestRev := mgr newestRevisionInFile:containerFile directory:containerPackage module:containerModule. |
|
1006 | 643 |
askForRevision ifFalse:[ |
644 |
rev := newestRev ? '' |
|
645 |
] ifTrue:[ |
|
1019 | 646 |
msg := resources string:'CheckOut which revision of ''%1'': (empty for newest)' with:nm allBold. |
986
78d2a098bc81
support to checkout/merge a class from the repository
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
647 |
rev notNil ifTrue:[ |
1006 | 648 |
msg := msg , '\\' , (resources string:'Current ''%1'' is based upon rev %2.' |
1019 | 649 |
with:nm allBold with:rev). |
1006 | 650 |
(rev2 notNil and:[rev2 ~= rev]) ifTrue:[ |
651 |
msg := msg , '\' , (resources string:'And has been checked into the repository as %1.' |
|
652 |
with:rev2) |
|
653 |
] |
|
986
78d2a098bc81
support to checkout/merge a class from the repository
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
654 |
]. |
1006 | 655 |
newestRev notNil ifTrue:[ |
656 |
msg := msg , '\' , (resources string:'Newest in reporitory is %1.' |
|
657 |
with:newestRev) |
|
989
bb70a0f30e98
care for autoloaded classes when checking out
Claus Gittinger <cg@exept.de>
parents:
987
diff
changeset
|
658 |
]. |
986
78d2a098bc81
support to checkout/merge a class from the repository
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
659 |
|
1006 | 660 |
rev := SourceCodeManagerUtilities |
661 |
askForExistingRevision:msg |
|
662 |
title:'CheckOut from repository' |
|
663 |
class:currentClass. |
|
664 |
rev isNil ifTrue:[ |
|
1339 | 665 |
^ self "/ canceled |
987 | 666 |
]. |
1006 | 667 |
]. |
986
78d2a098bc81
support to checkout/merge a class from the repository
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
668 |
|
1006 | 669 |
rev withoutSpaces isEmpty ifTrue:[ |
670 |
msg := 'extracting newest %1 (' , (newestRev ? '???') , ')'. |
|
671 |
"/ aStream := mgr getMostRecentSourceStreamForClassNamed:nm. |
|
672 |
aStream := mgr getSourceStreamFor:currentClass revision:newestRev. |
|
673 |
revString := '(newest: ' , (newestRev ? '???') , ')'. |
|
674 |
] ifFalse:[ |
|
675 |
msg := 'extracting previous %1'. |
|
1084 | 676 |
"/ aStream := mgr getSourceStreamFor:currentClass revision:rev. |
677 |
"/ revString := rev |
|
678 |
aStream := mgr |
|
679 |
streamForClass:currentClass |
|
680 |
fileName:containerFile |
|
681 |
revision:rev |
|
682 |
directory:containerPackage |
|
683 |
module:containerModule |
|
684 |
cache:true. |
|
1006 | 685 |
]. |
996 | 686 |
|
1006 | 687 |
aStream isNil ifTrue:[ |
1035 | 688 |
self warn:(resources string:'could not extract source of %1 from repository' with:aClass name allBold). |
1006 | 689 |
^ self |
690 |
]. |
|
691 |
aStream class readErrorSignal handle:[:ex | |
|
1245 | 692 |
self warn:('read error while reading extracted source\\' , ex description) withCRs. |
1006 | 693 |
aStream close. |
694 |
^ self |
|
695 |
] do:[ |
|
696 |
sourceToLoad := aStream contents asString. |
|
697 |
]. |
|
698 |
aStream close. |
|
987 | 699 |
|
1006 | 700 |
currentClass isLoaded ifFalse:[ |
701 |
rev = newestRev ifTrue:[ |
|
702 |
currentClass autoload. |
|
996 | 703 |
] ifFalse:[ |
1006 | 704 |
sourceToLoad readStream fileIn. |
996 | 705 |
]. |
1006 | 706 |
^ self. |
707 |
]. |
|
708 |
||
709 |
self activityNotification:'generating current source...'. |
|
710 |
||
711 |
aStream := '' writeStream. |
|
712 |
Method flushSourceStreamCache. |
|
713 |
currentClass fileOutOn:aStream withTimeStamp:false. |
|
714 |
currentSource := aStream contents asString. |
|
715 |
aStream close. |
|
716 |
||
717 |
self activityNotification:'comparing...'. |
|
718 |
||
719 |
sourceToLoad = currentSource ifTrue:[ |
|
720 |
"/ make all methods belong to the classes project |
|
721 |
self setPackageOfAllMethodsIn:aClass to:aClass package. |
|
1095 | 722 |
"/ (ChangeSet current includesChangeForClass:aClass) ifTrue:[ |
723 |
"/ (self confirm:(resources string:'Versions are identical: %1.\\Remove entries from changeSet ?' with:aClass name) withCRs) |
|
724 |
"/ ifTrue:[ |
|
725 |
"/ self halt |
|
726 |
"/ ] |
|
727 |
"/ ] ifFalse:[ |
|
728 |
self information:(resources string:'Versions are identical: %1' with:aClass name). |
|
729 |
"/ ]. |
|
1006 | 730 |
^ self. |
731 |
]. |
|
732 |
||
733 |
self activityNotification:'generating diffSet...'. |
|
734 |
listHere := ChangeSet fromStream:(currentSource readStream). |
|
735 |
listRep := ChangeSet fromStream:(sourceToLoad readStream). |
|
1051 | 736 |
|
737 |
versionMethodsHere := listHere select:[:change | (change isMethodChange |
|
738 |
and:[change selector == #version |
|
739 |
and:[change changeClass isMeta]])]. |
|
740 |
||
741 |
versionMethodsRep := listRep select:[:change | (change isMethodChange |
|
742 |
and:[change selector == #version |
|
743 |
and:[change changeClass isMeta]])]. |
|
744 |
||
1044 | 745 |
"/ compare all but the version methods |
746 |
listHere := listHere select:[:change | (change isMethodChange |
|
747 |
and:[change selector == #version |
|
748 |
and:[change changeClass isMeta]]) not]. |
|
749 |
listRep := listRep select:[:change | (change isMethodChange |
|
750 |
and:[change selector == #version |
|
751 |
and:[change changeClass isMeta]]) not]. |
|
752 |
||
1006 | 753 |
diffSet := listHere diffSetsAgainst:listRep. |
1157 | 754 |
changed := diffSet changed. |
755 |
onlyHere := diffSet onlyInReceiver. |
|
756 |
onlyInRep := diffSet onlyInArg. |
|
1006 | 757 |
|
1050 | 758 |
changedClassDefinitions := changed select:[:eachChangePair | eachChangePair first isClassDefinitionChange]. |
759 |
changed := changed reject:[:eachChangePair | eachChangePair first isClassDefinitionChange]. |
|
760 |
||
1121 | 761 |
labels := #('Cancel' 'Merge' 'Load'). |
1006 | 762 |
values := #(nil #merge #load). |
1007
44c0229bcb43
better dialog message text and load/cancel default.
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
763 |
default := askForRevision |
44c0229bcb43
better dialog message text and load/cancel default.
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
764 |
ifTrue:[3. "i.e. load"] |
44c0229bcb43
better dialog message text and load/cancel default.
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
765 |
ifFalse:[2. "i.e. merge"]. |
1006 | 766 |
|
1339 | 767 |
msg := 'About to load ''%4''.\\'. |
1006 | 768 |
onlyInRep size > 0 ifTrue:[ |
1007
44c0229bcb43
better dialog message text and load/cancel default.
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
769 |
msg := msg , 'The repositories version contains %1 method(s) which are not in your current class.\'. |
1006 | 770 |
]. |
771 |
onlyHere size > 0 ifTrue:[ |
|
772 |
onlyInRep size > 0 ifTrue:[ |
|
773 |
msg := msg , 'And there '. |
|
774 |
] ifFalse:[ |
|
775 |
msg := msg , 'There '. |
|
996 | 776 |
]. |
1006 | 777 |
msg := msg , 'are %2 methods in your current class, which are not in the repository.\'. |
778 |
]. |
|
779 |
changed size > 0 ifTrue:[ |
|
1054 | 780 |
changed size == 1 ifTrue:[ |
1339 | 781 |
msg := msg , 'The ''%6''-method is different (present in both).\\'. |
1291
60d89faa389f
no need for asText when sending allBold
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
782 |
singleChangeSelector := changed first first selector allBold |
1054 | 783 |
] ifFalse:[ |
784 |
msg := msg , '%3 methods are different (present in both).\\'. |
|
785 |
] |
|
1006 | 786 |
]. |
1050 | 787 |
changedClassDefinitions size > 0 ifTrue:[ |
788 |
changedClassDefinitions size == 1 ifTrue:[ |
|
1339 | 789 |
msg := msg , 'The class definition is different.\\'. |
1050 | 790 |
] ifFalse:[ |
791 |
msg := msg , '%5 class definitions are different.\\'. |
|
792 |
] |
|
793 |
]. |
|
996 | 794 |
|
1339 | 795 |
inChangeSet := ChangeSet current includesChangeForClass:aClass. |
796 |
||
1006 | 797 |
onlyHere isEmpty ifTrue:[ |
798 |
onlyInRep isEmpty ifTrue:[ |
|
1050 | 799 |
(changed isEmpty and:[changedClassDefinitions isEmpty]) ifTrue:[ |
1006 | 800 |
"/ make all methods belong to the classes project |
1055
f44b12442c58
version update after load from rep.
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
801 |
versionMethodsRep size == 1 ifTrue:[ |
f44b12442c58
version update after load from rep.
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
802 |
"/ (self confirm:(resources string:'Versions are identical: %1\\Update the version-ID ?' with:aClass name) withCRs) ifTrue:[ |
f44b12442c58
version update after load from rep.
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
803 |
versionMethodsRep first apply. |
f44b12442c58
version update after load from rep.
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
804 |
"/ ] |
f44b12442c58
version update after load from rep.
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
805 |
]. |
1006 | 806 |
self setPackageOfAllMethodsIn:aClass to:aClass package. |
807 |
^ self |
|
808 |
]. |
|
1339 | 809 |
inChangeSet ifTrue:[ |
810 |
msg := msg , '\Attention:\Load will undo your changes made to ''%4'' (if any were made).'. |
|
811 |
]. |
|
1121 | 812 |
labels := #('Cancel' 'Load'). |
1006 | 813 |
values := #(nil #load). |
1007
44c0229bcb43
better dialog message text and load/cancel default.
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
814 |
default := askForRevision |
44c0229bcb43
better dialog message text and load/cancel default.
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
815 |
ifTrue:[2. "i.e. load"] |
44c0229bcb43
better dialog message text and load/cancel default.
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
816 |
ifFalse:[1. "i.e. cancel"]. |
1006 | 817 |
] ifFalse:[ |
818 |
changed isEmpty ifTrue:[ |
|
1007
44c0229bcb43
better dialog message text and load/cancel default.
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
819 |
msg := msg , '\Attention:\Load will load methods which are not present in ''%4''.'. |
1121 | 820 |
labels := #('Cancel' 'Load'). |
987 | 821 |
values := #(nil #load). |
1007
44c0229bcb43
better dialog message text and load/cancel default.
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
822 |
default := askForRevision |
44c0229bcb43
better dialog message text and load/cancel default.
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
823 |
ifTrue:[2. "i.e. load"] |
44c0229bcb43
better dialog message text and load/cancel default.
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
824 |
ifFalse:[1. "i.e. cancel"]. |
987 | 825 |
] ifFalse:[ |
1339 | 826 |
inChangeSet ifTrue:[ |
827 |
msg := msg , '\Attention:\Load will undo your changes made to ''%4'' (if any were made);'. |
|
828 |
]. |
|
1007
44c0229bcb43
better dialog message text and load/cancel default.
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
829 |
msg := msg , '\Merge will only load methods which are not present in ''%4'' (i.e. undo removals but preserve changes).'. |
1006 | 830 |
]. |
831 |
] |
|
832 |
] ifFalse:[ |
|
833 |
onlyInRep isEmpty ifTrue:[ |
|
1339 | 834 |
inChangeSet ifTrue:[ |
835 |
msg := msg , '\Attention:\Load will undo your changes made to ''%4'' (if any were made),'. |
|
836 |
msg := msg , '\and remove added methods which are not present in the repository version.'. |
|
837 |
]. |
|
1121 | 838 |
labels := #('Cancel' 'Load'). |
1006 | 839 |
values := #(nil #load). |
1007
44c0229bcb43
better dialog message text and load/cancel default.
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
840 |
default := askForRevision |
44c0229bcb43
better dialog message text and load/cancel default.
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
841 |
ifTrue:[2. "i.e. load"] |
44c0229bcb43
better dialog message text and load/cancel default.
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
842 |
ifFalse:[1. "i.e. cancel"]. |
1006 | 843 |
] ifFalse:[ |
1339 | 844 |
inChangeSet ifTrue:[ |
845 |
msg := msg , '\Attention:\Load will undo your changes made to ''%4'' (if any were made);'. |
|
846 |
msg := msg , '\Merge will only load methods which are not present in ''%4'' (i.e. undo removals but preserve changes).'. |
|
847 |
] |
|
1006 | 848 |
] |
849 |
]. |
|
1050 | 850 |
|
1007
44c0229bcb43
better dialog message text and load/cancel default.
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
851 |
msg := msg bindWith:onlyInRep size printString |
44c0229bcb43
better dialog message text and load/cancel default.
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
852 |
with:onlyHere size printString |
44c0229bcb43
better dialog message text and load/cancel default.
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
853 |
with:changed size printString |
1050 | 854 |
with:aClass name allBold |
1054 | 855 |
with:changedClassDefinitions size printString |
856 |
with:singleChangeSelector. |
|
1007
44c0229bcb43
better dialog message text and load/cancel default.
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
857 |
|
1006 | 858 |
answer := (Dialog confirmWithCancel:msg withCRs |
859 |
labels:(resources array:labels) |
|
860 |
values:values |
|
1007
44c0229bcb43
better dialog message text and load/cancel default.
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
861 |
default:default). |
1006 | 862 |
answer isNil ifTrue:[^ self]. |
986
78d2a098bc81
support to checkout/merge a class from the repository
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
863 |
|
1006 | 864 |
self activityNotification:'updating...'. |
865 |
changedClasses := IdentitySet new. |
|
1000 | 866 |
|
1058
90807c795eb5
do update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1057
diff
changeset
|
867 |
"/ Class withoutUpdatingChangesDo:[ |
1057
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
868 |
answer == #load ifTrue:[ |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
869 |
changedClassDefinitions do:[:eachChangeArr | "apply this change (go to rep-version)" |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
870 |
|cHere cRep| |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
871 |
cHere := eachChangeArr at:1. |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
872 |
cRep := eachChangeArr at:2. |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
873 |
cRep apply. |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
874 |
cRep isMethodChange ifTrue:[ |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
875 |
cRep changeMethod setPackage:(cRep changeClass package). |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
876 |
changedClasses add:cRep changeClass. |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
877 |
] |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
878 |
]. |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
879 |
]. |
1006 | 880 |
onlyInRep do:[:eachChange | "apply this change (method only present in rep-version)" |
881 |
eachChange apply. |
|
882 |
eachChange isMethodChange ifTrue:[ |
|
1011
647a8c2fabc1
method category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents:
1007
diff
changeset
|
883 |
eachChange changeMethod setPackage:(eachChange changeClass package). |
1006 | 884 |
changedClasses add:eachChange changeClass. |
885 |
] |
|
886 |
]. |
|
1057
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
887 |
answer == #load ifTrue:[ |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
888 |
onlyHere do:[:eachChange | "remove this change (method not present in rep-version)" |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
889 |
|cClass cSel| |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
890 |
eachChange isMethodChange ifTrue:[ |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
891 |
cClass := eachChange changeClass. |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
892 |
cSel := eachChange selector. |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
893 |
cClass removeSelector:cSel. |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
894 |
] |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
895 |
]. |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
896 |
changed do:[:eachChangeArr | "apply this change (go to rep-version)" |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
897 |
|cHere cRep| |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
898 |
cHere := eachChangeArr at:1. |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
899 |
cRep := eachChangeArr at:2. |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
900 |
cRep apply. |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
901 |
cRep isMethodChange ifTrue:[ |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
902 |
cRep changeMethod setPackage:(cRep changeClass package). |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
903 |
changedClasses add:cRep changeClass. |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
904 |
] |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
905 |
]. |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
906 |
"/ make all methods belong to the classes project |
1055
f44b12442c58
version update after load from rep.
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
907 |
self setPackageOfAllMethodsIn:aClass to:aClass package. |
1057
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
908 |
versionMethodsRep size == 1 ifTrue:[ |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
909 |
versionMethodsRep first apply. |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
910 |
self setPackageOfAllMethodsIn:aClass to:aClass package. |
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
911 |
] ifFalse:[ |
1194 | 912 |
self error:'too many version methods'. |
1057
6903d4d5097d
do not update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
913 |
]. |
1055
f44b12442c58
version update after load from rep.
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
914 |
]. |
1058
90807c795eb5
do update the changesFile, when checkingOut
Claus Gittinger <cg@exept.de>
parents:
1057
diff
changeset
|
915 |
"/ ]. |
1006 | 916 |
changedClasses do:[:eachClass | |
917 |
eachClass changed:#projectOrganization. |
|
986
78d2a098bc81
support to checkout/merge a class from the repository
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
918 |
]. |
1011
647a8c2fabc1
method category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents:
1007
diff
changeset
|
919 |
Smalltalk changed:#projectOrganization. |
1044 | 920 |
|
921 |
"Modified: / 7.2.2001 / 18:18:32 / ps" |
|
986
78d2a098bc81
support to checkout/merge a class from the repository
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
922 |
! |
78d2a098bc81
support to checkout/merge a class from the repository
Claus Gittinger <cg@exept.de>
parents:
984
diff
changeset
|
923 |
|
957 | 924 |
compareClassWithRepository:aClass |
925 |
"open a diff-textView comparing the current (in-image) version |
|
926 |
against its orgiginal version found in the repository." |
|
927 |
||
928 |
|currentClass resources |
|
1194 | 929 |
aStream comparedSource currentSource rev revString thisRevString mgr |
957 | 930 |
nm msg rev2 newestRev |
1194 | 931 |
containerModule containerPackage containerFile| |
957 | 932 |
|
1377
0fd99dd003f6
classResources now understood by all classes
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
933 |
resources := self classResources. |
957 | 934 |
|
935 |
currentClass := aClass theNonMetaclass. |
|
936 |
||
937 |
nm := currentClass name. |
|
1189
fdc5e747c184
refactored check for a valid sourceCodeManager into one place
Claus Gittinger <cg@exept.de>
parents:
1185
diff
changeset
|
938 |
mgr := self sourceCodeManagerFor:currentClass. |
957 | 939 |
mgr isNil ifTrue:[ |
940 |
^ self |
|
941 |
]. |
|
942 |
rev := currentClass binaryRevision. |
|
943 |
rev2 := currentClass revision. |
|
944 |
rev isNil ifTrue:[ |
|
945 |
rev := rev2 |
|
946 |
]. |
|
947 |
rev isNil ifTrue:[ |
|
948 |
self warn:'Class seems to be not yet in the repository'. |
|
949 |
^ self |
|
950 |
]. |
|
951 |
||
952 |
"/ |
|
953 |
"/ class in repository - ask for revision |
|
954 |
"/ |
|
955 |
newestRev := mgr newestRevisionOf:currentClass. |
|
956 |
||
957 |
msg := resources string:'compare to revision: (empty for newest)'. |
|
958 |
rev notNil ifTrue:[ |
|
959 |
msg := msg , '\\' , (resources string:'Current %1 is based upon rev %2.' |
|
1019 | 960 |
with:nm allBold with:rev). |
957 | 961 |
(rev2 notNil and:[rev2 ~= rev]) ifTrue:[ |
962 |
msg := msg , '\' , (resources string:'And has been checked into the repository as %1.' |
|
963 |
with:rev2) |
|
964 |
] |
|
965 |
]. |
|
966 |
newestRev notNil ifTrue:[ |
|
967 |
msg := msg , '\' , (resources string:'Newest in reporitory is %1.' |
|
968 |
with:newestRev) |
|
969 |
]. |
|
970 |
||
971 |
rev := SourceCodeManagerUtilities |
|
972 |
askForExistingRevision:msg |
|
973 |
title:'Compare with repository' |
|
974 |
class:currentClass. |
|
975 |
||
976 |
(rev notNil or:[containerFile notNil]) ifTrue:[ |
|
977 |
rev notNil ifTrue:[ |
|
978 |
rev withoutSpaces isEmpty ifTrue:[ |
|
979 |
msg := 'extracting newest %1 (' , (newestRev ? '???') , ')'. |
|
980 |
"/ aStream := mgr getMostRecentSourceStreamForClassNamed:nm. |
|
981 |
aStream := mgr getSourceStreamFor:currentClass revision:newestRev. |
|
982 |
revString := '(newest: ' , (newestRev ? '???') , ')'. |
|
983 |
] ifFalse:[ |
|
984 |
msg := 'extracting previous %1'. |
|
985 |
aStream := mgr getSourceStreamFor:currentClass revision:rev. |
|
986 |
revString := rev |
|
987 |
]. |
|
988 |
] ifFalse:[ |
|
989 |
msg := 'extracting newest version from ' , containerModule , '/' , containerPackage, '/' , containerFile. |
|
990 |
aStream := mgr streamForClass:nil fileName:containerFile revision:#newest directory:containerPackage module:containerModule cache:false. |
|
991 |
revString := '???' |
|
992 |
]. |
|
993 |
||
994 |
aStream isNil ifTrue:[ |
|
995 |
self warn:'could not extract source from repository'. |
|
996 |
^ self |
|
997 |
]. |
|
998 |
aStream class readErrorSignal handle:[:ex | |
|
1245 | 999 |
self warn:('read error while reading extracted source\\' , ex description) withCRs. |
957 | 1000 |
aStream close. |
1001 |
^ self |
|
1002 |
] do:[ |
|
1003 |
comparedSource := aStream contents asString. |
|
1004 |
]. |
|
1005 |
aStream close. |
|
1006 |
||
1007 |
self activityNotification:'generating current source ...'. |
|
1008 |
||
1009 |
aStream := '' writeStream. |
|
1010 |
Method flushSourceStreamCache. |
|
1011 |
currentClass fileOutOn:aStream withTimeStamp:false. |
|
1012 |
currentSource := aStream contents asString. |
|
1013 |
aStream close. |
|
1014 |
||
1015 |
self activityNotification:'comparing ...'. |
|
1016 |
||
1017 |
comparedSource = currentSource ifTrue:[ |
|
1007
44c0229bcb43
better dialog message text and load/cancel default.
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1018 |
self information:(resources string:'Versions are identical: %1' with:currentClass name). |
957 | 1019 |
] ifFalse:[ |
1020 |
thisRevString := currentClass revision. |
|
1021 |
thisRevString isNil ifTrue:[ |
|
1022 |
thisRevString := 'no revision' |
|
1023 |
]. |
|
1024 |
||
1025 |
revString = '(newest)' ifTrue:[ |
|
1026 |
(rev := mgr newestRevisionOf:currentClass) notNil ifTrue:[ |
|
1027 |
revString := '(newest is ' , rev , ')' |
|
1028 |
] |
|
1029 |
]. |
|
1030 |
||
1031 |
self activityNotification:'comparing ...'. |
|
1032 |
||
1070 | 1033 |
(UserPreferences versionDiffViewerClass) |
957 | 1034 |
openOnClass:currentClass |
1035 |
labelA:('repository: ' , revString) |
|
1036 |
sourceA:comparedSource |
|
1037 |
labelB:('current: (based on: ' , thisRevString , ')') |
|
1038 |
sourceB:currentSource |
|
1039 |
title:('comparing ' , currentClass name). |
|
1040 |
]. |
|
1041 |
]. |
|
1042 |
||
1043 |
" |
|
997 | 1044 |
self compareClassWithRepository:Array |
957 | 1045 |
" |
1046 |
! |
|
1047 |
||
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1048 |
createSourceContainerForClass:aClass |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1049 |
"let user specify the source-repository values for aClass" |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1050 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1051 |
|resources| |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1052 |
|
1377
0fd99dd003f6
classResources now understood by all classes
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1053 |
resources := self classResources. |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1054 |
^ self |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1055 |
defineSourceContainerForClass:aClass |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1056 |
title:(resources string:'Repository information for %1' with:aClass name) |
1030 | 1057 |
text:(resources string:'Create new repository container for ''%1''' with:aClass name allBold) |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1058 |
createDirectories:true |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1059 |
createContainer:true. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1060 |
! |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1061 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1062 |
defineSourceContainerForClass:aClass title:title text:boxText createDirectories:createDirs createContainer:createContainer |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1063 |
"let user specify the source-repository values for aClass" |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1064 |
|
1158 | 1065 |
| className |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1066 |
oldModule oldPackage oldFileName |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1067 |
module package fileName nameSpace nameSpacePrefix |
1158 | 1068 |
info project nm mgr creatingNew msg |
952
c75976ac7b7f
when checking in initially, change packageID of class
Claus Gittinger <cg@exept.de>
parents:
937
diff
changeset
|
1069 |
answer doCheckinWithoutAsking forceCheckIn resources rslt note |
c75976ac7b7f
when checking in initially, change packageID of class
Claus Gittinger <cg@exept.de>
parents:
937
diff
changeset
|
1070 |
requiredPackage| |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1071 |
|
1377
0fd99dd003f6
classResources now understood by all classes
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1072 |
resources := self classResources. |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1073 |
aClass isLoaded ifFalse:[ |
1076 | 1074 |
self warn:(resources string:'Please load the %1-class first' with:aClass name). |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1075 |
^ false. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1076 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1077 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1078 |
className := aClass name. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1079 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1080 |
"/ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1081 |
"/ defaults, if nothing at all is known |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1082 |
"/ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1083 |
(module := LastModule) isNil ifTrue:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1084 |
module := (OperatingSystem getLoginName). |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1085 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1086 |
(package := LastPackage) isNil ifTrue:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1087 |
package := 'private'. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1088 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1089 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1090 |
"/ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1091 |
"/ try to extract some useful defaults from the current project |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1092 |
"/ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1093 |
(Project notNil and:[(project := Project current) notNil]) ifTrue:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1094 |
package isNil ifTrue:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1095 |
(nm := project repositoryDirectory) isNil ifTrue:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1096 |
nm := project name |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1097 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1098 |
package := nm. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1099 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1100 |
module isNil ifTrue:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1101 |
(nm := project repositoryModule) notNil ifTrue:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1102 |
module := nm |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1103 |
] |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1104 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1105 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1106 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1107 |
"/ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1108 |
"/ ask the sourceCodeManager if it knows anything about that class |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1109 |
"/ if so, take that as a default. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1110 |
"/ |
1189
fdc5e747c184
refactored check for a valid sourceCodeManager into one place
Claus Gittinger <cg@exept.de>
parents:
1185
diff
changeset
|
1111 |
mgr := self sourceCodeManagerFor:aClass. |
fdc5e747c184
refactored check for a valid sourceCodeManager into one place
Claus Gittinger <cg@exept.de>
parents:
1185
diff
changeset
|
1112 |
mgr isNil ifTrue:[ |
fdc5e747c184
refactored check for a valid sourceCodeManager into one place
Claus Gittinger <cg@exept.de>
parents:
1185
diff
changeset
|
1113 |
^ false |
fdc5e747c184
refactored check for a valid sourceCodeManager into one place
Claus Gittinger <cg@exept.de>
parents:
1185
diff
changeset
|
1114 |
]. |
fdc5e747c184
refactored check for a valid sourceCodeManager into one place
Claus Gittinger <cg@exept.de>
parents:
1185
diff
changeset
|
1115 |
|
1368 | 1116 |
|
1189
fdc5e747c184
refactored check for a valid sourceCodeManager into one place
Claus Gittinger <cg@exept.de>
parents:
1185
diff
changeset
|
1117 |
info := mgr sourceInfoOfClass:aClass. |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1118 |
info notNil ifTrue:[ |
1368 | 1119 |
true "module ~= LastModule" ifTrue:[ |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1120 |
(info includesKey:#module) ifTrue:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1121 |
module := (info at:#module). |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1122 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1123 |
]. |
1368 | 1124 |
true "package ~= LastPackage" ifTrue:[ |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1125 |
(info includesKey:#directory) ifTrue:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1126 |
package := (info at:#directory). |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1127 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1128 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1129 |
fileName := mgr containerFromSourceInfo:info. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1130 |
(nameSpace := aClass nameSpace) ~~ Smalltalk ifTrue:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1131 |
nameSpacePrefix := nameSpace name , '::'. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1132 |
(fileName startsWith:nameSpacePrefix) ifTrue:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1133 |
fileName := fileName copyFrom:(nameSpacePrefix size + 1). |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1134 |
] |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1135 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1136 |
"/ (info includesKey:#fileName) ifTrue:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1137 |
"/ fileName := (info at:#fileName). |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1138 |
"/ ] ifFalse:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1139 |
"/ (info includesKey:#expectedFileName) ifTrue:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1140 |
"/ fileName := (info at:#expectedFileName). |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1141 |
"/ ] ifFalse:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1142 |
"/ (info includesKey:#classFileNameBase) ifTrue:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1143 |
"/ fileName := (info at:#classFileNameBase) , '.st'. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1144 |
"/ ] |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1145 |
"/ ] |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1146 |
"/ ] |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1147 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1148 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1149 |
fileName isNil ifTrue:[ |
1338 | 1150 |
fileName := (Smalltalk fileNameForClass:aClass) , '.st'. |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1151 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1152 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1153 |
OperatingSystem isMSDOSlike ifTrue:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1154 |
module replaceAll:$\ with:$/. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1155 |
package replaceAll:$\ with:$/. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1156 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1157 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1158 |
"/ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1159 |
"/ check for conflicts (i.e. if such a container already exists) ... |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1160 |
"/ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1161 |
doCheckinWithoutAsking := false. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1162 |
(mgr checkForExistingContainerInModule:module |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1163 |
package:package |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1164 |
container:fileName) ifTrue:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1165 |
answer := Dialog confirmWithCancel:(resources |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1166 |
string:'About to change the source container. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1167 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1168 |
Notice: there is a container for %1 in: |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1169 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1170 |
%2 / %3 / %4 |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1171 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1172 |
Do you want to change it or check right into that container ?' |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1173 |
with:className |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1174 |
with:module |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1175 |
with:package |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1176 |
with:fileName) |
1076 | 1177 |
labels:(resources array:#('Cancel' 'Check in' 'Change')). |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1178 |
answer isNil ifTrue:[AbortSignal raise]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1179 |
answer ifTrue:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1180 |
doCheckinWithoutAsking := false. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1181 |
oldModule := module. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1182 |
oldPackage := package. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1183 |
oldFileName := fileName |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1184 |
] ifFalse:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1185 |
doCheckinWithoutAsking := true. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1186 |
creatingNew := false. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1187 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1188 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1189 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1190 |
doCheckinWithoutAsking ifFalse:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1191 |
"/ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1192 |
"/ open a dialog for this |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1193 |
"/ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1194 |
(mgr checkForExistingContainerInModule:module |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1195 |
package:package |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1196 |
container:fileName) ifFalse:[ |
893 | 1197 |
note := 'Notice: class seems to have no container yet.'. |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1198 |
creatingNew := true. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1199 |
] ifTrue:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1200 |
creatingNew := false. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1201 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1202 |
|
893 | 1203 |
rslt := self |
1204 |
askForContainer:boxText title:title note:note |
|
1030 | 1205 |
initialModule:module initialPackage:package initialFileName:fileName |
1206 |
forNewContainer:true. |
|
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1207 |
|
893 | 1208 |
rslt isNil ifTrue:[ |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1209 |
^ false |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1210 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1211 |
|
893 | 1212 |
module := rslt at:#module. |
1213 |
package := rslt at:#package. |
|
1214 |
fileName := rslt at:#fileName. |
|
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1215 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1216 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1217 |
(fileName endsWith:',v') ifTrue:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1218 |
fileName := fileName copyWithoutLast:2 |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1219 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1220 |
(fileName endsWith:'.st') ifFalse:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1221 |
fileName := fileName , '.st' |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1222 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1223 |
|
952
c75976ac7b7f
when checking in initially, change packageID of class
Claus Gittinger <cg@exept.de>
parents:
937
diff
changeset
|
1224 |
"/ we require the packageID to be <module>:<container-dir> |
c75976ac7b7f
when checking in initially, change packageID of class
Claus Gittinger <cg@exept.de>
parents:
937
diff
changeset
|
1225 |
"/ check for this ... |
c75976ac7b7f
when checking in initially, change packageID of class
Claus Gittinger <cg@exept.de>
parents:
937
diff
changeset
|
1226 |
|
c75976ac7b7f
when checking in initially, change packageID of class
Claus Gittinger <cg@exept.de>
parents:
937
diff
changeset
|
1227 |
requiredPackage := ((module ? '') , ':' , (package ? '')) asSymbol. |
c75976ac7b7f
when checking in initially, change packageID of class
Claus Gittinger <cg@exept.de>
parents:
937
diff
changeset
|
1228 |
requiredPackage ~= aClass package ifTrue:[ |
c75976ac7b7f
when checking in initially, change packageID of class
Claus Gittinger <cg@exept.de>
parents:
937
diff
changeset
|
1229 |
"/ doCheckinWithoutAsking ifFalse:[ |
c75976ac7b7f
when checking in initially, change packageID of class
Claus Gittinger <cg@exept.de>
parents:
937
diff
changeset
|
1230 |
"/ (self confirm:'Change the classes packageID to: ''', requiredPackage , ''' ?') |
c75976ac7b7f
when checking in initially, change packageID of class
Claus Gittinger <cg@exept.de>
parents:
937
diff
changeset
|
1231 |
"/ ifFalse:[ |
c75976ac7b7f
when checking in initially, change packageID of class
Claus Gittinger <cg@exept.de>
parents:
937
diff
changeset
|
1232 |
"/ ^ false |
c75976ac7b7f
when checking in initially, change packageID of class
Claus Gittinger <cg@exept.de>
parents:
937
diff
changeset
|
1233 |
"/ ] |
c75976ac7b7f
when checking in initially, change packageID of class
Claus Gittinger <cg@exept.de>
parents:
937
diff
changeset
|
1234 |
"/ ]. |
1077
6b1bcfd27521
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
1076
diff
changeset
|
1235 |
aClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | mthd setPackage:requiredPackage]. |
952
c75976ac7b7f
when checking in initially, change packageID of class
Claus Gittinger <cg@exept.de>
parents:
937
diff
changeset
|
1236 |
aClass package:requiredPackage. |
981 | 1237 |
aClass changed:#projectOrganization. |
1011
647a8c2fabc1
method category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents:
1007
diff
changeset
|
1238 |
Smalltalk changed:#projectOrganization with:(Array with:aClass). |
952
c75976ac7b7f
when checking in initially, change packageID of class
Claus Gittinger <cg@exept.de>
parents:
937
diff
changeset
|
1239 |
]. |
c75976ac7b7f
when checking in initially, change packageID of class
Claus Gittinger <cg@exept.de>
parents:
937
diff
changeset
|
1240 |
|
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1241 |
info := aClass revisionInfo. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1242 |
info notNil ifTrue:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1243 |
(info includesKey:#repositoryPathName) ifFalse:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1244 |
info := nil |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1245 |
] |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1246 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1247 |
info isNil ifTrue:[ |
1004
1bd564960810
dont ask if a version method should be created - just do it.
Claus Gittinger <cg@exept.de>
parents:
1000
diff
changeset
|
1248 |
true "doCheckinWithoutAsking" ifFalse:[ |
979 | 1249 |
answer := Dialog |
1250 |
confirmWithCancel:(resources string:'%1 does not have any (usable) revision info (#version method)\\Shall I create one ?' with:className) withCRs |
|
1076 | 1251 |
labels:(resources array:#( 'Cancel' 'No' 'Yes')). |
979 | 1252 |
answer isNil ifTrue:[^ false]. |
1253 |
] ifTrue:[ |
|
1254 |
answer := true. |
|
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1255 |
]. |
979 | 1256 |
answer ifTrue:[ |
1257 |
aClass updateVersionMethodFor:(mgr initialRevisionStringFor:aClass |
|
1258 |
inModule:module |
|
1259 |
package:package |
|
1260 |
container:fileName). |
|
1261 |
]. |
|
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1262 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1263 |
|
1158 | 1264 |
(self checkForExistingModule:module using:mgr allowCreate:(createDirs or:[creatingNew])) |
1265 |
ifFalse:[^ false]. |
|
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1266 |
LastModule := module. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1267 |
|
1158 | 1268 |
(self checkForExistingModule:module package:package using:mgr allowCreate:(createDirs or:[creatingNew])) |
1269 |
ifFalse:[^ false]. |
|
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1270 |
LastPackage := package. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1271 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1272 |
"/ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1273 |
"/ check for the container itself |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1274 |
"/ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1275 |
(mgr checkForExistingContainerInModule:module package:package container:fileName) ifTrue:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1276 |
creatingNew ifTrue:[ |
1076 | 1277 |
self warn:(resources string:'Container for %1 already exists in %2/%3.' with:fileName with:module with:package) withCRs. |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1278 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1279 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1280 |
"/ (oldModule notNil |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1281 |
"/ and:[(oldModule ~= module) |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1282 |
"/ or:[oldPackage ~= package |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1283 |
"/ or:[oldFileName ~= fileName]]]) |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1284 |
"/ ifFalse:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1285 |
"/ self warn:(resources string:'no change'). |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1286 |
"/ ^ false. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1287 |
"/ ]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1288 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1289 |
doCheckinWithoutAsking ifFalse:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1290 |
(Dialog |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1291 |
confirm:(resources string:'check %1 into the existing container |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1292 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1293 |
%2 / %3 / %4 ?' |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1294 |
with:className |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1295 |
with:module |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1296 |
with:package |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1297 |
with:fileName) withCRs |
1076 | 1298 |
noLabel:'Cancel') |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1299 |
ifFalse:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1300 |
^ false. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1301 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1302 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1303 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1304 |
aClass updateVersionMethodFor:'$' , 'Header' , '$'. "/ concatenated to avoid RCS-expansion |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1305 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1306 |
oldFileName notNil ifTrue:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1307 |
msg := ('forced checkin / source container change from ' , oldFileName). |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1308 |
] ifFalse:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1309 |
msg := 'defined source container' |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1310 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1311 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1312 |
(forceCheckIn := doCheckinWithoutAsking) ifFalse:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1313 |
(mgr |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1314 |
checkinClass:aClass |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1315 |
fileName:fileName |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1316 |
directory:package |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1317 |
module:module |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1318 |
logMessage:msg) |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1319 |
ifFalse:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1320 |
doCheckinWithoutAsking ifFalse:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1321 |
(Dialog |
1076 | 1322 |
confirm:'No easy merge seems possible; force checkin (no merge) ?' |
1323 |
noLabel:'Cancel') |
|
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1324 |
ifFalse:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1325 |
^ false. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1326 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1327 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1328 |
forceCheckIn := true. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1329 |
] |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1330 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1331 |
forceCheckIn ifTrue:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1332 |
(mgr |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1333 |
checkinClass:aClass |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1334 |
fileName:fileName |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1335 |
directory:package |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1336 |
module:module |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1337 |
logMessage:msg |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1338 |
force:true) |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1339 |
ifFalse:[ |
1076 | 1340 |
self warn:(resources string:'Failed to check into existing container.'). |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1341 |
^ false. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1342 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1343 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1344 |
^ true |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1345 |
] ifFalse:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1346 |
(createContainer or:[creatingNew]) ifFalse:[ |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1347 |
(Dialog |
1076 | 1348 |
confirm:(resources string:'No container exists for %1 in %2/%3\\create ?' |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1349 |
with:fileName with:module with:package) withCRs |
1076 | 1350 |
noLabel:'Cancel') ifFalse:[ |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1351 |
^ false |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1352 |
] |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1353 |
] |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1354 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1355 |
|
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1356 |
(mgr |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1357 |
createContainerFor:aClass |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1358 |
inModule:module |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1359 |
package:package |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1360 |
container:fileName) ifFalse:[ |
1076 | 1361 |
self warn:(resources string:'Failed to create container.'). |
876
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1362 |
^ false. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1363 |
]. |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1364 |
^ true |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1365 |
! |
461b86272f48
more functionality moved to SCMUtility
Claus Gittinger <cg@exept.de>
parents:
875
diff
changeset
|
1366 |
|
976
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1367 |
removeSourceContainerForClass:aClass |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1368 |
"show container & let user confirm twice." |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1369 |
|
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1370 |
^ self removeSourceContainerForClass:aClass confirm:true warn:true |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1371 |
! |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1372 |
|
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1373 |
removeSourceContainerForClass:aClass confirm:doConfirm warn:doWarn |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1374 |
"show container & optionally let user confirm twice." |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1375 |
|
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1376 |
|module package fileName info mgr resources| |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1377 |
|
1377
0fd99dd003f6
classResources now understood by all classes
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1378 |
resources := self classResources. |
976
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1379 |
|
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1380 |
aClass isLoaded ifFalse:[ |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1381 |
doWarn ifTrue:[ |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1382 |
self warn:(resources string:'Please load the class first.'). |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1383 |
]. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1384 |
^ false. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1385 |
]. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1386 |
|
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1387 |
"/ |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1388 |
"/ ask the sourceCodeManager if it knows anything about that class |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1389 |
"/ if so, take that as a default. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1390 |
"/ |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1391 |
mgr := aClass sourceCodeManager. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1392 |
mgr isNil ifTrue:[ |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1393 |
doWarn ifTrue:[ |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1394 |
self warn:(resources string:'No sourceCodeManagement.'). |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1395 |
]. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1396 |
^ false |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1397 |
]. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1398 |
|
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1399 |
info := mgr sourceInfoOfClass:aClass. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1400 |
info notNil ifTrue:[ |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1401 |
(info includesKey:#module) ifTrue:[ |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1402 |
module := (info at:#module). |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1403 |
]. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1404 |
(info includesKey:#directory) ifTrue:[ |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1405 |
package := (info at:#directory). |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1406 |
]. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1407 |
fileName := mgr containerFromSourceInfo:info. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1408 |
]. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1409 |
|
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1410 |
module isNil ifTrue:[ |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1411 |
doWarn ifTrue:[ |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1412 |
self warn:(resources string:'classes module is unknown.\\It seems to not have a container.') withCRs. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1413 |
]. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1414 |
^ false. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1415 |
]. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1416 |
package isNil ifTrue:[ |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1417 |
doWarn ifTrue:[ |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1418 |
self warn:(resources string:'classes package is unknown.\\It seems to not have a container.') withCRs. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1419 |
]. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1420 |
^ false. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1421 |
]. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1422 |
fileName isNil ifTrue:[ |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1423 |
doWarn ifTrue:[ |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1424 |
self warn:(resources string:'classes container fileName is unknown.\\It seems to not have a container.') withCRs. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1425 |
]. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1426 |
^ false. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1427 |
]. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1428 |
|
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1429 |
OperatingSystem isMSDOSlike ifTrue:[ |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1430 |
module replaceAll:$\ with:$/. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1431 |
]. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1432 |
OperatingSystem isMSDOSlike ifTrue:[ |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1433 |
package replaceAll:$\ with:$/. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1434 |
]. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1435 |
(mgr checkForExistingContainerInModule:module |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1436 |
package:package |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1437 |
container:fileName) ifFalse:[ |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1438 |
doWarn ifTrue:[ |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1439 |
self warn:(resources string:'Class has no source container.') withCRs. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1440 |
]. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1441 |
^ false. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1442 |
]. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1443 |
|
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1444 |
doConfirm ifTrue:[ |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1445 |
(Dialog |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1446 |
choose:(resources |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1447 |
string:'Please confirm removal of the container for %1: |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1448 |
|
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1449 |
container: %2 / %3 / %4 |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1450 |
|
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1451 |
Really remove ?' |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1452 |
with:aClass name |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1453 |
with:module |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1454 |
with:package |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1455 |
with:fileName) |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1456 |
labels:(Array |
1129 | 1457 |
with:(resources string:'No') |
1458 |
with:(resources string:'Remove')) |
|
976
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1459 |
values:#(false true) |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1460 |
default:false) ifFalse:[ |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1461 |
^ false. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1462 |
]. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1463 |
]. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1464 |
|
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1465 |
(mgr removeContainerFor:aClass |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1466 |
inModule:module |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1467 |
package:package |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1468 |
container:fileName) ifFalse:[ |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1469 |
doWarn ifTrue:[ |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1470 |
self warn:(resources string:'failed to remove container.'). |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1471 |
]. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1472 |
^ true. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1473 |
]. |
cedcdc7e405c
utitity to remove a container
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1474 |
^ false |
1000 | 1475 |
! |
1476 |
||
1026
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1477 |
repositoryLogOf:aClass onto:aStream |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1478 |
|info rv mgr info2 module fn msg s| |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1479 |
|
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1480 |
info := aClass revisionInfo. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1481 |
|
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1482 |
rv := aClass binaryRevision. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1483 |
rv notNil ifTrue:[ |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1484 |
aStream nextPutLine:'**** Loaded classes binary information ****'; cr. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1485 |
aStream nextPutLine:' Binary based upon : ' , rv. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1486 |
aStream cr. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1487 |
]. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1488 |
|
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1489 |
info notNil ifTrue:[ |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1490 |
mgr := aClass sourceCodeManager. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1491 |
|
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1492 |
(info includesKey:#revision) ifFalse:[ |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1493 |
aStream nextPutLine:'WARNING:'; cr. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1494 |
aStream nextPutLine:' The class seems not to be loaded from the repository.'. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1495 |
aStream nextPutLine:' Check carefully before checking anything in.'. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1496 |
aStream nextPutLine:' (i.e. compare with repository for renamed class(es), same-name but unrelated etc.)'. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1497 |
aStream cr. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1498 |
]. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1499 |
|
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1500 |
aStream nextPutLine:'**** Classes source information ****'; cr. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1501 |
s := info at:#repositoryPath ifAbsent:nil. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1502 |
s notNil ifTrue:[ |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1503 |
aStream nextPutLine:' Source repository : ' , s |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1504 |
]. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1505 |
aStream nextPutLine:' Filename ........ : ' , (info at:#fileName ifAbsent:'?'). |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1506 |
aStream nextPutLine:' Revision ........ : ' , (info at:#revision ifAbsent:'?'). |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1507 |
aStream nextPutLine:' Checkin date .... : ' , (info at:#date ifAbsent:'?') , ' ' , (info at:#time ifAbsent:'?'). |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1508 |
aStream nextPutLine:' Checkin user .... : ' , (info at:#user ifAbsent:'?'). |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1509 |
|
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1510 |
(info2 := aClass packageSourceCodeInfo) notNil ifTrue:[ |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1511 |
aStream nextPutLine:' Repository: ..... : ' , (info2 at:#module ifAbsent:'?'). |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1512 |
aStream nextPutLine:' Directory: ...... : ' , (info2 at:#directory ifAbsent:'?'). |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1513 |
]. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1514 |
aStream nextPutLine:' Container ....... : ' , (info at:#repositoryPathName ifAbsent:'?'). |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1515 |
aStream cr. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1516 |
|
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1517 |
mgr notNil ifTrue:[ |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1518 |
aStream nextPutLine:'**** Repository information ****'; cr. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1519 |
|
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1520 |
module := info2 at:#module ifAbsent:nil. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1521 |
module notNil ifTrue:[ |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1522 |
aStream nextPutLine:(' CVS Root ......: ' , |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1523 |
((mgr repositoryNameForModule:module) ifNil:[mgr repositoryName , ' (default)'])). |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1524 |
]. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1525 |
mgr writeRevisionLogOf:aClass to:aStream. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1526 |
] |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1527 |
] ifFalse:[ |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1528 |
aStream nextPutLine:'No revision info found'. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1529 |
aClass isLoaded ifFalse:[ |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1530 |
aStream cr; nextPutAll:'This is an autoloaded class - you may see more after its loaded.' |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1531 |
] ifTrue:[ |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1532 |
fn := aClass classFilename. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1533 |
aClass wasAutoloaded ifTrue:[ |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1534 |
msg := 'This class was autoloaded.'. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1535 |
fn notNil ifTrue:[ |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1536 |
msg := msg , ' (from ''' , fn , ''')'. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1537 |
]. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1538 |
] ifFalse:[ |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1539 |
fn notNil ifTrue:[ |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1540 |
msg := 'This class was loaded from ''' , fn , '''.' |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1541 |
]. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1542 |
]. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1543 |
msg notNil ifTrue:[ |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1544 |
aStream cr; nextPutAll:msg. |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1545 |
] |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1546 |
] |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1547 |
] |
1375 | 1548 |
! ! |
1549 |
||
1550 |
!SourceCodeManagerUtilities class methodsFor:'utilities-cvs-helpers'! |
|
1551 |
||
1552 |
getLogMessageFor:aString |
|
1553 |
"get a log message for checking in a class. |
|
1554 |
Return the message or nil if aborted." |
|
1555 |
||
1556 |
^ self getLogMessageFor:aString initialAnswer:LastSourceLogMessage |
|
1557 |
||
1558 |
" |
|
1559 |
SourceCodeManagerUtilities getLogMessageFor:'hello' |
|
1560 |
" |
|
1561 |
! |
|
1562 |
||
1563 |
getLogMessageFor:aString initialAnswer:initialAnswer |
|
1564 |
"get a log message for checking in a class. |
|
1565 |
Return the message or nil if aborted." |
|
1566 |
||
1567 |
|resources logMsg| |
|
1568 |
||
1377
0fd99dd003f6
classResources now understood by all classes
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1569 |
resources := self classResources. |
1375 | 1570 |
logMsg := Dialog |
1571 |
requestText:(resources string:'Enter log message for: %1' with:aString allBold) |
|
1572 |
lines:10 |
|
1573 |
columns:70 |
|
1574 |
initialAnswer:(initialAnswer ? LastSourceLogMessage ? ''). |
|
1575 |
||
1576 |
logMsg notNil ifTrue:[ |
|
1577 |
LastSourceLogMessage := logMsg |
|
1578 |
]. |
|
1579 |
^ logMsg |
|
1580 |
||
1581 |
" |
|
1582 |
SourceCodeManagerUtilities getLogMessageFor:'hello' |
|
1583 |
" |
|
1584 |
! |
|
1585 |
||
1586 |
getLogMessageFor:aString withButton:additionalButton |
|
1587 |
"get a log message for checking in a class. |
|
1588 |
Return the message or nil if aborted." |
|
1589 |
||
1590 |
|resources logMsg dialog textHolder| |
|
1591 |
||
1377
0fd99dd003f6
classResources now understood by all classes
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1592 |
resources := self classResources. |
1375 | 1593 |
textHolder := '' asValue. |
1594 |
dialog := Dialog |
|
1595 |
forRequestText:(resources string:'enter log message for: %1' with:aString) |
|
1596 |
lines:10 |
|
1597 |
columns:70 |
|
1598 |
initialAnswer:LastSourceLogMessage |
|
1599 |
model:textHolder. |
|
1600 |
||
1601 |
additionalButton notNil ifTrue:[ |
|
1602 |
dialog addButton:additionalButton before:(dialog okButton). |
|
1603 |
]. |
|
1604 |
||
1605 |
dialog open. |
|
1606 |
dialog accepted ifFalse:[ |
|
1607 |
^ nil. |
|
1608 |
]. |
|
1609 |
logMsg := textHolder value. |
|
1610 |
"/ logMsg := Dialog |
|
1611 |
"/ requestText:(resources string:'enter log message for: %1' with:aString) |
|
1612 |
"/ lines:10 |
|
1613 |
"/ columns:70 |
|
1614 |
"/ initialAnswer:LastSourceLogMessage. |
|
1615 |
logMsg notNil ifTrue:[ |
|
1616 |
LastSourceLogMessage := logMsg |
|
1617 |
]. |
|
1618 |
^ logMsg |
|
1619 |
||
1620 |
" |
|
1621 |
SourceCodeManagerUtilities getLogMessageFor:'hello' |
|
1622 |
SourceCodeManagerUtilities getLogMessageFor:'hello' withButton:(Button label:'foo') |
|
1623 |
" |
|
1624 |
! |
|
1625 |
||
1626 |
getMethodVersionsOfClass:aClass selector:selector numberOfRevisions:numberOfRevisionsOrNil |
|
1627 |
"check-out all previous versions of aClass and retrieve the history of selector. |
|
1628 |
Return a dictionary associating revision with a changeList entries for that method. |
|
1629 |
Unfinished - need a GUI for that." |
|
1630 |
||
1631 |
|mgr theClass revisionLog revisions items s entriesPerRevision previousVersion| |
|
1632 |
||
1633 |
theClass := aClass theNonMetaclass. |
|
1634 |
||
1635 |
mgr := self sourceCodeManagerFor:theClass. |
|
1636 |
mgr isNil ifTrue:[ |
|
1637 |
self error:'no sourceCodeManager'. |
|
1638 |
]. |
|
1639 |
||
1640 |
revisionLog := mgr |
|
1641 |
revisionLogOf:theClass |
|
1642 |
numberOfRevisions:numberOfRevisionsOrNil. |
|
1643 |
||
1644 |
revisions := revisionLog at:#revisions. |
|
1645 |
items := revisions collect:[:each | |rev date who| |
|
1646 |
rev := each at:#revision. |
|
1647 |
date := each at:#date. |
|
1648 |
who := each at:#author. |
|
1649 |
rev allBold , ' [' , date , ' by ' , who , ']' |
|
1650 |
]. |
|
1651 |
||
1652 |
revisions := revisions collect:[:each | each at:#revision]. |
|
1653 |
revisions addFirst:#current. |
|
1654 |
entriesPerRevision := Dictionary new. |
|
1655 |
||
1656 |
previousVersion := nil. |
|
1657 |
revisions reverseDo:[:eachRevision | |
|
1658 |
|srcStream entries thisVersion| |
|
1659 |
||
1660 |
eachRevision == #current ifTrue:[ |
|
1661 |
s := '' writeStream. |
|
1662 |
theClass fileOutOn:s withTimeStamp:false. |
|
1663 |
srcStream := s contents readStream. |
|
1664 |
] ifFalse:[ |
|
1665 |
self activityNotification:('checking out revision ' , eachRevision , '...'). |
|
1666 |
srcStream := mgr getSourceStreamFor:theClass revision:eachRevision. |
|
1667 |
]. |
|
1668 |
||
1669 |
entries := ChangeSet fromStream:srcStream. |
|
1670 |
srcStream close. |
|
1671 |
||
1672 |
"/ remove all definitions |
|
1673 |
entries := entries select:[:each | each isMethodChange]. |
|
1674 |
"/ remove all methods which are for other selectors |
|
1675 |
entries := entries select:[:each | each selector == selector]. |
|
1676 |
"/ remove all methods which are for private subclasses |
|
1677 |
entries := entries select:[:each | each className = aClass name]. |
|
1678 |
||
1679 |
entries size == 1 ifTrue:[ |
|
1680 |
"/ the method is there |
|
1681 |
thisVersion := entries first. |
|
1682 |
(previousVersion notNil and:[previousVersion sameAs:thisVersion]) ifTrue:[ |
|
1683 |
"/ no change |
|
1684 |
] ifFalse:[ |
|
1685 |
entriesPerRevision at:eachRevision put:thisVersion. |
|
1686 |
]. |
|
1687 |
] ifFalse:[ |
|
1688 |
"/ the method is not there |
|
1689 |
]. |
|
1690 |
previousVersion := thisVersion. |
|
1691 |
]. |
|
1692 |
self error:'unfinished code'. |
|
1693 |
||
1694 |
" |
|
1695 |
self getMethodVersionsOfClass:MenuPanel selector:#'helpTextForItem:' numberOfRevisions:20 |
|
1696 |
self getMethodVersionsOfClass:NewLauncher class selector:#'menu' numberOfRevisions:20 |
|
1697 |
" |
|
1698 |
! ! |
|
1699 |
||
1700 |
!SourceCodeManagerUtilities class methodsFor:'utilities-cvs-user interaction'! |
|
1701 |
||
1702 |
askForContainer:boxText title:title note:notice initialModule:initialModule initialPackage:initialPackage initialFileName:initialFileName |
|
1703 |
"open a dialog asking for a source container; |
|
1704 |
return a dictionary containing module, package and filename, |
|
1705 |
or nil if canceled." |
|
1706 |
||
1707 |
^ self |
|
1708 |
askForContainer:boxText title:title note:notice |
|
1709 |
initialModule:initialModule initialPackage:initialPackage initialFileName:initialFileName |
|
1710 |
forNewContainer:true |
|
1026
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1711 |
! |
1f193eb5f877
common code (in Browser, NewBrowser) for revisionLogOf
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
1712 |
|
1375 | 1713 |
askForContainer:boxText title:title note:notice initialModule:initialModule initialPackage:initialPackage initialFileName:initialFileName forNewContainer:forNewContainer |
1714 |
"open a dialog asking for a source container; |
|
1715 |
return a dictionary containing module, package and filename, |
|
1716 |
or nil if canceled." |
|
1717 |
||
1718 |
|box y component resources answer |
|
1719 |
moduleHolder packageHolder fileNameHolder |
|
1720 |
module package fileName |
|
1721 |
knownContainers knownPackages packageUpdater |
|
1722 |
packageBoxComponent fileNameBoxComponent fileNameUpdater| |
|
1723 |
||
1724 |
knownContainers := Set new. |
|
1725 |
Smalltalk allClassesDo:[:cls | |pckg| |
|
1726 |
pckg := cls package. |
|
1727 |
pckg size > 0 ifTrue:[ |
|
1728 |
knownContainers add:(pckg upTo:$:) |
|
1729 |
] |
|
1730 |
]. |
|
1731 |
knownContainers := knownContainers asOrderedCollection. |
|
1732 |
knownContainers := knownContainers select:[:module | module isBlank not]. |
|
1733 |
knownContainers sort. |
|
1734 |
||
1735 |
packageUpdater := [ |
|
1736 |
|theModulePrefix| |
|
1737 |
||
1738 |
theModulePrefix := moduleHolder value , ':'. |
|
1739 |
||
1740 |
Cursor wait showWhile:[ |
|
1741 |
knownPackages := Set new. |
|
1742 |
Smalltalk allClassesDo:[:cls | |pckg idx| |
|
1743 |
pckg := cls package. |
|
1744 |
pckg size > 0 ifTrue:[ |
|
1745 |
(pckg startsWith:theModulePrefix) ifTrue:[ |
|
1746 |
idx := pckg indexOf:$:. |
|
1747 |
knownPackages add:(pckg copyFrom:idx + 1) |
|
1748 |
] |
|
1749 |
] |
|
1750 |
]. |
|
1751 |
knownPackages := knownPackages asOrderedCollection. |
|
1752 |
knownPackages := knownPackages select:[:package | package isBlank not]. |
|
1753 |
knownPackages sort. |
|
1754 |
packageBoxComponent list:knownPackages. |
|
1755 |
]. |
|
1756 |
]. |
|
1757 |
||
1758 |
fileNameUpdater := [ |
|
1759 |
|module package files| |
|
1760 |
||
1761 |
Cursor read showWhile:[ |
|
1762 |
module := moduleHolder value ? '__NoProject__'. |
|
1763 |
package := packageHolder value ? '__NoProject__'. |
|
1764 |
||
1765 |
files := SourceCodeManager getExistingContainersInModule:module package:package. |
|
1766 |
files := files asOrderedCollection. |
|
1767 |
files := files select:[:eachFile | eachFile asFilename hasSuffix:'st']. |
|
1768 |
files sort. |
|
1769 |
fileNameBoxComponent list:files. |
|
1770 |
]. |
|
1771 |
]. |
|
1772 |
||
1773 |
moduleHolder := initialModule asValue. |
|
1774 |
packageHolder := initialPackage asValue. |
|
1775 |
fileNameHolder := initialFileName asValue. |
|
1776 |
||
1377
0fd99dd003f6
classResources now understood by all classes
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1777 |
resources := self classResources. |
1375 | 1778 |
|
1779 |
"/ |
|
1780 |
"/ open a dialog for this |
|
1781 |
"/ |
|
1782 |
box := DialogBox new. |
|
1783 |
box label:title. |
|
1784 |
||
1785 |
component := box addTextLabel:boxText withCRs. |
|
1786 |
component adjust:#left; borderWidth:0. |
|
1787 |
box addVerticalSpace. |
|
1788 |
box addVerticalSpace. |
|
1000 | 1789 |
|
1375 | 1790 |
y := box yPosition. |
1791 |
component := box addTextLabel:(resources string:'Module:'). |
|
1792 |
component width:0.4; adjust:#right. |
|
1793 |
box yPosition:y. |
|
1794 |
component := box addComboBoxOn:moduleHolder tabable:true. |
|
1795 |
component list:knownContainers. |
|
1796 |
||
1797 |
"/ component := box addInputFieldOn:moduleHolder tabable:true. |
|
1798 |
component width:0.6; left:0.4; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine. |
|
1799 |
||
1800 |
box addVerticalSpace. |
|
1801 |
y := box yPosition. |
|
1802 |
component := box addTextLabel:(resources string:'Package:'). |
|
1803 |
component width:0.4; adjust:#right. |
|
1804 |
box yPosition:y. |
|
1805 |
packageBoxComponent := component := box addComboBoxOn:packageHolder tabable:true. |
|
1806 |
"/ component := box addInputFieldOn:packageHolder tabable:true. |
|
1807 |
component width:0.6; left:0.4; "immediateAccept:true; "acceptOnLeave:true; cursorMovementWhenUpdating:#beginOfLine. |
|
1808 |
packageUpdater value. |
|
1809 |
moduleHolder onChangeEvaluate:packageUpdater. |
|
1810 |
||
1811 |
box addVerticalSpace. |
|
1812 |
y := box yPosition. |
|
1813 |
component := box addTextLabel:(resources string:'Filename:'). |
|
1814 |
component width:0.4; adjust:#right. |
|
1815 |
box yPosition:y. |
|
1816 |
||
1817 |
forNewContainer ifTrue:[ |
|
1818 |
component := box addInputFieldOn:fileNameHolder tabable:true. |
|
1819 |
component width:0.6; left:0.4; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine. |
|
1820 |
] ifFalse:[ |
|
1821 |
fileNameBoxComponent := component := box addComboBoxOn:fileNameHolder tabable:true. |
|
1822 |
component width:0.6; left:0.4; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine. |
|
1823 |
fileNameUpdater value. |
|
1824 |
packageHolder onChangeEvaluate:fileNameUpdater. |
|
1825 |
]. |
|
1826 |
||
1827 |
box addVerticalSpace. |
|
1828 |
||
1829 |
notice notNil ifTrue:[ |
|
1830 |
component := box addTextLabel:notice. |
|
1831 |
component adjust:#left; borderWidth:0. |
|
1832 |
]. |
|
1833 |
||
1834 |
box addVerticalSpace. |
|
1835 |
box addAbortAndOkButtons. |
|
1836 |
||
1837 |
(YesToAllNotification notNil and:[YesToAllNotification isHandled]) ifTrue:[ |
|
1838 |
component := Button label:'Yes to all'. |
|
1839 |
component action:[ |
|
1840 |
YesToAllNotification queryWith:true. |
|
1841 |
box doAccept. |
|
1842 |
]. |
|
1843 |
(DialogBox defaultOKButtonAtLeft) ifTrue:[ |
|
1844 |
box addButton:component after:nil. |
|
1845 |
] ifFalse:[ |
|
1846 |
box addButton:component before:nil. |
|
1847 |
]. |
|
1848 |
]. |
|
1849 |
(AbortAllSignal isHandled) ifTrue:[ |
|
1850 |
component := Button label:'Cancel all'. |
|
1851 |
component action:[ |
|
1852 |
box hide. |
|
1853 |
AbortAllSignal raiseSignal. |
|
1854 |
]. |
|
1855 |
(DialogBox defaultOKButtonAtLeft) ifTrue:[ |
|
1856 |
box addButton:component before:nil. |
|
1857 |
] ifFalse:[ |
|
1858 |
box addButton:component after:nil. |
|
1859 |
]. |
|
1860 |
]. |
|
1861 |
||
1862 |
(YesToAllQuery notNil and:[YesToAllQuery isHandled]) ifTrue:[ |
|
1863 |
answer := YesToAllQuery query. |
|
1864 |
]. |
|
1865 |
||
1866 |
answer isNil ifTrue:[ |
|
1867 |
box showAtPointer. |
|
1868 |
answer := box accepted |
|
1869 |
]. |
|
1870 |
||
1871 |
box destroy. |
|
1872 |
answer ifFalse:[ |
|
1873 |
^ nil |
|
1874 |
]. |
|
1000 | 1875 |
|
1375 | 1876 |
module := moduleHolder value withoutSpaces. |
1877 |
package := packageHolder value withoutSpaces. |
|
1878 |
fileName := fileNameHolder value withoutSpaces. |
|
1879 |
^ Dictionary new |
|
1880 |
at:#module put:module; |
|
1881 |
at:#package put:package; |
|
1882 |
at:#fileName put:fileName; |
|
1883 |
yourself |
|
1884 |
||
1885 |
" |
|
1886 |
self |
|
1887 |
askForContainer:'enter container' title:'container' note:'some note' |
|
1888 |
initialModule:'foo' initialPackage:'bar' initialFileName:'baz' |
|
1889 |
" |
|
1890 |
! |
|
1891 |
||
1892 |
askForExistingRevision:boxText title:title class:aClass |
|
1893 |
"open a dialog asking for a containers revision; |
|
1894 |
return a revision number, or nil if canceled." |
|
1895 |
||
1896 |
|mgr sourceInfo module package fileName| |
|
1897 |
||
1898 |
mgr := aClass sourceCodeManager. |
|
1899 |
sourceInfo := mgr sourceInfoOfClass:aClass. |
|
1900 |
sourceInfo isNil ifTrue:[^ nil]. |
|
1901 |
||
1902 |
package := mgr packageFromSourceInfo:sourceInfo. |
|
1903 |
module := mgr moduleFromSourceInfo:sourceInfo. |
|
1904 |
fileName := mgr containerFromSourceInfo:sourceInfo. |
|
1905 |
^ self |
|
1906 |
askForExistingRevision:boxText |
|
1907 |
title:title |
|
1908 |
class:aClass |
|
1909 |
manager:mgr |
|
1910 |
module:module package:package fileName:fileName |
|
1911 |
||
1912 |
" |
|
1913 |
SourceCodeManagerUtilities |
|
1914 |
askForRevisionToCompare:'enter revision' |
|
1915 |
title:'revision' |
|
1916 |
class:Array |
|
1917 |
" |
|
1918 |
! |
|
1919 |
||
1920 |
askForExistingRevision:boxText title:title class:clsOrNil manager:aSourceCodeManager module:module package:package fileName:fileName |
|
1921 |
"open a dialog asking for a containers revision; |
|
1922 |
return a revision number, or nil if canceled." |
|
1923 |
||
1924 |
|partialLog revisions items newestRev |
|
1925 |
box y component resources |
|
1926 |
revisionHolder| |
|
1927 |
||
1928 |
partialLog := aSourceCodeManager |
|
1929 |
revisionLogOf:clsOrNil |
|
1930 |
numberOfRevisions:20 |
|
1931 |
fileName:fileName |
|
1932 |
directory:package |
|
1933 |
module:module. |
|
1934 |
partialLog notNil ifTrue:[ |
|
1935 |
newestRev := partialLog at:#newestRevision. |
|
1936 |
revisions := partialLog at:#revisions. |
|
1937 |
items := revisions collect:[:each | |rev date who| |
|
1938 |
rev := each at:#revision. |
|
1939 |
date := each at:#date. |
|
1940 |
who := each at:#author. |
|
1941 |
rev allBold , ' [' , date , ' by ' , who , ']' |
|
1942 |
]. |
|
1943 |
revisions := revisions collect:[:each | each at:#revision]. |
|
1944 |
] ifFalse:[ |
|
1945 |
newestRev := aSourceCodeManager newestRevisionInFile:fileName directory:package module:module. |
|
1946 |
revisions := items := nil. |
|
1947 |
||
1948 |
newestRev isNil ifTrue:[ |
|
1949 |
(aSourceCodeManager checkForExistingContainerInModule:module package:package container:fileName) |
|
1950 |
ifFalse:[ |
|
1951 |
self warn:'Could not find/access the container for ',fileName,' in the repository. |
|
1952 |
This could be due to: |
|
1953 |
- invalid/wrong CVS-Root setting |
|
1954 |
- missing CVS access rights |
|
1955 |
(no access / not logged in) |
|
1956 |
- changed CVSRoot after compilation |
|
1957 |
(i.e. wrong CVS-path in classes version method) |
|
1958 |
'. |
|
1959 |
^ nil |
|
1960 |
] |
|
1961 |
] |
|
1962 |
]. |
|
1963 |
revisionHolder := newestRev asValue. |
|
1377
0fd99dd003f6
classResources now understood by all classes
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
1964 |
resources := self classResources. |
1375 | 1965 |
|
1966 |
revisionHolder onChangeEvaluate:[ |
|
1967 |
"/ cut off everything after revision |
|
1968 |
|s first words| |
|
1969 |
||
1970 |
s := revisionHolder value. |
|
1971 |
words := s asCollectionOfWords. |
|
1972 |
words size > 0 ifTrue:[ |
|
1973 |
first := words first string. |
|
1974 |
first ~= s ifTrue:[ |
|
1975 |
revisionHolder value:first |
|
1976 |
] |
|
1977 |
] |
|
1978 |
]. |
|
1979 |
||
1980 |
"/ |
|
1981 |
"/ open a dialog for this |
|
1982 |
"/ |
|
1983 |
box := DialogBox new. |
|
1984 |
box label:title. |
|
1985 |
||
1986 |
component := box addTextLabel:boxText withCRs. |
|
1987 |
component adjust:#left; borderWidth:0. |
|
1988 |
box addVerticalSpace. |
|
1989 |
box addVerticalSpace. |
|
1990 |
||
1991 |
y := box yPosition. |
|
1992 |
component := box addTextLabel:(resources string:'Revision:'). |
|
1993 |
component width:0.4; adjust:#right. |
|
1994 |
box yPosition:y. |
|
1995 |
component := box addComboBoxOn:revisionHolder tabable:true. |
|
1996 |
component list:items. |
|
1997 |
component width:0.6; left:0.4; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine. |
|
1998 |
||
1999 |
box addVerticalSpace. |
|
2000 |
||
2001 |
box addAbortAndOkButtons. |
|
2002 |
||
2003 |
Object abortAllSignal isHandled ifTrue:[ |
|
2004 |
(box addAbortButtonLabelled:'Cancel all') action:[AbortAllSignal raise]. |
|
2005 |
]. |
|
2006 |
||
2007 |
box showAtPointer. |
|
2008 |
||
2009 |
box accepted ifFalse:[ |
|
2010 |
box destroy. |
|
2011 |
^ nil |
|
2012 |
]. |
|
2013 |
box destroy. |
|
2014 |
||
2015 |
^ revisionHolder value withoutSpaces. |
|
2016 |
||
2017 |
" |
|
2018 |
SourceCodeManagerUtilities |
|
2019 |
askForRevisionToCompare:'enter revision' |
|
2020 |
title:'revision' |
|
2021 |
class:nil |
|
2022 |
manager:SourceCodeManager |
|
2023 |
module:'stx' |
|
2024 |
package:'libbasic' |
|
2025 |
fileName:'Array.st' |
|
2026 |
" |
|
2027 |
! |
|
2028 |
||
2029 |
checkAndWarnAboutBadMessagesInClass:aClass |
|
2030 |
"check if a class contains message-sends to: |
|
2031 |
#halt |
|
2032 |
#halt: |
|
2033 |
#error |
|
2034 |
(and maybe more in the future)" |
|
2035 |
||
2036 |
|badStuff whatIsBad msg answer labels values| |
|
2037 |
||
2038 |
badStuff := #( |
|
2039 |
( #halt 'sent of #halt (use for debugging only) - better use #error:''some message''' ) |
|
2040 |
( #halt: 'sent of #halt: (use for debugging only) - better use #error:' ) |
|
2041 |
( #error 'sent of #error without descriptive message - better use #error:''some message''' ) |
|
2042 |
). |
|
2043 |
||
2044 |
whatIsBad := Set new. |
|
2045 |
aClass theNonMetaclass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
|
2046 |
|setOfLiterals setOfSentMessages| |
|
2047 |
||
2048 |
setOfLiterals := mthd literals. "/ try without parsing first. |
|
2049 |
(badStuff contains:[:eachEntry | setOfLiterals includes:eachEntry first]) ifTrue:[ |
|
2050 |
setOfSentMessages := mthd messagesSent. |
|
2051 |
badStuff do:[:eachEntry | |
|
2052 |
(setOfSentMessages includes:eachEntry first) ifTrue:[ |
|
2053 |
whatIsBad add:eachEntry second |
|
2054 |
] |
|
1000 | 2055 |
]. |
2056 |
]. |
|
1375 | 2057 |
]. |
2058 |
whatIsBad notEmpty ifTrue:[ |
|
2059 |
(YesToAllQuery notNil and:[YesToAllQuery isHandled]) ifTrue:[ |
|
2060 |
answer := YesToAllQuery query. |
|
2061 |
answer notNil ifTrue:[ ^ answer ]. |
|
2062 |
]. |
|
2063 |
||
2064 |
msg := '%1 contains the following (considered bad style) message sends:\\'. |
|
2065 |
whatIsBad do:[:each | |
|
2066 |
msg := msg , ' ' , each , '\' |
|
1000 | 2067 |
]. |
1375 | 2068 |
msg := msg , '\\' , 'Do you really want to checkIn the %1 class ?'. |
2069 |
msg := msg bindWith:aClass name. |
|
2070 |
(YesToAllNotification notNil and:[YesToAllNotification isHandled]) ifTrue:[ |
|
2071 |
labels := #('Yes' 'Yes to all' 'No' 'No to all' 'Cancel'). |
|
2072 |
values := #(true #yesToAll false #noToAll nil). |
|
2073 |
AbortAllSignal isHandled ifTrue:[ |
|
2074 |
labels := labels , #('Cancel All'). |
|
2075 |
values := values , #(#cancelAll). |
|
2076 |
]. |
|
2077 |
answer := OptionBox |
|
2078 |
request:msg withCRs |
|
2079 |
label:'Really checkIn ?' |
|
1391
68432469745f
dont send obsolete message (OptionBox request:..form:..)
Claus Gittinger <cg@exept.de>
parents:
1381
diff
changeset
|
2080 |
image:(InfoBox iconBitmap) |
1375 | 2081 |
buttonLabels:labels |
2082 |
values:values |
|
2083 |
default:#yesToAll |
|
2084 |
onCancel:nil. |
|
2085 |
answer isNil ifTrue:[ |
|
2086 |
AbortSignal raise. |
|
2087 |
]. |
|
2088 |
answer == #cancelAll ifTrue:[ |
|
2089 |
AbortAllSignal raise. |
|
2090 |
]. |
|
2091 |
||
2092 |
answer == #yesToAll ifTrue:[ |
|
2093 |
YesToAllNotification queryWith:true. |
|
2094 |
^ true |
|
2095 |
]. |
|
2096 |
answer == #noToAll ifTrue:[ |
|
2097 |
YesToAllNotification queryWith:false. |
|
2098 |
^ false |
|
2099 |
]. |
|
2100 |
^ answer |
|
2101 |
] ifFalse:[ |
|
2102 |
^ self confirm:msg withCRs |
|
2103 |
] |
|
1000 | 2104 |
]. |
1375 | 2105 |
^ true. |
2106 |
||
2107 |
" |
|
2108 |
self checkAndWarnAboutBadMessagesInClass:(SourceCodeManagerUtilities) |
|
2109 |
" |
|
2110 |
! ! |
|
2111 |
||
2112 |
!SourceCodeManagerUtilities class methodsFor:'utilities-encoding'! |
|
2113 |
||
2114 |
guessEncodingOfBuffer:buffer |
|
2115 |
"look for a string of the form |
|
2116 |
encoding #name |
|
2117 |
or: |
|
2118 |
encoding: name |
|
2119 |
within the given buffer |
|
2120 |
(which is usually the first few bytes of a textFile)." |
|
2121 |
||
1381 | 2122 |
|s idx w withoutQuotes lcBuffer enc quote| |
1375 | 2123 |
|
2124 |
withoutQuotes := |
|
2125 |
[ |
|
2126 |
((w startsWith:$") or:[(w startsWith:$')]) ifTrue:[ |
|
2127 |
w := w copyFrom:2 |
|
2128 |
]. |
|
2129 |
((w endsWith:$") or:[(w endsWith:$')]) ifTrue:[ |
|
2130 |
w := w copyWithoutLast:1 |
|
2131 |
]. |
|
2132 |
w |
|
2133 |
]. |
|
2134 |
||
2135 |
lcBuffer := buffer asLowercase. |
|
2136 |
||
2137 |
#( 'charset' 'encoding' ) do:[:keyWord | |
|
2138 |
(idx := lcBuffer findString:keyWord) ~~ 0 ifTrue:[ |
|
2139 |
s := ReadStream on:buffer. |
|
2140 |
s position1Based:idx. |
|
2141 |
s skip:keyWord size. |
|
2142 |
s skipSeparators. |
|
2143 |
||
2144 |
['=:#' includes:s peek] whileTrue:[ |
|
2145 |
s next. |
|
2146 |
s skipSeparators. |
|
2147 |
]. |
|
1381 | 2148 |
s skipSeparators. |
2149 |
('"''' includes:s peek) ifTrue:[ |
|
2150 |
quote := s next. |
|
2151 |
w := s upTo:quote. |
|
2152 |
] ifFalse:[ |
|
2153 |
w := s upToSeparator. |
|
2154 |
]. |
|
1375 | 2155 |
w notNil ifTrue:[ |
2156 |
enc := withoutQuotes value. |
|
1377
0fd99dd003f6
classResources now understood by all classes
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
2157 |
(CharacterEncoder encoderFor:enc asSymbol ifAbsent:nil) notNil ifTrue:[ |
1375 | 2158 |
^ enc asSymbol |
2159 |
]. |
|
1378 | 2160 |
"/ enc size >=3 ifTrue:[ |
2161 |
"/ Transcript showCR:'Unknown encoding: ' , withoutQuotes value. |
|
2162 |
"/ ] |
|
1375 | 2163 |
]. |
2164 |
]. |
|
1011
647a8c2fabc1
method category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents:
1007
diff
changeset
|
2165 |
]. |
1375 | 2166 |
^ nil |
1189
fdc5e747c184
refactored check for a valid sourceCodeManager into one place
Claus Gittinger <cg@exept.de>
parents:
1185
diff
changeset
|
2167 |
! |
fdc5e747c184
refactored check for a valid sourceCodeManager into one place
Claus Gittinger <cg@exept.de>
parents:
1185
diff
changeset
|
2168 |
|
1375 | 2169 |
guessEncodingOfFile:aFilename |
2170 |
"look for a string |
|
2171 |
encoding #name |
|
2172 |
or: |
|
2173 |
encoding: name |
|
2174 |
within the given buffer |
|
2175 |
(which is usually the first few bytes of a textFile). |
|
2176 |
If thats not found, use heuristics (in CharacterArray) to guess." |
|
2177 |
||
2178 |
|s buffer n "{Class: SmallInteger }" |
|
2179 |
binary enc| |
|
2180 |
||
2181 |
s := aFilename asFilename readStreamOrNil. |
|
2182 |
s isNil ifTrue:[^ nil]. |
|
2183 |
||
2184 |
buffer := String new:2048. |
|
2185 |
n := buffer size. |
|
2186 |
n := s nextBytes:n into:buffer. |
|
2187 |
s close. |
|
2188 |
||
2189 |
enc := self guessEncodingOfBuffer:buffer. |
|
2190 |
enc notNil ifTrue:[^ enc]. |
|
2191 |
||
2192 |
binary := false. |
|
2193 |
1 to:n do:[:i | |
|
2194 |
(buffer at:i) isPrintable ifFalse:[binary := true]. |
|
2195 |
]. |
|
2196 |
||
2197 |
"/ look for JIS7 / EUC encoding |
|
2198 |
(buffer findString:(CharacterEncoder jisISO2022EscapeSequence)) ~~ 0 ifTrue:[ |
|
2199 |
^ #'iso2020-jp' |
|
2200 |
]. |
|
2201 |
(buffer findString:(CharacterEncoder jis7KanjiEscapeSequence)) ~~ 0 ifTrue:[ |
|
2202 |
^ #jis7 |
|
2203 |
]. |
|
2204 |
(buffer findString:(CharacterEncoder jis7KanjiOldEscapeSequence)) ~~ 0 ifTrue:[ |
|
2205 |
^ #jis7 |
|
2206 |
]. |
|
1189
fdc5e747c184
refactored check for a valid sourceCodeManager into one place
Claus Gittinger <cg@exept.de>
parents:
1185
diff
changeset
|
2207 |
|
1375 | 2208 |
"/ TODO: |
2209 |
||
2210 |
"/ "/ look for EUC |
|
2211 |
"/ idx := aString findFirst:[:char | |ascii| |
|
2212 |
"/ ((ascii := char asciiValue) >= 16rA1) |
|
2213 |
"/ and:[ascii <= 16rFE]]. |
|
2214 |
"/ idx ~~ 0 ifTrue:[ |
|
2215 |
"/ ascii := (aString at:(idx + 1)) asciiValue. |
|
2216 |
"/ (ascii >= 16rA1 and:[ascii <= 16rFE]) ifTrue:[ |
|
2217 |
"/ ^ #euc |
|
2218 |
"/ ] |
|
2219 |
"/ ]. |
|
2220 |
"/ look for SJIS ... |
|
2221 |
||
2222 |
^ nil |
|
2223 |
||
2224 |
" |
|
2225 |
SourceCodeManagerUtilities guessEncodingOfFile:'../../libview2/resources/ApplicationModel_de.rs' asFilename |
|
2226 |
SourceCodeManagerUtilities guessEncodingOfFile:'../../libview2/resources/ApplicationModel_ru.rs' asFilename |
|
2227 |
" |
|
2228 |
! |
|
2229 |
||
2230 |
guessEncodingOfStream:aStream |
|
2231 |
"look for a string of the form |
|
2232 |
encoding #name |
|
2233 |
or: |
|
2234 |
encoding: name |
|
2235 |
in the first few bytes of aStream." |
|
2236 |
||
2237 |
|oldPosition buffer n| |
|
2238 |
||
2239 |
buffer := String new:2048. |
|
2240 |
||
2241 |
oldPosition := aStream position. |
|
2242 |
n := buffer size. |
|
2243 |
n := aStream nextBytes:n into:buffer. |
|
2244 |
aStream position:oldPosition. |
|
2245 |
||
2246 |
^ self guessEncodingOfBuffer:buffer |
|
873 | 2247 |
! ! |
2248 |
||
2249 |
!SourceCodeManagerUtilities class methodsFor:'documentation'! |
|
2250 |
||
2251 |
version |
|
1391
68432469745f
dont send obsolete message (OptionBox request:..form:..)
Claus Gittinger <cg@exept.de>
parents:
1381
diff
changeset
|
2252 |
^ '$Header: /cvs/stx/stx/libbasic3/SourceCodeManagerUtilities.st,v 1.104 2004-05-18 13:30:31 cg Exp $' |
873 | 2253 |
! ! |