author | Claus Gittinger <cg@exept.de> |
Sat, 27 Apr 2013 14:56:56 +0200 | |
changeset 12725 | 93efe8fda21c |
parent 12702 | 2759bbb8d06b |
child 12807 | ba8c5416aa28 |
child 12893 | 61328b650b79 |
permissions | -rw-r--r-- |
11532 | 1 |
"{ Package: 'stx:libtool' }" |
2 |
||
3 |
SourceCodeManagerUtilities subclass:#PerforceSourceCodeManagerUtilities |
|
4 |
instanceVariableNames:'' |
|
5 |
classVariableNames:'' |
|
6 |
poolDictionaries:'' |
|
7 |
category:'System-SourceCodeManagement' |
|
8 |
! |
|
9 |
||
10 |
SimpleDialog subclass:#P4CheckinInfoDialog |
|
11 |
instanceVariableNames:'descriptionHolder logMessageHolder isStableHolder tagHolder |
|
12 |
quickCheckInHolder quickCheckInVisibleHolder allowEmptyLogMessage |
|
13 |
warningMessageHolder logHistory logHistoryHeadLineSelectionHolder |
|
14 |
submitHolder' |
|
15 |
classVariableNames:'' |
|
16 |
poolDictionaries:'' |
|
17 |
privateIn:PerforceSourceCodeManagerUtilities |
|
18 |
! |
|
19 |
||
20 |
SimpleDialog subclass:#SubmitInfoDialog |
|
21 |
instanceVariableNames:'descriptionHolder logMessageHolder isStableHolder tagHolder |
|
22 |
quickCheckInHolder quickCheckInVisibleHolder allowEmptyLogMessage |
|
23 |
warningMessageHolder filesHolder tagItInHolder' |
|
24 |
classVariableNames:'LastSourceLogMessage' |
|
25 |
poolDictionaries:'' |
|
26 |
privateIn:PerforceSourceCodeManagerUtilities |
|
27 |
! |
|
28 |
||
29 |
Object subclass:#WorkSpace |
|
30 |
instanceVariableNames:'client host owner root views perforceSettings temporaryWorkSpace |
|
31 |
tempDirectory' |
|
32 |
classVariableNames:'PerforceCommandSemaphore' |
|
33 |
poolDictionaries:'' |
|
34 |
privateIn:PerforceSourceCodeManagerUtilities |
|
35 |
! |
|
36 |
||
37 |
Object subclass:#View |
|
38 |
instanceVariableNames:'depot local workspace type' |
|
39 |
classVariableNames:'' |
|
40 |
poolDictionaries:'' |
|
41 |
privateIn:PerforceSourceCodeManagerUtilities::WorkSpace |
|
42 |
! |
|
43 |
||
44 |
||
45 |
!PerforceSourceCodeManagerUtilities class methodsFor:'class access'! |
|
46 |
||
47 |
submitInfoDialogClass |
|
48 |
||
49 |
^ SubmitInfoDialog |
|
50 |
||
51 |
"Created: / 01-06-2012 / 11:09:15 / cg" |
|
52 |
! |
|
53 |
||
54 |
workSpaceClass |
|
55 |
^ WorkSpace |
|
56 |
||
57 |
"Created: / 01-06-2012 / 11:13:49 / cg" |
|
58 |
! ! |
|
59 |
||
60 |
!PerforceSourceCodeManagerUtilities methodsFor:'utilities-cvs'! |
|
61 |
||
62 |
checkinClass:aClass withInfo:aLogInfoOrNil withCheck:doCheckClass usingManager:managerOrNil |
|
63 |
"check a class into the source repository. |
|
64 |
If the argument, aLogInfoOrNil isNil, ask interactively for log-message. |
|
65 |
If doCheckClass is true, the class is checked for send of halts etc." |
|
66 |
||
67 |
|logMessage checkinInfo mgr pri doSubmit| |
|
68 |
||
69 |
doSubmit := false. |
|
70 |
||
71 |
aClass isLoaded ifFalse:[ |
|
72 |
self information:(resources string:'Cannot checkin unloaded classes (%1)' with:aClass name). |
|
73 |
^ false. |
|
74 |
]. |
|
75 |
||
76 |
mgr := managerOrNil. |
|
77 |
mgr isNil ifTrue:[ |
|
78 |
mgr := self sourceCodeManagerFor:aClass. |
|
79 |
mgr isNil ifTrue:[ |
|
80 |
^ false |
|
81 |
] |
|
82 |
]. |
|
83 |
||
84 |
self ensureCorrectVersionMethodsInClass:aClass usingManager:mgr. |
|
85 |
mgr supportsCheckinLogMessages ifTrue:[ |
|
86 |
(self |
|
87 |
getLogMessageForClassCheckinTakingDefaultsFromPreviousLogInfo:aLogInfoOrNil |
|
88 |
forClass:aClass |
|
89 |
valuesInto:[:logMessageRet :checkinInfoRet | |
|
90 |
logMessage := logMessageRet. |
|
91 |
checkinInfo := checkinInfoRet. |
|
92 |
checkinInfo notNil ifTrue:[ |
|
93 |
doSubmit := checkinInfo submitHolder value. |
|
94 |
]. |
|
95 |
] |
|
96 |
) ifFalse:[^ false]. |
|
97 |
]. |
|
98 |
||
99 |
(self classIsNotYetInRepository:aClass withManager:mgr) ifTrue:[ |
|
100 |
(self createSourceContainerForClass:aClass usingManager:mgr) ifFalse:[ |
|
101 |
"/ self warn:'did not create a container for ''' , aClass name , ''''. |
|
102 |
^ false |
|
103 |
]. |
|
104 |
^ true. |
|
105 |
]. |
|
106 |
||
107 |
self activityNotification:(resources string:'checking in %1' with:aClass name). |
|
108 |
pri := Processor activePriority. |
|
109 |
Processor activeProcess withPriority:pri-1 to:pri |
|
110 |
do:[ |
|
111 |
|revision aborted| |
|
112 |
||
113 |
||
114 |
||
115 |
aborted := false. |
|
116 |
AbortOperationRequest handle:[:ex | |
|
117 |
aborted := true. |
|
118 |
ex return. |
|
119 |
] do:[ |
|
120 |
|checkinState cause| |
|
121 |
checkinState := false. |
|
122 |
cause := ''. |
|
123 |
[ |
|
124 |
checkinState := mgr checkinClass:aClass logMessage:logMessage submit:doSubmit |
|
125 |
] on:SourceCodeManagerError do:[:ex| |
|
126 |
self halt. |
|
127 |
cause := ex description. |
|
128 |
ex proceed. |
|
129 |
]. |
|
130 |
||
131 |
checkinState ifFalse:[ |
|
132 |
Transcript showCR:'checkin of ''' , aClass name , ''' failed - ', cause. |
|
133 |
self warn:(resources stringWithCRs:'Checkin of "%1" failed\\' with:aClass name allBold),cause. |
|
134 |
^ false. |
|
135 |
]. |
|
136 |
checkinInfo notNil ifTrue:[ |
|
137 |
checkinInfo isStable ifTrue:[ |
|
138 |
"set stable tag for class that has been checked in" |
|
139 |
self tagClass:aClass as:#stable. |
|
140 |
]. |
|
141 |
checkinInfo tagIt ifTrue:[ |
|
142 |
"set an additional tag for class that has been checked in" |
|
143 |
self tagClass:aClass as:(checkinInfo tag). |
|
144 |
]. |
|
145 |
]. |
|
146 |
]. |
|
147 |
aborted ifTrue:[ |con| |
|
148 |
Transcript showCR:'Checkin of ''' , aClass name , ''' aborted'. |
|
149 |
||
150 |
AbortAllOperationWantedQuery query ifTrue:[ |
|
151 |
(Dialog |
|
152 |
confirm:(resources stringWithCRs:'Checkin of "%1" aborted.\\Cancel all ?' with:aClass name) |
|
153 |
default:false) |
|
154 |
ifTrue:[ |
|
155 |
AbortAllOperationRequest raise. |
|
156 |
] |
|
157 |
]. |
|
158 |
^ false. |
|
159 |
]. |
|
160 |
]. |
|
161 |
^ true |
|
162 |
||
163 |
"Created: / 21-12-2011 / 18:19:14 / cg" |
|
164 |
! ! |
|
165 |
||
166 |
!PerforceSourceCodeManagerUtilities methodsFor:'utilities-p4'! |
|
167 |
||
168 |
submit |
|
169 |
self defaultManager submit |
|
170 |
! ! |
|
171 |
||
172 |
!PerforceSourceCodeManagerUtilities methodsFor:'utilities-p4-interaction'! |
|
173 |
||
174 |
getCheckinInfoFor:aClassNameOrPackageNameString initialAnswer:initialAnswerOrNil withQuickOption:withQuickOption |
|
175 |
"ask for a log message for checking in a class (plus checkinQuick state info), |
|
176 |
and other info (mark as stable, for example). |
|
177 |
Return the info-object (actually: the dialog) or nil if aborted." |
|
178 |
||
179 |
|logMsg infoDialog| |
|
180 |
||
181 |
infoDialog := self defaultManager checkInInfoDialogClass |
|
182 |
getCheckinInfoFor:aClassNameOrPackageNameString |
|
183 |
initialAnswer:(initialAnswerOrNil ? LastSourceLogMessage) |
|
184 |
withQuickOption:withQuickOption. |
|
185 |
infoDialog notNil ifTrue:[ |
|
186 |
logMsg := infoDialog logMessage. |
|
187 |
logMsg notEmptyOrNil ifTrue:[ |
|
188 |
LastSourceLogMessage := logMsg |
|
189 |
]. |
|
190 |
]. |
|
191 |
^ infoDialog |
|
192 |
||
193 |
" |
|
194 |
SourceCodeManagerUtilities getCheckinInfoFor:'hello' initialAnswer:'bla' |
|
195 |
" |
|
196 |
||
197 |
"Modified: / 06-07-2010 / 11:21:28 / cg" |
|
198 |
! ! |
|
199 |
||
200 |
!PerforceSourceCodeManagerUtilities::P4CheckinInfoDialog class methodsFor:'documentation'! |
|
201 |
||
202 |
copyright |
|
203 |
" |
|
204 |
COPYRIGHT (c) 2005 eXept Software AG |
|
205 |
All Rights Reserved |
|
206 |
||
207 |
This software is furnished under a license and may be used |
|
208 |
only in accordance with the terms of that license and with the |
|
209 |
inclusion of the above copyright notice. This software may not |
|
210 |
be provided or otherwise made available to, or used by, any |
|
211 |
other person. No title to or ownership of the software is |
|
212 |
hereby transferred. |
|
213 |
" |
|
214 |
! |
|
215 |
||
216 |
documentation |
|
217 |
" |
|
218 |
checkin-dialog. |
|
219 |
used to be private in SourceCodeManagerUtilites. |
|
220 |
moved to libtool because libbasic3 should not contain code inheriting from GUI classes. |
|
221 |
||
222 |
[author:] |
|
223 |
||
224 |
[see also:] |
|
225 |
||
226 |
[instance variables:] |
|
227 |
||
228 |
[class variables:] |
|
229 |
" |
|
230 |
! ! |
|
231 |
||
232 |
!PerforceSourceCodeManagerUtilities::P4CheckinInfoDialog class methodsFor:'interface specs'! |
|
233 |
||
234 |
windowSpec |
|
235 |
"This resource specification was automatically generated |
|
236 |
by the UIPainter of ST/X." |
|
237 |
||
238 |
"Do not manually edit this!! If it is corrupted, |
|
239 |
the UIPainter may not be able to read the specification." |
|
240 |
||
241 |
" |
|
242 |
UIPainter new openOnClass:PerforceSourceCodeManager::P4CheckinInfoDialog andSelector:#windowSpec |
|
243 |
PerforceSourceCodeManager::P4CheckinInfoDialog new openInterface:#windowSpec |
|
244 |
PerforceSourceCodeManager::P4CheckinInfoDialog open |
|
245 |
" |
|
246 |
||
247 |
<resource: #canvas> |
|
248 |
||
249 |
^ |
|
250 |
#(FullSpec |
|
251 |
name: windowSpec |
|
252 |
window: |
|
253 |
(WindowSpec |
|
254 |
label: 'Enter Log Message' |
|
255 |
name: 'Enter Log Message' |
|
256 |
min: (Point 10 10) |
|
257 |
bounds: (Rectangle 0 0 800 327) |
|
258 |
) |
|
259 |
component: |
|
260 |
(SpecCollection |
|
261 |
collection: ( |
|
262 |
(HorizontalPanelViewSpec |
|
263 |
name: 'HorizontalPanel2' |
|
264 |
layout: (LayoutFrame 0 0.0 0 0 0 1.0 32 0) |
|
265 |
horizontalLayout: left |
|
266 |
verticalLayout: center |
|
267 |
horizontalSpace: 0 |
|
268 |
verticalSpace: 3 |
|
269 |
component: |
|
270 |
(SpecCollection |
|
271 |
collection: ( |
|
272 |
(LabelSpec |
|
273 |
label: 'Enter checkIn log-message for:' |
|
274 |
name: 'Label1' |
|
275 |
translateLabel: true |
|
276 |
resizeForLabel: true |
|
277 |
useDefaultExtent: true |
|
278 |
) |
|
279 |
(LabelSpec |
|
280 |
name: 'Label2' |
|
281 |
translateLabel: true |
|
282 |
labelChannel: descriptionHolder |
|
283 |
useDefaultExtent: true |
|
284 |
) |
|
285 |
) |
|
286 |
||
287 |
) |
|
288 |
) |
|
289 |
(TextEditorSpec |
|
290 |
name: 'TextEditor1' |
|
291 |
layout: (LayoutFrame 2 0.0 38 0 -2 1 -125 1) |
|
292 |
model: logMessageHolder |
|
293 |
hasHorizontalScrollBar: true |
|
294 |
hasVerticalScrollBar: true |
|
295 |
hasKeyboardFocusInitially: false |
|
296 |
) |
|
297 |
(LabelSpec |
|
298 |
name: 'Label4' |
|
299 |
layout: (LayoutFrame 0 0.0 -119 1 0 1.0 -97 1) |
|
300 |
translateLabel: true |
|
301 |
labelChannel: warningMessageHolder |
|
302 |
) |
|
303 |
(CheckBoxSpec |
|
304 |
label: 'Quick Checkin (Only Classes in ChangeSet)' |
|
305 |
name: 'CheckInChangedOnlyCheckbox' |
|
306 |
layout: (LayoutFrame 3 0 -95 1 -3 0.5 -73 1) |
|
307 |
visibilityChannel: quickCheckInVisibleHolder |
|
308 |
model: quickCheckInHolder |
|
309 |
translateLabel: true |
|
310 |
) |
|
311 |
(CheckBoxSpec |
|
312 |
label: 'Mark as Stable' |
|
313 |
name: 'MarkStableCheckBox' |
|
314 |
layout: (LayoutFrame 3 0 -68 1 -3 1 -46 1) |
|
315 |
model: isStableHolder |
|
316 |
translateLabel: true |
|
317 |
) |
|
318 |
(LabelSpec |
|
319 |
label: 'Tag:' |
|
320 |
name: 'Label3' |
|
321 |
layout: (LayoutFrame -40 0.5 -67 1 0 0.5 -45 1) |
|
322 |
translateLabel: true |
|
323 |
adjust: right |
|
324 |
) |
|
325 |
(InputFieldSpec |
|
326 |
name: 'TagEntryField' |
|
327 |
layout: (LayoutFrame 0 0.5 -68 1 -3 1 -46 1) |
|
328 |
enableChannel: tagItInHolder |
|
329 |
model: tagHolder |
|
330 |
acceptOnReturn: true |
|
331 |
acceptOnTab: true |
|
332 |
acceptOnLostFocus: true |
|
333 |
acceptOnPointerLeave: false |
|
334 |
) |
|
335 |
(HorizontalPanelViewSpec |
|
336 |
name: 'ButtonPanel1' |
|
337 |
layout: (LayoutFrame 0 0.0 -40 1 0 1.0 0 1.0) |
|
338 |
horizontalLayout: fitSpace |
|
339 |
verticalLayout: center |
|
340 |
horizontalSpace: 3 |
|
341 |
verticalSpace: 2 |
|
342 |
reverseOrderIfOKAtLeft: true |
|
343 |
component: |
|
344 |
(SpecCollection |
|
345 |
collection: ( |
|
346 |
(ActionButtonSpec |
|
347 |
label: 'Cancel' |
|
348 |
name: 'Button2' |
|
349 |
translateLabel: true |
|
350 |
model: doCancel |
|
351 |
extent: (Point 395 22) |
|
352 |
) |
|
353 |
(ActionButtonSpec |
|
354 |
label: 'OK' |
|
355 |
name: 'Button1' |
|
356 |
translateLabel: true |
|
357 |
model: doAccept |
|
358 |
extent: (Point 396 22) |
|
359 |
) |
|
360 |
) |
|
361 |
||
362 |
) |
|
363 |
) |
|
364 |
(CheckBoxSpec |
|
365 |
label: 'Immediate Submit' |
|
366 |
name: 'CheckBox1' |
|
367 |
layout: (LayoutFrame 3 0.5 -95 1 -3 1 -73 1) |
|
368 |
model: submitHolder |
|
369 |
translateLabel: true |
|
370 |
) |
|
371 |
) |
|
372 |
||
373 |
) |
|
374 |
) |
|
375 |
! ! |
|
376 |
||
377 |
!PerforceSourceCodeManagerUtilities::P4CheckinInfoDialog class methodsFor:'opening'! |
|
378 |
||
379 |
getCheckinInfoFor:aString initialAnswer:initialAnswer |
|
380 |
^ self |
|
381 |
getCheckinInfoFor:aString |
|
382 |
initialAnswer:initialAnswer |
|
383 |
withQuickOption:false |
|
384 |
||
385 |
" |
|
386 |
self getCheckinInfoFor:'hello' initialAnswer:'bla' |
|
387 |
" |
|
388 |
||
389 |
"Modified (format): / 12-03-2012 / 12:38:48 / cg" |
|
390 |
! |
|
391 |
||
392 |
getCheckinInfoFor:aClassNameOrPackageNameString initialAnswer:initialAnswer withQuickOption:withQuickOption |
|
393 |
^ self |
|
394 |
getCheckinInfoFor:aClassNameOrPackageNameString |
|
395 |
initialAnswer:initialAnswer |
|
396 |
withQuickOption:withQuickOption |
|
397 |
logHistory:#() |
|
398 |
||
399 |
" |
|
400 |
self getCheckinInfoFor:'hello' initialAnswer:'bla' |
|
401 |
" |
|
402 |
||
403 |
"Modified: / 12-03-2012 / 12:39:00 / cg" |
|
404 |
! |
|
405 |
||
406 |
getCheckinInfoFor:aClassNameOrPackageNameString initialAnswer:initialAnswer withQuickOption:withQuickOption logHistory:logHistoryArg |
|
407 |
|dialog warnMessage| |
|
408 |
||
409 |
warnMessage := nil. |
|
410 |
||
411 |
[ |
|
412 |
dialog := self new. |
|
413 |
dialog |
|
414 |
description:aClassNameOrPackageNameString; |
|
415 |
logMessage:initialAnswer; |
|
416 |
withQuickOption:withQuickOption; |
|
417 |
logHistory:logHistoryArg. |
|
418 |
||
419 |
dialog warningMessageHolder value:warnMessage. |
|
420 |
dialog open. |
|
421 |
dialog accepted ifFalse:[ ^ nil ]. |
|
422 |
] doUntil:[ |
|
423 |
|stopAsking| |
|
424 |
||
425 |
stopAsking := dialog allowEmptyLogMessage |
|
426 |
or:[ dialog logMessage withoutSeparators notEmptyOrNil ]. |
|
427 |
stopAsking ifFalse:[ |
|
428 |
warnMessage := (self resources string:'Please enter a description of your changes!!') |
|
429 |
asText |
|
430 |
colorizeAllWith:Color red. |
|
431 |
]. |
|
432 |
stopAsking |
|
433 |
]. |
|
434 |
^ dialog |
|
435 |
||
436 |
||
437 |
" |
|
438 |
self getCheckinInfoFor:'hello' initialAnswer:'bla' |
|
439 |
" |
|
440 |
||
441 |
"Created: / 12-03-2012 / 12:36:26 / cg" |
|
442 |
! ! |
|
443 |
||
444 |
!PerforceSourceCodeManagerUtilities::P4CheckinInfoDialog methodsFor:'accessing'! |
|
445 |
||
446 |
allowEmptyLogMessage |
|
447 |
^ allowEmptyLogMessage ? false |
|
448 |
||
449 |
"Created: / 06-07-2010 / 11:23:18 / cg" |
|
450 |
! |
|
451 |
||
452 |
allowEmptyLogMessage:aBoolean |
|
453 |
allowEmptyLogMessage := aBoolean |
|
454 |
||
455 |
"Created: / 06-07-2010 / 11:23:31 / cg" |
|
456 |
! |
|
457 |
||
458 |
description |
|
459 |
^ self descriptionHolder value |
|
460 |
! |
|
461 |
||
462 |
description:aString |
|
463 |
self descriptionHolder value:aString allBold |
|
464 |
! |
|
465 |
||
466 |
isStable |
|
467 |
^ self isStableHolder value |
|
468 |
! |
|
469 |
||
470 |
isStable:aBoolean |
|
471 |
self isStableHolder value:aBoolean |
|
472 |
! |
|
473 |
||
474 |
logHistory:something |
|
475 |
logHistory := something. |
|
476 |
! |
|
477 |
||
478 |
logMessage |
|
479 |
^ self logMessageHolder value |
|
480 |
! |
|
481 |
||
482 |
logMessage:aString |
|
483 |
self logMessageHolder value:aString |
|
484 |
! |
|
485 |
||
486 |
quickCheckIn |
|
487 |
^ self quickCheckInHolder value |
|
488 |
! |
|
489 |
||
490 |
quickCheckIn:aBoolean |
|
491 |
self quickCheckInHolder value:aBoolean |
|
492 |
! |
|
493 |
||
494 |
tag |
|
495 |
^ self tagHolder value withoutSeparators |
|
496 |
! |
|
497 |
||
498 |
tag:aStringOrNil |
|
499 |
self tagHolder value:aStringOrNil |
|
500 |
||
501 |
"Modified: / 12-09-2006 / 12:03:50 / cg" |
|
502 |
! |
|
503 |
||
504 |
tagIt |
|
505 |
^ self tag notEmptyOrNil |
|
506 |
||
507 |
"Created: / 12-09-2006 / 13:06:49 / cg" |
|
508 |
! |
|
509 |
||
510 |
withQuickOption:aBoolean |
|
511 |
^ self quickCheckInVisibleHolder value:aBoolean |
|
512 |
! ! |
|
513 |
||
514 |
!PerforceSourceCodeManagerUtilities::P4CheckinInfoDialog methodsFor:'aspects'! |
|
515 |
||
516 |
descriptionHolder |
|
517 |
descriptionHolder isNil ifTrue:[ |
|
518 |
descriptionHolder := ValueHolder new. |
|
519 |
]. |
|
520 |
^ descriptionHolder |
|
521 |
! |
|
522 |
||
523 |
isStableHolder |
|
524 |
isStableHolder isNil ifTrue:[ |
|
525 |
isStableHolder := false asValue. |
|
526 |
]. |
|
527 |
^ isStableHolder. |
|
528 |
||
529 |
"Modified: / 16-01-2007 / 16:00:26 / cg" |
|
530 |
! |
|
531 |
||
532 |
logHistoryHeadLineSelectionHolder |
|
533 |
logHistoryHeadLineSelectionHolder isNil ifTrue:[ |
|
534 |
logHistoryHeadLineSelectionHolder := nil asValue. |
|
535 |
logHistoryHeadLineSelectionHolder |
|
536 |
onChangeEvaluate: |
|
537 |
[ |
|
538 |
self logMessageHolder value:(logHistory at:logHistoryHeadLineSelectionHolder value) |
|
539 |
]. |
|
540 |
]. |
|
541 |
^ logHistoryHeadLineSelectionHolder |
|
542 |
||
543 |
"Created: / 12-03-2012 / 12:40:36 / cg" |
|
544 |
! |
|
545 |
||
546 |
logHistoryHeadLines |
|
547 |
^ (logHistory ? #()) |
|
548 |
collect:[:msg | |
|
549 |
msg withoutLeadingSeparators asCollectionOfLines first , '...' |
|
550 |
] |
|
551 |
||
552 |
"Created: / 12-03-2012 / 12:39:35 / cg" |
|
553 |
! |
|
554 |
||
555 |
logMessageHolder |
|
556 |
logMessageHolder isNil ifTrue:[ |
|
557 |
logMessageHolder := '' asValue. |
|
558 |
]. |
|
559 |
^ logMessageHolder. |
|
560 |
||
561 |
"Modified: / 12-03-2012 / 12:34:13 / cg" |
|
562 |
! |
|
563 |
||
564 |
quickCheckInHolder |
|
565 |
quickCheckInHolder isNil ifTrue:[ |
|
566 |
quickCheckInHolder := true asValue. |
|
567 |
]. |
|
568 |
^ quickCheckInHolder |
|
569 |
! |
|
570 |
||
571 |
quickCheckInVisibleHolder |
|
572 |
quickCheckInVisibleHolder isNil ifTrue:[ |
|
573 |
quickCheckInVisibleHolder := false asValue. |
|
574 |
]. |
|
575 |
^ quickCheckInVisibleHolder |
|
576 |
! |
|
577 |
||
578 |
submitHolder |
|
579 |
submitHolder isNil ifTrue:[ |
|
580 |
submitHolder := false asValue. |
|
581 |
]. |
|
582 |
^ submitHolder |
|
583 |
! |
|
584 |
||
585 |
tagHolder |
|
586 |
tagHolder isNil ifTrue:[ |
|
587 |
tagHolder := '' asValue. |
|
588 |
]. |
|
589 |
^ tagHolder |
|
590 |
! |
|
591 |
||
592 |
warningMessageHolder |
|
593 |
warningMessageHolder isNil ifTrue:[ |
|
594 |
warningMessageHolder := nil asValue. |
|
595 |
]. |
|
596 |
^ warningMessageHolder. |
|
597 |
||
598 |
"Created: / 06-07-2010 / 11:30:29 / cg" |
|
599 |
! ! |
|
600 |
||
601 |
!PerforceSourceCodeManagerUtilities::SubmitInfoDialog class methodsFor:'documentation'! |
|
602 |
||
603 |
copyright |
|
604 |
" |
|
605 |
COPYRIGHT (c) 2005 eXept Software AG |
|
606 |
All Rights Reserved |
|
607 |
||
608 |
This software is furnished under a license and may be used |
|
609 |
only in accordance with the terms of that license and with the |
|
610 |
inclusion of the above copyright notice. This software may not |
|
611 |
be provided or otherwise made available to, or used by, any |
|
612 |
other person. No title to or ownership of the software is |
|
613 |
hereby transferred. |
|
614 |
" |
|
615 |
! |
|
616 |
||
617 |
documentation |
|
618 |
" |
|
619 |
checkin-dialog. |
|
620 |
used to be private in SourceCodeManagerUtilites. |
|
621 |
moved to libtool because libbasic3 should not contain code inheriting from GUI classes. |
|
622 |
||
623 |
[author:] |
|
624 |
||
625 |
[see also:] |
|
626 |
||
627 |
[instance variables:] |
|
628 |
||
629 |
[class variables:] |
|
630 |
" |
|
631 |
! ! |
|
632 |
||
633 |
!PerforceSourceCodeManagerUtilities::SubmitInfoDialog class methodsFor:'interface specs'! |
|
634 |
||
635 |
windowSpec |
|
636 |
"This resource specification was automatically generated |
|
637 |
by the UIPainter of ST/X." |
|
638 |
||
639 |
"Do not manually edit this!! If it is corrupted, |
|
640 |
the UIPainter may not be able to read the specification." |
|
641 |
||
642 |
" |
|
643 |
UIPainter new openOnClass:PerforceSourceCodeManager::SubmitInfoDialog andSelector:#windowSpec |
|
644 |
PerforceSourceCodeManager::SubmitInfoDialog new openInterface:#windowSpec |
|
645 |
PerforceSourceCodeManager::SubmitInfoDialog open |
|
646 |
" |
|
647 |
||
648 |
<resource: #canvas> |
|
649 |
||
650 |
^ |
|
651 |
#(FullSpec |
|
652 |
name: windowSpec |
|
653 |
window: |
|
654 |
(WindowSpec |
|
655 |
label: 'Enter Log Message' |
|
656 |
name: 'Enter Log Message' |
|
657 |
min: (Point 10 10) |
|
658 |
bounds: (Rectangle 0 0 563 561) |
|
659 |
) |
|
660 |
component: |
|
661 |
(SpecCollection |
|
662 |
collection: ( |
|
663 |
(HorizontalPanelViewSpec |
|
664 |
name: 'HorizontalPanel2' |
|
665 |
layout: (LayoutFrame 0 0.0 0 0 0 1.0 32 0) |
|
666 |
horizontalLayout: left |
|
667 |
verticalLayout: center |
|
668 |
horizontalSpace: 0 |
|
669 |
verticalSpace: 3 |
|
670 |
component: |
|
671 |
(SpecCollection |
|
672 |
collection: ( |
|
673 |
(LabelSpec |
|
674 |
label: 'Enter checkIn log-message for:' |
|
675 |
name: 'Label1' |
|
676 |
translateLabel: true |
|
677 |
resizeForLabel: true |
|
678 |
useDefaultExtent: true |
|
679 |
) |
|
680 |
(LabelSpec |
|
681 |
name: 'Label2' |
|
682 |
translateLabel: true |
|
683 |
labelChannel: descriptionHolder |
|
684 |
useDefaultExtent: true |
|
685 |
) |
|
686 |
) |
|
687 |
||
688 |
) |
|
689 |
) |
|
690 |
(VerticalPanelViewSpec |
|
691 |
name: 'VerticalPanel1' |
|
692 |
layout: (LayoutFrame 0 0.0 38 0 0 1.0 -80 1) |
|
693 |
horizontalLayout: fit |
|
694 |
verticalLayout: topFit |
|
695 |
horizontalSpace: 3 |
|
696 |
verticalSpace: 3 |
|
697 |
component: |
|
698 |
(SpecCollection |
|
699 |
collection: ( |
|
700 |
(LabelSpec |
|
701 |
label: 'Files:' |
|
702 |
name: 'Label4' |
|
703 |
translateLabel: true |
|
704 |
adjust: left |
|
705 |
extent: (Point 563 23) |
|
706 |
) |
|
707 |
(TextEditorSpec |
|
708 |
name: 'TextEditor1' |
|
709 |
enableChannel: false |
|
710 |
model: filesHolder |
|
711 |
hasHorizontalScrollBar: true |
|
712 |
hasVerticalScrollBar: true |
|
713 |
hasKeyboardFocusInitially: false |
|
714 |
extent: (Point 563 146) |
|
715 |
) |
|
716 |
(LabelSpec |
|
717 |
label: 'Log Message:' |
|
718 |
name: 'Label5' |
|
719 |
translateLabel: true |
|
720 |
adjust: left |
|
721 |
extent: (Point 563 23) |
|
722 |
) |
|
723 |
(TextEditorSpec |
|
724 |
name: 'TextEditor2' |
|
725 |
model: logMessageHolder |
|
726 |
hasHorizontalScrollBar: true |
|
727 |
hasVerticalScrollBar: true |
|
728 |
hasKeyboardFocusInitially: false |
|
729 |
extent: (Point 563 242) |
|
730 |
) |
|
731 |
) |
|
732 |
||
733 |
) |
|
734 |
) |
|
735 |
(CheckBoxSpec |
|
736 |
label: 'Mark as Stable' |
|
737 |
name: 'MarkStableCheckBox' |
|
738 |
layout: (LayoutFrame 3 0 -68 1 -3 1 -46 1) |
|
739 |
model: isStableHolder |
|
740 |
translateLabel: true |
|
741 |
) |
|
742 |
(LabelSpec |
|
743 |
label: 'Tag:' |
|
744 |
name: 'Label3' |
|
745 |
layout: (LayoutFrame -40 0.5 -67 1 0 0.5 -45 1) |
|
746 |
translateLabel: true |
|
747 |
adjust: right |
|
748 |
) |
|
749 |
(InputFieldSpec |
|
750 |
name: 'TagEntryField' |
|
751 |
layout: (LayoutFrame 0 0.5 -68 1 -3 1 -46 1) |
|
752 |
enableChannel: tagItInHolder |
|
753 |
model: tagHolder |
|
754 |
acceptOnReturn: true |
|
755 |
acceptOnTab: true |
|
756 |
acceptOnLostFocus: true |
|
757 |
acceptOnPointerLeave: false |
|
758 |
) |
|
759 |
(HorizontalPanelViewSpec |
|
760 |
name: 'ButtonPanel1' |
|
761 |
layout: (LayoutFrame 0 0.0 -40 1 0 1.0 0 1.0) |
|
762 |
horizontalLayout: fitSpace |
|
763 |
verticalLayout: center |
|
764 |
horizontalSpace: 3 |
|
765 |
verticalSpace: 2 |
|
766 |
reverseOrderIfOKAtLeft: true |
|
767 |
component: |
|
768 |
(SpecCollection |
|
769 |
collection: ( |
|
770 |
(ActionButtonSpec |
|
771 |
label: 'Cancel' |
|
772 |
name: 'Button2' |
|
773 |
translateLabel: true |
|
774 |
model: doCancel |
|
775 |
extent: (Point 277 22) |
|
776 |
) |
|
777 |
(ActionButtonSpec |
|
778 |
label: 'OK' |
|
779 |
name: 'Button1' |
|
780 |
translateLabel: true |
|
781 |
model: doAccept |
|
782 |
extent: (Point 277 22) |
|
783 |
) |
|
784 |
) |
|
785 |
||
786 |
) |
|
787 |
) |
|
788 |
) |
|
789 |
||
790 |
) |
|
791 |
) |
|
792 |
! ! |
|
793 |
||
794 |
!PerforceSourceCodeManagerUtilities::SubmitInfoDialog class methodsFor:'opening'! |
|
795 |
||
796 |
getCheckinInfoFor:aClassNameOrPackageNameString initialAnswer:initialAnswer withFileList:fileList |
|
797 |
|dialog warnMessage| |
|
798 |
||
799 |
warnMessage := nil. |
|
800 |
||
801 |
[ |
|
802 |
dialog := self new. |
|
803 |
dialog |
|
804 |
description:aClassNameOrPackageNameString; |
|
805 |
logMessage:initialAnswer; |
|
806 |
files:fileList. |
|
807 |
||
808 |
dialog warningMessageHolder value:warnMessage. |
|
809 |
dialog open. |
|
810 |
dialog accepted ifFalse:[ ^ nil ]. |
|
811 |
] doUntil:[ |
|
812 |
|stopAsking| |
|
813 |
||
814 |
stopAsking := dialog allowEmptyLogMessage |
|
815 |
or:[ dialog logMessage withoutSeparators notEmptyOrNil ]. |
|
816 |
stopAsking ifFalse:[ |
|
817 |
warnMessage := (self resources string:'Please enter a description of your changes!!') |
|
818 |
asText |
|
819 |
colorizeAllWith:Color red. |
|
820 |
]. |
|
821 |
stopAsking |
|
822 |
]. |
|
823 |
^ dialog |
|
824 |
||
825 |
||
826 |
" |
|
827 |
self getCheckinInfoFor:'hello' initialAnswer:'bla' |
|
828 |
" |
|
829 |
||
830 |
"Modified: / 06-07-2010 / 11:40:00 / cg" |
|
831 |
! |
|
832 |
||
833 |
getCheckinInfoFor:aClassNameOrPackageNameString initialAnswer:initialAnswer withQuickOption:withQuickOption |
|
834 |
|dialog warnMessage| |
|
835 |
||
836 |
warnMessage := nil. |
|
837 |
||
838 |
[ |
|
839 |
dialog := self new. |
|
840 |
dialog |
|
841 |
description:aClassNameOrPackageNameString; |
|
842 |
logMessage:initialAnswer; |
|
843 |
withQuickOption:withQuickOption. |
|
844 |
||
845 |
dialog warningMessageHolder value:warnMessage. |
|
846 |
dialog open. |
|
847 |
dialog accepted ifFalse:[ ^ nil ]. |
|
848 |
] doUntil:[ |
|
849 |
|stopAsking| |
|
850 |
||
851 |
stopAsking := dialog allowEmptyLogMessage |
|
852 |
or:[ dialog logMessage withoutSeparators notEmptyOrNil ]. |
|
853 |
stopAsking ifFalse:[ |
|
854 |
warnMessage := (self resources string:'Please enter a description of your changes!!') |
|
855 |
asText |
|
856 |
colorizeAllWith:Color red. |
|
857 |
]. |
|
858 |
stopAsking |
|
859 |
]. |
|
860 |
^ dialog |
|
861 |
||
862 |
||
863 |
" |
|
864 |
self getCheckinInfoFor:'hello' initialAnswer:'bla' |
|
865 |
" |
|
866 |
||
867 |
"Modified: / 06-07-2010 / 11:40:00 / cg" |
|
868 |
! ! |
|
869 |
||
870 |
!PerforceSourceCodeManagerUtilities::SubmitInfoDialog methodsFor:'accessing'! |
|
871 |
||
872 |
allowEmptyLogMessage |
|
873 |
^ allowEmptyLogMessage ? false |
|
874 |
||
875 |
"Created: / 06-07-2010 / 11:23:18 / cg" |
|
876 |
! |
|
877 |
||
878 |
allowEmptyLogMessage:aBoolean |
|
879 |
allowEmptyLogMessage := aBoolean |
|
880 |
||
881 |
"Created: / 06-07-2010 / 11:23:31 / cg" |
|
882 |
! |
|
883 |
||
884 |
description |
|
885 |
^ self descriptionHolder value |
|
886 |
! |
|
887 |
||
888 |
description:aString |
|
889 |
self descriptionHolder value:aString allBold |
|
890 |
! |
|
891 |
||
892 |
files |
|
893 |
^ self filesHolder value |
|
894 |
! |
|
895 |
||
896 |
files:aString |
|
897 |
self filesHolder value:aString |
|
898 |
! |
|
899 |
||
900 |
isStable |
|
901 |
^ self isStableHolder value |
|
902 |
! |
|
903 |
||
904 |
isStable:aBoolean |
|
905 |
self isStableHolder value:aBoolean |
|
906 |
! |
|
907 |
||
908 |
logMessage |
|
909 |
^ self logMessageHolder value |
|
910 |
! |
|
911 |
||
912 |
logMessage:aString |
|
913 |
self logMessageHolder value:aString |
|
914 |
! |
|
915 |
||
916 |
quickCheckIn |
|
917 |
^ self quickCheckInHolder value |
|
918 |
! |
|
919 |
||
920 |
quickCheckIn:aBoolean |
|
921 |
self quickCheckInHolder value:aBoolean |
|
922 |
! |
|
923 |
||
924 |
tag |
|
925 |
^ self tagHolder value withoutSeparators |
|
926 |
! |
|
927 |
||
928 |
tag:aStringOrNil |
|
929 |
self tagHolder value:aStringOrNil |
|
930 |
||
931 |
"Modified: / 12-09-2006 / 12:03:50 / cg" |
|
932 |
! |
|
933 |
||
934 |
tagIt |
|
935 |
^ self tag notEmptyOrNil |
|
936 |
||
937 |
"Created: / 12-09-2006 / 13:06:49 / cg" |
|
938 |
! |
|
939 |
||
940 |
withQuickOption:aBoolean |
|
941 |
^ self quickCheckInVisibleHolder value:aBoolean |
|
942 |
! ! |
|
943 |
||
944 |
!PerforceSourceCodeManagerUtilities::SubmitInfoDialog methodsFor:'aspects'! |
|
945 |
||
946 |
descriptionHolder |
|
947 |
descriptionHolder isNil ifTrue:[ |
|
948 |
descriptionHolder := ValueHolder new. |
|
949 |
]. |
|
950 |
^ descriptionHolder |
|
951 |
! |
|
952 |
||
953 |
filesHolder |
|
954 |
<resource: #uiAspect> |
|
955 |
||
956 |
"automatically generated by UIPainter ..." |
|
957 |
||
958 |
"*** the code below creates a default model when invoked." |
|
959 |
"*** (which may not be the one you wanted)" |
|
960 |
"*** Please change as required and accept it in the browser." |
|
961 |
"*** (and replace this comment by something more useful ;-)" |
|
962 |
||
963 |
filesHolder isNil ifTrue:[ |
|
964 |
filesHolder := '' asValue. |
|
965 |
"/ if your app needs to be notified of changes, uncomment one of the lines below: |
|
966 |
"/ filesHolder addDependent:self. |
|
967 |
"/ filesHolder onChangeSend:#filesHolderChanged to:self. |
|
968 |
]. |
|
969 |
^ filesHolder. |
|
970 |
! |
|
971 |
||
972 |
isStableHolder |
|
973 |
isStableHolder isNil ifTrue:[ |
|
974 |
isStableHolder := false asValue. |
|
975 |
]. |
|
976 |
^ isStableHolder. |
|
977 |
||
978 |
"Modified: / 16-01-2007 / 16:00:26 / cg" |
|
979 |
! |
|
980 |
||
981 |
logMessageHolder |
|
982 |
logMessageHolder isNil ifTrue:[ |
|
983 |
logMessageHolder := LastSourceLogMessage asValue. |
|
984 |
]. |
|
985 |
^ logMessageHolder. |
|
986 |
! |
|
987 |
||
988 |
quickCheckInHolder |
|
989 |
quickCheckInHolder isNil ifTrue:[ |
|
990 |
quickCheckInHolder := true asValue. |
|
991 |
]. |
|
992 |
^ quickCheckInHolder |
|
993 |
! |
|
994 |
||
995 |
quickCheckInVisibleHolder |
|
996 |
quickCheckInVisibleHolder isNil ifTrue:[ |
|
997 |
quickCheckInVisibleHolder := false asValue. |
|
998 |
]. |
|
999 |
^ quickCheckInVisibleHolder |
|
1000 |
! |
|
1001 |
||
1002 |
tagHolder |
|
1003 |
tagHolder isNil ifTrue:[ |
|
1004 |
tagHolder := '' asValue. |
|
1005 |
]. |
|
1006 |
^ tagHolder |
|
1007 |
! |
|
1008 |
||
1009 |
tagItInHolder |
|
1010 |
<resource: #uiAspect> |
|
1011 |
||
1012 |
"automatically generated by UIPainter ..." |
|
1013 |
||
1014 |
"*** the code below creates a default model when invoked." |
|
1015 |
"*** (which may not be the one you wanted)" |
|
1016 |
"*** Please change as required and accept it in the browser." |
|
1017 |
"*** (and replace this comment by something more useful ;-)" |
|
1018 |
||
1019 |
tagItInHolder isNil ifTrue:[ |
|
1020 |
tagItInHolder := true asValue. |
|
1021 |
"/ if your app needs to be notified of changes, uncomment one of the lines below: |
|
1022 |
"/ tagItInHolder addDependent:self. |
|
1023 |
"/ tagItInHolder onChangeSend:#tagItInHolderChanged to:self. |
|
1024 |
]. |
|
1025 |
^ tagItInHolder. |
|
1026 |
! |
|
1027 |
||
1028 |
warningMessageHolder |
|
1029 |
warningMessageHolder isNil ifTrue:[ |
|
1030 |
warningMessageHolder := nil asValue. |
|
1031 |
]. |
|
1032 |
^ warningMessageHolder. |
|
1033 |
||
1034 |
"Created: / 06-07-2010 / 11:30:29 / cg" |
|
1035 |
! ! |
|
1036 |
||
1037 |
!PerforceSourceCodeManagerUtilities::WorkSpace class methodsFor:'instance creation'! |
|
1038 |
||
1039 |
newWorkSpaceFor:aSettingsString |
|
1040 |
" |
|
1041 |
get the workspace definition from perforce client command output |
|
1042 |
" |
|
1043 |
||
1044 |
|workSpace| |
|
1045 |
||
1046 |
aSettingsString isEmptyOrNil ifTrue:[ ^nil]. |
|
1047 |
workSpace := self new initialize. |
|
1048 |
^ workSpace newWorkSpaceFor:aSettingsString |
|
1049 |
! |
|
1050 |
||
1051 |
newWorkSpaceForSettings:settingsDict |
|
1052 |
" |
|
1053 |
get the workspace definition from perforce client command output" |
|
1054 |
||
1055 |
|workSpace| |
|
1056 |
||
1057 |
workSpace := self new initialize. |
|
1058 |
^ workSpace newWorkSpaceForSettings:settingsDict |
|
1059 |
! ! |
|
1060 |
||
1061 |
!PerforceSourceCodeManagerUtilities::WorkSpace methodsFor:'accessing'! |
|
1062 |
||
1063 |
client |
|
1064 |
^ client |
|
1065 |
! |
|
1066 |
||
1067 |
client:something |
|
1068 |
client := something. |
|
1069 |
! |
|
1070 |
||
1071 |
host |
|
1072 |
^ host |
|
1073 |
! |
|
1074 |
||
1075 |
host:something |
|
1076 |
host := something. |
|
1077 |
! |
|
1078 |
||
1079 |
owner |
|
1080 |
^ owner |
|
1081 |
! |
|
1082 |
||
1083 |
owner:something |
|
1084 |
owner := something. |
|
1085 |
! |
|
1086 |
||
1087 |
perforceSettings |
|
1088 |
||
1089 |
perforceSettings isNil ifTrue:[ |
|
1090 |
perforceSettings := Dictionary new. |
|
1091 |
]. |
|
1092 |
^ perforceSettings |
|
1093 |
! |
|
1094 |
||
1095 |
perforceSettings:something |
|
1096 |
perforceSettings := something. |
|
1097 |
self owner:(perforceSettings at:#user ifAbsent:nil). |
|
1098 |
self client:(perforceSettings at:#client ifAbsent:nil). |
|
1099 |
! |
|
1100 |
||
1101 |
root |
|
1102 |
^ root |
|
1103 |
! |
|
1104 |
||
1105 |
root:something |
|
1106 |
root := something. |
|
1107 |
! |
|
1108 |
||
1109 |
tempDirectory |
|
1110 |
||
1111 |
tempDirectory isNil ifTrue:[ |
|
1112 |
tempDirectory := PerforceSourceCodeManager createTempDirectory:nil forModule:nil. |
|
1113 |
]. |
|
1114 |
^ tempDirectory |
|
1115 |
! |
|
1116 |
||
1117 |
temporaryWorkSpace |
|
1118 |
^ temporaryWorkSpace |
|
1119 |
! |
|
1120 |
||
1121 |
views |
|
1122 |
views isNil ifTrue:[ |
|
1123 |
views := OrderedCollection new. |
|
1124 |
]. |
|
1125 |
^ views |
|
1126 |
! ! |
|
1127 |
||
1128 |
!PerforceSourceCodeManagerUtilities::WorkSpace methodsFor:'actions'! |
|
1129 |
||
1130 |
addCheckIn:checkInDefinition submit:doSubmit |
|
1131 |
||
1132 |
| packagePath fullFilename s perforceCommand outputStream errorStream result tmpFilename binRevision newRevisionString number| |
|
1133 |
||
1134 |
" create container for class initial check in" |
|
1135 |
checkInDefinition isClassCheckin ifTrue:[ |
|
1136 |
binRevision := checkInDefinition getBinaryRevisionNumber. |
|
1137 |
(binRevision notNil and:[binRevision ~= 0]) ifTrue:[ |
|
1138 |
(Dialog confirm:('Someone seems to have removed the source container for ',checkInDefinition definitionObjectString,'\\Force new checkin ?') withCRs) ifTrue:[ |
|
1139 |
checkInDefinition definitionClass setBinaryRevision:nil. |
|
1140 |
] ifFalse:[ |
|
1141 |
^false |
|
1142 |
]. |
|
1143 |
]. |
|
1144 |
]. |
|
1145 |
"initial checkin here" |
|
1146 |
self activityNotification:'adding ' , checkInDefinition definitionObjectString , ' to perforce repository...'. |
|
1147 |
self getTemporaryWorkspaceFor:checkInDefinition. |
|
1148 |
self temporaryWorkSpace isNil ifTrue:[ |
|
1149 |
self perforceError raiseErrorString:('Error getting temporary workspace when adding ', checkInDefinition definitionObjectString, '.'). |
|
1150 |
^false |
|
1151 |
]. |
|
1152 |
number := self getChangeListNumber. |
|
1153 |
number isNil ifTrue:[ |
|
1154 |
self perforceError raiseErrorString:('Error when getting a change list for ', checkInDefinition definitionObjectString, '.'). |
|
1155 |
^false |
|
1156 |
]. |
|
1157 |
packagePath := Smalltalk packageDirectoryForPackageId:checkInDefinition package. |
|
1158 |
fullFilename := (packagePath construct:checkInDefinition packageDir) construct:checkInDefinition fileName. |
|
1159 |
tmpFilename := self getTemporaryFilenameFor:fullFilename pathName. |
|
1160 |
tmpFilename directory recursiveMakeDirectory. |
|
1161 |
s := tmpFilename writeStream. |
|
1162 |
checkInDefinition isClassCheckin ifTrue:[ |
|
1163 |
newRevisionString := self initialRevisionStringFor:checkInDefinition. |
|
1164 |
PerforceSourceCodeManager updateVersionMethod:(PerforceSourceCodeManager nameOfVersionMethodInClasses) |
|
1165 |
of:checkInDefinition definitionClass |
|
1166 |
for:newRevisionString. |
|
1167 |
]. |
|
1168 |
checkInDefinition isClassCheckin ifTrue:[ |
|
1169 |
PerforceSourceCodeManager fileOutSourceCodeOf:checkInDefinition definitionClass on:s. |
|
1170 |
] ifFalse:[ |
|
1171 |
s nextPutAll:checkInDefinition fileContents. |
|
1172 |
]. |
|
1173 |
s close. |
|
1174 |
perforceCommand := ('add -t +ko -c ' , number printString, ' "', tmpFilename pathName, '"'). |
|
1175 |
outputStream := ReadWriteStream on:''. |
|
1176 |
errorStream := ReadWriteStream on:''. |
|
1177 |
result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
|
1178 |
inputFrom:nil outputTo:outputStream |
|
1179 |
errorTo:errorStream |
|
1180 |
logHeader:('adding ', checkInDefinition definitionObjectString, '.'). |
|
1181 |
result ifFalse:[ |
|
1182 |
checkInDefinition isClassCheckin ifTrue:[ |
|
1183 |
Class withoutUpdatingChangesDo:[ |
|
1184 |
checkInDefinition definitionClass class removeSelector:PerforceSourceCodeManager nameOfVersionMethodInClasses |
|
1185 |
]. |
|
1186 |
]. |
|
1187 |
^ false |
|
1188 |
]. |
|
1189 |
result := self changeChangeDescriptionTo:checkInDefinition logMessage asStringCollection changeNumber:number printString. |
|
1190 |
doSubmit ifTrue:[ |
|
1191 |
result := self submitChangeNumber:number printString. |
|
1192 |
checkInDefinition isClassCheckin ifFalse:[ |
|
1193 |
" checkout in real workspace " |
|
1194 |
perforceCommand := ('sync ' , number printString, ' "', fullFilename pathName, '"'). |
|
1195 |
outputStream := ReadWriteStream on:''. |
|
1196 |
errorStream := ReadWriteStream on:''. |
|
1197 |
result := self executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
|
1198 |
inputFrom:nil outputTo:outputStream |
|
1199 |
errorTo:errorStream |
|
1200 |
logHeader:('sync in my workspace ', checkInDefinition definitionObjectString, '.'). |
|
1201 |
result ifFalse:[ |
|
1202 |
^ false |
|
1203 |
]. |
|
1204 |
]. |
|
1205 |
]. |
|
1206 |
||
1207 |
self activityNotification:''. |
|
1208 |
^result |
|
1209 |
! |
|
1210 |
||
1211 |
askForMergedSource:mergedSource |
|
1212 |
localSource:mySource |
|
1213 |
changesDict:changesDict |
|
1214 |
haveRevision:haveRevision |
|
1215 |
changesAsLogged:changesAsLogged |
|
1216 |
pathName:pathName |
|
1217 |
definitionClass:definitionClass |
|
1218 |
||
1219 |
|msg answer checkInRepaired emphasizedText emSep diffTextComment didAccept editor repairedText resultSource| |
|
1220 |
||
1221 |
(changesDict notNil and:[(changesDict at:#conflicting) > 0]) ifTrue:[ |
|
1222 |
"ooops must resolve conflicts" |
|
1223 |
msg := self messageForConflictsInClass:definitionClass revision:haveRevision. |
|
1224 |
answer := self checkinTroubleDialog:'Version conflict' |
|
1225 |
message:msg |
|
1226 |
log:changesAsLogged |
|
1227 |
abortable:false |
|
1228 |
option:'show conflicts' |
|
1229 |
option2:'resolve conflicts'. |
|
1230 |
||
1231 |
answer == #option ifTrue:[ |
|
1232 |
"/ |
|
1233 |
"/ show conflicts in a 3-way DiffTextView ... |
|
1234 |
"/ |
|
1235 |
Diff3TextView |
|
1236 |
openOnMergedText:mergedSource |
|
1237 |
label:'your version (checkin attempt)' |
|
1238 |
label:'original (base version)' |
|
1239 |
label:'newest repository version'. |
|
1240 |
]. |
|
1241 |
||
1242 |
checkInRepaired := false. |
|
1243 |
answer == #option2 ifTrue:[ |
|
1244 |
"/ |
|
1245 |
"/ allow checkin of repair version |
|
1246 |
"/ this is error prone ... |
|
1247 |
"/ |
|
1248 |
"/ |
|
1249 |
"/ show merged version in an editor ... |
|
1250 |
"/ ... accept will check it in. |
|
1251 |
"/ |
|
1252 |
emphasizedText := mergedSource asStringCollection. |
|
1253 |
emSep := (Array with:(#color->Color black) with:(#backgroundColor->Color green)). |
|
1254 |
emphasizedText := Diff3TextView |
|
1255 |
emphasizeMergedDiff3TextFromPerforce:emphasizedText |
|
1256 |
origEmphasis:(Array with:(#color->Color black) with:(#backgroundColor->Color yellow)) |
|
1257 |
otherEmphasis:(Array with:(#color->Color white) with:(#backgroundColor->Color red)) |
|
1258 |
yourEmphasis:(Array with:(#color->Color white) with:(#backgroundColor->Color red)) |
|
1259 |
separatorEmphasis:emSep. |
|
1260 |
||
1261 |
diffTextComment := self diffTextComment. |
|
1262 |
diffTextComment := (Text string:diffTextComment emphasis:emSep) asStringCollection. |
|
1263 |
emphasizedText := diffTextComment , emphasizedText. |
|
1264 |
||
1265 |
didAccept := false. checkInRepaired := true. |
|
1266 |
[didAccept not and:[checkInRepaired]] whileTrue:[ |
|
1267 |
editor := RCSConflictEditTextView |
|
1268 |
setupWith:emphasizedText |
|
1269 |
title:'Resolve conflicts in ' , pathName asFilename baseName , ', then accept & close to checkin'. |
|
1270 |
||
1271 |
editor acceptAction:[:dummy | |
|
1272 |
repairedText := editor list. |
|
1273 |
didAccept := true. |
|
1274 |
]. |
|
1275 |
didAccept := false. |
|
1276 |
editor topView openModal. |
|
1277 |
||
1278 |
didAccept ifFalse:[ |
|
1279 |
(Dialog confirm:'You did not accept the new text. Edit again ?') |
|
1280 |
ifFalse:[ |
|
1281 |
checkInRepaired := false. |
|
1282 |
] |
|
1283 |
] ifTrue:[ |
|
1284 |
"/ check if all green-stuff (separators) have been removed |
|
1285 |
(repairedText findFirst:[:line | line notNil and:[line notEmpty and:[(line emphasisAt:1) = emSep]]]) ~~ 0 ifTrue:[ |
|
1286 |
self warn:'You have to look at ALL conflicts, and remove ALL green lines as a confirmation !!'. |
|
1287 |
didAccept := false. |
|
1288 |
] |
|
1289 |
]. |
|
1290 |
]. |
|
1291 |
resultSource := repairedText asString string. |
|
1292 |
]. |
|
1293 |
||
1294 |
checkInRepaired ifTrue:[ |
|
1295 |
Transcript showCR:'checking in ' , pathName asFilename baseName , ' (manually repaired version) ...' |
|
1296 |
] ifFalse:[ |
|
1297 |
'PerforceSourceCodeManager [warning]: cannot (for now) checkin; conflicts found' infoPrintCR. |
|
1298 |
Transcript showCR:'checkin of ' , pathName asFilename baseName , ' aborted (conflicting changes; repository unchanged)'. |
|
1299 |
^ nil. |
|
1300 |
] |
|
1301 |
] ifFalse:[ |
|
1302 |
mySource = mergedSource ifTrue:[ |
|
1303 |
msg := self messageForNoChangesInClass:definitionClass. |
|
1304 |
self checkinTroubleDialog:'Merging versions' |
|
1305 |
message:msg |
|
1306 |
log:changesAsLogged |
|
1307 |
abortable:false |
|
1308 |
option:nil. |
|
1309 |
] ifFalse:[ |
|
1310 |
msg := self messageForChangesInClass:definitionClass revision:haveRevision. |
|
1311 |
answer := self checkinTroubleDialog:'Merging versions' |
|
1312 |
message:msg |
|
1313 |
log:changesAsLogged |
|
1314 |
abortable:true |
|
1315 |
option:'Stop - see first'. |
|
1316 |
answer ~~ true ifTrue:[ |
|
1317 |
answer == #option ifTrue:[ |
|
1318 |
DiffCodeView |
|
1319 |
openOn:mySource |
|
1320 |
label:'current version' |
|
1321 |
and:mergedSource |
|
1322 |
label:'merged version'. |
|
1323 |
||
1324 |
]. |
|
1325 |
Transcript showCR:'checkin aborted - (no merge; repository unchanged)'. |
|
1326 |
^ nil. |
|
1327 |
]. |
|
1328 |
resultSource := mergedSource. |
|
1329 |
]. |
|
1330 |
]. |
|
1331 |
^ resultSource |
|
1332 |
||
1333 |
"Modified (format): / 01-06-2012 / 10:45:09 / cg" |
|
1334 |
! |
|
1335 |
||
1336 |
changeChangeDescriptionTo:logLines changeNumber:changeNumber |
|
1337 |
||
1338 |
|perforceCommand outputStream errorStream changeListFile result changeFileContents changeListFileStream firstIndex oldLogFileLines writeNextLine newLogFileLines currentTokenLineParts currentToken| |
|
1339 |
||
1340 |
perforceCommand := 'change -o ', (changeNumber ? ''). |
|
1341 |
outputStream := ReadWriteStream on:''. |
|
1342 |
errorStream := ReadWriteStream on:''. |
|
1343 |
result := self temporaryWorkSpace executePerforceCommand:perforceCommand |
|
1344 |
inDirectory:self tempDirectory |
|
1345 |
inputFrom:nil |
|
1346 |
outputTo:outputStream |
|
1347 |
errorTo:errorStream |
|
1348 |
logHeader:('get change desription for change ', changeNumber printString, '.'). |
|
1349 |
result ifFalse:[ |
|
1350 |
^ false |
|
1351 |
]. |
|
1352 |
changeFileContents := outputStream contents. |
|
1353 |
changeFileContents isEmptyOrNil ifTrue:[ |
|
1354 |
^false |
|
1355 |
]. |
|
1356 |
changeListFile := self tempDirectory construct:'change'. |
|
1357 |
changeListFileStream := changeListFile writeStream. |
|
1358 |
changeFileContents := changeFileContents asStringCollection. |
|
1359 |
firstIndex := changeFileContents indexOfLineStartingWith:'Description:'. |
|
1360 |
firstIndex == 0 ifTrue:[ |
|
1361 |
^false |
|
1362 |
]. |
|
1363 |
oldLogFileLines := StringCollection new. |
|
1364 |
changeFileContents from:firstIndex do:[:aLine| |
|
1365 |
((aLine size > 1) and:[aLine first ~= $# and:[aLine first isSeparator not]]) ifTrue:[ |
|
1366 |
currentTokenLineParts := aLine asCollectionOfSubstringsSeparatedBy:$:. |
|
1367 |
currentTokenLineParts size > 1 ifTrue:[ |
|
1368 |
currentToken := currentTokenLineParts first. |
|
1369 |
]. |
|
1370 |
]. |
|
1371 |
((aLine size > 1) and:[aLine first isSeparator and:[currentToken = 'Description']]) ifTrue:[ |
|
1372 |
oldLogFileLines add:(aLine copyFrom:2). |
|
1373 |
]. |
|
1374 |
]. |
|
1375 |
newLogFileLines := StringCollection new. |
|
1376 |
changeNumber isNil ifTrue:[ |
|
1377 |
newLogFileLines := logLines. |
|
1378 |
] ifFalse:[ |
|
1379 |
(oldLogFileLines asString includesString:logLines asString) ifTrue:[ |
|
1380 |
newLogFileLines := oldLogFileLines. |
|
1381 |
] ifFalse:[ |
|
1382 |
newLogFileLines := oldLogFileLines. |
|
1383 |
newLogFileLines addAll:logLines |
|
1384 |
]. |
|
1385 |
]. |
|
1386 |
writeNextLine := true. |
|
1387 |
changeFileContents do:[:aLine| |
|
1388 |
writeNextLine ifFalse:[ |
|
1389 |
(aLine notEmpty and:[aLine first isSeparator not]) ifTrue:[ |
|
1390 |
writeNextLine := true. |
|
1391 |
]. |
|
1392 |
]. |
|
1393 |
writeNextLine ifTrue:[ |
|
1394 |
(aLine startsWith:'Description:') ifTrue:[ |
|
1395 |
changeListFileStream nextPutLine:aLine. |
|
1396 |
newLogFileLines do:[:logLine| |
|
1397 |
changeListFileStream nextPut:Character tab. |
|
1398 |
changeListFileStream nextPutLine:logLine. |
|
1399 |
]. |
|
1400 |
writeNextLine := false. |
|
1401 |
] ifFalse:[ |
|
1402 |
changeListFileStream nextPutLine:aLine |
|
1403 |
]. |
|
1404 |
]. |
|
1405 |
]. |
|
1406 |
changeListFileStream close. |
|
1407 |
perforceCommand := ('change -i < "', changeListFile pathName, '"'). |
|
1408 |
outputStream := ReadWriteStream on:''. |
|
1409 |
errorStream := ReadWriteStream on:''. |
|
1410 |
result := self temporaryWorkSpace executePerforceCommand:perforceCommand |
|
1411 |
inDirectory:self tempDirectory |
|
1412 |
inputFrom:nil |
|
1413 |
outputTo:outputStream |
|
1414 |
errorTo:errorStream |
|
1415 |
logHeader:('write change desription for change ', changeNumber printString, '.'). |
|
1416 |
result ifFalse:[ |
|
1417 |
^false |
|
1418 |
]. |
|
1419 |
^ true |
|
1420 |
! |
|
1421 |
||
1422 |
checkForExistingContainer:checkInDefinition |
|
1423 |
||
1424 |
||
1425 |
|perforceCommand outputStream errorStream result packagePath fullFilename depotPath| |
|
1426 |
||
1427 |
packagePath := Smalltalk packageDirectoryForPackageId:checkInDefinition package. |
|
1428 |
fullFilename := packagePath construct:checkInDefinition packageDir. |
|
1429 |
depotPath := self getDepotPathForLocalPath:fullFilename pathName. |
|
1430 |
perforceCommand := ('dirs "' ,depotPath , '"'). |
|
1431 |
outputStream := ReadWriteStream on:''. |
|
1432 |
errorStream := ReadWriteStream on:''. |
|
1433 |
result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
|
1434 |
inputFrom:nil outputTo:outputStream |
|
1435 |
errorTo:errorStream |
|
1436 |
logHeader:('dirs in checkForExistingContainer for ', depotPath, '.'). |
|
1437 |
result ifFalse:[ |
|
1438 |
^ false |
|
1439 |
]. |
|
1440 |
errorStream contents notEmpty ifTrue:[ |
|
1441 |
^false |
|
1442 |
]. |
|
1443 |
^ true |
|
1444 |
! |
|
1445 |
||
1446 |
checkIn:checkInDefinition submit:doSubmit |
|
1447 |
||
1448 |
| packagePath fullFilename s perforceCommand outputStream errorStream result tmpFilename fileNameAndRev tmpFilenameAndRev |
|
1449 |
haveChange nextVersionMethod diffOutput number baseRevision cls newestInRepository newVersionString openChangeNumber| |
|
1450 |
||
1451 |
self activityNotification:'checkin ' , checkInDefinition definitionObjectString , ' to perforce repository...'. |
|
1452 |
[ |
|
1453 |
cls := checkInDefinition definitionClass. |
|
1454 |
self getTemporaryWorkspaceFor:checkInDefinition. |
|
1455 |
self temporaryWorkSpace isNil ifTrue:[ |
|
1456 |
self perforceError raiseErrorString:('Error getting temporary workspace when check in ', checkInDefinition definitionObjectString, '.'). |
|
1457 |
^false. |
|
1458 |
]. |
|
1459 |
baseRevision := checkInDefinition getLocalRevisionNumber. |
|
1460 |
newestInRepository := checkInDefinition getReposRevisionNumberBeforeCheckin. |
|
1461 |
baseRevision isNil ifTrue:[ |
|
1462 |
self perforceError raiseErrorString:('No local revision for ', checkInDefinition definitionObjectString,' - should not happen here.'). |
|
1463 |
^false |
|
1464 |
]. |
|
1465 |
packagePath := Smalltalk packageDirectoryForPackageId:checkInDefinition package. |
|
1466 |
fullFilename := (packagePath construct:checkInDefinition packageDir) construct:checkInDefinition fileName. |
|
1467 |
tmpFilename := self getTemporaryFilenameFor:fullFilename pathName. |
|
1468 |
tmpFilename directory recursiveMakeDirectory. |
|
1469 |
checkInDefinition isClassCheckin ifTrue:[ |
|
1470 |
baseRevision > newestInRepository ifTrue:[ |
|
1471 |
openChangeNumber := self getOpenChangeFor:checkInDefinition. |
|
1472 |
openChangeNumber isNil ifTrue:[ |
|
1473 |
(Dialog confirm:('The version-info of ',checkInDefinition definitionObjectString allBold,' is wrong \(The class version (',baseRevision printString allBold,') is newer than the newest version in the repository (',newestInRepository printString allBold,').\\Patch the version and checkin ?') withCRs) |
|
1474 |
ifTrue:[ |
|
1475 |
newVersionString := self updatedRevisionStringOf:cls |
|
1476 |
forRevision:newestInRepository printString with:(cls revisionStringOfManager:self). |
|
1477 |
PerforceSourceCodeManager updateVersionMethod:(PerforceSourceCodeManager nameOfVersionMethodInClasses) |
|
1478 |
of:cls |
|
1479 |
for:newVersionString. |
|
1480 |
||
1481 |
cls updateVersionMethodFor:newVersionString. |
|
1482 |
]. |
|
1483 |
]. |
|
1484 |
]. |
|
1485 |
]. |
|
1486 |
fileNameAndRev := checkInDefinition fileName, '#', baseRevision printString. |
|
1487 |
tmpFilenameAndRev := tmpFilename directory construct:fileNameAndRev. |
|
1488 |
||
1489 |
openChangeNumber notNil ifTrue:[ |
|
1490 |
s := tmpFilename writeStream. |
|
1491 |
checkInDefinition isClassCheckin ifTrue:[ |
|
1492 |
PerforceSourceCodeManager fileOutSourceCodeOf:cls on:s. |
|
1493 |
] ifFalse:[ |
|
1494 |
self halt. |
|
1495 |
s nextPutAll:''. |
|
1496 |
]. |
|
1497 |
s close. |
|
1498 |
self changeChangeDescriptionTo:checkInDefinition logMessage asStringCollection changeNumber:openChangeNumber printString. |
|
1499 |
doSubmit ifTrue:[ |
|
1500 |
self submitChangeNumber:openChangeNumber printString |
|
1501 |
]. |
|
1502 |
^true |
|
1503 |
]. |
|
1504 |
||
1505 |
perforceCommand := ('sync "' , tmpFilenameAndRev pathName, '"'). |
|
1506 |
outputStream := ReadWriteStream on:''. |
|
1507 |
errorStream := ReadWriteStream on:''. |
|
1508 |
result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
|
1509 |
inputFrom:nil outputTo:outputStream |
|
1510 |
errorTo:errorStream |
|
1511 |
logHeader:('sync ', checkInDefinition definitionObjectString, ' to revision ', baseRevision printString, '.'). |
|
1512 |
result ifFalse:[ |
|
1513 |
^ false |
|
1514 |
]. |
|
1515 |
||
1516 |
number := self getChangeListNumber. |
|
1517 |
number isNil ifTrue:[ |
|
1518 |
self perforceError raiseErrorString:('Error when getting a change list for ', checkInDefinition definitionObjectString, '.'). |
|
1519 |
^false |
|
1520 |
]. |
|
1521 |
perforceCommand := ('edit -c ' ,number printString, ' "', tmpFilename pathName, '"'). |
|
1522 |
outputStream := ReadWriteStream on:''. |
|
1523 |
errorStream := ReadWriteStream on:''. |
|
1524 |
result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
|
1525 |
inputFrom:nil outputTo:outputStream |
|
1526 |
errorTo:errorStream |
|
1527 |
logHeader:('edit ', checkInDefinition definitionObjectString, '.'). |
|
1528 |
result ifFalse:[ |
|
1529 |
^ false |
|
1530 |
]. |
|
1531 |
s := tmpFilename writeStream. |
|
1532 |
checkInDefinition isClassCheckin ifTrue:[ |
|
1533 |
PerforceSourceCodeManager fileOutSourceCodeOf:cls on:s. |
|
1534 |
] ifFalse:[ |
|
1535 |
self halt. |
|
1536 |
s nextPutAll:''. |
|
1537 |
]. |
|
1538 |
s close. |
|
1539 |
perforceCommand := ('diff -db -dw -dl "' , tmpFilename pathName, '"'). |
|
1540 |
outputStream := ReadWriteStream on:''. |
|
1541 |
errorStream := ReadWriteStream on:''. |
|
1542 |
result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
|
1543 |
inputFrom:nil outputTo:outputStream |
|
1544 |
errorTo:errorStream |
|
1545 |
logHeader:('diff ', checkInDefinition definitionObjectString, '.'). |
|
1546 |
diffOutput := outputStream contents asStringCollection. |
|
1547 |
haveChange := diffOutput isEmptyOrNil or:[diffOutput notEmptyOrNil and:[diffOutput size > 1]]. |
|
1548 |
haveChange ifFalse:[ |
|
1549 |
self information:checkInDefinition definitionObjectString, ' not changed for revision ', baseRevision printString. |
|
1550 |
perforceCommand := ('revert "' , tmpFilename pathName, '"'). |
|
1551 |
outputStream := ReadWriteStream on:''. |
|
1552 |
errorStream := ReadWriteStream on:''. |
|
1553 |
result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
|
1554 |
inputFrom:nil outputTo:outputStream |
|
1555 |
errorTo:errorStream |
|
1556 |
logHeader:('revert ', checkInDefinition definitionObjectString, '.'). |
|
1557 |
^true |
|
1558 |
]. |
|
1559 |
checkInDefinition isClassCheckin ifTrue:[ |
|
1560 |
nextVersionMethod := self nextRevisionStringFor:checkInDefinition. |
|
1561 |
nextVersionMethod isNil ifTrue:[ |
|
1562 |
self perforceError raiseErrorString:('Cant get next version method string for ', checkInDefinition definitionObjectString, ' revision ', baseRevision printString, '.'). |
|
1563 |
^false |
|
1564 |
]. |
|
1565 |
PerforceSourceCodeManager updateVersionMethod:(PerforceSourceCodeManager nameOfVersionMethodInClasses) |
|
1566 |
of:cls |
|
1567 |
for:nextVersionMethod. |
|
1568 |
]. |
|
1569 |
result := self changeChangeDescriptionTo:checkInDefinition logMessage asStringCollection changeNumber:number printString. |
|
1570 |
doSubmit ifTrue:[ |
|
1571 |
result := self submitChangeNumber:number printString |
|
1572 |
]. |
|
1573 |
] ensure:[ |
|
1574 |
self activityNotification:''. |
|
1575 |
]. |
|
1576 |
^result |
|
1577 |
! |
|
1578 |
||
1579 |
createChange |
|
1580 |
||
1581 |
^self changeChangeDescriptionTo:('' asStringCollection) changeNumber:nil |
|
1582 |
! |
|
1583 |
||
1584 |
createWorkSpaceClientSpecFor:checkInDefinition |
|
1585 |
||
1586 |
|ws myView| |
|
1587 |
||
1588 |
ws := WriteStream on:''. |
|
1589 |
ws nextPutAll:'Client: '. |
|
1590 |
ws nextPutAll:(self client). |
|
1591 |
ws cr. |
|
1592 |
ws nextPutAll:'Owner: '. |
|
1593 |
ws nextPutAll:(self owner). |
|
1594 |
ws cr. |
|
1595 |
ws nextPutAll:'Host: '. |
|
1596 |
ws nextPutAll:(self host). |
|
1597 |
ws cr. |
|
1598 |
ws nextPutAll:'Description: '. |
|
1599 |
ws nextPutAll:'Used temporary for Smalltalk/X'. |
|
1600 |
ws cr. |
|
1601 |
ws nextPutAll:'Root: '. |
|
1602 |
ws nextPutAll:(self root asFilename pathName). |
|
1603 |
ws cr. |
|
1604 |
ws nextPutAll:'Options: '. |
|
1605 |
ws nextPutAll:'allwrite noclobber nocompress unlocked nomodtime normdir'. |
|
1606 |
ws cr. |
|
1607 |
ws nextPutAll:'SubmitOptions: '. |
|
1608 |
ws nextPutAll:'submitunchanged'. |
|
1609 |
ws cr. |
|
1610 |
ws nextPutAll:'LineEnd: '. |
|
1611 |
ws nextPutAll:'local'. |
|
1612 |
ws cr. |
|
1613 |
ws nextPutAll:'View: '. |
|
1614 |
myView := checkInDefinition workSpace getViewForPackage:checkInDefinition package. |
|
1615 |
ws nextPutAll:myView depot. |
|
1616 |
ws space. |
|
1617 |
ws nextPutAll:'//', self client, '/...'. |
|
1618 |
ws cr. |
|
1619 |
ws close. |
|
1620 |
^ws contents |
|
1621 |
! |
|
1622 |
||
1623 |
delete:checkInDefinition submit:doSubmit |
|
1624 |
||
1625 |
| packagePath fullFilename perforceCommand outputStream errorStream result tmpFilename number newestInRepository| |
|
1626 |
||
1627 |
self activityNotification:'delete ' , checkInDefinition definitionObjectString , ' from perforce repository...'. |
|
1628 |
[ |
|
1629 |
newestInRepository := checkInDefinition getReposRevisionNumberBeforeCheckin. |
|
1630 |
newestInRepository isNil ifTrue:[ |
|
1631 |
self information:(checkInDefinition definitionObjectString, ' not exists in repository.'). |
|
1632 |
^true |
|
1633 |
]. |
|
1634 |
self getTemporaryWorkspaceFor:checkInDefinition. |
|
1635 |
self temporaryWorkSpace isNil ifTrue:[ |
|
1636 |
self perforceError raiseErrorString:('Error getting temporary workspace when check in ', checkInDefinition definitionObjectString, '.'). |
|
1637 |
^false. |
|
1638 |
]. |
|
1639 |
packagePath := Smalltalk packageDirectoryForPackageId:checkInDefinition package. |
|
1640 |
fullFilename := (packagePath construct:checkInDefinition packageDir) construct:checkInDefinition fileName. |
|
1641 |
tmpFilename := self getTemporaryFilenameFor:fullFilename pathName. |
|
1642 |
tmpFilename directory recursiveMakeDirectory. |
|
1643 |
||
1644 |
number := self getChangeListNumber. |
|
1645 |
number isNil ifTrue:[ |
|
1646 |
self perforceError raiseErrorString:('Error when getting a change list for ', checkInDefinition definitionObjectString, '.'). |
|
1647 |
^false |
|
1648 |
]. |
|
1649 |
perforceCommand := ('delete -c ' ,number printString, ' "', tmpFilename pathName, '"'). |
|
1650 |
outputStream := ReadWriteStream on:''. |
|
1651 |
errorStream := ReadWriteStream on:''. |
|
1652 |
result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
|
1653 |
inputFrom:nil outputTo:outputStream |
|
1654 |
errorTo:errorStream |
|
1655 |
logHeader:('Error delete ', checkInDefinition definitionObjectString, '.'). |
|
1656 |
result ifFalse:[ |
|
1657 |
^ false |
|
1658 |
]. |
|
1659 |
result := self changeChangeDescriptionTo:checkInDefinition logMessage asStringCollection changeNumber:number printString. |
|
1660 |
doSubmit ifTrue:[ |
|
1661 |
result := self submitChangeNumber:number printString |
|
1662 |
]. |
|
1663 |
] ensure:[ |
|
1664 |
self activityNotification:''. |
|
1665 |
]. |
|
1666 |
^result |
|
1667 |
! |
|
1668 |
||
1669 |
deleteWorkSpaceFromServer |
|
1670 |
||
1671 |
|perforceCommand outputStream errorStream result| |
|
1672 |
||
1673 |
perforceCommand := ('client -df ', client). |
|
1674 |
outputStream := ReadWriteStream on:''. |
|
1675 |
errorStream := ReadWriteStream on:''. |
|
1676 |
result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
|
1677 |
inputFrom:nil outputTo:outputStream |
|
1678 |
errorTo:errorStream |
|
1679 |
logHeader:('delete client ', client). |
|
1680 |
result ifFalse:[ |
|
1681 |
^ false |
|
1682 |
]. |
|
1683 |
^true |
|
1684 |
! |
|
1685 |
||
1686 |
getChangeDespriptionInfoFor:changeNumber |
|
1687 |
||
1688 |
|valuePairs startLineIndex keyEndIndex changeContents cmd outputStream errorStream result keyValues beginLine endLine keyName keyValue| |
|
1689 |
||
1690 |
valuePairs := OrderedCollection new. |
|
1691 |
cmd := 'change -o ', (changeNumber ? ''). |
|
1692 |
outputStream := ReadWriteStream on:''. |
|
1693 |
errorStream := ReadWriteStream on:''. |
|
1694 |
result := self temporaryWorkSpace executePerforceCommand:cmd |
|
1695 |
inDirectory:self tempDirectory |
|
1696 |
inputFrom:nil |
|
1697 |
outputTo:outputStream |
|
1698 |
errorTo:errorStream |
|
1699 |
logHeader:('getting change description ', (changeNumber ? ''), '.'). |
|
1700 |
result ifFalse:[ |
|
1701 |
^ nil |
|
1702 |
]. |
|
1703 |
changeContents := outputStream contents asStringCollection. |
|
1704 |
changeContents doWithIndex:[:aLine :index| |
|
1705 |
startLineIndex isNil ifTrue:[ |
|
1706 |
(aLine isEmpty or:[(aLine startsWith:$#) or:[aLine first isSeparator]]) ifFalse:[ |
|
1707 |
keyEndIndex := aLine indexOf:$:. |
|
1708 |
keyEndIndex ~= 0 ifTrue:[ |
|
1709 |
startLineIndex := index. |
|
1710 |
valuePairs add:(Array with:index with:nil with:(aLine copyTo:keyEndIndex - 1)). |
|
1711 |
]. |
|
1712 |
]. |
|
1713 |
] ifFalse:[ |
|
1714 |
(aLine isEmpty or:[aLine startsWith:$#]) ifTrue:[ |
|
1715 |
valuePairs last at:2 put:index. |
|
1716 |
startLineIndex := nil. |
|
1717 |
]. |
|
1718 |
]. |
|
1719 |
]. |
|
1720 |
keyValues := Dictionary new. |
|
1721 |
valuePairs do:[:each| |
|
1722 |
beginLine := each first. |
|
1723 |
endLine := each second. |
|
1724 |
keyName := each last. |
|
1725 |
(beginLine == (endLine - 1)) ifTrue:[ |
|
1726 |
keyValue := (changeContents at:beginLine) copyFrom:(keyName size + 2). |
|
1727 |
keyValue := (keyValue withoutLeadingSeparators withoutTrailingSeparators) asStringCollection. |
|
1728 |
] ifFalse:[ |
|
1729 |
keyValue := changeContents copyFrom:(beginLine + 1) to:(endLine - 1). |
|
1730 |
keyValue := keyValue collect:[:each | each withoutLeadingSeparators withoutTrailingSeparators]. |
|
1731 |
]. |
|
1732 |
keyValues at:keyName put:keyValue. |
|
1733 |
]. |
|
1734 |
^ keyValues. |
|
1735 |
! |
|
1736 |
||
1737 |
getChangeListNumber |
|
1738 |
||
1739 |
|numbers| |
|
1740 |
||
1741 |
numbers := self getCurrentChangeListNumbers. |
|
1742 |
numbers notEmptyOrNil ifTrue:[ |
|
1743 |
^numbers first. |
|
1744 |
]. |
|
1745 |
self createChange ifTrue:[ |
|
1746 |
numbers := self getCurrentChangeListNumbers. |
|
1747 |
numbers notEmptyOrNil ifTrue:[ |
|
1748 |
^numbers first. |
|
1749 |
]. |
|
1750 |
||
1751 |
]. |
|
1752 |
^nil |
|
1753 |
! |
|
1754 |
||
1755 |
getCurrentChangeListNumbers |
|
1756 |
||
1757 |
|perforceCommand outputStream errorStream result pendingChangesOutput words numbers number| |
|
1758 |
||
1759 |
perforceCommand := 'changes -s pending -u ', owner. |
|
1760 |
outputStream := ReadWriteStream on:''. |
|
1761 |
errorStream := ReadWriteStream on:''. |
|
1762 |
result := self temporaryWorkSpace executePerforceCommand:perforceCommand |
|
1763 |
inDirectory:self tempDirectory |
|
1764 |
inputFrom:nil |
|
1765 |
outputTo:outputStream |
|
1766 |
errorTo:errorStream |
|
1767 |
doLog:false. |
|
1768 |
result ifFalse:[ |
|
1769 |
^ nil |
|
1770 |
]. |
|
1771 |
numbers := OrderedCollection new. |
|
1772 |
pendingChangesOutput := outputStream contents asStringCollection. |
|
1773 |
pendingChangesOutput do:[:eachLine| |
|
1774 |
words := eachLine asCollectionOfWords. |
|
1775 |
words size > 1 ifTrue:[ |
|
1776 |
number := Number readFrom:(ReadStream on:(words at:2)) onError:nil. |
|
1777 |
numbers add:number. |
|
1778 |
]. |
|
1779 |
]. |
|
1780 |
^numbers |
|
1781 |
! |
|
1782 |
||
1783 |
getFileStatForPathname:aPathname |
|
1784 |
||
1785 |
||
1786 |
|perforceCommand outputStream errorStream result fileStatDict endOfKeywordIndex keyWord keyValue| |
|
1787 |
||
1788 |
perforceCommand := ('fstat "' , aPathname, '"'). |
|
1789 |
outputStream := ReadWriteStream on:''. |
|
1790 |
errorStream := ReadWriteStream on:''. |
|
1791 |
result := self executePerforceCommand:perforceCommand inDirectory:self root |
|
1792 |
inputFrom:nil outputTo:outputStream |
|
1793 |
errorTo:errorStream |
|
1794 |
logHeader:('getting file status from ', aPathname, '.'). |
|
1795 |
result ifFalse:[ |
|
1796 |
^ nil |
|
1797 |
]. |
|
1798 |
fileStatDict := Dictionary new. |
|
1799 |
outputStream contents asStringCollection do:[:aLine| |
|
1800 |
endOfKeywordIndex := aLine indexOfSeparatorStartingAt:5. |
|
1801 |
keyWord := aLine copyFrom:5 to:(endOfKeywordIndex - 1). |
|
1802 |
keyValue := aLine copyFrom:endOfKeywordIndex + 1. |
|
1803 |
fileStatDict at:keyWord put:keyValue. |
|
1804 |
]. |
|
1805 |
^ fileStatDict |
|
1806 |
||
1807 |
" |
|
1808 |
| workSpace tempWorkSpace dict| |
|
1809 |
workSpace := PerforceSourceCodeManager getWorkSpaceForPackage:'applistx'. |
|
1810 |
tempWorkSpace := workSpace temporaryWorkSpace. |
|
1811 |
dict := tempWorkSpace getFileStatForPathname:'C:\Dokumente und Einstellungen\gds2180\Lokale Einstellungen\Temp\stx_tmp\st6120368\applistx\util\libDataType\ActionLQualifier.st'. |
|
1812 |
dict includesKey:'unresolved' |
|
1813 |
" |
|
1814 |
! |
|
1815 |
||
1816 |
getOpenChangeFor:checkInDefinition |
|
1817 |
||
1818 |
|numbers changeDescr files versionInfo| |
|
1819 |
||
1820 |
numbers := self getCurrentChangeListNumbers. |
|
1821 |
numbers notEmptyOrNil ifTrue:[ |
|
1822 |
numbers do:[:changeNumber| |
|
1823 |
changeDescr := self getChangeDespriptionInfoFor:changeNumber printString. |
|
1824 |
files := changeDescr at:#Files ifAbsent:[nil]. |
|
1825 |
files notNil ifTrue:[ |
|
1826 |
versionInfo := PerforceSourceCodeManager versionInfoClass fromRCSString:checkInDefinition getLocalRevisionString. |
|
1827 |
files do:[:aFileAndAction| |
|
1828 |
(aFileAndAction startsWith:versionInfo repositoryPathName) ifTrue:[ |
|
1829 |
^changeNumber |
|
1830 |
]. |
|
1831 |
]. |
|
1832 |
]. |
|
1833 |
]. |
|
1834 |
]. |
|
1835 |
^nil |
|
1836 |
! |
|
1837 |
||
1838 |
getTemporaryWorkspaceFor:checkInDefinition |
|
1839 |
" |
|
1840 |
create an temporary workspace for handle checkin |
|
1841 |
" |
|
1842 |
||
1843 |
|workSpaceName workSpaceDefinitionFilename ws perforceCommand result readStream directory |
|
1844 |
settingsTemporary myView outputStream errorStream lineStream clientSpec index words| |
|
1845 |
||
1846 |
directory := self tempDirectory. |
|
1847 |
workSpaceName := self temporaryClientName. |
|
1848 |
perforceCommand := 'clients -u ' , (self perforceSettings at:#user). |
|
1849 |
outputStream := ReadWriteStream on:''. |
|
1850 |
errorStream := ReadWriteStream on:''. |
|
1851 |
result := self executePerforceCommand:perforceCommand |
|
1852 |
inDirectory:directory pathName |
|
1853 |
inputFrom:nil |
|
1854 |
outputTo:outputStream |
|
1855 |
errorTo:errorStream |
|
1856 |
doLog:false |
|
1857 |
logHeader:('check for existing workspace client.'). |
|
1858 |
result ifFalse:[ |
|
1859 |
temporaryWorkSpace := nil. |
|
1860 |
]. |
|
1861 |
index := outputStream contents asStringCollection findFirst:[:aLine| |
|
1862 |
words := aLine asCollectionOfWords. |
|
1863 |
words size > 1 and:[words second = workSpaceName] |
|
1864 |
]. |
|
1865 |
index = 0 ifTrue:[ |
|
1866 |
temporaryWorkSpace := nil. |
|
1867 |
]. |
|
1868 |
temporaryWorkSpace isNil ifTrue:[ |
|
1869 |
directory exists ifFalse:[ |
|
1870 |
self perforceError raiseErrorString:('Perforce temporary workspace directory ', directory pathName, ' not exists.'). |
|
1871 |
^nil |
|
1872 |
]. |
|
1873 |
settingsTemporary := self perforceSettings copy. |
|
1874 |
settingsTemporary at:#client put:workSpaceName. |
|
1875 |
temporaryWorkSpace := self class newWorkSpaceForSettings:settingsTemporary. |
|
1876 |
temporaryWorkSpace root:directory asFilename pathName. |
|
1877 |
temporaryWorkSpace host:self host. |
|
1878 |
myView := self getViewForPackage:checkInDefinition package. |
|
1879 |
lineStream := WriteStream on:''. |
|
1880 |
lineStream nextPutAll:myView depot. |
|
1881 |
lineStream space. |
|
1882 |
lineStream nextPutAll:'//', workSpaceName, '/...'. |
|
1883 |
temporaryWorkSpace views add:(View newFromLine:lineStream contents workspace:temporaryWorkSpace). |
|
1884 |
workSpaceDefinitionFilename := directory asFilename construct:workSpaceName. |
|
1885 |
clientSpec := temporaryWorkSpace createWorkSpaceClientSpecFor:checkInDefinition. |
|
1886 |
ws := workSpaceDefinitionFilename writeStream. |
|
1887 |
ws nextPutAll:clientSpec. |
|
1888 |
ws close. |
|
1889 |
||
1890 |
readStream := ReadStream on:clientSpec. |
|
1891 |
perforceCommand := 'client -i < "', workSpaceDefinitionFilename pathName, '"'. |
|
1892 |
outputStream := ReadWriteStream on:''. |
|
1893 |
errorStream := ReadWriteStream on:''. |
|
1894 |
result := temporaryWorkSpace executePerforceCommand:perforceCommand |
|
1895 |
inDirectory:directory pathName |
|
1896 |
inputFrom:nil |
|
1897 |
outputTo:outputStream |
|
1898 |
errorTo:errorStream |
|
1899 |
doLog:false |
|
1900 |
logHeader:('writing temporary workspace definition.'). |
|
1901 |
result ifFalse:[ |
|
1902 |
temporaryWorkSpace := nil. |
|
1903 |
]. |
|
1904 |
]. |
|
1905 |
^temporaryWorkSpace |
|
1906 |
! |
|
1907 |
||
1908 |
mergeOrResolveConflictsForChangeNumber:aNumber |
|
1909 |
||
1910 |
| tmpFilename perforceCommand outputStream errorStream result s |
|
1911 |
changesAsLogged inStream line changesDict chunksPart words mergedSource mySource |
|
1912 |
localRevision resultSource definitionClass descriptionInfo resolveFiles depotPath localPath checkInDefinition fileStatDict| |
|
1913 |
||
1914 |
self temporaryWorkSpace isNil ifTrue:[ |
|
1915 |
^false |
|
1916 |
]. |
|
1917 |
descriptionInfo := (self getChangeDespriptionInfoFor:aNumber printString). |
|
1918 |
descriptionInfo isNil ifTrue:[ |
|
1919 |
^false. |
|
1920 |
]. |
|
1921 |
resolveFiles := descriptionInfo at:#Files ifAbsent:nil. |
|
1922 |
resolveFiles isNil ifTrue:[ |
|
1923 |
^false. |
|
1924 |
]. |
|
1925 |
resolveFiles do:[:aFileLine| |
|
1926 |
depotPath := (aFileLine copyTo:((aFileLine lastIndexOf:$#) - 1 )) withoutTrailingSeparators. |
|
1927 |
localPath := self temporaryWorkSpace getLocalPathForDepotPath:depotPath. |
|
1928 |
fileStatDict := self temporaryWorkSpace getFileStatForPathname:localPath. |
|
1929 |
(fileStatDict includesKey:'unresolved') ifTrue:[ |
|
1930 |
definitionClass := Smalltalk at:(localPath asFilename withoutSuffix baseName asSymbol) ifAbsent:nil. |
|
1931 |
checkInDefinition := PerforceSourceCodeManager getCheckInDefinitionForClass:definitionClass. |
|
1932 |
localRevision := checkInDefinition getLocalRevisionNumber. |
|
1933 |
tmpFilename := localPath asFilename. |
|
1934 |
perforceCommand := ('resolve -af "' , tmpFilename pathName, '"'). |
|
1935 |
outputStream := ReadWriteStream on:''. |
|
1936 |
errorStream := ReadWriteStream on:''. |
|
1937 |
result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
|
1938 |
inputFrom:nil outputTo:outputStream |
|
1939 |
errorTo:errorStream |
|
1940 |
logHeader:('resolving ', tmpFilename pathName, '.'). |
|
1941 |
result ifFalse:[ |
|
1942 |
^ false |
|
1943 |
]. |
|
1944 |
"check for conflicts" |
|
1945 |
changesAsLogged := StringCollection new. |
|
1946 |
inStream := ReadStream on:(outputStream contents). |
|
1947 |
||
1948 |
[inStream atEnd not] whileTrue:[ |
|
1949 |
line:= inStream nextLine. |
|
1950 |
line notNil ifTrue:[ |
|
1951 |
(line startsWith:'Diff chunks:') ifTrue:[ |
|
1952 |
changesAsLogged add:line. |
|
1953 |
changesDict := Dictionary new. |
|
1954 |
chunksPart := line copyFrom:('Diff chunks:' size + 1). |
|
1955 |
(chunksPart asCollectionOfSubstringsSeparatedBy:$+) do:[:eachElement| |
|
1956 |
words := eachElement asCollectionOfWords. |
|
1957 |
changesDict at:words second asSymbol put:words first asNumber. |
|
1958 |
]. |
|
1959 |
]. |
|
1960 |
]. |
|
1961 |
]. |
|
1962 |
s := WriteStream on:String new. |
|
1963 |
PerforceSourceCodeManager fileOutSourceCodeOf:definitionClass on:s. |
|
1964 |
mergedSource := tmpFilename readStream contents asString. |
|
1965 |
mySource := s contents asString. |
|
1966 |
resultSource := self askForMergedSource:mergedSource |
|
1967 |
localSource:mySource |
|
1968 |
changesDict:changesDict |
|
1969 |
haveRevision:(fileStatDict at:'haveRev' ifAbsent:nil) |
|
1970 |
changesAsLogged:changesAsLogged |
|
1971 |
pathName:tmpFilename pathName |
|
1972 |
definitionClass:definitionClass. |
|
1973 |
resultSource isNil ifTrue:[ |
|
1974 |
^false. |
|
1975 |
]. |
|
1976 |
"now we have a merge - lets get latest revision and write on it " |
|
1977 |
perforceCommand := ('revert "' , tmpFilename pathName, '"'). |
|
1978 |
outputStream := ReadWriteStream on:''. |
|
1979 |
errorStream := ReadWriteStream on:''. |
|
1980 |
result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
|
1981 |
inputFrom:nil outputTo:outputStream |
|
1982 |
errorTo:errorStream |
|
1983 |
logHeader:('revert after resolving ', tmpFilename pathName, '.'). |
|
1984 |
result ifFalse:[ |
|
1985 |
^ false |
|
1986 |
]. |
|
1987 |
||
1988 |
tmpFilename remove. |
|
1989 |
||
1990 |
perforceCommand := ('sync -f "' , tmpFilename pathName, '"'). |
|
1991 |
outputStream := ReadWriteStream on:''. |
|
1992 |
errorStream := ReadWriteStream on:''. |
|
1993 |
result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
|
1994 |
inputFrom:nil outputTo:outputStream |
|
1995 |
errorTo:errorStream |
|
1996 |
logHeader:('sync after resolving ', tmpFilename pathName, '.'). |
|
1997 |
result ifFalse:[ |
|
1998 |
^ false |
|
1999 |
]. |
|
2000 |
||
2001 |
perforceCommand := ('edit -c ', aNumber printString, ' "' , tmpFilename pathName, '"'). |
|
2002 |
outputStream := ReadWriteStream on:''. |
|
2003 |
errorStream := ReadWriteStream on:''. |
|
2004 |
result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
|
2005 |
inputFrom:nil outputTo:outputStream |
|
2006 |
errorTo:errorStream |
|
2007 |
logHeader:('edit after resolving ', tmpFilename pathName, '.'). |
|
2008 |
result ifFalse:[ |
|
2009 |
^ false |
|
2010 |
]. |
|
2011 |
||
2012 |
"write my result" |
|
2013 |
resultSource notNil ifTrue:[ |
|
2014 |
s := tmpFilename writeStream. |
|
2015 |
s nextPutAll:resultSource. |
|
2016 |
s close. |
|
2017 |
]. |
|
2018 |
]. |
|
2019 |
]. |
|
2020 |
^true |
|
2021 |
! |
|
2022 |
||
2023 |
releaseWorkSpace |
|
2024 |
||
2025 |
temporaryWorkSpace notNil ifTrue:[ |
|
2026 |
temporaryWorkSpace deleteWorkSpaceFromServer. |
|
2027 |
]. |
|
2028 |
tempDirectory notNil ifTrue:[ |
|
2029 |
tempDirectory recursiveRemove. |
|
2030 |
]. |
|
2031 |
! |
|
2032 |
||
2033 |
revisionLogOf:clsOrNil |
|
2034 |
fromRevision:firstRev |
|
2035 |
toRevision:lastRef |
|
2036 |
numberOfRevisions:numRevisions |
|
2037 |
fileName:classFileName |
|
2038 |
directory:packageDir |
|
2039 |
module:aPackage |
|
2040 |
||
2041 |
|atEnd line inHeaderInfo info record revisionRecords headerOnly msg revArg infoAndLogString elements |
|
2042 |
foundView outputStream errorStream inStream packagePath fullFilename depotPath perforceCommand result labelLineElements tags label revision| |
|
2043 |
||
2044 |
[ |
|
2045 |
revArg := ''. |
|
2046 |
headerOnly := false. |
|
2047 |
(firstRev notNil or:[lastRef notNil]) ifTrue:[ |
|
2048 |
(firstRev == 0 and:[lastRef == 0]) ifTrue:[ |
|
2049 |
headerOnly := true. |
|
2050 |
] |
|
2051 |
]. |
|
2052 |
foundView := self getViewForPackage:aPackage. |
|
2053 |
headerOnly ifTrue:[ |
|
2054 |
msg := 'fetching revision info ' |
|
2055 |
] ifFalse:[ |
|
2056 |
msg := 'reading revision log ' |
|
2057 |
]. |
|
2058 |
clsOrNil isNil ifTrue:[ |
|
2059 |
foundView notNil ifTrue:[ |
|
2060 |
msg := msg , 'in ', foundView local. |
|
2061 |
]. |
|
2062 |
] ifFalse:[ |
|
2063 |
msg := msg , 'of ', clsOrNil name. |
|
2064 |
]. |
|
2065 |
self activityNotification:msg,'...'. |
|
2066 |
packagePath := Smalltalk packageDirectoryForPackageId:aPackage. |
|
2067 |
fullFilename := (packagePath construct:packageDir) construct:classFileName. |
|
2068 |
depotPath := foundView getDepotPathForLocalPath:fullFilename pathName. |
|
2069 |
perforceCommand := ('filelog "' , depotPath, '"'). |
|
2070 |
outputStream := ReadWriteStream on:''. |
|
2071 |
errorStream := ReadWriteStream on:''. |
|
2072 |
result := self executePerforceCommand:perforceCommand inDirectory:self root |
|
2073 |
inputFrom:nil outputTo:outputStream |
|
2074 |
errorTo:errorStream |
|
2075 |
logHeader:('getting filelog ', depotPath, '.'). |
|
2076 |
result ifFalse:[ |
|
2077 |
^ nil |
|
2078 |
]. |
|
2079 |
||
2080 |
"/ |
|
2081 |
"/ read the commands pipe output and extract the container info |
|
2082 |
"/ |
|
2083 |
info := IdentityDictionary new. |
|
2084 |
inHeaderInfo := true. |
|
2085 |
revisionRecords := OrderedCollection new. |
|
2086 |
info at:#revisions put:revisionRecords. |
|
2087 |
inStream := ReadStream on:(outputStream contents). |
|
2088 |
[inHeaderInfo and:[inStream atEnd not]] whileTrue:[ |
|
2089 |
line:= inStream nextLine. |
|
2090 |
line notNil ifTrue:[ |
|
2091 |
|gotIt| |
|
2092 |
||
2093 |
gotIt := false. |
|
2094 |
infoAndLogString := line asCollectionOfSubstringsSeparatedBy:$'. |
|
2095 |
elements := infoAndLogString size. |
|
2096 |
elements > 1 ifTrue:[ |
|
2097 |
record := self readRevisionLogEntryFromString:line. |
|
2098 |
((record at:#state ifAbsent:'') = 'delete') ifTrue:[ |
|
2099 |
info at:#newestRevision put:#deleted. |
|
2100 |
] ifFalse:[ |
|
2101 |
info at:#newestRevision put:(record at:#revision). |
|
2102 |
]. |
|
2103 |
info at:#numberOfRevisions put:((record at:#revision) asNumber). |
|
2104 |
revisionRecords add:record. |
|
2105 |
inHeaderInfo := false |
|
2106 |
]. |
|
2107 |
] |
|
2108 |
]. |
|
2109 |
||
2110 |
info isEmpty ifTrue:[ |
|
2111 |
('PerforceSourceCodeManager [warning]: no log for ', depotPath) errorPrintCR. |
|
2112 |
^ nil |
|
2113 |
]. |
|
2114 |
||
2115 |
"/ strip selected revisions from the total-revisions entry |
|
2116 |
headerOnly ifFalse:[ |
|
2117 |
"/ |
|
2118 |
"/ continue to read the commands pipe output |
|
2119 |
"/ and extract revision info records |
|
2120 |
"/ |
|
2121 |
atEnd := false. |
|
2122 |
[atEnd or:[inStream atEnd]] whileFalse:[ |
|
2123 |
record := self readRevisionLogEntryFromStream:inStream. |
|
2124 |
record isNil ifTrue:[ |
|
2125 |
atEnd := true. |
|
2126 |
] ifFalse:[ |
|
2127 |
revisionRecords add:record. |
|
2128 |
]. |
|
2129 |
(numRevisions notNil and:[revisionRecords size >= numRevisions]) ifTrue:[ |
|
2130 |
atEnd := true |
|
2131 |
] |
|
2132 |
]. |
|
2133 |
]. |
|
2134 |
] ensure:[ |
|
2135 |
outputStream notNil ifTrue:[outputStream close]. |
|
2136 |
self activityNotification:nil. |
|
2137 |
]. |
|
2138 |
perforceCommand := ('labels "' , depotPath, '"'). |
|
2139 |
outputStream := ReadWriteStream on:''. |
|
2140 |
errorStream := ReadWriteStream on:''. |
|
2141 |
result := self executePerforceCommand:perforceCommand inDirectory:self root |
|
2142 |
inputFrom:nil outputTo:outputStream |
|
2143 |
errorTo:errorStream |
|
2144 |
logHeader:('getting labels ', depotPath, '.'). |
|
2145 |
result ifFalse:[ |
|
2146 |
^ nil |
|
2147 |
]. |
|
2148 |
inStream := ReadStream on:(outputStream contents). |
|
2149 |
tags := Dictionary new. |
|
2150 |
[inStream atEnd not] whileTrue:[ |
|
2151 |
line:= inStream nextLine. |
|
2152 |
line notEmptyOrNil ifTrue:[ |
|
2153 |
labelLineElements := line asCollectionOfWords. |
|
2154 |
elements := labelLineElements size. |
|
2155 |
elements > 1 ifTrue:[ |
|
2156 |
label := labelLineElements second withoutSeparators. |
|
2157 |
revision := self getRevisionForLabel:label depotPath:depotPath. |
|
2158 |
tags at:(labelLineElements second withoutSeparators) put:revision. |
|
2159 |
]. |
|
2160 |
] |
|
2161 |
]. |
|
2162 |
info at:#symbolicNames put:tags. |
|
2163 |
||
2164 |
^ info |
|
2165 |
! |
|
2166 |
||
2167 |
setSymbolicName:symbolicNameArg revision:rev overWrite:overWriteBool pathes:pathesInRepository |
|
2168 |
"set a symbolicName for revision rev. |
|
2169 |
If rev is nil, set it for the head (most recent) revision. |
|
2170 |
If rev is 0, delete the symbolic name. |
|
2171 |
If overWriteBool is true, the symbolicName will be changed, even if it has already been set. |
|
2172 |
If overWriteBool is false, an error will be raised if symbolicName has already been set. |
|
2173 |
||
2174 |
If filename is nil, the symbolicName for a whole package is set. |
|
2175 |
If multiple pathes are given, the revision MUST be nil." |
|
2176 |
||
2177 |
|argumentString result errorStream moduleDirs symbolicName perforceCommand outputStream| |
|
2178 |
||
2179 |
symbolicName := (symbolicNameArg includes:Character space) |
|
2180 |
ifTrue:[ '"',symbolicNameArg,'"' ] |
|
2181 |
ifFalse:[ symbolicNameArg ]. |
|
2182 |
||
2183 |
pathesInRepository size > 1 ifTrue:[ |
|
2184 |
self assert:(rev isNil or:[rev == 0]) "revision must be nil (for head) or 0 (for delete) with multiple pathes" |
|
2185 |
]. |
|
2186 |
||
2187 |
moduleDirs := pathesInRepository |
|
2188 |
collect:[:pathInRepository | |
|
2189 |
(pathInRepository asCollectionOfSubstringsSeparatedByAny:'/\') first. |
|
2190 |
]. |
|
2191 |
moduleDirs do:[:moduleDir | |
|
2192 |
|pathesInModule pathesInModuleAsArgument| |
|
2193 |
||
2194 |
pathesInModule := pathesInRepository |
|
2195 |
select:[:pathInRepository | |
|
2196 |
|moduleOfThisPath| |
|
2197 |
||
2198 |
moduleOfThisPath := (pathInRepository asCollectionOfSubstringsSeparatedByAny:'/\') first. |
|
2199 |
moduleOfThisPath = moduleDir |
|
2200 |
]. |
|
2201 |
||
2202 |
rev = 0 ifTrue:[ |
|
2203 |
argumentString := ' -d '. |
|
2204 |
] ifFalse:[ |
|
2205 |
argumentString := ' -r ', (rev ? 'HEAD'). |
|
2206 |
overWriteBool ifTrue:[ |
|
2207 |
argumentString := argumentString, ' -F' |
|
2208 |
]. |
|
2209 |
]. |
|
2210 |
||
2211 |
pathesInModuleAsArgument := pathesInModule |
|
2212 |
collect:[:eachPath | |
|
2213 |
(eachPath includes:Character space) ifTrue:[ |
|
2214 |
'"',eachPath,'"' |
|
2215 |
] ifFalse:[ |
|
2216 |
eachPath |
|
2217 |
]. |
|
2218 |
]. |
|
2219 |
pathesInModuleAsArgument := pathesInModuleAsArgument asStringCollection asStringWith:Character space. |
|
2220 |
||
2221 |
self activityNotification:'setting symbolic name for: ', pathesInModuleAsArgument. |
|
2222 |
||
2223 |
self information:'Implementation not finished yet'. |
|
2224 |
^self. |
|
2225 |
||
2226 |
perforceCommand := ('label "' , pathesInRepository, '"'). |
|
2227 |
outputStream := ReadWriteStream on:''. |
|
2228 |
errorStream := ReadWriteStream on:''. |
|
2229 |
result := self executePerforceCommand:perforceCommand inDirectory:self root |
|
2230 |
inputFrom:nil outputTo:outputStream |
|
2231 |
errorTo:errorStream |
|
2232 |
logHeader:('set label ', pathesInRepository, '.'). |
|
2233 |
result ifFalse:[ |
|
2234 |
^ nil |
|
2235 |
]. |
|
2236 |
]. |
|
2237 |
||
2238 |
" |
|
2239 |
self setSymbolicName:'stable' revision:nil overWrite:false path:'stx/libbasic/Array.st' |
|
2240 |
self setSymbolicName:'stable' revision:nil overWrite:true path:'stx/libbasic/Array.st' |
|
2241 |
||
2242 |
self |
|
2243 |
setSymbolicName:'test1' |
|
2244 |
revision:nil |
|
2245 |
overWrite:true |
|
2246 |
path:'bosch/dapasx/datenbasis/DAPASX__HierarchicalList.st' |
|
2247 |
||
2248 |
self |
|
2249 |
setSymbolicName:'test2' |
|
2250 |
revision:nil |
|
2251 |
overWrite:true |
|
2252 |
pathes:#( 'bosch/dapasx/datenbasis/DAPASX__HierarchicalList.st' |
|
2253 |
'bosch/dapasx/datenbasis/DAPASX__ProjectSearch.st' ) |
|
2254 |
||
2255 |
self |
|
2256 |
setSymbolicName:'test2' |
|
2257 |
revision:0 |
|
2258 |
overWrite:true |
|
2259 |
pathes:#( 'bosch/dapasx/datenbasis/DAPASX__HierarchicalList.st' |
|
2260 |
'bosch/dapasx/datenbasis/DAPASX__ProjectSearch.st' ) |
|
2261 |
" |
|
2262 |
||
2263 |
"Created: / 12-09-2006 / 12:36:44 / cg" |
|
2264 |
! |
|
2265 |
||
2266 |
streamFor:checkInDefinition revision:revision cache:doCache |
|
2267 |
"extract a classes source code and return an open readStream on it. |
|
2268 |
A revision of nil selects the current (in image) revision. |
|
2269 |
The classes source code is extracted using the revision and the sourceCodeInfo, |
|
2270 |
which itself is extracted from the classes packageString." |
|
2271 |
||
2272 |
|cacheIt cacheDir classFileName fullName cachedSourceFilename cacheSubDir cachedFile tempdir checkoutName |
|
2273 |
checkoutNameLocal revMsg fullTempName fullCachedName stream tempFile outStream |
|
2274 |
line modulDir lineNr result outputStream errorStream inStream cls module packageDir packagePath fullFilename perforceCommand| |
|
2275 |
||
2276 |
cacheIt := doCache. |
|
2277 |
(cacheIt and:[revision ~~ #newest and:[revision notNil]]) ifTrue:[ |
|
2278 |
(cacheDir := PerforceSourceCodeManager sourceCacheDirectory) isNil ifTrue:[ |
|
2279 |
'PerforceSourceCodeManager [warning]: no source cache directory' errorPrintCR. |
|
2280 |
] |
|
2281 |
]. |
|
2282 |
self getTemporaryWorkspaceFor:checkInDefinition. |
|
2283 |
cls := checkInDefinition definitionClass. |
|
2284 |
classFileName := checkInDefinition fileName. |
|
2285 |
classFileName isNil ifTrue:[classFileName := cls classBaseFilename]. |
|
2286 |
||
2287 |
(classFileName endsWith:',v') ifTrue:[ |
|
12702
2759bbb8d06b
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
11959
diff
changeset
|
2288 |
classFileName := classFileName copyButLast:2. |
11532 | 2289 |
]. |
2290 |
(classFileName endsWith:'.st') ifTrue:[ |
|
2291 |
cls notNil ifTrue:[ |
|
12702
2759bbb8d06b
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
11959
diff
changeset
|
2292 |
classFileName := classFileName copyButLast:3. |
11532 | 2293 |
] |
2294 |
]. |
|
2295 |
module := checkInDefinition package. |
|
2296 |
packageDir := checkInDefinition packageDir. |
|
2297 |
fullName := module , '/' , packageDir , '/' , classFileName. |
|
2298 |
cls notNil ifTrue:[ |
|
2299 |
fullName := fullName , '.st'. |
|
2300 |
]. |
|
2301 |
||
2302 |
(revision isNil or:[revision == #newest]) ifTrue:[ |
|
2303 |
cachedSourceFilename := classFileName, '_p4'. |
|
2304 |
revMsg := ''. |
|
2305 |
] ifFalse:[ |
|
2306 |
cachedSourceFilename := classFileName , '_p4_' , revision. |
|
2307 |
revMsg := ' (' , revision , ')'. |
|
2308 |
]. |
|
2309 |
||
2310 |
cacheDir notNil ifTrue:[ |
|
2311 |
cacheSubDir := cacheDir construct:module. |
|
2312 |
cacheSubDir := cacheSubDir construct:packageDir. |
|
2313 |
cachedFile := cacheSubDir construct:cachedSourceFilename. |
|
2314 |
cachedFile exists ifTrue:[ |
|
2315 |
^ cachedFile readStream |
|
2316 |
]. |
|
2317 |
]. |
|
2318 |
||
2319 |
"/ |
|
2320 |
"/ first, create a temporary work tree |
|
2321 |
"/ Do not make module and package directories, their existence cause cvs checkout to fail in server mode |
|
2322 |
"/ |
|
2323 |
tempdir := self tempDirectory. |
|
2324 |
||
2325 |
||
2326 |
"/ |
|
2327 |
"/ check it out there |
|
2328 |
"/ |
|
2329 |
checkoutName := fullName. |
|
2330 |
||
2331 |
modulDir := module asFilename construct:packageDir. |
|
2332 |
checkoutNameLocal := modulDir constructString:(fullName asFilename baseName). |
|
2333 |
||
2334 |
self activityNotification:'checking out source ' , checkoutName , revMsg. |
|
2335 |
||
2336 |
packagePath := Smalltalk packageDirectoryForPackageId:checkInDefinition package. |
|
2337 |
fullFilename := (packagePath construct:checkInDefinition packageDir) construct:checkInDefinition fileName. |
|
2338 |
fullTempName := self getTemporaryFilenameFor:fullFilename pathName. |
|
2339 |
||
2340 |
perforceCommand := ('print "' , fullFilename pathName, '#', revision, '"'). |
|
2341 |
outputStream := ReadWriteStream on:''. |
|
2342 |
errorStream := ReadWriteStream on:''. |
|
2343 |
result := self executePerforceCommand:perforceCommand inDirectory:self root |
|
2344 |
inputFrom:nil outputTo:outputStream |
|
2345 |
errorTo:errorStream |
|
2346 |
logHeader:('get contents of ', fullFilename pathName, ' for revision ', revision, '.'). |
|
2347 |
result ifFalse:[ |
|
2348 |
^ nil |
|
2349 |
]. |
|
2350 |
errorStream contents notEmpty ifTrue:[ |
|
2351 |
^nil |
|
2352 |
]. |
|
2353 |
FileStream openErrorSignal handle:[:ex| |
|
2354 |
('PerforceSourceCodeManager [error]: can not create ', fullTempName pathName) errorPrintCR. |
|
2355 |
^ nil. |
|
2356 |
] do:[ |
|
2357 |
fullTempName directory recursiveMakeDirectory. |
|
2358 |
outStream := fullTempName writeStream. |
|
2359 |
]. |
|
2360 |
lineNr := 1. |
|
2361 |
inStream := ReadStream on:(outputStream contents). |
|
2362 |
[inStream atEnd not] whileTrue:[ |
|
2363 |
line:= inStream nextLine. |
|
2364 |
line notNil ifTrue:[ |
|
2365 |
lineNr = 1 ifTrue:[ |
|
2366 |
] ifFalse:[ |
|
2367 |
outStream nextPutLine:line. |
|
2368 |
]. |
|
2369 |
]. |
|
2370 |
lineNr := lineNr + 1. |
|
2371 |
]. |
|
2372 |
outStream close. |
|
2373 |
||
2374 |
(cacheSubDir isNil) ifTrue:[ |
|
2375 |
cacheIt := false |
|
2376 |
] ifFalse:[ |
|
2377 |
cacheSubDir recursiveMakeDirectory. |
|
2378 |
fullCachedName := cacheSubDir constructString:cachedSourceFilename. |
|
2379 |
]. |
|
2380 |
(cacheIt |
|
2381 |
and:[cachedFile notNil |
|
2382 |
and:[fullTempName exists]]) |
|
2383 |
ifTrue:[ |
|
12725
93efe8fda21c
class: PerforceSourceCodeManagerUtilities
Claus Gittinger <cg@exept.de>
parents:
12702
diff
changeset
|
2384 |
(OsError catch:[ |
11532 | 2385 |
fullTempName moveTo:fullCachedName |
2386 |
]) ifTrue:[ |
|
2387 |
('PerforceSourceCodeManager [error]: failed to rename ', fullTempName pathName, ' to ', cachedSourceFilename) errorPrintCR. |
|
2388 |
^ nil |
|
2389 |
]. |
|
2390 |
fullCachedName asFilename exists ifTrue:[ |
|
2391 |
stream := fullCachedName asFilename readStream. |
|
2392 |
]. |
|
2393 |
] ifFalse:[ |
|
2394 |
checkInDefinition fileName = 'extensions.st' ifTrue:[ |
|
2395 |
self activityNotification:'Not cached - please check your settings and/or the version method in the projectDefinition.'. |
|
2396 |
] ifFalse:[ |
|
2397 |
self activityNotification:'Not cached - please check your settings.'. |
|
2398 |
]. |
|
2399 |
OperatingSystem isUNIXlike ifFalse:[ |
|
2400 |
"/ cannot remove files which are still open ... |
|
2401 |
"/ sigh - need a delete-on-close flag in FileStream. |
|
2402 |
"/ |
|
2403 |
tempFile := Filename newTemporary. |
|
2404 |
fullTempName copyTo:tempFile. |
|
2405 |
stream := tempFile readStream. |
|
2406 |
stream notNil ifTrue:[ |
|
2407 |
stream removeOnClose:true. |
|
2408 |
]. |
|
2409 |
] ifTrue:[ |
|
2410 |
stream := fullTempName readStream. |
|
2411 |
] |
|
2412 |
]. |
|
2413 |
||
2414 |
^ stream |
|
2415 |
! |
|
2416 |
||
2417 |
submit |
|
2418 |
||
2419 |
|numbers| |
|
2420 |
||
2421 |
numbers := self getCurrentChangeListNumbers. |
|
2422 |
numbers isEmptyOrNil ifTrue:[ |
|
2423 |
^false |
|
2424 |
]. |
|
2425 |
numbers do:[:aNumber| |
|
2426 |
(self submitChangeNumber:aNumber) ifFalse:[ |
|
2427 |
^false |
|
2428 |
]. |
|
2429 |
]. |
|
2430 |
^true |
|
2431 |
! |
|
2432 |
||
2433 |
submitChangeNumber:changeNumber |
|
2434 |
||
2435 |
|cmd outputStream errorStream result changeListDescription infoDialog logMsg| |
|
2436 |
||
2437 |
changeListDescription := self getChangeDespriptionInfoFor:changeNumber printString. |
|
2438 |
infoDialog := PerforceSourceCodeManager submitInfoDialogClass |
|
2439 |
getCheckinInfoFor:'Perforce submit message check' |
|
2440 |
initialAnswer:((changeListDescription at:#Description ifAbsent:'') copy) |
|
2441 |
withFileList:(changeListDescription at:#Files ifAbsent:''). |
|
2442 |
infoDialog notNil ifTrue:[ |
|
2443 |
logMsg := infoDialog logMessage. |
|
2444 |
(changeListDescription at:#Description ifAbsent:'') ~= logMsg asStringCollection ifTrue:[ |
|
2445 |
self changeChangeDescriptionTo:logMsg asStringCollection changeNumber:changeNumber printString |
|
2446 |
]. |
|
2447 |
]. |
|
2448 |
cmd := ('submit -c ', changeNumber printString). |
|
2449 |
outputStream := ReadWriteStream on:''. |
|
2450 |
errorStream := ReadWriteStream on:''. |
|
2451 |
result := self temporaryWorkSpace executePerforceCommand:cmd |
|
2452 |
inDirectory:self tempDirectory |
|
2453 |
inputFrom:nil |
|
2454 |
outputTo:outputStream |
|
2455 |
errorTo:errorStream |
|
2456 |
doLog:false. |
|
2457 |
result ifFalse:[ |
|
2458 |
result := self mergeOrResolveConflictsForChangeNumber:changeNumber. |
|
2459 |
result ifTrue:[ |
|
2460 |
cmd := ('submit -c ', changeNumber printString). |
|
2461 |
outputStream := ReadWriteStream on:''. |
|
2462 |
errorStream := ReadWriteStream on:''. |
|
2463 |
result := self temporaryWorkSpace executePerforceCommand:cmd |
|
2464 |
inDirectory:self tempDirectory |
|
2465 |
inputFrom:nil |
|
2466 |
outputTo:outputStream |
|
2467 |
errorTo:errorStream |
|
2468 |
logHeader:('submit change ', changeNumber printString, ' after resolve.'). |
|
2469 |
result ifFalse:[ |
|
2470 |
^ false |
|
2471 |
]. |
|
2472 |
]. |
|
2473 |
]. |
|
2474 |
^true |
|
2475 |
! ! |
|
2476 |
||
2477 |
!PerforceSourceCodeManagerUtilities::WorkSpace methodsFor:'basic administration'! |
|
2478 |
||
2479 |
initialRevisionInfo:checkInDefinition |
|
2480 |
"return a string usable as initial revision string" |
|
2481 |
||
2482 |
|version workSpace foundView packagePath fullFilename depotPath| |
|
2483 |
||
2484 |
checkInDefinition definitionClass isPrivate ifTrue:[ |
|
2485 |
PerforceSourceCodeManager reportError:'refuse to get revision for private classes.'. |
|
2486 |
^ nil. |
|
2487 |
]. |
|
2488 |
||
2489 |
"/ |
|
2490 |
"/ first, create a temporary work tree |
|
2491 |
"/ |
|
2492 |
"/ tempdir := checkInDefinition tempDirectory. |
|
2493 |
||
2494 |
||
2495 |
workSpace := PerforceSourceCodeManager getWorkSpaceForPackage:(checkInDefinition packageString). |
|
2496 |
workSpace isNil ifTrue:[ |
|
2497 |
('PerforceSourceCodeManager [error]: failed to create workspace for', checkInDefinition definitionObjectString) errorPrintCR. |
|
2498 |
^ nil |
|
2499 |
]. |
|
2500 |
checkInDefinition workSpace:workSpace. |
|
2501 |
version := PerforceSourceCodeManager versionInfoClass new. |
|
2502 |
foundView := workSpace getViewForPackage:checkInDefinition package. |
|
2503 |
packagePath := Smalltalk packageDirectoryForPackageId:checkInDefinition package. |
|
2504 |
fullFilename := (packagePath construct:checkInDefinition packageDir) construct:checkInDefinition fileName. |
|
2505 |
depotPath := foundView getDepotPathForLocalPath:fullFilename pathName. |
|
2506 |
||
2507 |
version repositoryPathName:depotPath. |
|
2508 |
version user:workSpace owner. |
|
2509 |
" |
|
2510 |
s := CharacterWriteStream on:(String basicNew:40). |
|
2511 |
Date today printOn:s format:'%d-%m-%y' language:nil. |
|
2512 |
version date:s contents. |
|
2513 |
s := CharacterWriteStream on:(String basicNew:40). |
|
2514 |
Timestamp now printOn:s format:'%h-%m-%s.%i'. |
|
2515 |
version time:s contents. |
|
2516 |
" |
|
2517 |
version revision:'1'. |
|
2518 |
^ version. |
|
2519 |
||
2520 |
" |
|
2521 |
self initialRevisionStringFor:RTDBInspectorStartup inModule:'applistx' directory:'util/rtdb' container:'RTDBInterfaceInspector.st' |
|
2522 |
" |
|
2523 |
! |
|
2524 |
||
2525 |
initialRevisionStringFor:checkInDefinition |
|
2526 |
"return a string usable as initial revision string" |
|
2527 |
||
2528 |
|info| |
|
2529 |
||
2530 |
info := self initialRevisionInfo:checkInDefinition. |
|
2531 |
info notNil ifTrue:[ |
|
2532 |
^info getVersionString |
|
2533 |
]. |
|
2534 |
^nil |
|
2535 |
" |
|
2536 |
self initialRevisionStringFor:RTDBInspectorStartup inModule:'applistx' directory:'util/rtdb' container:'RTDBInterfaceInspector.st' |
|
2537 |
" |
|
2538 |
! |
|
2539 |
||
2540 |
nextRevisionStringFor:checkInDefinition |
|
2541 |
||
2542 |
|versionInfo s newestRevisionNumber versionMethod versionString| |
|
2543 |
||
2544 |
versionMethod := checkInDefinition definitionClass findVersionMethodOfManager:PerforceSourceCodeManager. |
|
2545 |
versionMethod notNil ifTrue:[ |
|
2546 |
versionString := (versionMethod valueWithReceiver:(checkInDefinition definitionClass theNonMetaclass) arguments:#()). |
|
2547 |
versionString notNil ifTrue:[ |
|
2548 |
versionInfo := PerforceSourceCodeManager versionInfoClass fromRCSString:versionString. |
|
2549 |
]. |
|
2550 |
]. |
|
2551 |
versionInfo isNil ifTrue:[ |
|
2552 |
versionInfo := self initialRevisionInfo:checkInDefinition. |
|
2553 |
] ifFalse:[ |
|
2554 |
versionInfo user:checkInDefinition workSpace owner. |
|
2555 |
s := CharacterWriteStream on:(String basicNew:40). |
|
2556 |
Date today printOn:s format:'%d-%m-%y' language:nil. |
|
2557 |
versionInfo date:s contents. |
|
2558 |
s := CharacterWriteStream on:(String basicNew:40). |
|
2559 |
Timestamp now printOn:s format:'%h-%m-%s.%i'. |
|
2560 |
versionInfo time:s contents. |
|
2561 |
]. |
|
2562 |
versionInfo isNil ifTrue:[ |
|
2563 |
^nil. |
|
2564 |
]. |
|
2565 |
newestRevisionNumber := checkInDefinition getReposRevisionNumberBeforeCheckin. |
|
2566 |
newestRevisionNumber isNil ifTrue:[ |
|
2567 |
^nil. |
|
2568 |
]. |
|
2569 |
versionInfo revision:((newestRevisionNumber + 1) printString). |
|
2570 |
^versionInfo getVersionString |
|
2571 |
! ! |
|
2572 |
||
2573 |
!PerforceSourceCodeManagerUtilities::WorkSpace methodsFor:'command execution'! |
|
2574 |
||
2575 |
executePerforceCommand:perforceCommand inDirectory:dirArg |
|
2576 |
inputFrom:inputStream outputTo:outputStream |
|
2577 |
errorTo:errorStream |
|
2578 |
"execute command and prepend perforce command name and global options. |
|
2579 |
execute command in the dirArg directory. |
|
2580 |
The doLog argument, if false supresses a logEntry to be added |
|
2581 |
in the cvs log file (used when reading / extracting history)" |
|
2582 |
||
2583 |
^self executePerforceCommand:perforceCommand inDirectory:dirArg |
|
2584 |
inputFrom:inputStream outputTo:outputStream |
|
2585 |
errorTo:errorStream |
|
2586 |
doLog:true |
|
2587 |
! |
|
2588 |
||
2589 |
executePerforceCommand:perforceCommand inDirectory:dirArg |
|
2590 |
inputFrom:inputStream outputTo:outputStream |
|
2591 |
errorTo:errorStream |
|
2592 |
doLog:doLog |
|
2593 |
"execute command and prepend perforce command name and global options. |
|
2594 |
execute command in the dirArg directory. |
|
2595 |
The doLog argument, if false supresses a logEntry to be added |
|
2596 |
in the cvs log file (used when reading / extracting history)" |
|
2597 |
||
2598 |
^self executePerforceCommand:perforceCommand inDirectory:dirArg |
|
2599 |
inputFrom:inputStream outputTo:outputStream |
|
2600 |
errorTo:errorStream |
|
2601 |
doLog:doLog |
|
2602 |
logHeader:nil |
|
2603 |
! |
|
2604 |
||
2605 |
executePerforceCommand:perforceCommand inDirectory:dirArg |
|
2606 |
inputFrom:inputStream outputTo:outputStream |
|
2607 |
errorTo:errorStream |
|
2608 |
doLog:doLog |
|
2609 |
logHeader:logHeader |
|
2610 |
"execute command and prepend perforce command name and global options. |
|
2611 |
execute command in the dirArg directory. |
|
2612 |
The doLog argument, if false supresses a logEntry to be added |
|
2613 |
in the cvs log file (used when reading / extracting history)" |
|
2614 |
||
2615 |
|command rslt pathOfDir errorString timeout errorMsgStream executeStream| |
|
2616 |
||
2617 |
dirArg notNil ifTrue:[ |
|
2618 |
pathOfDir := dirArg asFilename pathName. |
|
2619 |
]. |
|
2620 |
||
2621 |
command := self getCommandOptionsForCommand:perforceCommand. |
|
2622 |
Processor isDispatching ifFalse:[ |
|
2623 |
rslt := OperatingSystem executeCommand:command |
|
2624 |
inputFrom:inputStream |
|
2625 |
outputTo:outputStream |
|
2626 |
errorTo:errorStream |
|
2627 |
auxFrom:nil |
|
2628 |
inDirectory:pathOfDir |
|
2629 |
lineWise:true |
|
2630 |
onError:[:status| false]. |
|
2631 |
] ifTrue:[ |
|
2632 |
PerforceCommandSemaphore critical:[ |
|
2633 |
|p | |
|
2634 |
||
2635 |
p := [ |
|
2636 |
rslt := OperatingSystem executeCommand:command |
|
2637 |
inputFrom:inputStream |
|
2638 |
outputTo:outputStream |
|
2639 |
errorTo:errorStream |
|
2640 |
auxFrom:nil |
|
2641 |
inDirectory:pathOfDir |
|
2642 |
lineWise:true |
|
2643 |
onError:[:status| false]. |
|
2644 |
] fork. |
|
2645 |
||
2646 |
timeout := (p waitUntilTerminatedWithTimeout:300). |
|
2647 |
timeout ifTrue:[ |
|
2648 |
('PerforceSourceCodeManager [info]: command timeout: ' , command) errorPrintCR. |
|
2649 |
rslt := false. |
|
2650 |
errorString := 'Perforce command timeout'. |
|
2651 |
] ifFalse:[ |
|
2652 |
rslt ifFalse:[ |
|
2653 |
errorString := ('PerforceSourceCodeManager [info]: command failed: ' , command). |
|
2654 |
]. |
|
2655 |
]. |
|
2656 |
]. |
|
2657 |
]. |
|
2658 |
||
2659 |
PerforceSourceCodeManager verboseSourceCodeAccess == true ifTrue:[ |
|
2660 |
executeStream := WriteStream on:''. |
|
2661 |
executeStream nextPutAll:AbsoluteTime now printString. |
|
2662 |
executeStream cr. |
|
2663 |
executeStream nextPutAll:('Command <', command, '>'). |
|
2664 |
executeStream cr. |
|
2665 |
executeStream nextPutAll:('StdErr Output: <', errorStream contents, '>'). |
|
2666 |
executeStream cr. |
|
2667 |
executeStream nextPutAll:('StdOut Output: <', outputStream contents, '>'). |
|
2668 |
executeStream cr. |
|
2669 |
executeStream nextPutAll:('##############################'). |
|
2670 |
Transcript showCR:executeStream contents. |
|
2671 |
]. |
|
2672 |
rslt ifFalse:[ |
|
2673 |
doLog ifTrue:[ |
|
2674 |
errorMsgStream := WriteStream on:''. |
|
2675 |
logHeader notNil ifTrue:[ |
|
2676 |
errorMsgStream nextPutAll:'Error '. |
|
2677 |
errorMsgStream nextPutAll:logHeader. |
|
2678 |
errorMsgStream cr. |
|
2679 |
]. |
|
2680 |
timeout ifTrue:[ |
|
2681 |
errorMsgStream nextPutAll:('Timeout command <', command, '>'). |
|
2682 |
errorMsgStream cr. |
|
2683 |
] ifFalse:[ |
|
2684 |
errorMsgStream nextPutAll:('Command <', command, '>'). |
|
2685 |
errorMsgStream cr. |
|
2686 |
errorMsgStream nextPutAll:('Error output: ', errorStream contents). |
|
2687 |
outputStream contents notEmpty ifTrue:[ |
|
2688 |
errorMsgStream nextPutAll:('Output: ', outputStream contents). |
|
2689 |
]. |
|
2690 |
]. |
|
2691 |
self perforceError raiseErrorString:errorMsgStream contents. |
|
2692 |
SourceCodeManagerError isHandled ifTrue:[ |
|
2693 |
SourceCodeManagerError raiseErrorString:errorMsgStream contents. |
|
2694 |
]. |
|
2695 |
]. |
|
2696 |
]. |
|
2697 |
^ rslt. |
|
2698 |
! |
|
2699 |
||
2700 |
executePerforceCommand:perforceCommand inDirectory:dirArg |
|
2701 |
inputFrom:inputStream outputTo:outputStream |
|
2702 |
errorTo:errorStream |
|
2703 |
logHeader:logHeader |
|
2704 |
"execute command and prepend perforce command name and global options. |
|
2705 |
execute command in the dirArg directory. |
|
2706 |
The doLog argument, if false supresses a logEntry to be added |
|
2707 |
in the cvs log file (used when reading / extracting history)" |
|
2708 |
||
2709 |
^self executePerforceCommand:perforceCommand inDirectory:dirArg |
|
2710 |
inputFrom:inputStream outputTo:outputStream |
|
2711 |
errorTo:errorStream |
|
2712 |
doLog:true |
|
2713 |
logHeader:logHeader. |
|
2714 |
! |
|
2715 |
||
2716 |
getCommandOptionsForCommand:perforceCommand |
|
2717 |
||
2718 |
|commandStream executable port user password clientString| |
|
2719 |
||
2720 |
commandStream := WriteStream on:''. |
|
2721 |
executable := PerforceSourceCodeManager perforceExecutable. |
|
2722 |
(executable includes:Character space) ifTrue:[ |
|
2723 |
commandStream nextPut:$". |
|
2724 |
commandStream nextPutAll:executable. |
|
2725 |
commandStream nextPut:$". |
|
2726 |
] ifFalse:[ |
|
2727 |
commandStream nextPutAll:executable. |
|
2728 |
]. |
|
2729 |
commandStream space. |
|
2730 |
port := self perforceSettings at:#port ifAbsent:nil. |
|
2731 |
port notNil ifTrue:[ |
|
2732 |
commandStream space. |
|
2733 |
commandStream nextPutAll:'-p '. |
|
2734 |
commandStream nextPutAll:port. |
|
2735 |
commandStream space. |
|
2736 |
]. |
|
2737 |
clientString := self perforceSettings at:#client ifAbsent:nil. |
|
2738 |
clientString notNil ifTrue:[ |
|
2739 |
commandStream space. |
|
2740 |
commandStream nextPutAll:'-c '. |
|
2741 |
commandStream nextPutAll:clientString. |
|
2742 |
commandStream space. |
|
2743 |
]. |
|
2744 |
user := self perforceSettings at:#user ifAbsent:nil. |
|
2745 |
user notNil ifTrue:[ |
|
2746 |
commandStream space. |
|
2747 |
commandStream nextPutAll:'-u '. |
|
2748 |
commandStream nextPutAll:user. |
|
2749 |
commandStream space. |
|
2750 |
]. |
|
2751 |
password := self perforceSettings at:#password ifAbsent:nil. |
|
2752 |
password notNil ifTrue:[ |
|
2753 |
commandStream space. |
|
2754 |
commandStream nextPutAll:'-P '. |
|
2755 |
commandStream nextPutAll:password. |
|
2756 |
commandStream space. |
|
2757 |
]. |
|
2758 |
commandStream nextPutAll:perforceCommand. |
|
2759 |
||
2760 |
^ commandStream contents. |
|
2761 |
! ! |
|
2762 |
||
2763 |
!PerforceSourceCodeManagerUtilities::WorkSpace methodsFor:'dialogs & helpers'! |
|
2764 |
||
2765 |
checkinTroubleDialog:title message:message log:log abortable:abortable option:optionTitle |
|
2766 |
"trouble checking in - open a dialog" |
|
2767 |
||
2768 |
^ self |
|
2769 |
checkinTroubleDialog:title |
|
2770 |
message:message |
|
2771 |
log:log |
|
2772 |
abortable:abortable |
|
2773 |
option:optionTitle |
|
2774 |
option2:nil |
|
2775 |
||
2776 |
"Created: 10.12.1995 / 17:34:33 / cg" |
|
2777 |
"Modified: 12.9.1996 / 02:39:06 / cg" |
|
2778 |
! |
|
2779 |
||
2780 |
checkinTroubleDialog:title message:message log:log abortable:abortable option:optionTitle option2:optionTitle2 |
|
2781 |
^self |
|
2782 |
checkinTroubleDialog:title |
|
2783 |
message:message |
|
2784 |
log:log |
|
2785 |
abortable:abortable |
|
2786 |
option:optionTitle |
|
2787 |
option2:optionTitle2 |
|
2788 |
option3:nil |
|
2789 |
! |
|
2790 |
||
2791 |
checkinTroubleDialog:title message:message log:log abortable:abortable option:optionTitle option2:optionTitle2 option3:optionTitle3 |
|
2792 |
"trouble checking in - open a dialog" |
|
2793 |
||
2794 |
|l box list listView optionPressed option2Pressed option3Pressed| |
|
2795 |
||
2796 |
l := log collect:[:line | line withTabsExpanded]. |
|
2797 |
list := SelectionInList with:l. |
|
2798 |
||
2799 |
box := Dialog new. |
|
2800 |
box label:(title). |
|
2801 |
||
2802 |
(box addTextLabel:message) borderWidth:0. |
|
2803 |
||
2804 |
l asString notEmptyOrNil ifTrue:[ |
|
2805 |
listView := SelectionInListView on:list. |
|
2806 |
listView disable. |
|
2807 |
listView height:(listView heightOfContents max:250). |
|
2808 |
box addComponent:(HVScrollableView forView:listView miniScrollerH:true) tabable:false. |
|
2809 |
box addVerticalSpace. |
|
2810 |
]. |
|
2811 |
||
2812 |
abortable ifTrue:[ |
|
2813 |
box addAbortButton |
|
2814 |
]. |
|
2815 |
optionTitle notNil ifTrue:[ |
|
2816 |
box addOkButton:(Button label:optionTitle action:[optionPressed := true. box hide]). |
|
2817 |
]. |
|
2818 |
optionTitle2 notNil ifTrue:[ |
|
2819 |
box addOkButton:(Button label:optionTitle2 action:[option2Pressed := true. box hide]). |
|
2820 |
]. |
|
2821 |
optionTitle3 notNil ifTrue:[ |
|
2822 |
box addOkButton:(Button label:optionTitle3 action:[option3Pressed := true. box hide]). |
|
2823 |
]. |
|
2824 |
box addOkButton. |
|
2825 |
||
2826 |
box extent:(box preferredExtent). |
|
2827 |
box minExtent:box extent. |
|
2828 |
box maxExtent:box extent. |
|
2829 |
||
2830 |
box open. |
|
2831 |
box destroy. |
|
2832 |
optionPressed == true ifTrue:[^ #option]. |
|
2833 |
option2Pressed == true ifTrue:[^ #option2]. |
|
2834 |
option3Pressed == true ifTrue:[^ #option3]. |
|
2835 |
^ box accepted |
|
2836 |
||
2837 |
" |
|
2838 |
| changesAsLogged | |
|
2839 |
changesAsLogged := OrderedCollection new. |
|
2840 |
1 to:10 do:[:each| |
|
2841 |
changesAsLogged add:('Hallo', each printString). |
|
2842 |
]. |
|
2843 |
changesAsLogged := OrderedCollection new. |
|
2844 |
self checkinTroubleDialog:'Version conflict' |
|
2845 |
message:'Message Message Message Message Message Message Message Message Message Message Message Message Message Message' |
|
2846 |
log:changesAsLogged |
|
2847 |
abortable:false |
|
2848 |
option:'show conflicts' |
|
2849 |
option2:'resolve conflicts' |
|
2850 |
" |
|
2851 |
! |
|
2852 |
||
2853 |
diffTextComment |
|
2854 |
||
2855 |
|ws| |
|
2856 |
||
2857 |
ws := WriteStream on:''. |
|
2858 |
ws nextPutLine:'"/ ***************************************************************'. |
|
2859 |
ws nextPutLine:'"/ This text contains your current versions code (blue)'. |
|
2860 |
ws nextPutLine:'"/ merged with the conflicting code as found in the repository (red) which resulted'. |
|
2861 |
ws nextPutLine:'"/ from some other checkin.'. |
|
2862 |
ws nextPutLine:'"/ Each such conflict is surrounded by green text (like this paragraph).'. |
|
2863 |
ws nextPutLine:'"/ '. |
|
2864 |
ws nextPutLine:'"/ Please have a look at ALL the conflicts and fix things as appropriate.'. |
|
2865 |
ws nextPutLine:'"/ Delete the green lines as a confirmation - I will not checkin the changed text,'. |
|
2866 |
ws nextPutLine:'"/ unless no more green parts are present. This includes this comment at the top.'. |
|
2867 |
ws nextPutLine:'"/ ***************************************************************'. |
|
2868 |
^ ws contents |
|
2869 |
! |
|
2870 |
||
2871 |
getRevisionForLabel:label depotPath:depotPath |
|
2872 |
||
2873 |
||
2874 |
|perforceCommand outputStream errorStream result inStream line depotAndRevision| |
|
2875 |
||
2876 |
perforceCommand := ('files "@' , label, '"'). |
|
2877 |
outputStream := ReadWriteStream on:''. |
|
2878 |
errorStream := ReadWriteStream on:''. |
|
2879 |
result := self executePerforceCommand:perforceCommand inDirectory:self root |
|
2880 |
inputFrom:nil outputTo:outputStream |
|
2881 |
errorTo:errorStream |
|
2882 |
logHeader:('getting revision for label ', label, '.'). |
|
2883 |
result ifFalse:[ |
|
2884 |
^ nil |
|
2885 |
]. |
|
2886 |
inStream := ReadStream on:(outputStream contents). |
|
2887 |
[inStream atEnd not] whileTrue:[ |
|
2888 |
line:= inStream nextLine. |
|
2889 |
line notEmptyOrNil ifTrue:[ |
|
2890 |
(line startsWith:depotPath) ifTrue:[ |
|
2891 |
depotAndRevision := line asCollectionOfWords first. |
|
2892 |
depotAndRevision := depotAndRevision asCollectionOfSubstringsSeparatedBy:$#. |
|
2893 |
^ depotAndRevision second |
|
2894 |
]. |
|
2895 |
]. |
|
2896 |
]. |
|
2897 |
^nil |
|
2898 |
! |
|
2899 |
||
2900 |
messageForChangesInClass:class revision:revisionNumber |
|
2901 |
||
2902 |
|msgStream| |
|
2903 |
||
2904 |
msgStream := WriteStream on:''. |
|
2905 |
msgStream nextPutAll:'The source of '; nextPutAll:class className; nextPutAll:'has been changed in the meanwhile as listed below.'. |
|
2906 |
msgStream cr. |
|
2907 |
msgStream nextPutAll:'If you continue, your new changes (based upon rev. '; nextPutAll:revisionNumber printString; nextPutAll:') will be MERGED'. |
|
2908 |
msgStream nextPutAll:'into the newest revision. This will combine the other version with your changes'. |
|
2909 |
msgStream nextPutAll:'into a new common revision which may be different from both.'. |
|
2910 |
msgStream nextPutAll:'Although this is a nice feature, it may fail to create the expected result in certain situations.'. |
|
2911 |
msgStream cr. |
|
2912 |
msgStream nextPutAll:'You should carefully check the result - by comparing the current version with the'. |
|
2913 |
msgStream nextPutAll:'most recent version in the repository. If that does not contain an acceptable version,'. |
|
2914 |
msgStream nextPutAll:'change methods as required and check in again.'. |
|
2915 |
msgStream nextPutAll:'Be aware, that after that, the actual repository version is different from your current classes,'. |
|
2916 |
msgStream nextPutAll:'and you should update your class from the repository.'. |
|
2917 |
msgStream cr. |
|
2918 |
msgStream nextPutAll:'Continue ?'. |
|
2919 |
^ msgStream contents |
|
2920 |
! |
|
2921 |
||
2922 |
messageForConflictsInClass:definitionClass revision:revisionNumber |
|
2923 |
||
2924 |
|msgStream| |
|
2925 |
||
2926 |
msgStream := WriteStream on:''. |
|
2927 |
msgStream nextPutAll:'The source of '; nextPutAll:definitionClass className; nextPutAll:' has been changed in the meanwhile as listed below.'. |
|
2928 |
msgStream cr. |
|
2929 |
msgStream nextPutAll:'Your new changes (based upon rev. '; nextPutAll:revisionNumber printString; nextPutAll:') CONFLICT with those changes'. |
|
2930 |
msgStream cr. |
|
2931 |
msgStream nextPutAll:'You should fix things by comparing your class with the most recent repository version'. |
|
2932 |
msgStream nextPutAll:'and change your methods avoiding conflicts. The checkin again.'. |
|
2933 |
msgStream cr. |
|
2934 |
^ msgStream contents |
|
2935 |
! |
|
2936 |
||
2937 |
messageForNoChangesInClass:class |
|
2938 |
||
2939 |
|msgStream| |
|
2940 |
||
2941 |
msgStream := WriteStream on:''. |
|
2942 |
msgStream nextPutAll:'The source of '; nextPutAll:class className; nextPutAll:'has been changed in the meanwhile as listed below.'. |
|
2943 |
msgStream cr. |
|
2944 |
msgStream nextPutAll:'I have merged your version with the newest repository version,'. |
|
2945 |
msgStream nextPutAll:'and found no differences between the result and your current version'. |
|
2946 |
msgStream nextPutAll:'(i.e. your version seemed up-to-date).'. |
|
2947 |
^ msgStream contents |
|
2948 |
! |
|
2949 |
||
2950 |
updatedRevisionStringOf:aClass forRevision:newRevision with:originalVersionString |
|
2951 |
"update a revision string" |
|
2952 |
||
2953 |
|versionInfo packageID module foundView packagePath fullFilename depotPath sourceInfo classFileName| |
|
2954 |
||
2955 |
originalVersionString isEmptyOrNil ifTrue:[ |
|
2956 |
packageID := PackageId from:aClass package. |
|
2957 |
module := packageID module. |
|
2958 |
foundView := self getViewForPackage:module. |
|
2959 |
packagePath := Smalltalk packageDirectoryForPackageId:module. |
|
2960 |
sourceInfo := PerforceSourceCodeManager sourceInfoOfClass:aClass. |
|
2961 |
sourceInfo isNil ifTrue:[ |
|
2962 |
PerforceSourceCodeManager reportError:('no sourceInfo for class: ' , aClass name). |
|
2963 |
^ nil |
|
2964 |
]. |
|
2965 |
classFileName := PerforceSourceCodeManager containerFromSourceInfo:sourceInfo. |
|
2966 |
fullFilename := (packagePath construct:packageID directory) construct:classFileName. |
|
2967 |
depotPath := foundView getDepotPathForLocalPath:fullFilename pathName. |
|
2968 |
||
2969 |
versionInfo := PerforceSourceCodeManager versionInfoClass fromRepositoryPathName:depotPath. |
|
2970 |
] ifFalse:[ |
|
2971 |
versionInfo := PerforceSourceCodeManager versionInfoClass fromRCSString:originalVersionString. |
|
2972 |
]. |
|
2973 |
versionInfo revision:newRevision printString. |
|
2974 |
^ versionInfo getVersionString. |
|
2975 |
||
2976 |
||
2977 |
||
2978 |
" |
|
2979 |
self updatedRevisionStringOf:nil |
|
2980 |
forRevision:'6' |
|
2981 |
with:'$','Header','$' |
|
2982 |
" |
|
2983 |
! ! |
|
2984 |
||
2985 |
!PerforceSourceCodeManagerUtilities::WorkSpace methodsFor:'initialization'! |
|
2986 |
||
2987 |
initialize |
|
2988 |
||
2989 |
PerforceCommandSemaphore := Semaphore new:10. |
|
2990 |
! ! |
|
2991 |
||
2992 |
!PerforceSourceCodeManagerUtilities::WorkSpace methodsFor:'queries'! |
|
2993 |
||
2994 |
getDepotPathForLocalPath:aFilename |
|
2995 |
|view| |
|
2996 |
||
2997 |
view := self getViewForPath:aFilename. |
|
2998 |
view isNil ifTrue:[ |
|
2999 |
^nil |
|
3000 |
]. |
|
3001 |
^view getDepotPathForLocalPath:aFilename |
|
3002 |
! |
|
3003 |
||
3004 |
getLocalPathForDepotPath:depotPath |
|
3005 |
||
3006 |
|view| |
|
3007 |
||
3008 |
view := self getViewForDepotPath:depotPath. |
|
3009 |
view notNil ifTrue:[ |
|
3010 |
^view getLocalPathForDepotPath:depotPath. |
|
3011 |
]. |
|
3012 |
^nil |
|
3013 |
" |
|
3014 |
| workSpace tempWorkSpace | |
|
3015 |
workSpace := PerforceSourceCodeManager getWorkSpaceForPackage:'applistx'. |
|
3016 |
tempWorkSpace := workSpace temporaryWorkSpace. |
|
3017 |
tempWorkSpace getLocalPathForDepotPath:'//depot/applistx/util/libDataType/ActionLQualifier.st' |
|
3018 |
" |
|
3019 |
! |
|
3020 |
||
3021 |
getTemporaryFilenameFor:aFilename |
|
3022 |
||
3023 |
|myView checkInPart fullTempFilename| |
|
3024 |
||
3025 |
myView := self getViewForPath:aFilename. |
|
3026 |
self temporaryWorkSpace isNil ifTrue:[ |
|
3027 |
^nil |
|
3028 |
]. |
|
3029 |
self temporaryWorkSpace views do:[:aView| |
|
3030 |
myView depot = aView depot ifTrue:[ |
|
3031 |
checkInPart := PerforceSourceCodeManager getTrailungPathNameFrom:aFilename with:myView localPathName. |
|
3032 |
fullTempFilename := aView localPathName asFilename construct:checkInPart. |
|
3033 |
^fullTempFilename |
|
3034 |
]. |
|
3035 |
]. |
|
3036 |
^nil |
|
3037 |
! |
|
3038 |
||
3039 |
getTemporaryViewForPackage:aPackage |
|
3040 |
||
3041 |
|myView| |
|
3042 |
||
3043 |
myView := self getViewForPackage:aPackage. |
|
3044 |
self temporaryWorkSpace isNil ifTrue:[ |
|
3045 |
^nil |
|
3046 |
]. |
|
3047 |
self temporaryWorkSpace views do:[:aView| |
|
3048 |
myView depot = aView depot ifTrue:[ |
|
3049 |
^ aView |
|
3050 |
]. |
|
3051 |
]. |
|
3052 |
! |
|
3053 |
||
3054 |
getViewForDepotPath:depotPath |
|
3055 |
||
3056 |
|myHostName| |
|
3057 |
||
3058 |
myHostName := OperatingSystem getHostName. |
|
3059 |
(myHostName endsWith:OperatingSystem getDomainName) ifTrue:[ |
|
3060 |
myHostName := myHostName copyTo:(myHostName size - (OperatingSystem getDomainName size + 1)). |
|
3061 |
]. |
|
3062 |
||
3063 |
(myHostName asLowercase startsWith:(self host asLowercase)) ifFalse:[ |
|
3064 |
self perforceError raiseErrorString:('Client ', (perforceSettings at:#client), ' is made for host ', self host, ' and not for ', myHostName). |
|
3065 |
^ nil |
|
3066 |
]. |
|
3067 |
self views do:[:aView | |
|
3068 |
(aView hasViewForDepotPath:depotPath) ifTrue:[ |
|
3069 |
^aView |
|
3070 |
]. |
|
3071 |
]. |
|
3072 |
self perforceError raiseErrorString:('Client ', (perforceSettings at:#client), ' have no View for depot path ', depotPath). |
|
3073 |
^ nil |
|
3074 |
! |
|
3075 |
||
3076 |
getViewForPackage:aPackage |
|
3077 |
||
3078 |
|locPackage packagePath| |
|
3079 |
||
3080 |
aPackage isNil ifTrue:[ |
|
3081 |
locPackage := Smalltalk package. |
|
3082 |
] ifFalse:[ |
|
3083 |
locPackage := aPackage. |
|
3084 |
]. |
|
3085 |
packagePath := self packageDirectoryForPackageId:locPackage. |
|
3086 |
packagePath notNil ifTrue:[ |
|
3087 |
packagePath := packagePath pathName. |
|
3088 |
] ifFalse:[ |
|
3089 |
self perforceError raiseErrorString:('no package path for ', aPackage printString). |
|
3090 |
^nil |
|
3091 |
]. |
|
3092 |
^self getViewForPath:packagePath |
|
3093 |
||
3094 |
" |
|
3095 |
PerforceSourceCodeManager perforceWorkspaces first value getViewForPackage:'applistx:application/rtdbInspector/builder' |
|
3096 |
" |
|
3097 |
! |
|
3098 |
||
3099 |
getViewForPath:aPathName |
|
3100 |
||
3101 |
|myHostName| |
|
3102 |
||
3103 |
myHostName := OperatingSystem getHostName. |
|
3104 |
(myHostName endsWith:OperatingSystem getDomainName) ifTrue:[ |
|
3105 |
myHostName := myHostName copyTo:(myHostName size - (OperatingSystem getDomainName size + 1)). |
|
3106 |
]. |
|
3107 |
||
3108 |
(myHostName asLowercase startsWith:(self host asLowercase)) ifFalse:[ |
|
3109 |
self perforceError raiseErrorString:('Client ', (perforceSettings at:#client), ' is made for host ', self host, ' and not for ', myHostName). |
|
3110 |
^ nil |
|
3111 |
]. |
|
3112 |
self views do:[:aView | |
|
3113 |
(aView hasViewForPath:aPathName) ifTrue:[ |
|
3114 |
^aView |
|
3115 |
]. |
|
3116 |
]. |
|
3117 |
self perforceError raiseErrorString:('Client ', (perforceSettings at:#client), ' have no View for path ', aPathName). |
|
3118 |
^ nil |
|
3119 |
! |
|
3120 |
||
3121 |
hasViewForPackage:aPackage |
|
3122 |
||
3123 |
^(self getViewForPackage:aPackage) notNil |
|
3124 |
! |
|
3125 |
||
3126 |
hasViewForPath:aPathName |
|
3127 |
||
3128 |
^(self getViewForPath:aPathName) notNil |
|
3129 |
! |
|
3130 |
||
3131 |
packageDirectoryForPackageId:package |
|
3132 |
||
3133 |
^self packageDirectoryForPackageId:package checkParents:true |
|
3134 |
||
3135 |
" |
|
3136 |
PerforceSourceCodeManager perforceWorkspaces first value getViewForPackage:'applisddtx:application/rtdbInspector/builder' |
|
3137 |
" |
|
3138 |
! |
|
3139 |
||
3140 |
packageDirectoryForPackageId:package checkParents:checkParents |
|
3141 |
||
3142 |
|locPackage packagePath| |
|
3143 |
||
3144 |
locPackage := package copyReplaceAll:$: with:$/. |
|
3145 |
[ packagePath isNil ] whileTrue:[ |
|
3146 |
packagePath := Smalltalk packageDirectoryForPackageId:locPackage. |
|
3147 |
packagePath notNil ifTrue:[ |
|
3148 |
^packagePath |
|
3149 |
]. |
|
3150 |
locPackage := locPackage asFilename directoryName. |
|
3151 |
]. |
|
3152 |
^nil |
|
3153 |
||
3154 |
" |
|
3155 |
PerforceSourceCodeManager perforceWorkspaces first value getViewForPackage:'applisddtx:application/rtdbInspector/builder' |
|
3156 |
" |
|
3157 |
! |
|
3158 |
||
3159 |
perforceError |
|
3160 |
||
3161 |
^ PerforceSourceCodeManager perforceError |
|
3162 |
! |
|
3163 |
||
3164 |
perforceSettingsString |
|
3165 |
||
3166 |
^ PerforceSourceCodeManager getStringFromPerforceSettings:self perforceSettings |
|
3167 |
! |
|
3168 |
||
3169 |
readRevisionLogEntryFromStream:inStream |
|
3170 |
"read and parse a single revision info-entry from the cvs log output. |
|
3171 |
Return nil on end. |
|
3172 |
||
3173 |
The returned information is a structure (IdentityDictionary) |
|
3174 |
filled with: |
|
3175 |
#revision -> the revision string |
|
3176 |
#author -> who checked that revision into the repository |
|
3177 |
#date -> when was it checked in |
|
3178 |
#state -> the RCS state |
|
3179 |
#numberOfChangedLines -> the number of changed line w.r.t the previous |
|
3180 |
#logMessage -> the checkIn log message |
|
3181 |
" |
|
3182 |
||
3183 |
|revLine1 atEnd| |
|
3184 |
||
3185 |
atEnd := false. |
|
3186 |
||
3187 |
revLine1 := inStream nextLine. |
|
3188 |
^ self readRevisionLogEntryFromString:revLine1. |
|
3189 |
! |
|
3190 |
||
3191 |
readRevisionLogEntryFromString:revLine1 |
|
3192 |
"read and parse a single revision info-entry from the cvs log output. |
|
3193 |
Return nil on end. |
|
3194 |
||
3195 |
The returned information is a structure (IdentityDictionary) |
|
3196 |
filled with: |
|
3197 |
#revision -> the revision string |
|
3198 |
#author -> who checked that revision into the repository |
|
3199 |
#date -> when was it checked in |
|
3200 |
#state -> the RCS state |
|
3201 |
#numberOfChangedLines -> the number of changed line w.r.t the previous |
|
3202 |
#logMessage -> the checkIn log message |
|
3203 |
" |
|
3204 |
||
3205 |
| record revisionLineElements noOfRevisionLineElements posText| |
|
3206 |
||
3207 |
(revLine1 notNil) ifTrue:[ |
|
3208 |
record := IdentityDictionary new. |
|
3209 |
revisionLineElements := revLine1 asCollectionOfWords. |
|
3210 |
noOfRevisionLineElements := revisionLineElements size. |
|
3211 |
noOfRevisionLineElements > 1 ifTrue:[ |
|
3212 |
record at:#revision put:((revisionLineElements at:2) copyFrom:2). |
|
3213 |
]. |
|
3214 |
noOfRevisionLineElements > 8 ifTrue:[ |
|
3215 |
record at:#author put:(revisionLineElements at:9). |
|
3216 |
]. |
|
3217 |
noOfRevisionLineElements > 6 ifTrue:[ |
|
3218 |
record at:#date put:(revisionLineElements at:7). |
|
3219 |
]. |
|
3220 |
noOfRevisionLineElements > 4 ifTrue:[ |
|
3221 |
record at:#state put:(revisionLineElements at:5). |
|
3222 |
]. |
|
3223 |
noOfRevisionLineElements > 10 ifTrue:[ |
|
3224 |
posText := 0. |
|
3225 |
1 to:9 do:[:ele| posText := posText + (revisionLineElements at:ele) size + 1]. |
|
3226 |
record at:#logMessage put:(revLine1 copyFrom:posText). |
|
3227 |
]. |
|
3228 |
]. |
|
3229 |
^record. |
|
3230 |
! |
|
3231 |
||
3232 |
temporaryClientName |
|
3233 |
||
3234 |
^ 'stxCheckinWorkSpace_', self owner, self host. |
|
3235 |
! ! |
|
3236 |
||
3237 |
!PerforceSourceCodeManagerUtilities::WorkSpace methodsFor:'read'! |
|
3238 |
||
3239 |
getDefinitionFromServer |
|
3240 |
|cmd myBaseDirectory outputStream errorStream rslt clients inStream line words| |
|
3241 |
||
3242 |
cmd := 'clients -u ' , (self perforceSettings at:#user). |
|
3243 |
myBaseDirectory := (Filename currentDirectory asAbsoluteFilename) pathName. |
|
3244 |
outputStream := WriteStream on:''. |
|
3245 |
errorStream := WriteStream on:''. |
|
3246 |
rslt := self |
|
3247 |
executePerforceCommand:cmd |
|
3248 |
inDirectory:myBaseDirectory |
|
3249 |
inputFrom:nil |
|
3250 |
outputTo:outputStream |
|
3251 |
errorTo:errorStream |
|
3252 |
logHeader:('getting workspaces '). |
|
3253 |
rslt ifFalse:[ |
|
3254 |
self perforceError raiseErrorString:(outputStream contents, errorStream contents). |
|
3255 |
^false |
|
3256 |
]. |
|
3257 |
clients := OrderedCollection new. |
|
3258 |
inStream := ReadStream on:(outputStream contents). |
|
3259 |
[ inStream atEnd not ] whileTrue:[ |
|
3260 |
line := inStream nextLine. |
|
3261 |
line notEmptyOrNil ifTrue:[ |
|
3262 |
words := line asCollectionOfWords. |
|
3263 |
words size > 1 ifTrue:[ |
|
3264 |
clients add:(words at:2). |
|
3265 |
]. |
|
3266 |
]. |
|
3267 |
]. |
|
3268 |
(clients includes:(self perforceSettings at:#client ifAbsent:nil)) ifFalse:[ |
|
3269 |
self perforceError raiseErrorString:('No workspace ', (self perforceSettings at:#client ifAbsent:'?'), ' for user ', (self perforceSettings at:#user ifAbsent:'?'), ' on ', (self perforceSettings at:#port ifAbsent:'?'), ' available.'). |
|
3270 |
]. |
|
3271 |
||
3272 |
cmd := 'client -o'. |
|
3273 |
myBaseDirectory := (Filename currentDirectory asAbsoluteFilename) pathName. |
|
3274 |
outputStream reset. |
|
3275 |
errorStream reset. |
|
3276 |
rslt := self |
|
3277 |
executePerforceCommand:cmd |
|
3278 |
inDirectory:myBaseDirectory |
|
3279 |
inputFrom:nil |
|
3280 |
outputTo:outputStream |
|
3281 |
errorTo:errorStream |
|
3282 |
logHeader:('getting empty workspace definition '). |
|
3283 |
rslt ifFalse:[ |
|
3284 |
self perforceError raiseErrorString:(outputStream contents, errorStream contents). |
|
3285 |
^false |
|
3286 |
]. |
|
3287 |
inStream := ReadStream on:(outputStream contents). |
|
3288 |
self getWorkSpaceFromClientSpecFrom:inStream. |
|
3289 |
^true |
|
3290 |
||
3291 |
" |
|
3292 |
(PerforceSourceCodeManager getWorkSpaceForPackage:'applistx') getDefinitionFromServer |
|
3293 |
" |
|
3294 |
! |
|
3295 |
||
3296 |
getWorkSpaceFromClientSpecFrom:inStream |
|
3297 |
" |
|
3298 |
get the workspace definition from perforce client command output |
|
3299 |
" |
|
3300 |
||
3301 |
|line nextKey | |
|
3302 |
||
3303 |
[inStream atEnd not] whileTrue:[ |
|
3304 |
line:= inStream nextLine. |
|
3305 |
line notEmptyOrNil ifTrue:[ |
|
3306 |
line first = $# ifFalse:[ |
|
3307 |
(line startsWith:'Owner:') ifTrue:[ |
|
3308 |
self owner:line asCollectionOfWords second. |
|
3309 |
]. |
|
3310 |
(line startsWith:'Host:') ifTrue:[ |
|
3311 |
self host:line asCollectionOfWords second. |
|
3312 |
]. |
|
3313 |
(line startsWith:'Client:') ifTrue:[ |
|
3314 |
self client:(line asCollectionOfWords second). |
|
3315 |
]. |
|
3316 |
(line startsWith:'Root:') ifTrue:[ |
|
3317 |
self root:((line copyFrom:('Root:' size + 1)) withoutLeadingSeparators). |
|
3318 |
]. |
|
3319 |
(line startsWith:'View:') ifTrue:[ |
|
3320 |
nextKey := false. |
|
3321 |
[nextKey not and:[inStream atEnd not]] whileTrue:[ |
|
3322 |
line:= inStream nextLine. |
|
3323 |
line notEmptyOrNil ifTrue:[ |
|
3324 |
line first isSeparator ifTrue:[ |
|
3325 |
self views add:(View newFromLine:line workspace:self). |
|
3326 |
] ifFalse:[ |
|
3327 |
nextKey := true. |
|
3328 |
]. |
|
3329 |
]. |
|
3330 |
]. |
|
3331 |
]. |
|
3332 |
]. |
|
3333 |
]. |
|
3334 |
]. |
|
3335 |
! |
|
3336 |
||
3337 |
newWorkSpaceFor:settingsString |
|
3338 |
settingsString isNil ifTrue:[ |
|
3339 |
^ nil |
|
3340 |
]. |
|
3341 |
self perforceSettings:(PerforceSourceCodeManager |
|
3342 |
getPerforceSettingsFromString:settingsString). |
|
3343 |
self getDefinitionFromServer ifTrue:[ |
|
3344 |
^self |
|
3345 |
]. |
|
3346 |
^nil |
|
3347 |
! |
|
3348 |
||
3349 |
newWorkSpaceForSettings:settingsDict |
|
3350 |
||
3351 |
settingsDict isNil ifTrue:[ |
|
3352 |
self perforceError raiseErrorString:('nil settings when creating workspace'). |
|
3353 |
^ self |
|
3354 |
]. |
|
3355 |
self perforceSettings:settingsDict. |
|
3356 |
! ! |
|
3357 |
||
3358 |
!PerforceSourceCodeManagerUtilities::WorkSpace::View class methodsFor:'instance creation'! |
|
3359 |
||
3360 |
newFromLine:aLine workspace:aWorkspaceDefinition |
|
3361 |
||
3362 |
|instance| |
|
3363 |
||
3364 |
instance := self new. |
|
3365 |
instance newFromLine:aLine. |
|
3366 |
instance workspace:aWorkspaceDefinition. |
|
3367 |
^instance |
|
3368 |
! ! |
|
3369 |
||
3370 |
!PerforceSourceCodeManagerUtilities::WorkSpace::View methodsFor:'accessing'! |
|
3371 |
||
3372 |
depot |
|
3373 |
^ depot |
|
3374 |
! |
|
3375 |
||
3376 |
depot:something |
|
3377 |
depot := something. |
|
3378 |
! |
|
3379 |
||
3380 |
local |
|
3381 |
^ local |
|
3382 |
! |
|
3383 |
||
3384 |
local:something |
|
3385 |
local := something. |
|
3386 |
! |
|
3387 |
||
3388 |
type |
|
3389 |
||
3390 |
" there special types for views |
|
3391 |
+ for added to the same directory |
|
3392 |
- exclude this view |
|
3393 |
and standard view |
|
3394 |
" |
|
3395 |
||
3396 |
^ type |
|
3397 |
! |
|
3398 |
||
3399 |
type:something |
|
3400 |
type := something. |
|
3401 |
! |
|
3402 |
||
3403 |
workspace |
|
3404 |
^ workspace |
|
3405 |
! |
|
3406 |
||
3407 |
workspace:something |
|
3408 |
workspace := something. |
|
3409 |
! ! |
|
3410 |
||
3411 |
!PerforceSourceCodeManagerUtilities::WorkSpace::View methodsFor:'queries'! |
|
3412 |
||
3413 |
getDepotPathForLocalPath:aFilename |
|
3414 |
|depotPath restPath unixRestPath| |
|
3415 |
||
3416 |
(self hasViewForPath:aFilename) ifFalse:[ |
|
3417 |
^nil |
|
3418 |
]. |
|
3419 |
depotPath := depot. |
|
3420 |
(depot endsWith:'...') ifTrue:[ |
|
3421 |
depotPath := depot copyTo:(depot size - 3). |
|
3422 |
] ifFalse:[ |
|
3423 |
depotPath := depot. |
|
3424 |
]. |
|
3425 |
restPath := PerforceSourceCodeManager getTrailungPathNameFrom:aFilename with:self localPathName. |
|
3426 |
unixRestPath := (UnixFilename fromComponents:(restPath asFilename components)) pathName. |
|
3427 |
depotPath := depotPath, unixRestPath. |
|
3428 |
^depotPath. |
|
3429 |
! |
|
3430 |
||
3431 |
getLocalPathForDepotPath:depotPath |
|
3432 |
|viewDepotPath restPath| |
|
3433 |
||
3434 |
(self hasViewForDepotPath:depotPath) ifFalse:[ |
|
3435 |
^nil |
|
3436 |
]. |
|
3437 |
viewDepotPath := depot. |
|
3438 |
(depot endsWith:'...') ifTrue:[ |
|
3439 |
viewDepotPath := depot copyTo:(depot size - 3). |
|
3440 |
] ifFalse:[ |
|
3441 |
viewDepotPath := depot. |
|
3442 |
]. |
|
3443 |
restPath := PerforceSourceCodeManager getTrailungPathNameFrom:depotPath with:viewDepotPath. |
|
3444 |
^ (self localPathName asFilename construct:restPath) pathName. |
|
3445 |
! |
|
3446 |
||
3447 |
hasViewForDepotPath:depotPath |
|
3448 |
||
3449 |
|viewDepotPath| |
|
3450 |
||
3451 |
depotPath isEmptyOrNil ifTrue:[ |
|
3452 |
^ false. |
|
3453 |
]. |
|
3454 |
viewDepotPath := depot. |
|
3455 |
(depot endsWith:'...') ifTrue:[ |
|
3456 |
viewDepotPath := depot copyTo:(depot size - 3). |
|
3457 |
] ifFalse:[ |
|
3458 |
viewDepotPath := depot. |
|
3459 |
]. |
|
3460 |
(PerforceSourceCodeManager path:depotPath hasSamePrefixLikePath:viewDepotPath) ifFalse:[ |
|
3461 |
^false |
|
3462 |
]. |
|
3463 |
^true |
|
3464 |
! |
|
3465 |
||
3466 |
hasViewForPath:aPathname |
|
3467 |
||
3468 |
aPathname isEmptyOrNil ifTrue:[ |
|
3469 |
^ false. |
|
3470 |
]. |
|
3471 |
(PerforceSourceCodeManager path:aPathname hasSamePrefixLikePath:self localPathName) ifFalse:[ |
|
3472 |
^false |
|
3473 |
]. |
|
3474 |
^true |
|
3475 |
! |
|
3476 |
||
3477 |
localPathName |
|
3478 |
||
3479 |
|indexOfClientString localPathName| |
|
3480 |
||
3481 |
(local endsWith:'...') ifTrue:[ |
|
3482 |
localPathName := local copyTo:(local size -3). |
|
3483 |
] ifFalse:[ |
|
3484 |
localPathName := local. |
|
3485 |
]. |
|
3486 |
indexOfClientString := local findString:workspace client. |
|
3487 |
indexOfClientString == 0 ifTrue:[ |
|
3488 |
^workspace root. |
|
3489 |
]. |
|
3490 |
localPathName := workspace root asFilename construct:(localPathName copyFrom:(indexOfClientString + workspace client size)). |
|
3491 |
^localPathName pathName |
|
3492 |
! ! |
|
3493 |
||
3494 |
!PerforceSourceCodeManagerUtilities::WorkSpace::View methodsFor:'reading'! |
|
3495 |
||
3496 |
newFromLine:aLine |
|
3497 |
||
3498 |
|words firstIndex secondIndex theLine| |
|
3499 |
||
3500 |
theLine := aLine withoutLeadingSeparators. |
|
3501 |
theLine := theLine withoutTrailingSeparators. |
|
3502 |
theLine isEmpty ifTrue:[ |
|
3503 |
^self |
|
3504 |
]. |
|
3505 |
theLine first == $+ ifTrue:[ |
|
3506 |
type := #+. |
|
3507 |
theLine := theLine copyFrom:2. |
|
3508 |
]. |
|
3509 |
theLine first == $- ifTrue:[ |
|
3510 |
type := #-. |
|
3511 |
theLine := theLine copyFrom:2. |
|
3512 |
]. |
|
3513 |
(theLine includes:$") ifTrue:[ |
|
3514 |
"oops we have space directories search for quotes" |
|
3515 |
||
3516 |
firstIndex := theLine indexOf:$" startingAt:1. |
|
3517 |
firstIndex == 1 ifTrue:[ |
|
3518 |
secondIndex := theLine indexOf:$" startingAt:firstIndex + 1. |
|
3519 |
depot := theLine copyFrom:firstIndex + 1 to:secondIndex - 1. |
|
3520 |
firstIndex := theLine indexOf:$" startingAt:secondIndex + 1. |
|
3521 |
secondIndex := theLine indexOf:$" startingAt:firstIndex + 1. |
|
3522 |
local := theLine copyFrom:firstIndex + 1 to:secondIndex - 1. |
|
3523 |
] ifFalse:[ |
|
3524 |
depot := (theLine copyTo:firstIndex - 1) withoutTrailingSeparators. |
|
3525 |
local := theLine copyFrom:firstIndex + 1 to:(theLine size - 1). |
|
3526 |
]. |
|
3527 |
] ifFalse:[ |
|
3528 |
words := theLine asCollectionOfWords. |
|
3529 |
depot := words first. |
|
3530 |
local := words second. |
|
3531 |
]. |
|
3532 |
||
3533 |
" |
|
3534 |
View newFromLine:ws contents. |
|
3535 |
" |
|
3536 |
! ! |
|
3537 |
||
3538 |
!PerforceSourceCodeManagerUtilities class methodsFor:'documentation'! |
|
3539 |
||
3540 |
version |
|
12725
93efe8fda21c
class: PerforceSourceCodeManagerUtilities
Claus Gittinger <cg@exept.de>
parents:
12702
diff
changeset
|
3541 |
^ '$Header: /cvs/stx/stx/libtool/PerforceSourceCodeManagerUtilities.st,v 1.4 2013-04-27 12:56:56 cg Exp $' |
11532 | 3542 |
! |
3543 |
||
3544 |
version_CVS |
|
12725
93efe8fda21c
class: PerforceSourceCodeManagerUtilities
Claus Gittinger <cg@exept.de>
parents:
12702
diff
changeset
|
3545 |
^ '$Header: /cvs/stx/stx/libtool/PerforceSourceCodeManagerUtilities.st,v 1.4 2013-04-27 12:56:56 cg Exp $' |
11532 | 3546 |
! ! |
12702
2759bbb8d06b
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
11959
diff
changeset
|
3547 |