56 |
61 |
57 "Created: / 01-06-2012 / 11:13:49 / cg" |
62 "Created: / 01-06-2012 / 11:13:49 / cg" |
58 ! ! |
63 ! ! |
59 |
64 |
60 !PerforceSourceCodeManagerUtilities methodsFor:'utilities-cvs'! |
65 !PerforceSourceCodeManagerUtilities methodsFor:'utilities-cvs'! |
|
66 |
|
67 askForContainer:boxText title:title note:notice initialModule:initialModule initialPackage:initialPackage initialFileName:initialFileName forNewContainer:forNewContainer |
|
68 "open a dialog asking for a source container; |
|
69 return a dictionary containing module, package and filename, |
|
70 or nil if canceled." |
|
71 |
|
72 |box y component answer |
|
73 moduleHolder packageHolder fileNameHolder |
|
74 module package fileName |
|
75 knownContainers knownPackages packageUpdater |
|
76 packageBoxComponent fileNameBoxComponent fileNameUpdater| |
|
77 |
|
78 knownContainers := Set new. |
|
79 Smalltalk allClassesDo:[:cls | |pckg| |
|
80 pckg := cls package. |
|
81 pckg size > 0 ifTrue:[ |
|
82 knownContainers add:(pckg upTo:$:) |
|
83 ] |
|
84 ]. |
|
85 knownContainers := knownContainers asOrderedCollection. |
|
86 knownContainers := knownContainers select:[:module | module isBlank not]. |
|
87 knownContainers sort. |
|
88 |
|
89 packageUpdater := [ |
|
90 |theModulePrefix| |
|
91 |
|
92 theModulePrefix := moduleHolder value , ':'. |
|
93 |
|
94 Cursor wait showWhile:[ |
|
95 knownPackages := Set new. |
|
96 Smalltalk allClassesDo:[:cls | |pckg idx| |
|
97 pckg := cls package. |
|
98 pckg size > 0 ifTrue:[ |
|
99 (pckg startsWith:theModulePrefix) ifTrue:[ |
|
100 idx := pckg indexOf:$:. |
|
101 knownPackages add:(pckg copyFrom:idx + 1) |
|
102 ] |
|
103 ] |
|
104 ]. |
|
105 knownPackages := knownPackages asOrderedCollection. |
|
106 knownPackages := knownPackages select:[:package | package isBlank not]. |
|
107 knownPackages sort. |
|
108 packageBoxComponent list:knownPackages. |
|
109 ]. |
|
110 ]. |
|
111 |
|
112 fileNameUpdater := [ |
|
113 |module package files| |
|
114 |
|
115 Cursor read showWhile:[ |
|
116 module := moduleHolder value ? (PackageId noProjectID). |
|
117 package := packageHolder value ? (PackageId noProjectID). |
|
118 |
|
119 files := PerforceSourceCodeManager getExistingContainersInModule:module directory:package. |
|
120 files := files asOrderedCollection. |
|
121 files := files select:[:eachFile | eachFile asFilename hasSuffix:'st']. |
|
122 files sort. |
|
123 fileNameBoxComponent list:files. |
|
124 ]. |
|
125 ]. |
|
126 |
|
127 moduleHolder := initialModule asValue. |
|
128 packageHolder := initialPackage asValue. |
|
129 fileNameHolder := initialFileName asValue. |
|
130 |
|
131 resources := self classResources. |
|
132 |
|
133 "/ |
|
134 "/ open a dialog for this |
|
135 "/ |
|
136 box := DialogBox new. |
|
137 box label:title. |
|
138 |
|
139 component := box addTextLabel:boxText withCRs. |
|
140 component adjust:#left; borderWidth:0. |
|
141 box addVerticalSpace. |
|
142 box addVerticalSpace. |
|
143 |
|
144 y := box yPosition. |
|
145 component := box addTextLabel:(resources string:'Module:'). |
|
146 component width:0.4; adjust:#right. |
|
147 box yPosition:y. |
|
148 component := box addComboBoxOn:moduleHolder tabable:true. |
|
149 component list:knownContainers. |
|
150 |
|
151 "/ component := box addInputFieldOn:moduleHolder tabable:true. |
|
152 component width:0.6; left:0.4; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine. |
|
153 |
|
154 box addVerticalSpace. |
|
155 y := box yPosition. |
|
156 component := box addTextLabel:(resources string:'Package:'). |
|
157 component width:0.4; adjust:#right. |
|
158 box yPosition:y. |
|
159 packageBoxComponent := component := box addComboBoxOn:packageHolder tabable:true. |
|
160 "/ component := box addInputFieldOn:packageHolder tabable:true. |
|
161 component width:0.6; left:0.4; "immediateAccept:true; "acceptOnLeave:true; cursorMovementWhenUpdating:#beginOfLine. |
|
162 packageUpdater value. |
|
163 moduleHolder onChangeEvaluate:packageUpdater. |
|
164 |
|
165 box addVerticalSpace. |
|
166 y := box yPosition. |
|
167 component := box addTextLabel:(resources string:'Filename:'). |
|
168 component width:0.4; adjust:#right. |
|
169 box yPosition:y. |
|
170 |
|
171 forNewContainer ifTrue:[ |
|
172 component := box addInputFieldOn:fileNameHolder tabable:true. |
|
173 component width:0.6; left:0.4; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine. |
|
174 ] ifFalse:[ |
|
175 fileNameBoxComponent := component := box addComboBoxOn:fileNameHolder tabable:true. |
|
176 component width:0.6; left:0.4; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine. |
|
177 fileNameUpdater value. |
|
178 packageHolder onChangeEvaluate:fileNameUpdater. |
|
179 ]. |
|
180 |
|
181 box addVerticalSpace. |
|
182 |
|
183 notice notNil ifTrue:[ |
|
184 component := box addTextLabel:notice. |
|
185 component adjust:#left; borderWidth:0. |
|
186 ]. |
|
187 |
|
188 box addVerticalSpace. |
|
189 box addAbortAndOkButtons. |
|
190 |
|
191 (YesToAllNotification notNil and:[YesToAllNotification isHandled]) ifTrue:[ |
|
192 component := Button label:'Yes to all'. |
|
193 component action:[ |
|
194 YesToAllNotification queryWith:true. |
|
195 box doAccept. |
|
196 box okPressed. |
|
197 ]. |
|
198 (DialogBox defaultOKButtonAtLeft) ifTrue:[ |
|
199 box addButton:component after:nil. |
|
200 ] ifFalse:[ |
|
201 box addButton:component before:nil. |
|
202 ]. |
|
203 ]. |
|
204 (AbortAllSignal isHandled) ifTrue:[ |
|
205 component := Button label:'Cancel all'. |
|
206 component action:[ |
|
207 box hide. |
|
208 AbortAllSignal raiseSignal. |
|
209 ]. |
|
210 (DialogBox defaultOKButtonAtLeft) ifTrue:[ |
|
211 box addButton:component before:nil. |
|
212 ] ifFalse:[ |
|
213 box addButton:component after:nil. |
|
214 ]. |
|
215 ]. |
|
216 |
|
217 (YesToAllQuery notNil and:[YesToAllQuery isHandled]) ifTrue:[ |
|
218 answer := YesToAllQuery query. |
|
219 ]. |
|
220 |
|
221 answer isNil ifTrue:[ |
|
222 box showAtPointer. |
|
223 answer := box accepted |
|
224 ]. |
|
225 |
|
226 box destroy. |
|
227 answer ifFalse:[ |
|
228 ^ nil |
|
229 ]. |
|
230 |
|
231 module := moduleHolder value withoutSpaces. |
|
232 package := packageHolder value withoutSpaces. |
|
233 fileName := fileNameHolder value withoutSpaces. |
|
234 ^ Dictionary new |
|
235 at:#module put:module; |
|
236 at:#package put:package; |
|
237 at:#fileName put:fileName; |
|
238 yourself |
|
239 |
|
240 " |
|
241 self |
|
242 askForContainer:'enter container' title:'container' note:'some note' |
|
243 initialModule:'foo' initialPackage:'bar' initialFileName:'baz' |
|
244 " |
|
245 |
|
246 "Modified: / 23-08-2006 / 14:13:04 / cg" |
|
247 ! |
61 |
248 |
62 checkinClass:aClass withInfo:aLogInfoOrNil withCheck:doCheckClass usingManager:managerOrNil |
249 checkinClass:aClass withInfo:aLogInfoOrNil withCheck:doCheckClass usingManager:managerOrNil |
63 "check a class into the source repository. |
250 "check a class into the source repository. |
64 If the argument, aLogInfoOrNil isNil, ask interactively for log-message. |
251 If the argument, aLogInfoOrNil isNil, ask interactively for log-message. |
65 If doCheckClass is true, the class is checked for send of halts etc." |
252 If doCheckClass is true, the class is checked for send of halts etc." |
66 |
253 |
67 |logMessage checkinInfo mgr pri doSubmit| |
254 |logMessage checkinInfo mgr pri doSubmit| |
68 |
255 |
|
256 resources := self classResources. |
69 doSubmit := false. |
257 doSubmit := false. |
70 |
258 |
71 aClass isLoaded ifFalse:[ |
259 aClass isLoaded ifFalse:[ |
72 self information:(resources string:'Cannot checkin unloaded classes (%1)' with:aClass name). |
260 self information:(resources string:'Cannot checkin unloaded classes (%1)' with:aClass name). |
73 ^ false. |
261 ^ false. |
74 ]. |
262 ]. |
75 |
263 |
76 mgr := managerOrNil. |
264 mgr := managerOrNil. |
77 mgr isNil ifTrue:[ |
265 mgr isNil ifTrue:[ |
78 mgr := self sourceCodeManagerFor:aClass. |
266 mgr := self sourceCodeManagerFor:aClass. |
79 mgr isNil ifTrue:[ |
267 mgr isNil ifTrue:[ |
80 ^ false |
268 ^ false |
81 ] |
269 ] |
82 ]. |
270 ]. |
83 |
271 |
84 self ensureCorrectVersionMethodsInClass:aClass usingManager:mgr. |
272 self ensureCorrectVersionMethodsInClass:aClass usingManager:mgr. |
85 mgr supportsCheckinLogMessages ifTrue:[ |
273 mgr supportsCheckinLogMessages ifTrue:[ |
86 (self |
274 (self |
87 getLogMessageForClassCheckinTakingDefaultsFromPreviousLogInfo:aLogInfoOrNil |
275 getLogMessageForClassCheckinTakingDefaultsFromPreviousLogInfo:aLogInfoOrNil |
88 forClass:aClass |
276 forClass:aClass |
89 valuesInto:[:logMessageRet :checkinInfoRet | |
277 valuesInto:[:logMessageRet :checkinInfoRet | |
90 logMessage := logMessageRet. |
278 logMessage := logMessageRet. |
91 checkinInfo := checkinInfoRet. |
279 checkinInfo := checkinInfoRet. |
92 checkinInfo notNil ifTrue:[ |
280 checkinInfo notNil ifTrue:[ |
93 doSubmit := checkinInfo submitHolder value. |
281 doSubmit := checkinInfo submitHolder value. |
94 ]. |
282 ]. |
95 ] |
283 ] |
96 ) ifFalse:[^ false]. |
284 ) ifFalse:[^ false]. |
97 ]. |
285 ]. |
98 |
286 |
99 (self classIsNotYetInRepository:aClass withManager:mgr) ifTrue:[ |
287 (self classIsNotYetInRepository:aClass withManager:mgr) ifTrue:[ |
100 (self createSourceContainerForClass:aClass usingManager:mgr) ifFalse:[ |
288 (self createSourceContainerForClass:aClass usingManager:mgr) ifFalse:[ |
101 "/ self warn:'did not create a container for ''' , aClass name , ''''. |
289 "/ self warn:'did not create a container for ''' , aClass name , ''''. |
102 ^ false |
290 ^ false |
103 ]. |
291 ]. |
104 ^ true. |
292 ^ true. |
105 ]. |
293 ]. |
106 |
294 |
107 self activityNotification:(resources string:'checking in %1' with:aClass name). |
295 self activityNotification:(resources string:'checking in %1' with:aClass name). |
108 pri := Processor activePriority. |
296 pri := Processor activePriority. |
109 Processor activeProcess withPriority:pri-1 to:pri |
297 Processor activeProcess withPriority:pri-1 to:pri |
110 do:[ |
298 do:[ |
111 |revision aborted| |
299 |revision aborted| |
112 |
300 |
113 |
301 |
114 |
302 |
115 aborted := false. |
303 aborted := false. |
116 AbortOperationRequest handle:[:ex | |
304 AbortOperationRequest handle:[:ex | |
117 aborted := true. |
305 aborted := true. |
118 ex return. |
306 ex return. |
119 ] do:[ |
307 ] do:[ |
120 |checkinState cause| |
308 |checkinState cause| |
121 checkinState := false. |
309 checkinState := false. |
122 cause := ''. |
310 cause := ''. |
123 [ |
311 [ |
124 checkinState := mgr checkinClass:aClass logMessage:logMessage submit:doSubmit |
312 checkinState := mgr checkinClass:aClass logMessage:logMessage submit:doSubmit |
125 ] on:SourceCodeManagerError do:[:ex| |
313 ] on:SourceCodeManagerError do:[:ex| |
126 self halt. |
314 cause := ex description. |
127 cause := ex description. |
315 ex proceed. |
128 ex proceed. |
316 ]. |
129 ]. |
317 |
130 |
318 checkinState ifFalse:[ |
131 checkinState ifFalse:[ |
319 Transcript showCR:'checkin of ''' , aClass name , ''' failed - ', cause. |
132 Transcript showCR:'checkin of ''' , aClass name , ''' failed - ', cause. |
320 self warn:(resources stringWithCRs:'Checkin of "%1" failed\\' with:aClass name allBold),cause. |
133 self warn:(resources stringWithCRs:'Checkin of "%1" failed\\' with:aClass name allBold),cause. |
321 ^ false. |
134 ^ false. |
322 ]. |
135 ]. |
323 checkinInfo notNil ifTrue:[ |
136 checkinInfo notNil ifTrue:[ |
324 checkinInfo isStable ifTrue:[ |
137 checkinInfo isStable ifTrue:[ |
325 "set stable tag for class that has been checked in" |
138 "set stable tag for class that has been checked in" |
326 self tagClass:aClass as:#stable. |
139 self tagClass:aClass as:#stable. |
327 ]. |
140 ]. |
328 checkinInfo tagIt ifTrue:[ |
141 checkinInfo tagIt ifTrue:[ |
329 "set an additional tag for class that has been checked in" |
142 "set an additional tag for class that has been checked in" |
330 self tagClass:aClass as:(checkinInfo tag). |
143 self tagClass:aClass as:(checkinInfo tag). |
331 ]. |
144 ]. |
332 ]. |
145 ]. |
333 ]. |
146 ]. |
334 aborted ifTrue:[ |con| |
147 aborted ifTrue:[ |con| |
335 Transcript showCR:'Checkin of ''' , aClass name , ''' aborted'. |
148 Transcript showCR:'Checkin of ''' , aClass name , ''' aborted'. |
336 |
149 |
337 AbortAllOperationWantedQuery query ifTrue:[ |
150 AbortAllOperationWantedQuery query ifTrue:[ |
338 (Dialog |
151 (Dialog |
339 confirm:(resources stringWithCRs:'Checkin of "%1" aborted.\\Cancel all ?' with:aClass name) |
152 confirm:(resources stringWithCRs:'Checkin of "%1" aborted.\\Cancel all ?' with:aClass name) |
340 default:false) |
153 default:false) |
341 ifTrue:[ |
154 ifTrue:[ |
342 AbortAllOperationRequest raise. |
155 AbortAllOperationRequest raise. |
343 ] |
156 ] |
344 ]. |
157 ]. |
345 ^ false. |
158 ^ false. |
346 ]. |
159 ]. |
|
160 ]. |
347 ]. |
161 ^ true |
348 ^ true |
162 |
349 |
163 "Created: / 21-12-2011 / 18:19:14 / cg" |
350 "Created: / 21-12-2011 / 18:19:14 / cg" |
|
351 ! |
|
352 |
|
353 defineSourceContainerForClass:aClass usingManager:mgr title:title text:boxText createDirectories:createDirs createContainer:createContainer |
|
354 "let user specify the source-repository values for aClass" |
|
355 |
|
356 |className |
|
357 "oldModule oldPackage" oldFileName |
|
358 module directory fileName nameSpace nameSpacePrefix |
|
359 info project nm creatingNew msg |
|
360 answer doCheckinWithoutAsking forceCheckIn rslt note |
|
361 requiredPackage projectDefinitionClass packageId| |
|
362 |
|
363 mgr isNil ifTrue:[^ false]. |
|
364 |
|
365 resources := self classResources. |
|
366 aClass isLoaded ifFalse:[ |
|
367 self warn:(resources string:'Please load the %1-class first' with:aClass name). |
|
368 ^ false. |
|
369 ]. |
|
370 |
|
371 className := aClass name. |
|
372 |
|
373 aClass isProjectDefinition ifTrue:[ |
|
374 "/ no way - their package is already known and fix. |
|
375 module := aClass module. |
|
376 directory := aClass moduleDirectory. |
|
377 ] ifFalse:[ |
|
378 "/ |
|
379 "/ defaults, if nothing at all is known |
|
380 "/ |
|
381 projectDefinitionClass := aClass projectDefinitionClass. |
|
382 projectDefinitionClass notNil ifTrue:[ |
|
383 packageId := PackageId from:projectDefinitionClass package. |
|
384 module := packageId module. |
|
385 directory := packageId directory. |
|
386 ] ifFalse:[ |
|
387 (module := LastModule) isNil ifTrue:[ |
|
388 module := (OperatingSystem getLoginName). |
|
389 ]. |
|
390 (directory := LastPackage) isNil ifTrue:[ |
|
391 directory := 'private'. |
|
392 ]. |
|
393 ]. |
|
394 ]. |
|
395 |
|
396 "/ |
|
397 "/ try to extract some useful defaults from the current project |
|
398 "/ |
|
399 (Project notNil and:[(project := Project current) notNil]) ifTrue:[ |
|
400 directory isNil ifTrue:[ |
|
401 (nm := project repositoryDirectory) isNil ifTrue:[ |
|
402 nm := project name |
|
403 ]. |
|
404 directory := nm. |
|
405 ]. |
|
406 module isNil ifTrue:[ |
|
407 (nm := project repositoryModule) notNil ifTrue:[ |
|
408 module := nm |
|
409 ] |
|
410 ]. |
|
411 ]. |
|
412 |
|
413 "/ |
|
414 "/ ask the sourceCodeManager if it knows anything about that class |
|
415 "/ if so, take that as a default. |
|
416 "/ |
|
417 info := mgr sourceInfoOfClass:aClass. |
|
418 info notNil ifTrue:[ |
|
419 true "module ~= LastModule" ifTrue:[ |
|
420 (info includesKey:#module) ifTrue:[ |
|
421 module := (info at:#module). |
|
422 ]. |
|
423 ]. |
|
424 "/ true "package ~= LastPackage" ifTrue:[ |
|
425 "/ (info includesKey:#directory) ifTrue:[ |
|
426 "/ package := (info at:#directory). |
|
427 "/ ]. |
|
428 "/ ]. |
|
429 fileName := mgr containerFromSourceInfo:info. |
|
430 (nameSpace := aClass nameSpace) ~~ Smalltalk ifTrue:[ |
|
431 nameSpacePrefix := nameSpace name , '::'. |
|
432 (fileName startsWith:nameSpacePrefix) ifTrue:[ |
|
433 fileName := fileName copyFrom:(nameSpacePrefix size + 1). |
|
434 ] |
|
435 ]. |
|
436 "/ (info includesKey:#fileName) ifTrue:[ |
|
437 "/ fileName := (info at:#fileName). |
|
438 "/ ] ifFalse:[ |
|
439 "/ (info includesKey:#expectedFileName) ifTrue:[ |
|
440 "/ fileName := (info at:#expectedFileName). |
|
441 "/ ] ifFalse:[ |
|
442 "/ (info includesKey:#classFileNameBase) ifTrue:[ |
|
443 "/ fileName := (info at:#classFileNameBase) , '.st'. |
|
444 "/ ] |
|
445 "/ ] |
|
446 "/ ] |
|
447 ]. |
|
448 |
|
449 fileName isNil ifTrue:[ |
|
450 fileName := (Smalltalk fileNameForClass:aClass) , '.st'. |
|
451 ]. |
|
452 |
|
453 OperatingSystem isMSDOSlike ifTrue:[ |
|
454 module replaceAll:$\ with:$/. |
|
455 directory replaceAll:$\ with:$/. |
|
456 ]. |
|
457 |
|
458 "/ |
|
459 "/ check for conflicts (i.e. if such a container already exists) ... |
|
460 "/ |
|
461 doCheckinWithoutAsking := false. |
|
462 "/false ifTrue:[ |
|
463 "/ (mgr checkForExistingContainer:fileName inModule:module directory:directory) ifTrue:[ |
|
464 "/ answer := Dialog confirmWithCancel:(resources |
|
465 "/ string:'About to change the source container. |
|
466 "/ |
|
467 "/Notice: there is a container for %1 in: |
|
468 "/ |
|
469 "/ %2 / %3 / %4 |
|
470 "/ |
|
471 "/Do you want to change it or check right into that container ?' |
|
472 "/ with:className |
|
473 "/ with:module |
|
474 "/ with:directory |
|
475 "/ with:fileName) |
|
476 "/ labels:(resources array:#('Cancel' 'Check in' 'Change')). |
|
477 "/ answer isNil ifTrue:[AbortSignal raise]. |
|
478 "/ answer ifTrue:[ |
|
479 "/ doCheckinWithoutAsking := false. |
|
480 "/ oldModule := module. |
|
481 "/ oldPackage := directory. |
|
482 "/ oldFileName := fileName |
|
483 "/ ] ifFalse:[ |
|
484 "/ doCheckinWithoutAsking := true. |
|
485 "/ creatingNew := false. |
|
486 "/ ]. |
|
487 "/ ]. |
|
488 "/]. |
|
489 mgr isContainerBased ifTrue:[ |
|
490 doCheckinWithoutAsking ifFalse:[ |
|
491 "/ |
|
492 "/ open a dialog for this |
|
493 "/ |
|
494 (mgr checkForExistingContainer:fileName inModule:module directory:directory) ifFalse:[ |
|
495 note := 'Notice: class seems to have no container yet.'. |
|
496 creatingNew := true. |
|
497 ] ifTrue:[ |
|
498 creatingNew := false. |
|
499 ]. |
|
500 |
|
501 rslt := self |
|
502 askForContainer:boxText title:title note:note |
|
503 initialModule:module initialPackage:directory initialFileName:fileName |
|
504 forNewContainer:true. |
|
505 |
|
506 rslt isNil ifTrue:[ |
|
507 ^ false |
|
508 ]. |
|
509 |
|
510 module := rslt at:#module. |
|
511 directory := rslt at:#package. |
|
512 fileName := rslt at:#fileName. |
|
513 ]. |
|
514 (fileName endsWith:',v') ifTrue:[ |
|
515 fileName := fileName copyWithoutLast:2 |
|
516 ]. |
|
517 (fileName endsWith:'.st') ifFalse:[ |
|
518 fileName := fileName , '.st' |
|
519 ]. |
|
520 |
|
521 ]. |
|
522 |
|
523 "/ we require the packageID to be <module>:<container-dir> |
|
524 "/ check for this ... |
|
525 |
|
526 requiredPackage := ((module ? '') , ':' , (directory ? '')) asSymbol. |
|
527 requiredPackage ~= aClass package ifTrue:[ |
|
528 "/ doCheckinWithoutAsking ifFalse:[ |
|
529 "/ (self confirm:'Change the classes packageID to: ''', requiredPackage , ''' ?') |
|
530 "/ ifFalse:[ |
|
531 "/ ^ false |
|
532 "/ ] |
|
533 "/ ]. |
|
534 aClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | mthd setPackage:requiredPackage]. |
|
535 aClass package:requiredPackage. |
|
536 ]. |
|
537 |
|
538 info := aClass revisionInfo. |
|
539 info notNil ifTrue:[ |
|
540 (info repositoryPathName isNil) ifTrue:[ |
|
541 info := nil |
|
542 ]. |
|
543 "/ (info includesKey:#repositoryPathName) ifFalse:[ |
|
544 "/ info := nil |
|
545 "/ ] |
|
546 ]. |
|
547 |
|
548 info isNil ifTrue:[ |
|
549 true "doCheckinWithoutAsking" ifFalse:[ |
|
550 answer := Dialog |
|
551 confirmWithCancel:(resources string:'%1 does not have any (usable) revision info (#version method)\\Shall I create one ?' with:className) withCRs |
|
552 labels:(resources array:#( 'Cancel' 'No' 'Yes')). |
|
553 answer isNil ifTrue:[^ false]. |
|
554 ] ifTrue:[ |
|
555 answer := true. |
|
556 ]. |
|
557 answer ifTrue:[ |
|
558 mgr |
|
559 updateVersionMethodOf:aClass |
|
560 for:(mgr initialRevisionStringFor:aClass |
|
561 inModule:module |
|
562 directory:directory |
|
563 container:fileName). |
|
564 ]. |
|
565 ]. |
|
566 |
|
567 (self checkForExistingModule:module usingManager:mgr allowCreate:(createDirs or:[creatingNew])) |
|
568 ifFalse:[^ false]. |
|
569 LastModule := module. |
|
570 |
|
571 (self checkForExistingModule:module directory:directory usingManager:mgr allowCreate:(createDirs or:[creatingNew])) |
|
572 ifFalse:[^ false]. |
|
573 LastPackage := directory. |
|
574 |
|
575 "/ |
|
576 "/ check for the container itself |
|
577 "/ |
|
578 (mgr isContainerBased not |
|
579 or:[ mgr checkForExistingContainer:fileName inModule:module directory:directory ]) ifTrue:[ |
|
580 "/ (oldModule notNil |
|
581 "/ and:[(oldModule ~= module) |
|
582 "/ or:[oldPackage ~= package |
|
583 "/ or:[oldFileName ~= fileName]]]) |
|
584 "/ ifFalse:[ |
|
585 "/ self warn:(resources string:'no change'). |
|
586 "/ ^ false. |
|
587 "/ ]. |
|
588 |
|
589 mgr isContainerBased ifTrue:[ |
|
590 creatingNew ifTrue:[ |
|
591 self warn:(resources string:'Container for %1 already exists in %2/%3.' with:fileName with:module with:directory) withCRs. |
|
592 ]. |
|
593 |
|
594 doCheckinWithoutAsking ifFalse:[ |
|
595 (Dialog |
|
596 confirm:(resources string:'check %1 into the existing container |
|
597 |
|
598 %2 / %3 / %4 ?' |
|
599 with:className |
|
600 with:module |
|
601 with:directory |
|
602 with:fileName) withCRs |
|
603 noLabel:'Cancel') |
|
604 ifFalse:[ |
|
605 ^ false. |
|
606 ]. |
|
607 ]. |
|
608 ]. |
|
609 oldFileName notNil ifTrue:[ |
|
610 msg := ('forced checkin / source container change from ' , oldFileName). |
|
611 ] ifFalse:[ |
|
612 msg := 'defined source container' |
|
613 ]. |
|
614 |
|
615 (forceCheckIn := doCheckinWithoutAsking) ifFalse:[ |
|
616 (mgr |
|
617 checkinClass:aClass |
|
618 fileName:fileName |
|
619 directory:directory |
|
620 module:module |
|
621 logMessage:msg) |
|
622 ifFalse:[ |
|
623 doCheckinWithoutAsking ifFalse:[ |
|
624 (Dialog |
|
625 confirm:'No easy merge seems possible; force checkin (no merge) ?' |
|
626 noLabel:'Cancel') |
|
627 ifFalse:[ |
|
628 ^ false. |
|
629 ]. |
|
630 ]. |
|
631 forceCheckIn := true. |
|
632 ] |
|
633 ]. |
|
634 forceCheckIn ifTrue:[ |
|
635 (mgr |
|
636 checkinClass:aClass |
|
637 fileName:fileName |
|
638 directory:directory |
|
639 module:module |
|
640 logMessage:msg |
|
641 force:true) |
|
642 ifFalse:[ |
|
643 self warn:(resources string:'Failed to check into existing container.'). |
|
644 ^ false. |
|
645 ]. |
|
646 ]. |
|
647 ^ true |
|
648 ] ifFalse:[ |
|
649 (createContainer or:[creatingNew]) ifFalse:[ |
|
650 (Dialog |
|
651 confirm:(resources string:'No container exists for %1 in %2/%3\\create ?' |
|
652 with:fileName with:module with:directory) withCRs |
|
653 noLabel:'Cancel') ifFalse:[ |
|
654 ^ false |
|
655 ] |
|
656 ] |
|
657 ]. |
|
658 |
|
659 aClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | mthd setPackage:requiredPackage]. |
|
660 aClass package:requiredPackage. |
|
661 |
|
662 (mgr |
|
663 createContainerFor:aClass |
|
664 inModule:module |
|
665 package:directory |
|
666 container:fileName |
|
667 ) ifFalse:[ |
|
668 self warn:(resources string:'Failed to create container.'). |
|
669 ^ false. |
|
670 ]. |
|
671 ^ true |
|
672 |
|
673 "Created: / 21-12-2011 / 18:34:02 / cg" |
164 ! ! |
674 ! ! |
165 |
675 |
166 !PerforceSourceCodeManagerUtilities methodsFor:'utilities-p4'! |
676 !PerforceSourceCodeManagerUtilities methodsFor:'utilities-p4'! |
167 |
677 |
168 submit |
678 submit |
1335 |
1845 |
1336 changeChangeDescriptionTo:logLines changeNumber:changeNumber |
1846 changeChangeDescriptionTo:logLines changeNumber:changeNumber |
1337 |
1847 |
1338 |perforceCommand outputStream errorStream changeListFile result changeFileContents changeListFileStream firstIndex oldLogFileLines writeNextLine newLogFileLines currentTokenLineParts currentToken| |
1848 |perforceCommand outputStream errorStream changeListFile result changeFileContents changeListFileStream firstIndex oldLogFileLines writeNextLine newLogFileLines currentTokenLineParts currentToken| |
1339 |
1849 |
|
1850 self temporaryWorkSpace isNil ifTrue:[ |
|
1851 self perforceError raiseErrorString:('Error getting temporary workspace when change the change description for ', changeNumber printString, '.'). |
|
1852 ^false. |
|
1853 ]. |
1340 perforceCommand := 'change -o ', (changeNumber ? ''). |
1854 perforceCommand := 'change -o ', (changeNumber ? ''). |
1341 outputStream := ReadWriteStream on:''. |
1855 outputStream := ReadWriteStream on:''. |
1342 errorStream := ReadWriteStream on:''. |
1856 errorStream := ReadWriteStream on:''. |
1343 result := self temporaryWorkSpace executePerforceCommand:perforceCommand |
1857 result := self temporaryWorkSpace executePerforceCommand:perforceCommand |
1344 inDirectory:self tempDirectory |
1858 inDirectory:self tempDirectory |
1345 inputFrom:nil |
1859 inputFrom:nil |
1346 outputTo:outputStream |
1860 outputTo:outputStream |
1347 errorTo:errorStream |
1861 errorTo:errorStream |
1348 logHeader:('get change desription for change ', changeNumber printString, '.'). |
1862 logHeader:('get change desription for change ', changeNumber printString, '.'). |
1349 result ifFalse:[ |
1863 result ifFalse:[ |
1350 ^ false |
1864 ^ false |
1351 ]. |
1865 ]. |
1352 changeFileContents := outputStream contents. |
1866 changeFileContents := outputStream contents. |
1353 changeFileContents isEmptyOrNil ifTrue:[ |
1867 changeFileContents isEmptyOrNil ifTrue:[ |
1354 ^false |
1868 ^false |
1355 ]. |
1869 ]. |
1356 changeListFile := self tempDirectory construct:'change'. |
1870 changeListFile := self tempDirectory construct:'change'. |
1357 changeListFileStream := changeListFile writeStream. |
1871 changeListFileStream := changeListFile writeStream. |
1358 changeFileContents := changeFileContents asStringCollection. |
1872 changeFileContents := changeFileContents asStringCollection. |
1359 firstIndex := changeFileContents indexOfLineStartingWith:'Description:'. |
1873 firstIndex := changeFileContents indexOfLineStartingWith:'Description:'. |
1360 firstIndex == 0 ifTrue:[ |
1874 firstIndex == 0 ifTrue:[ |
1361 ^false |
1875 ^false |
1362 ]. |
1876 ]. |
1363 oldLogFileLines := StringCollection new. |
1877 oldLogFileLines := StringCollection new. |
1364 changeFileContents from:firstIndex do:[:aLine| |
1878 changeFileContents from:firstIndex do:[:aLine| |
1365 ((aLine size > 1) and:[aLine first ~= $# and:[aLine first isSeparator not]]) ifTrue:[ |
1879 ((aLine size > 1) and:[aLine first ~= $# and:[aLine first isSeparator not]]) ifTrue:[ |
1366 currentTokenLineParts := aLine asCollectionOfSubstringsSeparatedBy:$:. |
1880 currentTokenLineParts := aLine asCollectionOfSubstringsSeparatedBy:$:. |
1367 currentTokenLineParts size > 1 ifTrue:[ |
1881 currentTokenLineParts size > 1 ifTrue:[ |
1368 currentToken := currentTokenLineParts first. |
1882 currentToken := currentTokenLineParts first. |
1369 ]. |
1883 ]. |
1370 ]. |
1884 ]. |
1371 ((aLine size > 1) and:[aLine first isSeparator and:[currentToken = 'Description']]) ifTrue:[ |
1885 ((aLine size > 1) and:[aLine first isSeparator and:[currentToken = 'Description']]) ifTrue:[ |
1372 oldLogFileLines add:(aLine copyFrom:2). |
1886 oldLogFileLines add:(aLine copyFrom:2). |
1373 ]. |
1887 ]. |
1374 ]. |
1888 ]. |
1375 newLogFileLines := StringCollection new. |
1889 newLogFileLines := StringCollection new. |
1376 changeNumber isNil ifTrue:[ |
1890 changeNumber isNil ifTrue:[ |
1377 newLogFileLines := logLines. |
1891 newLogFileLines := logLines. |
1378 ] ifFalse:[ |
1892 ] ifFalse:[ |
1379 (oldLogFileLines asString includesString:logLines asString) ifTrue:[ |
1893 (oldLogFileLines asString includesString:logLines asString) ifTrue:[ |
1380 newLogFileLines := oldLogFileLines. |
1894 newLogFileLines := oldLogFileLines. |
1381 ] ifFalse:[ |
1895 ] ifFalse:[ |
1382 newLogFileLines := oldLogFileLines. |
1896 newLogFileLines := oldLogFileLines. |
1383 newLogFileLines addAll:logLines |
1897 newLogFileLines addAll:logLines |
1384 ]. |
1898 ]. |
1385 ]. |
1899 ]. |
1386 writeNextLine := true. |
1900 writeNextLine := true. |
1387 changeFileContents do:[:aLine| |
1901 changeFileContents do:[:aLine| |
1388 writeNextLine ifFalse:[ |
1902 writeNextLine ifFalse:[ |
1389 (aLine notEmpty and:[aLine first isSeparator not]) ifTrue:[ |
1903 (aLine notEmpty and:[aLine first isSeparator not]) ifTrue:[ |
1390 writeNextLine := true. |
1904 writeNextLine := true. |
1391 ]. |
1905 ]. |
1392 ]. |
1906 ]. |
1393 writeNextLine ifTrue:[ |
1907 writeNextLine ifTrue:[ |
1394 (aLine startsWith:'Description:') ifTrue:[ |
1908 (aLine startsWith:'Description:') ifTrue:[ |
1395 changeListFileStream nextPutLine:aLine. |
1909 changeListFileStream nextPutLine:aLine. |
1396 newLogFileLines do:[:logLine| |
1910 newLogFileLines do:[:logLine| |
1397 changeListFileStream nextPut:Character tab. |
1911 changeListFileStream nextPut:Character tab. |
1398 changeListFileStream nextPutLine:logLine. |
1912 changeListFileStream nextPutLine:logLine. |
1399 ]. |
1913 ]. |
1400 writeNextLine := false. |
1914 writeNextLine := false. |
1401 ] ifFalse:[ |
1915 ] ifFalse:[ |
1402 changeListFileStream nextPutLine:aLine |
1916 changeListFileStream nextPutLine:aLine |
1403 ]. |
1917 ]. |
1404 ]. |
1918 ]. |
1405 ]. |
1919 ]. |
1406 changeListFileStream close. |
1920 changeListFileStream close. |
1407 perforceCommand := ('change -i < "', changeListFile pathName, '"'). |
1921 perforceCommand := ('change -i < "', changeListFile pathName, '"'). |
1408 outputStream := ReadWriteStream on:''. |
1922 outputStream := ReadWriteStream on:''. |
1409 errorStream := ReadWriteStream on:''. |
1923 errorStream := ReadWriteStream on:''. |
1410 result := self temporaryWorkSpace executePerforceCommand:perforceCommand |
1924 result := self temporaryWorkSpace executePerforceCommand:perforceCommand |
1411 inDirectory:self tempDirectory |
1925 inDirectory:self tempDirectory |
1412 inputFrom:nil |
1926 inputFrom:nil |
1413 outputTo:outputStream |
1927 outputTo:outputStream |
1414 errorTo:errorStream |
1928 errorTo:errorStream |
1415 logHeader:('write change desription for change ', changeNumber printString, '.'). |
1929 logHeader:('write change desription for change ', changeNumber printString, '.'). |
1416 result ifFalse:[ |
1930 result ifFalse:[ |
1417 ^false |
1931 ^false |
1418 ]. |
1932 ]. |
1419 ^ true |
1933 ^ true |
1420 ! |
1934 ! |
1421 |
1935 |
1422 checkForExistingContainer:checkInDefinition |
1936 checkForExistingContainer:checkInDefinition |
1428 fullFilename := packagePath construct:checkInDefinition packageDir. |
1942 fullFilename := packagePath construct:checkInDefinition packageDir. |
1429 depotPath := self getDepotPathForLocalPath:fullFilename pathName. |
1943 depotPath := self getDepotPathForLocalPath:fullFilename pathName. |
1430 perforceCommand := ('dirs "' ,depotPath , '"'). |
1944 perforceCommand := ('dirs "' ,depotPath , '"'). |
1431 outputStream := ReadWriteStream on:''. |
1945 outputStream := ReadWriteStream on:''. |
1432 errorStream := ReadWriteStream on:''. |
1946 errorStream := ReadWriteStream on:''. |
1433 result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
1947 self getTemporaryWorkspaceFor:checkInDefinition. |
1434 inputFrom:nil outputTo:outputStream |
1948 self temporaryWorkSpace isNil ifTrue:[ |
1435 errorTo:errorStream |
1949 self perforceError raiseErrorString:('Error getting temporary workspace when check for existing container ', checkInDefinition definitionObjectString, '.'). |
1436 logHeader:('dirs in checkForExistingContainer for ', depotPath, '.'). |
1950 ^false. |
|
1951 ]. |
|
1952 result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
|
1953 inputFrom:nil outputTo:outputStream |
|
1954 errorTo:errorStream |
|
1955 logHeader:('dirs in checkForExistingContainer for ', depotPath, '.'). |
1437 result ifFalse:[ |
1956 result ifFalse:[ |
1438 ^ false |
1957 ^ false |
1439 ]. |
1958 ]. |
1440 errorStream contents notEmpty ifTrue:[ |
1959 errorStream contents notEmpty ifTrue:[ |
1441 ^false |
1960 ^false |
1442 ]. |
1961 ]. |
1443 ^ true |
1962 ^ true |
1444 ! |
1963 ! |
1445 |
1964 |
1446 checkIn:checkInDefinition submit:doSubmit |
1965 checkIn:checkInDefinition submit:doSubmit |
1447 |
1966 |
1448 | packagePath fullFilename s perforceCommand outputStream errorStream result tmpFilename fileNameAndRev tmpFilenameAndRev |
1967 | packagePath fullFilename s perforceCommand outputStream errorStream result tmpFilename fileNameAndRev tmpFilenameAndRev |
1449 haveChange nextVersionMethod diffOutput number baseRevision cls newestInRepository newVersionString openChangeNumber| |
1968 haveChange nextVersionMethod diffOutput number baseRevision cls newestInRepository newVersionString openChangeNumber| |
1450 |
1969 |
1451 self activityNotification:'checkin ' , checkInDefinition definitionObjectString , ' to perforce repository...'. |
1970 self activityNotification:'checkin ' , checkInDefinition definitionObjectString , ' to perforce repository...'. |
1452 [ |
1971 [ |
1453 cls := checkInDefinition definitionClass. |
1972 cls := checkInDefinition definitionClass. |
1454 self getTemporaryWorkspaceFor:checkInDefinition. |
1973 self getTemporaryWorkspaceFor:checkInDefinition. |
1455 self temporaryWorkSpace isNil ifTrue:[ |
1974 self temporaryWorkSpace isNil ifTrue:[ |
1456 self perforceError raiseErrorString:('Error getting temporary workspace when check in ', checkInDefinition definitionObjectString, '.'). |
1975 self perforceError raiseErrorString:('Error getting temporary workspace when check in ', checkInDefinition definitionObjectString, '.'). |
1457 ^false. |
1976 ^false. |
1458 ]. |
1977 ]. |
1459 baseRevision := checkInDefinition getLocalRevisionNumber. |
1978 baseRevision := checkInDefinition getLocalRevisionNumber. |
1460 newestInRepository := checkInDefinition getReposRevisionNumberBeforeCheckin. |
1979 newestInRepository := checkInDefinition getReposRevisionNumberBeforeCheckin. |
1461 baseRevision isNil ifTrue:[ |
1980 (checkInDefinition isClassCheckin and:[baseRevision isNil]) ifTrue:[ |
1462 self perforceError raiseErrorString:('No local revision for ', checkInDefinition definitionObjectString,' - should not happen here.'). |
1981 (Dialog confirm:('The version-info of ',checkInDefinition definitionObjectString allBold,' not exists. \Patch the version info?') withCRs) |
1463 ^false |
1982 ifTrue:[ |
1464 ]. |
1983 newVersionString := self updatedRevisionStringOf:cls |
1465 packagePath := Smalltalk packageDirectoryForPackageId:checkInDefinition package. |
1984 forRevision:newestInRepository printString with:(cls revisionStringOfManager:PerforceSourceCodeManager). |
1466 fullFilename := (packagePath construct:checkInDefinition packageDir) construct:checkInDefinition fileName. |
1985 PerforceSourceCodeManager updateVersionMethod:(PerforceSourceCodeManager nameOfVersionMethodInClasses) |
1467 tmpFilename := self getTemporaryFilenameFor:fullFilename pathName. |
1986 of:cls |
1468 tmpFilename directory recursiveMakeDirectory. |
1987 for:newVersionString. |
1469 checkInDefinition isClassCheckin ifTrue:[ |
1988 baseRevision := checkInDefinition getLocalRevisionNumber. |
1470 baseRevision > newestInRepository ifTrue:[ |
1989 baseRevision notNil ifTrue:[ |
1471 openChangeNumber := self getOpenChangeFor:checkInDefinition. |
1990 (Dialog confirm:('Check in ', checkInDefinition definitionObjectString allBold, 'based on version ', baseRevision printString, '?') withCRs) |
1472 openChangeNumber isNil ifTrue:[ |
1991 ifFalse:[ |
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) |
1992 ^false. |
1474 ifTrue:[ |
1993 ]. |
1475 newVersionString := self updatedRevisionStringOf:cls |
1994 ]. |
1476 forRevision:newestInRepository printString with:(cls revisionStringOfManager:self). |
1995 ] ifFalse:[ |
1477 PerforceSourceCodeManager updateVersionMethod:(PerforceSourceCodeManager nameOfVersionMethodInClasses) |
1996 ^false |
1478 of:cls |
1997 ]. |
1479 for:newVersionString. |
1998 ]. |
1480 |
1999 packagePath := Smalltalk packageDirectoryForPackageId:checkInDefinition package. |
1481 cls updateVersionMethodFor:newVersionString. |
2000 fullFilename := (packagePath construct:checkInDefinition packageDir) construct:checkInDefinition fileName. |
1482 ]. |
2001 tmpFilename := self getTemporaryFilenameFor:fullFilename pathName. |
1483 ]. |
2002 tmpFilename directory recursiveMakeDirectory. |
1484 ]. |
2003 checkInDefinition isClassCheckin ifTrue:[ |
1485 ]. |
2004 baseRevision > newestInRepository ifTrue:[ |
1486 fileNameAndRev := checkInDefinition fileName, '#', baseRevision printString. |
2005 openChangeNumber := self getOpenChangeFor:checkInDefinition. |
1487 tmpFilenameAndRev := tmpFilename directory construct:fileNameAndRev. |
2006 openChangeNumber isNil ifTrue:[ |
1488 |
2007 (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) |
1489 openChangeNumber notNil ifTrue:[ |
2008 ifTrue:[ |
1490 s := tmpFilename writeStream. |
2009 newVersionString := self updatedRevisionStringOf:cls |
1491 checkInDefinition isClassCheckin ifTrue:[ |
2010 forRevision:newestInRepository printString with:(cls revisionStringOfManager:PerforceSourceCodeManager). |
1492 PerforceSourceCodeManager fileOutSourceCodeOf:cls on:s. |
2011 PerforceSourceCodeManager updateVersionMethod:(PerforceSourceCodeManager nameOfVersionMethodInClasses) |
1493 ] ifFalse:[ |
2012 of:cls |
1494 self halt. |
2013 for:newVersionString. |
1495 s nextPutAll:''. |
2014 |
1496 ]. |
2015 cls updateVersionMethodFor:newVersionString. |
1497 s close. |
2016 ]. |
1498 self changeChangeDescriptionTo:checkInDefinition logMessage asStringCollection changeNumber:openChangeNumber printString. |
2017 ]. |
1499 doSubmit ifTrue:[ |
2018 ]. |
1500 self submitChangeNumber:openChangeNumber printString |
2019 ]. |
1501 ]. |
2020 checkInDefinition isClassCheckin ifTrue:[ |
1502 ^true |
2021 fileNameAndRev := checkInDefinition fileName, '#', baseRevision printString. |
1503 ]. |
2022 ] ifFalse:[ |
1504 |
2023 fileNameAndRev := checkInDefinition fileName, '#', newestInRepository printString. |
1505 perforceCommand := ('sync "' , tmpFilenameAndRev pathName, '"'). |
2024 ]. |
1506 outputStream := ReadWriteStream on:''. |
2025 tmpFilenameAndRev := tmpFilename directory construct:fileNameAndRev. |
1507 errorStream := ReadWriteStream on:''. |
2026 |
1508 result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
2027 openChangeNumber notNil ifTrue:[ |
1509 inputFrom:nil outputTo:outputStream |
2028 s := tmpFilename writeStream. |
1510 errorTo:errorStream |
2029 checkInDefinition isClassCheckin ifTrue:[ |
1511 logHeader:('sync ', checkInDefinition definitionObjectString, ' to revision ', baseRevision printString, '.'). |
2030 PerforceSourceCodeManager fileOutSourceCodeOf:cls on:s. |
1512 result ifFalse:[ |
2031 ] ifFalse:[ |
1513 ^ false |
2032 s nextPutAll:checkInDefinition fileContents. |
1514 ]. |
2033 ]. |
1515 |
2034 s close. |
1516 number := self getChangeListNumber. |
2035 self changeChangeDescriptionTo:checkInDefinition logMessage asStringCollection changeNumber:openChangeNumber printString. |
1517 number isNil ifTrue:[ |
2036 doSubmit ifTrue:[ |
1518 self perforceError raiseErrorString:('Error when getting a change list for ', checkInDefinition definitionObjectString, '.'). |
2037 self submitChangeNumber:openChangeNumber printString |
1519 ^false |
2038 ]. |
1520 ]. |
2039 ^true |
1521 perforceCommand := ('edit -c ' ,number printString, ' "', tmpFilename pathName, '"'). |
2040 ]. |
1522 outputStream := ReadWriteStream on:''. |
2041 perforceCommand := ('revert "' , tmpFilename pathName, '"'). |
1523 errorStream := ReadWriteStream on:''. |
2042 outputStream := ReadWriteStream on:''. |
1524 result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
2043 errorStream := ReadWriteStream on:''. |
1525 inputFrom:nil outputTo:outputStream |
2044 result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
1526 errorTo:errorStream |
2045 inputFrom:nil outputTo:outputStream |
1527 logHeader:('edit ', checkInDefinition definitionObjectString, '.'). |
2046 errorTo:errorStream |
1528 result ifFalse:[ |
2047 logHeader:('sync ', checkInDefinition definitionObjectString, ' to revision ', baseRevision printString, '.'). |
1529 ^ false |
2048 result ifFalse:[ |
1530 ]. |
2049 ^ false |
1531 s := tmpFilename writeStream. |
2050 ]. |
1532 checkInDefinition isClassCheckin ifTrue:[ |
2051 perforceCommand := ('sync -f "' , tmpFilenameAndRev pathName, '"'). |
1533 PerforceSourceCodeManager fileOutSourceCodeOf:cls on:s. |
2052 outputStream := ReadWriteStream on:''. |
1534 ] ifFalse:[ |
2053 errorStream := ReadWriteStream on:''. |
1535 self halt. |
2054 result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
1536 s nextPutAll:''. |
2055 inputFrom:nil outputTo:outputStream |
1537 ]. |
2056 errorTo:errorStream |
1538 s close. |
2057 logHeader:('sync ', checkInDefinition definitionObjectString, ' to revision ', baseRevision printString, '.'). |
1539 perforceCommand := ('diff -db -dw -dl "' , tmpFilename pathName, '"'). |
2058 result ifFalse:[ |
1540 outputStream := ReadWriteStream on:''. |
2059 ^ false |
1541 errorStream := ReadWriteStream on:''. |
2060 ]. |
1542 result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
2061 |
1543 inputFrom:nil outputTo:outputStream |
2062 number := self getChangeListNumber. |
1544 errorTo:errorStream |
2063 number isNil ifTrue:[ |
1545 logHeader:('diff ', checkInDefinition definitionObjectString, '.'). |
2064 self perforceError raiseErrorString:('Error when getting a change list for ', checkInDefinition definitionObjectString, '.'). |
1546 diffOutput := outputStream contents asStringCollection. |
2065 ^false |
1547 haveChange := diffOutput isEmptyOrNil or:[diffOutput notEmptyOrNil and:[diffOutput size > 1]]. |
2066 ]. |
1548 haveChange ifFalse:[ |
2067 perforceCommand := ('edit -c ' ,number printString, ' "', tmpFilename pathName, '"'). |
1549 self information:checkInDefinition definitionObjectString, ' not changed for revision ', baseRevision printString. |
2068 outputStream := ReadWriteStream on:''. |
1550 perforceCommand := ('revert "' , tmpFilename pathName, '"'). |
2069 errorStream := ReadWriteStream on:''. |
1551 outputStream := ReadWriteStream on:''. |
2070 result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
1552 errorStream := ReadWriteStream on:''. |
2071 inputFrom:nil outputTo:outputStream |
1553 result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
2072 errorTo:errorStream |
1554 inputFrom:nil outputTo:outputStream |
2073 logHeader:('edit ', checkInDefinition definitionObjectString, '.'). |
1555 errorTo:errorStream |
2074 result ifFalse:[ |
1556 logHeader:('revert ', checkInDefinition definitionObjectString, '.'). |
2075 ^ false |
1557 ^true |
2076 ]. |
1558 ]. |
2077 s := tmpFilename writeStream. |
1559 checkInDefinition isClassCheckin ifTrue:[ |
2078 checkInDefinition isClassCheckin ifTrue:[ |
1560 nextVersionMethod := self nextRevisionStringFor:checkInDefinition. |
2079 PerforceSourceCodeManager fileOutSourceCodeOf:cls on:s. |
1561 nextVersionMethod isNil ifTrue:[ |
2080 ] ifFalse:[ |
1562 self perforceError raiseErrorString:('Cant get next version method string for ', checkInDefinition definitionObjectString, ' revision ', baseRevision printString, '.'). |
2081 s nextPutAll:checkInDefinition fileContents. |
1563 ^false |
2082 ]. |
1564 ]. |
2083 s close. |
1565 PerforceSourceCodeManager updateVersionMethod:(PerforceSourceCodeManager nameOfVersionMethodInClasses) |
2084 perforceCommand := ('diff -db -dw -dl "' , tmpFilename pathName, '"'). |
1566 of:cls |
2085 outputStream := ReadWriteStream on:''. |
1567 for:nextVersionMethod. |
2086 errorStream := ReadWriteStream on:''. |
1568 ]. |
2087 result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
1569 result := self changeChangeDescriptionTo:checkInDefinition logMessage asStringCollection changeNumber:number printString. |
2088 inputFrom:nil outputTo:outputStream |
1570 doSubmit ifTrue:[ |
2089 errorTo:errorStream |
1571 result := self submitChangeNumber:number printString |
2090 logHeader:('diff ', checkInDefinition definitionObjectString, '.'). |
1572 ]. |
2091 diffOutput := outputStream contents asStringCollection. |
|
2092 haveChange := diffOutput isEmptyOrNil or:[diffOutput notEmptyOrNil and:[diffOutput size > 1]]. |
|
2093 haveChange ifFalse:[ |
|
2094 self information:checkInDefinition definitionObjectString, ' not changed for revision ', baseRevision printString. |
|
2095 newestInRepository ~= baseRevision ifTrue:[ |
|
2096 newVersionString := self updatedRevisionStringOf:cls |
|
2097 forRevision:newestInRepository printString with:(cls revisionStringOfManager:PerforceSourceCodeManager). |
|
2098 PerforceSourceCodeManager updateVersionMethod:(PerforceSourceCodeManager nameOfVersionMethodInClasses) |
|
2099 of:cls |
|
2100 for:newVersionString. |
|
2101 ]. |
|
2102 perforceCommand := ('revert "' , tmpFilename pathName, '"'). |
|
2103 outputStream := ReadWriteStream on:''. |
|
2104 errorStream := ReadWriteStream on:''. |
|
2105 result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
|
2106 inputFrom:nil outputTo:outputStream |
|
2107 errorTo:errorStream |
|
2108 logHeader:('revert ', checkInDefinition definitionObjectString, '.'). |
|
2109 ^true |
|
2110 ]. |
|
2111 checkInDefinition isClassCheckin ifTrue:[ |
|
2112 nextVersionMethod := self nextRevisionStringFor:checkInDefinition. |
|
2113 nextVersionMethod isNil ifTrue:[ |
|
2114 self perforceError raiseErrorString:('Cant get next version method string for ', checkInDefinition definitionObjectString, ' revision ', baseRevision printString, '.'). |
|
2115 ^false |
|
2116 ]. |
|
2117 PerforceSourceCodeManager updateVersionMethod:(PerforceSourceCodeManager nameOfVersionMethodInClasses) |
|
2118 of:cls |
|
2119 for:nextVersionMethod. |
|
2120 ]. |
|
2121 result := self changeChangeDescriptionTo:checkInDefinition logMessage asStringCollection changeNumber:number printString. |
|
2122 doSubmit ifTrue:[ |
|
2123 result := self submitChangeNumber:number printString |
|
2124 ]. |
1573 ] ensure:[ |
2125 ] ensure:[ |
1574 self activityNotification:''. |
2126 self activityNotification:''. |
1575 ]. |
2127 ]. |
1576 ^result |
2128 ^result |
1577 ! |
2129 ! |
1578 |
2130 |
1579 createChange |
2131 createChange |
1666 ^result |
2218 ^result |
1667 ! |
2219 ! |
1668 |
2220 |
1669 deleteWorkSpaceFromServer |
2221 deleteWorkSpaceFromServer |
1670 |
2222 |
1671 |perforceCommand outputStream errorStream result| |
2223 |perforceCommand outputStream errorStream result tmpWorkSpace| |
1672 |
2224 |
|
2225 tmpWorkSpace := self temporaryWorkSpace. |
|
2226 tmpWorkSpace isNil ifTrue:[ ^true]. |
1673 perforceCommand := ('client -df ', client). |
2227 perforceCommand := ('client -df ', client). |
1674 outputStream := ReadWriteStream on:''. |
2228 outputStream := ReadWriteStream on:''. |
1675 errorStream := ReadWriteStream on:''. |
2229 errorStream := ReadWriteStream on:''. |
1676 result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
2230 result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
1677 inputFrom:nil outputTo:outputStream |
2231 inputFrom:nil outputTo:outputStream |
1678 errorTo:errorStream |
2232 errorTo:errorStream |
1679 logHeader:('delete client ', client). |
2233 logHeader:('delete client ', client). |
1680 result ifFalse:[ |
2234 result ifFalse:[ |
1681 ^ false |
2235 ^ false |
1682 ]. |
2236 ]. |
1683 ^true |
2237 ^true |
1684 ! |
2238 ! |
1685 |
2239 |
1686 getChangeDespriptionInfoFor:changeNumber |
2240 getChangeDespriptionInfoFor:changeNumber |
1687 |
2241 |
1688 |valuePairs startLineIndex keyEndIndex changeContents cmd outputStream errorStream result keyValues beginLine endLine keyName keyValue| |
2242 |valuePairs startLineIndex keyEndIndex changeContents cmd outputStream errorStream result keyValues beginLine endLine keyName keyValue| |
1689 |
2243 |
|
2244 self temporaryWorkSpace isNil ifTrue:[ |
|
2245 self perforceError raiseErrorString:('Error getting temporary workspace when try to get change description for ', changeNumber printString, '.'). |
|
2246 ^nil. |
|
2247 ]. |
1690 valuePairs := OrderedCollection new. |
2248 valuePairs := OrderedCollection new. |
1691 cmd := 'change -o ', (changeNumber ? ''). |
2249 cmd := 'change -o ', (changeNumber ? ''). |
1692 outputStream := ReadWriteStream on:''. |
2250 outputStream := ReadWriteStream on:''. |
1693 errorStream := ReadWriteStream on:''. |
2251 errorStream := ReadWriteStream on:''. |
1694 result := self temporaryWorkSpace executePerforceCommand:cmd |
2252 result := self temporaryWorkSpace executePerforceCommand:cmd |
1695 inDirectory:self tempDirectory |
2253 inDirectory:self tempDirectory |
1696 inputFrom:nil |
2254 inputFrom:nil |
1697 outputTo:outputStream |
2255 outputTo:outputStream |
1698 errorTo:errorStream |
2256 errorTo:errorStream |
1699 logHeader:('getting change description ', (changeNumber ? ''), '.'). |
2257 logHeader:('getting change description ', (changeNumber ? ''), '.'). |
1700 result ifFalse:[ |
2258 result ifFalse:[ |
1701 ^ nil |
2259 ^ nil |
1702 ]. |
2260 ]. |
1703 changeContents := outputStream contents asStringCollection. |
2261 changeContents := outputStream contents asStringCollection. |
1704 changeContents doWithIndex:[:aLine :index| |
2262 changeContents doWithIndex:[:aLine :index| |
1705 startLineIndex isNil ifTrue:[ |
2263 startLineIndex isNil ifTrue:[ |
1706 (aLine isEmpty or:[(aLine startsWith:$#) or:[aLine first isSeparator]]) ifFalse:[ |
2264 (aLine isEmpty or:[(aLine startsWith:$#) or:[aLine first isSeparator]]) ifFalse:[ |
1707 keyEndIndex := aLine indexOf:$:. |
2265 keyEndIndex := aLine indexOf:$:. |
1708 keyEndIndex ~= 0 ifTrue:[ |
2266 keyEndIndex ~= 0 ifTrue:[ |
1709 startLineIndex := index. |
2267 startLineIndex := index. |
1710 valuePairs add:(Array with:index with:nil with:(aLine copyTo:keyEndIndex - 1)). |
2268 valuePairs add:(Array with:index with:nil with:(aLine copyTo:keyEndIndex - 1)). |
1711 ]. |
2269 ]. |
1712 ]. |
2270 ]. |
1713 ] ifFalse:[ |
2271 ] ifFalse:[ |
1714 (aLine isEmpty or:[aLine startsWith:$#]) ifTrue:[ |
2272 (aLine isEmpty or:[aLine startsWith:$#]) ifTrue:[ |
1715 valuePairs last at:2 put:index. |
2273 valuePairs last at:2 put:index. |
1716 startLineIndex := nil. |
2274 startLineIndex := nil. |
1717 ]. |
2275 ]. |
1718 ]. |
2276 ]. |
1719 ]. |
2277 ]. |
1720 keyValues := Dictionary new. |
2278 keyValues := Dictionary new. |
1721 valuePairs do:[:each| |
2279 valuePairs do:[:each| |
1722 beginLine := each first. |
2280 beginLine := each first. |
1723 endLine := each second. |
2281 endLine := each second. |
1724 keyName := each last. |
2282 keyName := each last. |
1725 (beginLine == (endLine - 1)) ifTrue:[ |
2283 (beginLine == (endLine - 1)) ifTrue:[ |
1726 keyValue := (changeContents at:beginLine) copyFrom:(keyName size + 2). |
2284 keyValue := (changeContents at:beginLine) copyFrom:(keyName size + 2). |
1727 keyValue := (keyValue withoutLeadingSeparators withoutTrailingSeparators) asStringCollection. |
2285 keyValue := (keyValue withoutLeadingSeparators withoutTrailingSeparators) asStringCollection. |
1728 ] ifFalse:[ |
2286 ] ifFalse:[ |
1729 keyValue := changeContents copyFrom:(beginLine + 1) to:(endLine - 1). |
2287 keyValue := changeContents copyFrom:(beginLine + 1) to:(endLine - 1). |
1730 keyValue := keyValue collect:[:each | each withoutLeadingSeparators withoutTrailingSeparators]. |
2288 keyValue := keyValue collect:[:each | each withoutLeadingSeparators withoutTrailingSeparators]. |
1731 ]. |
2289 ]. |
1732 keyValues at:keyName put:keyValue. |
2290 keyValues at:keyName put:keyValue. |
1733 ]. |
2291 ]. |
1734 ^ keyValues. |
2292 ^ keyValues. |
1735 ! |
2293 ! |
1736 |
2294 |
1737 getChangeListNumber |
2295 getChangeListNumber |
1905 ^temporaryWorkSpace |
2467 ^temporaryWorkSpace |
1906 ! |
2468 ! |
1907 |
2469 |
1908 mergeOrResolveConflictsForChangeNumber:aNumber |
2470 mergeOrResolveConflictsForChangeNumber:aNumber |
1909 |
2471 |
1910 | tmpFilename perforceCommand outputStream errorStream result s |
2472 | tmpFilename perforceCommand outputStream errorStream result s |
1911 changesAsLogged inStream line changesDict chunksPart words mergedSource mySource |
2473 changesAsLogged inStream line changesDict chunksPart words mergedSource mySource |
1912 localRevision resultSource definitionClass descriptionInfo resolveFiles depotPath localPath checkInDefinition fileStatDict| |
2474 localRevision resultSource definitionClass descriptionInfo resolveFiles depotPath localPath checkInDefinition fileStatDict| |
1913 |
2475 |
1914 self temporaryWorkSpace isNil ifTrue:[ |
2476 self temporaryWorkSpace isNil ifTrue:[ |
1915 ^false |
2477 self perforceError raiseErrorString:('Error getting temporary workspace when try to merge or resolve conflicts for ', aNumber printString, '.'). |
|
2478 ^false. |
1916 ]. |
2479 ]. |
1917 descriptionInfo := (self getChangeDespriptionInfoFor:aNumber printString). |
2480 descriptionInfo := (self getChangeDespriptionInfoFor:aNumber printString). |
1918 descriptionInfo isNil ifTrue:[ |
2481 descriptionInfo isNil ifTrue:[ |
1919 ^false. |
2482 ^false. |
1920 ]. |
2483 ]. |
1921 resolveFiles := descriptionInfo at:#Files ifAbsent:nil. |
2484 resolveFiles := descriptionInfo at:#Files ifAbsent:nil. |
1922 resolveFiles isNil ifTrue:[ |
2485 resolveFiles isNil ifTrue:[ |
1923 ^false. |
2486 ^false. |
1924 ]. |
2487 ]. |
1925 resolveFiles do:[:aFileLine| |
2488 resolveFiles do:[:aFileLine| |
1926 depotPath := (aFileLine copyTo:((aFileLine lastIndexOf:$#) - 1 )) withoutTrailingSeparators. |
2489 depotPath := (aFileLine copyTo:((aFileLine lastIndexOf:$#) - 1 )) withoutTrailingSeparators. |
1927 localPath := self temporaryWorkSpace getLocalPathForDepotPath:depotPath. |
2490 localPath := self temporaryWorkSpace getLocalPathForDepotPath:depotPath. |
1928 fileStatDict := self temporaryWorkSpace getFileStatForPathname:localPath. |
2491 fileStatDict := self temporaryWorkSpace getFileStatForPathname:localPath. |
1929 (fileStatDict includesKey:'unresolved') ifTrue:[ |
2492 (fileStatDict includesKey:'unresolved') ifTrue:[ |
1930 definitionClass := Smalltalk at:(localPath asFilename withoutSuffix baseName asSymbol) ifAbsent:nil. |
2493 definitionClass := Smalltalk at:(localPath asFilename withoutSuffix baseName asSymbol) ifAbsent:nil. |
1931 checkInDefinition := PerforceSourceCodeManager getCheckInDefinitionForClass:definitionClass. |
2494 checkInDefinition := PerforceSourceCodeManager getCheckInDefinitionForClass:definitionClass. |
1932 localRevision := checkInDefinition getLocalRevisionNumber. |
2495 localRevision := checkInDefinition getLocalRevisionNumber. |
1933 tmpFilename := localPath asFilename. |
2496 tmpFilename := localPath asFilename. |
1934 perforceCommand := ('resolve -af "' , tmpFilename pathName, '"'). |
2497 perforceCommand := ('resolve -af "' , tmpFilename pathName, '"'). |
1935 outputStream := ReadWriteStream on:''. |
2498 outputStream := ReadWriteStream on:''. |
1936 errorStream := ReadWriteStream on:''. |
2499 errorStream := ReadWriteStream on:''. |
1937 result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
2500 result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
1938 inputFrom:nil outputTo:outputStream |
2501 inputFrom:nil outputTo:outputStream |
1939 errorTo:errorStream |
2502 errorTo:errorStream |
1940 logHeader:('resolving ', tmpFilename pathName, '.'). |
2503 logHeader:('resolving ', tmpFilename pathName, '.'). |
1941 result ifFalse:[ |
2504 result ifFalse:[ |
1942 ^ false |
2505 ^ false |
1943 ]. |
2506 ]. |
1944 "check for conflicts" |
2507 "check for conflicts" |
1945 changesAsLogged := StringCollection new. |
2508 changesAsLogged := StringCollection new. |
1946 inStream := ReadStream on:(outputStream contents). |
2509 inStream := ReadStream on:(outputStream contents). |
1947 |
2510 |
1948 [inStream atEnd not] whileTrue:[ |
2511 [inStream atEnd not] whileTrue:[ |
1949 line:= inStream nextLine. |
2512 line:= inStream nextLine. |
1950 line notNil ifTrue:[ |
2513 line notNil ifTrue:[ |
1951 (line startsWith:'Diff chunks:') ifTrue:[ |
2514 (line startsWith:'Diff chunks:') ifTrue:[ |
1952 changesAsLogged add:line. |
2515 changesAsLogged add:line. |
1953 changesDict := Dictionary new. |
2516 changesDict := Dictionary new. |
1954 chunksPart := line copyFrom:('Diff chunks:' size + 1). |
2517 chunksPart := line copyFrom:('Diff chunks:' size + 1). |
1955 (chunksPart asCollectionOfSubstringsSeparatedBy:$+) do:[:eachElement| |
2518 (chunksPart asCollectionOfSubstringsSeparatedBy:$+) do:[:eachElement| |
1956 words := eachElement asCollectionOfWords. |
2519 words := eachElement asCollectionOfWords. |
1957 changesDict at:words second asSymbol put:words first asNumber. |
2520 changesDict at:words second asSymbol put:words first asNumber. |
1958 ]. |
2521 ]. |
1959 ]. |
2522 ]. |
1960 ]. |
2523 ]. |
1961 ]. |
2524 ]. |
1962 s := WriteStream on:String new. |
2525 s := WriteStream on:String new. |
1963 PerforceSourceCodeManager fileOutSourceCodeOf:definitionClass on:s. |
2526 PerforceSourceCodeManager fileOutSourceCodeOf:definitionClass on:s. |
1964 mergedSource := tmpFilename readStream contents asString. |
2527 mergedSource := tmpFilename readStream contents asString. |
1965 mySource := s contents asString. |
2528 mySource := s contents asString. |
1966 resultSource := self askForMergedSource:mergedSource |
2529 resultSource := self askForMergedSource:mergedSource |
1967 localSource:mySource |
2530 localSource:mySource |
1968 changesDict:changesDict |
2531 changesDict:changesDict |
1969 haveRevision:(fileStatDict at:'haveRev' ifAbsent:nil) |
2532 haveRevision:(fileStatDict at:'haveRev' ifAbsent:nil) |
1970 changesAsLogged:changesAsLogged |
2533 changesAsLogged:changesAsLogged |
1971 pathName:tmpFilename pathName |
2534 pathName:tmpFilename pathName |
1972 definitionClass:definitionClass. |
2535 definitionClass:definitionClass. |
1973 resultSource isNil ifTrue:[ |
2536 resultSource isNil ifTrue:[ |
1974 ^false. |
2537 ^false. |
1975 ]. |
2538 ]. |
1976 "now we have a merge - lets get latest revision and write on it " |
2539 "now we have a merge - lets get latest revision and write on it " |
1977 perforceCommand := ('revert "' , tmpFilename pathName, '"'). |
2540 perforceCommand := ('revert "' , tmpFilename pathName, '"'). |
1978 outputStream := ReadWriteStream on:''. |
2541 outputStream := ReadWriteStream on:''. |
1979 errorStream := ReadWriteStream on:''. |
2542 errorStream := ReadWriteStream on:''. |
1980 result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
2543 result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
1981 inputFrom:nil outputTo:outputStream |
2544 inputFrom:nil outputTo:outputStream |
1982 errorTo:errorStream |
2545 errorTo:errorStream |
1983 logHeader:('revert after resolving ', tmpFilename pathName, '.'). |
2546 logHeader:('revert after resolving ', tmpFilename pathName, '.'). |
1984 result ifFalse:[ |
2547 result ifFalse:[ |
1985 ^ false |
2548 ^ false |
1986 ]. |
2549 ]. |
1987 |
2550 |
1988 tmpFilename remove. |
2551 tmpFilename remove. |
1989 |
2552 |
1990 perforceCommand := ('sync -f "' , tmpFilename pathName, '"'). |
2553 perforceCommand := ('sync -f "' , tmpFilename pathName, '"'). |
1991 outputStream := ReadWriteStream on:''. |
2554 outputStream := ReadWriteStream on:''. |
1992 errorStream := ReadWriteStream on:''. |
2555 errorStream := ReadWriteStream on:''. |
1993 result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
2556 result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
1994 inputFrom:nil outputTo:outputStream |
2557 inputFrom:nil outputTo:outputStream |
1995 errorTo:errorStream |
2558 errorTo:errorStream |
1996 logHeader:('sync after resolving ', tmpFilename pathName, '.'). |
2559 logHeader:('sync after resolving ', tmpFilename pathName, '.'). |
1997 result ifFalse:[ |
2560 result ifFalse:[ |
1998 ^ false |
2561 ^ false |
1999 ]. |
2562 ]. |
2000 |
2563 |
2001 perforceCommand := ('edit -c ', aNumber printString, ' "' , tmpFilename pathName, '"'). |
2564 perforceCommand := ('edit -c ', aNumber printString, ' "' , tmpFilename pathName, '"'). |
2002 outputStream := ReadWriteStream on:''. |
2565 outputStream := ReadWriteStream on:''. |
2003 errorStream := ReadWriteStream on:''. |
2566 errorStream := ReadWriteStream on:''. |
2004 result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
2567 result := self temporaryWorkSpace executePerforceCommand:perforceCommand inDirectory:self temporaryWorkSpace root |
2005 inputFrom:nil outputTo:outputStream |
2568 inputFrom:nil outputTo:outputStream |
2006 errorTo:errorStream |
2569 errorTo:errorStream |
2007 logHeader:('edit after resolving ', tmpFilename pathName, '.'). |
2570 logHeader:('edit after resolving ', tmpFilename pathName, '.'). |
2008 result ifFalse:[ |
2571 result ifFalse:[ |
2009 ^ false |
2572 ^ false |
2010 ]. |
2573 ]. |
2011 |
2574 |
2012 "write my result" |
2575 "write my result" |
2013 resultSource notNil ifTrue:[ |
2576 resultSource notNil ifTrue:[ |
2014 s := tmpFilename writeStream. |
2577 s := tmpFilename writeStream. |
2015 s nextPutAll:resultSource. |
2578 s nextPutAll:resultSource. |
2016 s close. |
2579 s close. |
2017 ]. |
2580 ]. |
2018 ]. |
2581 ]. |
2019 ]. |
2582 ]. |
2020 ^true |
2583 ^true |
2021 ! |
2584 ! |
2022 |
2585 |
2023 releaseWorkSpace |
2586 releaseWorkSpace |