author | Claus Gittinger <cg@exept.de> |
Wed, 21 Dec 2011 16:11:04 +0100 | |
changeset 2646 | 6735a726f7d3 |
parent 2639 | 11a1cea10275 |
child 2652 | f1faa96b62ac |
permissions | -rw-r--r-- |
2330 | 1 |
"{ Package: 'stx:libbasic3' }" |
2 |
||
3 |
AbstractSourceCodeManager subclass:#PerforceSourceCodeManager |
|
2359
62c8ea518b59
changed: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
4 |
instanceVariableNames:'' |
62c8ea518b59
changed: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
5 |
classVariableNames:'PerforceExecutable PerforceModuleRoots PerforceClient |
62c8ea518b59
changed: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
6 |
PerforcePort PerforceUser PerforcePassword PerforceTempDir |
62c8ea518b59
changed: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
7 |
Verbose PerforceCommandSemaphore PerforceEnabled |
62c8ea518b59
changed: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
8 |
PerforceCacheDirectoryName' |
62c8ea518b59
changed: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
9 |
poolDictionaries:'' |
62c8ea518b59
changed: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
10 |
category:'System-SourceCodeManagement' |
2330 | 11 |
! |
12 |
||
13 |
Object subclass:#CheckInDefinition |
|
2359
62c8ea518b59
changed: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
14 |
instanceVariableNames:'class packageDir classFileName sourceFileName force logMessage |
62c8ea518b59
changed: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
15 |
moduleName manager tempDirectory workSpaceDefinition |
62c8ea518b59
changed: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
16 |
newestRevision definitionClass' |
62c8ea518b59
changed: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
17 |
classVariableNames:'' |
62c8ea518b59
changed: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
18 |
poolDictionaries:'' |
62c8ea518b59
changed: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
19 |
privateIn:PerforceSourceCodeManager |
2330 | 20 |
! |
21 |
||
2355
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
22 |
VersionInfo subclass:#PerforceVersionInfo |
2359
62c8ea518b59
changed: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
23 |
instanceVariableNames:'repositoryPathName' |
62c8ea518b59
changed: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
24 |
classVariableNames:'' |
62c8ea518b59
changed: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
25 |
poolDictionaries:'' |
62c8ea518b59
changed: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
26 |
privateIn:PerforceSourceCodeManager |
2355
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
27 |
! |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
28 |
|
2349 | 29 |
Object subclass:#WorkSpaceDefinition |
2359
62c8ea518b59
changed: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
30 |
instanceVariableNames:'client host localDir owner repositoryDir root workSpaceName |
62c8ea518b59
changed: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
31 |
workSpaceDefinitionFilename moduleName' |
62c8ea518b59
changed: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
32 |
classVariableNames:'' |
62c8ea518b59
changed: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
33 |
poolDictionaries:'' |
62c8ea518b59
changed: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
34 |
privateIn:PerforceSourceCodeManager |
2349 | 35 |
! |
36 |
||
2330 | 37 |
|
38 |
!PerforceSourceCodeManager class methodsFor:'initialization'! |
|
39 |
||
40 |
initialize |
|
41 |
||
42 |
PerforceCommandSemaphore := Semaphore new:10. |
|
43 |
! ! |
|
44 |
||
45 |
!PerforceSourceCodeManager class methodsFor:'accessing'! |
|
46 |
||
47 |
cacheDirectoryName |
|
48 |
"return the name of the cache directory, where checked out class |
|
49 |
sources are kept for faster access. The default is '/tmp/stx_sourceCache'. |
|
50 |
This cache is shared among all ST/X users on a system." |
|
51 |
||
52 |
^ PerforceCacheDirectoryName |
|
53 |
||
54 |
"Modified: 12.9.1996 / 02:20:45 / cg" |
|
55 |
! |
|
56 |
||
57 |
cacheDirectoryName:aStringOrFilename |
|
58 |
"set the name of the cache directory, where checked out class |
|
59 |
sources are kept for faster access. The default is '/tmp/stx_sourceCache'. |
|
60 |
This cache is shared among all ST/X users on a system. |
|
61 |
The directory is typically set via the launchers setting menu, or |
|
62 |
from a startup rc-file." |
|
63 |
||
64 |
PerforceCacheDirectoryName := aStringOrFilename |
|
65 |
||
66 |
"Created: 16.12.1995 / 15:18:43 / cg" |
|
67 |
"Modified: 12.9.1996 / 02:21:35 / cg" |
|
68 |
! |
|
69 |
||
70 |
perforceClient |
|
71 |
|envVar| |
|
72 |
||
73 |
PerforceClient notNil ifTrue:[ ^ PerforceClient]. |
|
74 |
envVar := OperatingSystem getEnvironment:'P4CLIENT'. |
|
75 |
envVar notEmptyOrNil ifTrue:[ ^ envVar]. |
|
76 |
^ 'workspace' |
|
77 |
! |
|
78 |
||
79 |
perforceClient:something |
|
80 |
PerforceClient := something. |
|
81 |
! |
|
82 |
||
83 |
perforceEnabled |
|
84 |
||
85 |
PerforceEnabled notNil ifTrue:[ ^ false]. |
|
86 |
^ PerforceEnabled |
|
87 |
! |
|
88 |
||
89 |
perforceEnabled:enable |
|
90 |
||
91 |
PerforceEnabled := enable. |
|
92 |
! |
|
93 |
||
94 |
perforceExecutable |
|
95 |
^ PerforceExecutable ? 'p4' |
|
96 |
! |
|
97 |
||
98 |
perforceExecutable:aString |
|
99 |
"set the name of the cvs executable." |
|
100 |
||
101 |
aString isEmptyOrNil ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
102 |
PerforceExecutable := nil |
2330 | 103 |
] ifFalse:[ |
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
104 |
PerforceExecutable := aString. |
2330 | 105 |
]. |
106 |
||
107 |
"Created: / 21-09-2006 / 15:31:59 / cg" |
|
108 |
"Modified: / 21-09-2006 / 16:41:33 / cg" |
|
109 |
! |
|
110 |
||
111 |
perforcePassword |
|
112 |
|envVar| |
|
113 |
||
114 |
PerforcePassword notNil ifTrue:[ ^ PerforcePassword]. |
|
115 |
envVar := OperatingSystem getEnvironment:'P4PASSWD'. |
|
116 |
envVar notEmptyOrNil ifTrue:[ ^ envVar]. |
|
2341 | 117 |
^ 'pass' |
118 |
||
119 |
"Modified: / 19-04-2011 / 10:46:56 / cg" |
|
2330 | 120 |
! |
121 |
||
122 |
perforcePassword:something |
|
123 |
PerforcePassword := something. |
|
124 |
! |
|
125 |
||
126 |
perforcePort |
|
127 |
|envVar| |
|
128 |
||
129 |
PerforcePort notNil ifTrue:[ ^ PerforcePort]. |
|
130 |
envVar := OperatingSystem getEnvironment:'P4PORT'. |
|
131 |
envVar notEmptyOrNil ifTrue:[ ^ envVar]. |
|
132 |
^ 'localhost:1666' |
|
133 |
! |
|
134 |
||
135 |
perforcePort:something |
|
136 |
PerforcePort := something. |
|
137 |
! |
|
138 |
||
139 |
perforceUser |
|
140 |
|envVar| |
|
141 |
||
142 |
PerforceUser notNil ifTrue:[ ^ PerforceUser]. |
|
143 |
envVar := OperatingSystem getEnvironment:'P4USER'. |
|
144 |
envVar notEmptyOrNil ifTrue:[ ^ envVar]. |
|
145 |
^ OperatingSystem getLoginName ? 'user' |
|
146 |
! |
|
147 |
||
148 |
perforceUser:something |
|
149 |
PerforceUser := something. |
|
150 |
! |
|
151 |
||
152 |
repositoryInfoPerModule |
|
153 |
"Superclass AbstractSourceCodeManager class says that I am responsible to implement this method" |
|
154 |
||
155 |
^ PerforceModuleRoots ? Dictionary new |
|
156 |
! |
|
157 |
||
158 |
repositoryInfoPerModule:aDictionary |
|
159 |
"set the dictionary, which associates CVSRoots to module names. |
|
160 |
If no entry is contained in this dictionary for some module, |
|
161 |
the default cvsRoot (CVSRoot) will be used." |
|
162 |
||
163 |
PerforceModuleRoots := aDictionary |
|
164 |
! |
|
165 |
||
166 |
repositoryName |
|
167 |
"return the name of the repository. |
|
168 |
Since this is an abstract class, return nil (i.e. none)" |
|
169 |
||
170 |
^ (self perforceClient ,':', |
|
171 |
self perforceUser, ':', |
|
172 |
(self perforcePassword ? 'pass'), '@', |
|
173 |
self perforcePort) |
|
174 |
"Modified: 12.9.1996 / 02:20:45 / cg" |
|
175 |
"Created: 14.9.1996 / 13:21:37 / cg" |
|
176 |
! |
|
177 |
||
178 |
repositoryName:settingsString |
|
179 |
"return the name of the repository. |
|
180 |
Since this is an abstract class, return nil (i.e. none)" |
|
181 |
||
182 |
|settings| |
|
183 |
||
184 |
settings := self getPerforceSettingsFromString:settingsString. |
|
185 |
self perforceClient:(settings at:#client ifAbsent:nil). |
|
186 |
self perforceUser:(settings at:#user ifAbsent:nil). |
|
187 |
self perforcePassword:(settings at:#password ifAbsent:nil). |
|
188 |
self perforcePort:(settings at:#port ifAbsent:nil). |
|
189 |
"Modified: 12.9.1996 / 02:20:45 / cg" |
|
190 |
"Created: 14.9.1996 / 13:21:37 / cg" |
|
191 |
! |
|
192 |
||
193 |
repositoryNameForModule:aModuleName |
|
194 |
||
195 |
|settings| |
|
196 |
||
197 |
settings := self getPerforceSettingsForModule:aModuleName. |
|
198 |
settings isNil ifTrue:[ ^ '']. |
|
199 |
^ ((settings at:#client ifAbsent:'') ,':', |
|
200 |
(settings at:#user ifAbsent:''), ':', |
|
201 |
(settings at:#password ifAbsent:''), '@', |
|
202 |
(settings at:#port ifAbsent:'')) |
|
2341 | 203 |
! |
204 |
||
2595 | 205 |
repositoryNameForPackage:packageId |
206 |
^ self repositoryNameForModule:(packageId upTo:$:) |
|
207 |
"Modified: / 10-10-2011 / 19:48:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2567 | 208 |
! |
209 |
||
2341 | 210 |
verboseSourceCodeAccess |
211 |
||
212 |
^ Verbose |
|
213 |
||
214 |
"Created: / 19-04-2011 / 10:52:29 / cg" |
|
215 |
! |
|
216 |
||
217 |
verboseSourceCodeAccess:aBoolean |
|
218 |
||
219 |
Verbose := aBoolean |
|
220 |
||
221 |
"Created: / 19-04-2011 / 10:52:43 / cg" |
|
2330 | 222 |
! ! |
223 |
||
224 |
!PerforceSourceCodeManager class methodsFor:'basic access'! |
|
225 |
||
226 |
checkoutModule:aModule directory:aPackage andDo:aBlock |
|
227 |
"check out everything from a package into a temporary directory. |
|
228 |
Then evaluate aBlock, passing the name of that temp-directory. |
|
229 |
Afterwards, the tempDir is removed. |
|
230 |
Return true, if OK, false if any error occurred." |
|
231 |
||
232 |
self shouldImplement |
|
233 |
! |
|
234 |
||
235 |
createTempDirectory:packageDir forModule:moduleDir |
|
236 |
"create a temp directory for checking out" |
|
237 |
||
238 |
|tempdir dir| |
|
239 |
||
240 |
"/ if CVSTempDir isNil, use current. |
|
241 |
OperatingSystem errorSignal handle:[:ex | |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
242 |
self reportError:('cannot create temporary directory'). |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
243 |
^ nil. |
2330 | 244 |
] do:[ |
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
245 |
tempdir := Filename newTemporaryDirectoryIn:(self perforceTmpDirectory). |
2330 | 246 |
]. |
247 |
||
248 |
moduleDir notNil ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
249 |
dir := tempdir construct:moduleDir. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
250 |
dir makeDirectory. |
2330 | 251 |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
252 |
packageDir notNil ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
253 |
dir := dir construct:packageDir. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
254 |
dir recursiveMakeDirectory. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
255 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
256 |
dir exists ifFalse:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
257 |
(tempdir construct:moduleDir) recursiveRemove. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
258 |
tempdir recursiveRemove. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
259 |
self reportError:('cannot create temporary directory'). |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
260 |
^ nil. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
261 |
]. |
2330 | 262 |
]. |
263 |
^ tempdir |
|
264 |
||
265 |
"self createTempDirectory:'fooPackage' forModule:'fooModule'" |
|
266 |
||
267 |
"Created: / 09-12-1995 / 19:14:35 / cg" |
|
268 |
"Modified: / 19-12-1995 / 16:13:02 / stefan" |
|
269 |
"Modified: / 29-08-2006 / 13:16:23 / cg" |
|
270 |
! |
|
271 |
||
272 |
savePreferencesOn:aStream |
|
2364 | 273 |
aStream nextPutLine:'PerforceSourceCodeManager notNil ifTrue:['. |
274 |
self repositoryInfoPerModule notEmptyOrNil ifTrue:[ |
|
275 |
aStream nextPutLine:' PerforceSourceCodeManager repositoryInfoPerModule:' , self repositoryInfoPerModule storeString , '.'. |
|
276 |
]. |
|
2330 | 277 |
PerforceExecutable notNil ifTrue:[ |
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
278 |
aStream nextPutLine:' PerforceSourceCodeManager perforceExecutable:' , PerforceExecutable storeString , '.'. |
2330 | 279 |
]. |
280 |
(Smalltalk at:#SourceCodeManager) == self ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
281 |
aStream nextPutLine:' Smalltalk at:#SourceCodeManager put: PerforceSourceCodeManager.'. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
282 |
aStream nextPutLine:' PerforceSourceCodeManager initializeForRepository:' , self repositoryName storeString , '.'. |
2330 | 283 |
]. |
2364 | 284 |
aStream nextPutLine:'].'. |
2330 | 285 |
! |
286 |
||
287 |
streamForClass:cls fileName:fileName revision:revision directory:packageDir module:moduleDir cache:doCache |
|
288 |
"extract a classes source code and return an open readStream on it. |
|
289 |
A revision of nil selects the current (in image) revision. |
|
290 |
The classes source code is extracted using the revision and the sourceCodeInfo, |
|
291 |
which itself is extracted from the classes packageString." |
|
292 |
||
293 |
|cacheIt cacheDir classFileName fullName cachedSourceFilename cacheSubDir cachedFile tempdir checkoutName |
|
294 |
checkoutNameLocal revisionArg revMsg fullTempName fullCachedName stream tempFile cmd inDirectory inStream outStream |
|
295 |
line modulDir lineNr result| |
|
296 |
||
297 |
cacheIt := doCache. |
|
298 |
(cacheIt and:[revision ~~ #newest and:[revision notNil]]) ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
299 |
(cacheDir := self sourceCacheDirectory) isNil ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
300 |
'PerforceSourceCodeManager [warning]: no source cache directory' errorPrintCR. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
301 |
] |
2330 | 302 |
]. |
303 |
||
304 |
classFileName := fileName. |
|
305 |
classFileName isNil ifTrue:[classFileName := cls classBaseFilename]. |
|
306 |
||
307 |
(classFileName endsWith:',v') ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
308 |
classFileName := classFileName copyWithoutLast:2. |
2330 | 309 |
]. |
310 |
(classFileName endsWith:'.st') ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
311 |
cls notNil ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
312 |
classFileName := classFileName copyWithoutLast:3. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
313 |
] |
2330 | 314 |
]. |
315 |
fullName := moduleDir , '/' , packageDir , '/' , classFileName. |
|
316 |
cls notNil ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
317 |
fullName := fullName , '.st'. |
2330 | 318 |
]. |
319 |
||
320 |
(revision isNil or:[revision == #newest]) ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
321 |
cachedSourceFilename := classFileName. |
2330 | 322 |
] ifFalse:[ |
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
323 |
cachedSourceFilename := classFileName , '_' , revision. |
2330 | 324 |
]. |
325 |
||
326 |
cacheDir notNil ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
327 |
cacheSubDir := cacheDir construct:moduleDir. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
328 |
cacheSubDir exists ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
329 |
cacheSubDir := cacheSubDir construct:packageDir. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
330 |
cacheSubDir exists ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
331 |
cachedFile := cacheSubDir construct:cachedSourceFilename. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
332 |
cachedFile exists ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
333 |
^ cachedFile readStream |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
334 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
335 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
336 |
]. |
2330 | 337 |
]. |
338 |
||
339 |
"/ |
|
340 |
"/ first, create a temporary work tree |
|
341 |
"/ Do not make module and package directories, their existence cause cvs checkout to fail in server mode |
|
342 |
"/ |
|
343 |
tempdir := self createTempDirectory:nil forModule:nil. |
|
344 |
||
345 |
||
346 |
"/ |
|
347 |
"/ check it out there |
|
348 |
"/ |
|
349 |
checkoutName := fullName. |
|
350 |
||
351 |
modulDir := moduleDir asFilename construct:packageDir. |
|
352 |
checkoutNameLocal := modulDir constructString:(fullName asFilename baseName). |
|
353 |
||
354 |
(revision isNil or:[revision == #newest]) ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
355 |
cachedSourceFilename := classFileName. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
356 |
revisionArg := ''. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
357 |
revMsg := ''. |
2330 | 358 |
] ifFalse:[ |
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
359 |
cachedSourceFilename := classFileName , '_' , revision. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
360 |
revisionArg := ' -r ' , revision. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
361 |
revMsg := ' (' , revision , ')'. |
2330 | 362 |
]. |
363 |
self activityNotification:'checking out source ' , checkoutName , revMsg. |
|
364 |
||
365 |
fullTempName := tempdir construct:checkoutNameLocal. |
|
366 |
cmd := ('print ' , classFileName, '.st#', revision). |
|
367 |
||
368 |
inDirectory := (Filename currentDirectory asAbsoluteFilename construct:modulDir) pathName. |
|
369 |
result := self executePerforceCommand:cmd |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
370 |
module:moduleDir |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
371 |
inDirectory:inDirectory |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
372 |
log:false |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
373 |
pipe:false. |
2330 | 374 |
result ifFalse:[ |
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
375 |
('PerforceSourceCodeManager [error]: error execute command ', cmd) errorPrintCR. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
376 |
^ nil |
2330 | 377 |
]. |
378 |
inStream := self executePerforceCommand:cmd |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
379 |
module:moduleDir |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
380 |
inDirectory:inDirectory |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
381 |
log:true |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
382 |
pipe:true. |
2330 | 383 |
|
384 |
inStream isNil ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
385 |
('PerforceSourceCodeManager [error]: could not get Stream from ', cmd) errorPrintCR. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
386 |
^ nil |
2330 | 387 |
]. |
388 |
FileStream openErrorSignal handle:[:ex| |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
389 |
('PerforceSourceCodeManager [error]: can not create ', fullTempName pathName) errorPrintCR. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
390 |
^ nil. |
2330 | 391 |
] do:[ |
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
392 |
fullTempName directory recursiveMakeDirectory. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
393 |
outStream := fullTempName writeStream. |
2330 | 394 |
]. |
395 |
lineNr := 1. |
|
396 |
[inStream atEnd not] whileTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
397 |
line:= inStream nextLine. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
398 |
line notNil ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
399 |
lineNr = 1 ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
400 |
] ifFalse:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
401 |
outStream nextPutLine:line. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
402 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
403 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
404 |
lineNr := lineNr + 1. |
2330 | 405 |
]. |
406 |
outStream close. |
|
407 |
||
408 |
(cacheSubDir isNil) ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
409 |
cacheIt := false |
2330 | 410 |
] ifFalse:[ |
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
411 |
cacheSubDir recursiveMakeDirectory. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
412 |
fullCachedName := cacheSubDir constructString:cachedSourceFilename. |
2330 | 413 |
]. |
414 |
fullTempName exists ifFalse:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
415 |
('PerforceSourceCodeManager [error]: failed to checkout ', fullTempName pathName, ' (file does not exist after cvs co)') errorPrintCR. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
416 |
tempdir recursiveRemove. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
417 |
^ nil |
2330 | 418 |
]. |
419 |
||
420 |
(cacheIt |
|
421 |
and:[cachedFile notNil |
|
422 |
and:[fullTempName exists]]) |
|
423 |
ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
424 |
(OperatingSystem errorSignal catch:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
425 |
fullTempName moveTo:fullCachedName |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
426 |
]) ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
427 |
('CVSSourceCodeManager [error]: failed to rename ', fullTempName pathName, ' to ', cachedSourceFilename) errorPrintCR. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
428 |
tempdir recursiveRemove. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
429 |
^ nil |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
430 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
431 |
fullCachedName asFilename exists ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
432 |
stream := fullCachedName asFilename readStream. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
433 |
]. |
2330 | 434 |
] ifFalse:[ |
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
435 |
OperatingSystem isUNIXlike ifFalse:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
436 |
"/ cannot remove files which are still open ... |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
437 |
"/ sigh - need a delete-on-close flag in FileStream. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
438 |
"/ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
439 |
tempFile := Filename newTemporary. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
440 |
fullTempName copyTo:tempFile. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
441 |
stream := tempFile readStream. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
442 |
stream notNil ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
443 |
stream removeOnClose:true. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
444 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
445 |
] ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
446 |
stream := fullTempName readStream. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
447 |
] |
2330 | 448 |
]. |
449 |
||
450 |
^ stream |
|
451 |
! ! |
|
452 |
||
453 |
!PerforceSourceCodeManager class methodsFor:'basic administration'! |
|
454 |
||
455 |
checkForExistingContainer:fileName inModule:moduleDir directory:packageDir |
|
456 |
"check for a container to exist" |
|
457 |
||
458 |
|newestRevision class className| |
|
459 |
||
460 |
fileName isString ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
461 |
className := fileName asFilename withoutSuffix baseName. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
462 |
class := Smalltalk at:(className asSymbol). |
2330 | 463 |
] ifFalse:[ |
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
464 |
class := fileName. |
2330 | 465 |
]. |
466 |
newestRevision := self newestRevisionOf:class. |
|
467 |
^ newestRevision notNil |
|
468 |
! |
|
469 |
||
470 |
checkForExistingModule:moduleName |
|
471 |
"check for a module directory to be present" |
|
472 |
||
473 |
|workSpaceDefinition| |
|
474 |
||
475 |
workSpaceDefinition := self getWorkSpaceForModule:moduleName modulePath:nil. |
|
476 |
^ workSpaceDefinition notNil. |
|
477 |
||
478 |
||
479 |
" |
|
480 |
self checkForExistingModule:'applistx' |
|
481 |
self checkForExistingModule:'balla' |
|
482 |
" |
|
2344
8a715906b999
comment/format in: #checkForExistingModule:
Claus Gittinger <cg@exept.de>
parents:
2341
diff
changeset
|
483 |
|
8a715906b999
comment/format in: #checkForExistingModule:
Claus Gittinger <cg@exept.de>
parents:
2341
diff
changeset
|
484 |
"Modified: / 19-04-2011 / 11:30:41 / cg" |
2330 | 485 |
! |
486 |
||
487 |
checkForExistingModule:moduleName directory:packageDir |
|
488 |
"check for a package directory to be present" |
|
489 |
||
490 |
|modulePath cmd inDirectory inStream line workSpaceDefinition repositoryDir| |
|
491 |
||
492 |
modulePath := moduleName , '/' , packageDir. |
|
493 |
||
494 |
inDirectory := (Filename currentDirectory asAbsoluteFilename) pathName. |
|
495 |
workSpaceDefinition := self getWorkSpaceForModule:moduleName modulePath:modulePath. |
|
496 |
workSpaceDefinition isNil ifTrue:[ |
|
2349 | 497 |
('PerforceSourceCodeManager [error]: cant get perforce client info for ', moduleName) errorPrintCR. |
498 |
^ false |
|
2330 | 499 |
]. |
2349 | 500 |
repositoryDir := workSpaceDefinition repositoryDir. |
2330 | 501 |
(repositoryDir endsWith:'...') ifTrue:[ |
2349 | 502 |
repositoryDir := repositoryDir copyTo:(repositoryDir size - 3). |
2330 | 503 |
]. |
504 |
cmd := ('sync ' , repositoryDir, modulePath, '/...'). |
|
505 |
inStream := self executePerforceCommand:cmd |
|
2349 | 506 |
module:moduleName |
507 |
inDirectory:inDirectory |
|
508 |
log:true |
|
509 |
pipe:true. |
|
2330 | 510 |
inStream isNil ifTrue:[ |
2349 | 511 |
('PerforceSourceCodeManager [error]: cannot open pipe to perforce sync ', moduleName) errorPrintCR. |
512 |
^ false |
|
2330 | 513 |
]. |
514 |
||
515 |
"/ |
|
516 |
"/ read the commands pipe output and extract the container info |
|
517 |
"/ |
|
518 |
[inStream atEnd not] whileTrue:[ |
|
2349 | 519 |
line:= inStream nextLine. |
520 |
line notNil ifTrue:[ |
|
521 |
(line endsWith:'no such file(s).') ifTrue:[ |
|
522 |
^ false |
|
523 |
]. |
|
524 |
] |
|
2330 | 525 |
]. |
526 |
^ true |
|
527 |
||
528 |
" |
|
529 |
self checkForExistingModule:'testModule' directory:'libTestPerforce' |
|
530 |
" |
|
531 |
! |
|
532 |
||
533 |
checkinClass:cls fileName:classFileName directory:packageDir module:moduleName logMessage:logMessage force:forceArg |
|
534 |
"enter a classes source code |
|
535 |
into the source repository. If the force argument is true, no merge is done; |
|
536 |
instead, the code is checked in as given (Dangerous). |
|
537 |
Return true if ok, false if not." |
|
538 |
||
2354 | 539 |
|tempdir cmd checkoutName logMsg locRevision newestRevision binRevision newVersionString |
2330 | 540 |
workspaceDefinitionFile workSpaceName result checkInDefinition workSpaceDefinition depotRoot| |
541 |
||
542 |
cls isPrivate ifTrue:[ |
|
2349 | 543 |
self reportError:'refuse to check in private classes.'. |
544 |
^ false. |
|
2330 | 545 |
]. |
546 |
checkInDefinition := CheckInDefinition new. |
|
547 |
checkInDefinition definitionClass:cls. |
|
548 |
checkInDefinition classFileName:classFileName. |
|
549 |
checkInDefinition force:forceArg. |
|
550 |
checkInDefinition moduleName:moduleName. |
|
551 |
checkInDefinition packageDir:packageDir. |
|
552 |
checkInDefinition manager:self. |
|
553 |
(checkInDefinition setLogMessage:logMessage) ifFalse:[ |
|
2349 | 554 |
self reportError:'perforce cannot handle unicode in logMessage'. |
555 |
^ false |
|
2330 | 556 |
]. |
557 |
||
558 |
||
559 |
locRevision := checkInDefinition getLocalRevisionNumber. |
|
560 |
(binRevision := checkInDefinition getBinaryRevisionNumber) notNil ifTrue:[ |
|
2349 | 561 |
locRevision ~= binRevision ifTrue:[ |
562 |
('PerforceSourceCodeManager [info]: class ' , checkInDefinition className , ' is based upon ' , binRevision printString, ' but has revision ' , (locRevision printString ? '?')) infoPrintCR |
|
563 |
] |
|
2330 | 564 |
]. |
565 |
||
566 |
locRevision isNil ifTrue:[ |
|
2349 | 567 |
locRevision := checkInDefinition getLocalRevisionNumberFromRepository. |
2330 | 568 |
]. |
569 |
||
570 |
"/ |
|
571 |
"/ first, create a temporary work tree |
|
572 |
"/ |
|
573 |
tempdir := checkInDefinition tempDirectory. |
|
574 |
||
575 |
tempdir notNil ifTrue:[ |
|
2349 | 576 |
[ |
2354 | 577 |
checkoutName := checkInDefinition classFileName. |
2330 | 578 |
|
2349 | 579 |
workSpaceDefinition := self createWorkspaceFor:checkInDefinition. |
580 |
workSpaceDefinition isNil ifTrue:[ |
|
581 |
('PerforceSourceCodeManager [error]: failed to create workspace for', checkoutName) errorPrintCR. |
|
582 |
^ false |
|
583 |
]. |
|
584 |
checkInDefinition workSpaceDefinition:workSpaceDefinition. |
|
2330 | 585 |
|
2349 | 586 |
workspaceDefinitionFile := checkInDefinition workSpaceDefinitionFilename. |
587 |
workspaceDefinitionFile notNil ifTrue:[ |
|
588 |
[ |
|
589 |
workSpaceName := checkInDefinition workSpaceName. |
|
590 |
newestRevision := checkInDefinition getNewestRevisionNumber. |
|
2330 | 591 |
|
2349 | 592 |
newestRevision isNil ifTrue:[ |
593 |
" create container for class initial check in" |
|
594 |
(binRevision notNil) ifTrue:[ |
|
595 |
(Dialog confirm:('Someone seems to have removed the source container for ',cls name,'\\Force new checkin ?') withCRs) ifTrue:[ |
|
596 |
cls setBinaryRevision:nil. |
|
597 |
^ self checkinClass:cls fileName:classFileName directory:packageDir module:moduleName logMessage:logMsg force:forceArg. |
|
598 |
]. |
|
599 |
]. |
|
600 |
"initial checkin here" |
|
601 |
^ self initialCheckinFor:checkInDefinition. |
|
602 |
]. |
|
603 |
"/ is the version correct ? |
|
604 |
locRevision > newestRevision ifTrue:[ |
|
605 |
(Dialog confirm:('The version-info of ',cls name allBold,' is wrong \(The class version (',locRevision allBold,') is newer than the newest version in the repository (',newestRevision printString allBold,').\\Patch the version and retry checkin ?') withCRs) |
|
606 |
ifTrue:[ |
|
607 |
newVersionString := self updatedRevisionStringOf:cls forRevision:newestRevision with:cls revisionString. |
|
608 |
cls updateVersionMethodFor:newVersionString. |
|
609 |
^ self checkinClass:cls fileName:classFileName directory:packageDir module:moduleName logMessage:logMsg force:forceArg. |
|
610 |
]. |
|
611 |
]. |
|
612 |
newestRevision > locRevision ifTrue:[ |
|
613 |
"someone changed repository in the meanwhile" |
|
614 |
self activityNotification:'merging ' , cls name , ' with repository version...'. |
|
615 |
self mergeOrResolveConflictsFor:checkInDefinition. |
|
616 |
self postCheckInClass:cls checkInDefinition:checkInDefinition. |
|
617 |
] ifFalse:[ |
|
618 |
result := self standardCheckinFor:checkInDefinition localRevision:locRevision. |
|
619 |
result ifFalse:[ |
|
620 |
('PerforceSourceCodeManager [error]: failed to checkin ', checkoutName) errorPrintCR. |
|
621 |
^ false |
|
622 |
]. |
|
623 |
]. |
|
624 |
] |
|
625 |
ensure:[ |
|
626 |
" we have to revert all before delete workspace " |
|
627 |
depotRoot := workSpaceDefinition repositoryDir. |
|
628 |
depotRoot notNil ifTrue:[ |
|
629 |
cmd := ('revert ' , depotRoot). |
|
630 |
result := self executePerforceCommand:cmd |
|
631 |
module:moduleName |
|
632 |
inDirectory:tempdir |
|
633 |
log:true |
|
634 |
pipe:false |
|
635 |
clientName:workSpaceName. |
|
636 |
]. |
|
637 |
cmd := ('client -d ' , workSpaceName). |
|
638 |
result := self executePerforceCommand:cmd |
|
639 |
module:moduleName |
|
640 |
inDirectory:tempdir |
|
641 |
log:true |
|
642 |
pipe:false |
|
643 |
clientName:workSpaceName. |
|
2330 | 644 |
|
2349 | 645 |
]. |
646 |
]. |
|
647 |
] ensure:[ |
|
648 |
tempdir recursiveRemove. |
|
649 |
]. |
|
2330 | 650 |
]. |
651 |
^ true |
|
652 |
||
653 |
" |
|
654 |
SourceCodeManager checkinClass:Array logMessage:'testing only' |
|
655 |
" |
|
656 |
||
657 |
"Created: / 11-09-1996 / 16:16:11 / cg" |
|
658 |
"Modified: / 26-02-1998 / 17:34:16 / stefan" |
|
659 |
"Modified: / 25-10-2006 / 17:41:46 / cg" |
|
660 |
! |
|
661 |
||
662 |
checkinClass:cls fileName:classFileName directory:packageDir module:moduleName source:sourceFileName logMessage:logMessage force:forceArg |
|
663 |
"enter a classes source code (which has been already filed out into sourceFileName) |
|
664 |
here we have to create our own source file |
|
665 |
into the source repository. If the force argument is true, no merge is done; |
|
666 |
instead, the code is checked in as given (Dangerous). |
|
667 |
Return true if ok, false if not." |
|
668 |
||
669 |
^ self checkinClass:cls fileName:classFileName directory:packageDir module:moduleName logMessage:logMessage force:forceArg |
|
670 |
||
671 |
" |
|
672 |
SourceCodeManager checkinClass:Array logMessage:'testing only' |
|
673 |
" |
|
674 |
||
675 |
"Created: / 11-09-1996 / 16:16:11 / cg" |
|
676 |
"Modified: / 26-02-1998 / 17:34:16 / stefan" |
|
677 |
"Modified: / 25-10-2006 / 17:41:46 / cg" |
|
678 |
! |
|
679 |
||
680 |
createContainerFor:aClass inModule:moduleName directory:dirName container:fileName |
|
681 |
"create a new container & check into it an initial version of aClass" |
|
682 |
||
683 |
self shouldImplement |
|
684 |
! |
|
685 |
||
686 |
createContainerFor:cls inModule:moduleName package:packageDir container:classFileName |
|
687 |
||
688 |
^ self checkinClass:cls fileName:classFileName directory:packageDir module:moduleName logMessage:'Initial check in' force:false. |
|
689 |
! |
|
690 |
||
691 |
createContainerFor:cls inModule:moduleName package:packageDir container:classFileName logMessage:logMessage |
|
692 |
||
693 |
||
694 |
^ self checkinClass:cls fileName:classFileName directory:packageDir module:moduleName logMessage:logMessage force:false. |
|
695 |
! |
|
696 |
||
697 |
createModule:moduleName |
|
698 |
"create a new module directory" |
|
699 |
||
700 |
self shouldImplement |
|
701 |
! |
|
702 |
||
703 |
createModule:module directory:directory |
|
704 |
"nothing to do with PerforceSourceCodeManager |
|
705 |
subdirectory in repository will created with adding the file " |
|
706 |
||
707 |
^ true |
|
708 |
! |
|
709 |
||
710 |
initialRevisionStringFor:aClass inModule:moduleDir directory:packageDir container:fileName |
|
711 |
"return a string usable as initial revision string" |
|
712 |
||
713 |
||
714 |
|modulePath workSpaceDefinition version checkoutName repositoryDir repositoryPathName| |
|
715 |
||
716 |
modulePath := moduleDir , '/' , packageDir. |
|
717 |
checkoutName := modulePath , '/' , aClass name, '.st'. |
|
718 |
workSpaceDefinition := self getWorkSpaceForModule:moduleDir modulePath:modulePath. |
|
719 |
version := PerforceVersionInfo new. |
|
2349 | 720 |
repositoryDir := workSpaceDefinition repositoryDir. |
2330 | 721 |
(repositoryDir endsWith:'...') ifTrue:[ |
2349 | 722 |
repositoryDir := repositoryDir copyTo:(repositoryDir size - 3). |
2330 | 723 |
]. |
724 |
||
725 |
repositoryPathName := repositoryDir asFilename construct:checkoutName. |
|
726 |
version repositoryPathName:repositoryPathName pathName. |
|
727 |
version revision:'1'. |
|
728 |
^ version getVersionString. |
|
729 |
! |
|
730 |
||
731 |
readRevisionLogEntryFromStream:inStream |
|
732 |
"read and parse a single revision info-entry from the cvs log output. |
|
733 |
Return nil on end. |
|
734 |
||
735 |
The returned information is a structure (IdentityDictionary) |
|
736 |
filled with: |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
737 |
#revision -> the revision string |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
738 |
#author -> who checked that revision into the repository |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
739 |
#date -> when was it checked in |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
740 |
#state -> the RCS state |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
741 |
#numberOfChangedLines -> the number of changed line w.r.t the previous |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
742 |
#logMessage -> the checkIn log message |
2330 | 743 |
" |
744 |
||
745 |
|revLine1 atEnd| |
|
746 |
||
747 |
atEnd := false. |
|
748 |
||
749 |
revLine1 := inStream nextLine. |
|
750 |
^ self readRevisionLogEntryFromString:revLine1. |
|
751 |
! |
|
752 |
||
753 |
readRevisionLogEntryFromString:revLine1 |
|
754 |
"read and parse a single revision info-entry from the cvs log output. |
|
755 |
Return nil on end. |
|
756 |
||
757 |
The returned information is a structure (IdentityDictionary) |
|
758 |
filled with: |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
759 |
#revision -> the revision string |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
760 |
#author -> who checked that revision into the repository |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
761 |
#date -> when was it checked in |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
762 |
#state -> the RCS state |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
763 |
#numberOfChangedLines -> the number of changed line w.r.t the previous |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
764 |
#logMessage -> the checkIn log message |
2330 | 765 |
" |
766 |
||
767 |
| record revisionLineElements noOfRevisionLineElements posText| |
|
768 |
||
769 |
(revLine1 notNil) ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
770 |
record := IdentityDictionary new. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
771 |
revisionLineElements := revLine1 asCollectionOfWords. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
772 |
noOfRevisionLineElements := revisionLineElements size. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
773 |
noOfRevisionLineElements > 1 ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
774 |
record at:#revision put:((revisionLineElements at:2) copyFrom:2). |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
775 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
776 |
noOfRevisionLineElements > 8 ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
777 |
record at:#author put:(revisionLineElements at:9). |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
778 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
779 |
noOfRevisionLineElements > 6 ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
780 |
record at:#date put:(revisionLineElements at:7). |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
781 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
782 |
noOfRevisionLineElements > 4 ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
783 |
record at:#state put:(revisionLineElements at:5). |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
784 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
785 |
noOfRevisionLineElements > 10 ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
786 |
posText := 0. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
787 |
1 to:9 do:[:ele| posText := posText + (revisionLineElements at:ele) size + 1]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
788 |
record at:#logMessage put:(revLine1 copyFrom:posText). |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
789 |
]. |
2330 | 790 |
]. |
791 |
^record. |
|
792 |
! |
|
793 |
||
2349 | 794 |
revisionLogOf:clsOrNil |
795 |
fromRevision:firstRev |
|
796 |
toRevision:lastRef |
|
797 |
numberOfRevisions:numRevisions |
|
798 |
fileName:classFileName |
|
799 |
directory:packageDir |
|
800 |
module:moduleName |
|
2330 | 801 |
"return info about the repository container and |
802 |
(part of) the revisionlog as a collection of revision entries. |
|
803 |
Return nil on failure. |
|
804 |
||
805 |
If numRevisions is notNil, it limits the number of revision records returned - |
|
806 |
only numRevions of the newest revision infos will be collected. |
|
807 |
||
808 |
The returned information is a structure (IdentityDictionary) |
|
809 |
filled with: |
|
2349 | 810 |
#newestRevision -> the revisionString of the newest revision |
811 |
#numberOfRevisions -> the number of revisions in the container (nil for all) |
|
812 |
#revisions -> collection of per-revision info (see below) |
|
2330 | 813 |
|
2349 | 814 |
firstRev / lastRef specify from which revisions a logEntry is wanted: |
815 |
-If firstRev is nil, the first revision is the initial revision |
|
816 |
otherwise, the log starts with that revision. |
|
817 |
-If lastRef is nil, the last revision is the newest revision |
|
818 |
otherwise, the log ends with that revision. |
|
2330 | 819 |
|
2349 | 820 |
-If both are nil, all logEntries are extracted. |
821 |
-If both are 0 (not nil), no logEntries are extracted (i.e. only the header). |
|
2330 | 822 |
|
2349 | 823 |
per revision info consists of one record per revision: |
2330 | 824 |
|
2349 | 825 |
#revision -> the revision string |
826 |
#author -> who checked that revision into the repository |
|
827 |
#date -> when was it checked in |
|
828 |
#state -> the RCS state |
|
829 |
#numberOfChangedLines -> the number of changed line w.r.t the previous |
|
830 |
#logMessage -> the checkIn log message |
|
2330 | 831 |
|
2349 | 832 |
revisions are ordered newest first |
833 |
(i.e. the last entry is for the initial revision; the first for the most recent one) |
|
834 |
Attention: if state = 'dead' that revision is no longer valid. |
|
835 |
" |
|
2330 | 836 |
|
2354 | 837 |
|fullName inStream atEnd line inHeaderInfo workSpaceDefinition |
2330 | 838 |
info record revisionRecords headerOnly msg revArg inDirectory infoAndLogString elements newestRevision foundView| |
839 |
||
840 |
||
841 |
[ |
|
2349 | 842 |
|cmd moduleDir| |
2330 | 843 |
|
2349 | 844 |
revArg := ''. |
845 |
headerOnly := false. |
|
846 |
(firstRev notNil or:[lastRef notNil]) ifTrue:[ |
|
847 |
(firstRev == 0 and:[lastRef == 0]) ifTrue:[ |
|
848 |
headerOnly := true. |
|
849 |
] |
|
850 |
]. |
|
851 |
workSpaceDefinition := self getWorkSpaceForModule:moduleName. |
|
2354 | 852 |
|
853 |
workSpaceDefinition isNil ifTrue:[ |
|
854 |
self error:('Perforce cant get workspace definition for module ', moduleName, '.'). |
|
855 |
^ nil. |
|
2349 | 856 |
]. |
857 |
headerOnly ifTrue:[ |
|
858 |
msg := 'fetching revision info ' |
|
859 |
] ifFalse:[ |
|
860 |
msg := 'reading revision log ' |
|
861 |
]. |
|
2354 | 862 |
foundView := workSpaceDefinition getDepotPackageDirDorModule:packageDir classFileName:classFileName. |
863 |
||
2349 | 864 |
clsOrNil isNil ifTrue:[ |
2354 | 865 |
msg := msg , 'in ' , foundView. |
2349 | 866 |
] ifFalse:[ |
867 |
msg := msg , 'of ', clsOrNil name. |
|
868 |
]. |
|
869 |
self activityNotification:msg,'...'. |
|
2330 | 870 |
|
2349 | 871 |
cmd := ('filelog ' , foundView). |
872 |
||
2354 | 873 |
inDirectory := (Filename currentDirectory asAbsoluteFilename) pathName. |
2349 | 874 |
inStream := self executePerforceCommand:cmd |
875 |
module:moduleName |
|
876 |
inDirectory:inDirectory |
|
877 |
log:true |
|
878 |
pipe:true. |
|
879 |
inStream isNil ifTrue:[ |
|
880 |
('PerforceSourceCodeManager [error]: cannot open pipe to perforce filelog ', fullName) errorPrintCR. |
|
881 |
^ nil |
|
882 |
]. |
|
2330 | 883 |
|
2349 | 884 |
"/ |
885 |
"/ read the commands pipe output and extract the container info |
|
886 |
"/ |
|
887 |
info := IdentityDictionary new. |
|
888 |
inHeaderInfo := true. |
|
889 |
revisionRecords := OrderedCollection new. |
|
890 |
[inHeaderInfo and:[inStream atEnd not]] whileTrue:[ |
|
891 |
line:= inStream nextLine. |
|
892 |
line notNil ifTrue:[ |
|
893 |
|gotIt| |
|
2330 | 894 |
|
2349 | 895 |
gotIt := false. |
896 |
infoAndLogString := line asCollectionOfSubstringsSeparatedBy:$'. |
|
897 |
elements := infoAndLogString size. |
|
898 |
elements > 1 ifTrue:[ |
|
899 |
record := self readRevisionLogEntryFromString:line. |
|
900 |
newestRevision := record at:#revision. |
|
901 |
info at:#newestRevision put:newestRevision. |
|
902 |
info at:#numberOfRevisions put:newestRevision asNumber. |
|
903 |
revisionRecords add:record. |
|
904 |
inHeaderInfo := false |
|
905 |
]. |
|
906 |
] |
|
907 |
]. |
|
2330 | 908 |
|
2349 | 909 |
info isEmpty ifTrue:[ |
2354 | 910 |
('PerforceSourceCodeManager [warning]: no log for ', foundView) errorPrintCR. |
2349 | 911 |
^ nil |
912 |
]. |
|
2330 | 913 |
|
2349 | 914 |
"/ strip selected revisions from the total-revisions entry |
915 |
headerOnly ifFalse:[ |
|
916 |
"/ |
|
917 |
"/ continue to read the commands pipe output |
|
918 |
"/ and extract revision info records |
|
919 |
"/ |
|
920 |
info at:#revisions put:revisionRecords. |
|
2330 | 921 |
|
2349 | 922 |
atEnd := false. |
923 |
[atEnd or:[inStream atEnd]] whileFalse:[ |
|
924 |
record := self readRevisionLogEntryFromStream:inStream. |
|
925 |
record isNil ifTrue:[ |
|
926 |
atEnd := true. |
|
927 |
] ifFalse:[ |
|
928 |
revisionRecords add:record. |
|
929 |
]. |
|
930 |
(numRevisions notNil and:[revisionRecords size >= numRevisions]) ifTrue:[ |
|
931 |
atEnd := true |
|
932 |
] |
|
933 |
]. |
|
934 |
]. |
|
2330 | 935 |
] ensure:[ |
2349 | 936 |
inStream notNil ifTrue:[inStream close]. |
2330 | 937 |
|
2349 | 938 |
self activityNotification:nil. |
2330 | 939 |
]. |
940 |
^ info |
|
941 |
||
942 |
" |
|
943 |
AbstractSourceCodeManager revisionLogOf:ExtIF |
|
944 |
SourceCodeManager revisionLogOf:Array fromRevision:'1.40' toRevision:'1.43' |
|
945 |
SourceCodeManager revisionLogOf:Array fromRevision:'1.40' toRevision:nil |
|
946 |
SourceCodeManager revisionLogOf:Array fromRevision:nil toRevision:'1.3' |
|
947 |
SourceCodeManager revisionLogOf:Array fromRevision:nil toRevision:nil |
|
948 |
SourceCodeManager revisionLogOf:Array fromRevision:0 toRevision:0 |
|
949 |
" |
|
950 |
||
951 |
"Created: / 16-11-1995 / 13:25:30 / cg" |
|
952 |
"Modified: / 29-01-1997 / 16:51:30 / stefan" |
|
953 |
"Modified: / 29-08-2006 / 14:57:26 / cg" |
|
954 |
! ! |
|
955 |
||
956 |
!PerforceSourceCodeManager class methodsFor:'execute'! |
|
957 |
||
958 |
executePerforceCommand:cvsCommand module:moduleName inDirectory:dir |
|
959 |
"execute command and prepend cvs command name and global options. |
|
960 |
if dir ~= nil, execute command in that directory. |
|
961 |
This also leads to a log-entry to be added to cvs's logfile." |
|
962 |
||
963 |
^ self |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
964 |
executePerforceCommand:cvsCommand |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
965 |
module:moduleName |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
966 |
inDirectory:dir |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
967 |
log:true |
2330 | 968 |
! |
969 |
||
970 |
executePerforceCommand:cvsCommand module:moduleName inDirectory:dir log:doLog |
|
971 |
"execute command and prepend cvs command name and global options. |
|
972 |
if dir ~= nil, execute command in that directory. |
|
973 |
The doLog argument, if false supresses a logEntry to be added |
|
974 |
in the cvs log file (used when reading / extracting history)" |
|
975 |
||
976 |
^ self |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
977 |
executePerforceCommand:cvsCommand module:moduleName inDirectory:dir log:doLog |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
978 |
pipe:false |
2330 | 979 |
! |
980 |
||
981 |
executePerforceCommand:perforceCommand module:moduleName inDirectory:dirArg log:doLog pipe:doPipe |
|
982 |
"execute command and prepend perforce command name and global options. |
|
983 |
execute command in the dirArg directory. |
|
984 |
The doLog argument, if false supresses a logEntry to be added |
|
985 |
in the cvs log file (used when reading / extracting history)" |
|
986 |
||
987 |
^ self executePerforceCommand:perforceCommand module:moduleName inDirectory:dirArg log:doLog pipe:doPipe clientName:nil |
|
988 |
! |
|
989 |
||
990 |
executePerforceCommand:perforceCommand module:moduleName inDirectory:dirArg log:doLog pipe:doPipe clientName:clientName |
|
991 |
"execute command and prepend perforce command name and global options. |
|
992 |
execute command in the dirArg directory. |
|
993 |
The doLog argument, if false supresses a logEntry to be added |
|
994 |
in the cvs log file (used when reading / extracting history)" |
|
995 |
||
996 |
^ self executePerforceCommand:perforceCommand module:moduleName inDirectory:dirArg log:doLog pipe:doPipe clientName:clientName inputFrom:nil. |
|
997 |
! |
|
998 |
||
999 |
executePerforceCommand:perforceCommand module:moduleName inDirectory:dirArg log:doLog pipe:doPipe clientName:clientName inputFrom:inputStream |
|
1000 |
"execute command and prepend perforce command name and global options. |
|
1001 |
execute command in the dirArg directory. |
|
1002 |
The doLog argument, if false supresses a logEntry to be added |
|
1003 |
in the cvs log file (used when reading / extracting history)" |
|
1004 |
||
1005 |
|command perforceSettings rslt ok pathOfDir errorString commandStream password user port client executable| |
|
1006 |
||
1007 |
dirArg notNil ifTrue:[ |
|
2349 | 1008 |
pathOfDir := dirArg asFilename pathName. |
2330 | 1009 |
]. |
1010 |
||
1011 |
perforceSettings := self getPerforceSettingsForModule:moduleName. |
|
1012 |
perforceSettings isNil ifTrue:[ ^ nil]. |
|
1013 |
||
1014 |
commandStream := WriteStream on:''. |
|
1015 |
executable := self perforceExecutable. |
|
1016 |
(executable includes:Character space) ifTrue:[ |
|
2349 | 1017 |
commandStream nextPut:$". |
1018 |
commandStream nextPutAll:executable. |
|
1019 |
commandStream nextPut:$". |
|
2330 | 1020 |
] ifFalse:[ |
2349 | 1021 |
commandStream nextPutAll:executable. |
2330 | 1022 |
]. |
1023 |
commandStream space. |
|
1024 |
port := perforceSettings at:#port ifAbsent:nil. |
|
1025 |
port notNil ifTrue:[ |
|
2349 | 1026 |
commandStream space. |
1027 |
commandStream nextPutAll:'-p '. |
|
1028 |
commandStream nextPutAll:(perforceSettings at:#port). |
|
1029 |
commandStream space. |
|
2330 | 1030 |
]. |
1031 |
clientName notNil ifTrue:[ |
|
2349 | 1032 |
client := clientName. |
2330 | 1033 |
] ifFalse:[ |
2349 | 1034 |
client := perforceSettings at:#client ifAbsent:nil. |
2330 | 1035 |
]. |
1036 |
client notEmptyOrNil ifTrue:[ |
|
2349 | 1037 |
commandStream space. |
1038 |
commandStream nextPutAll:'-c '. |
|
1039 |
commandStream nextPutAll:client. |
|
1040 |
commandStream space. |
|
2330 | 1041 |
]. |
1042 |
user := perforceSettings at:#user ifAbsent:nil. |
|
1043 |
user notNil ifTrue:[ |
|
2349 | 1044 |
commandStream space. |
1045 |
commandStream nextPutAll:'-u '. |
|
1046 |
commandStream nextPutAll:(perforceSettings at:#user). |
|
1047 |
commandStream space. |
|
2330 | 1048 |
]. |
1049 |
password := perforceSettings at:#password ifAbsent:nil. |
|
1050 |
password notNil ifTrue:[ |
|
2349 | 1051 |
commandStream space. |
1052 |
commandStream nextPutAll:'-P '. |
|
1053 |
commandStream nextPutAll:(perforceSettings at:#password ifAbsent:''). |
|
1054 |
commandStream space. |
|
2330 | 1055 |
]. |
1056 |
commandStream nextPutAll:perforceCommand. |
|
1057 |
||
1058 |
command := commandStream contents. |
|
1059 |
Verbose == true ifTrue:[ |
|
2349 | 1060 |
('PerforceSourceCodeManager [info]: executing: ' , command , ' [in ' , (pathOfDir?'.') , ']') infoPrintCR. |
2330 | 1061 |
]. |
1062 |
doPipe ifTrue:[ |
|
2349 | 1063 |
rslt := PipeStream readingFrom:command errorDisposition:#inline inDirectory:pathOfDir. |
1064 |
ok := rslt notNil. |
|
2330 | 1065 |
] ifFalse:[ |
2349 | 1066 |
Processor isDispatching ifFalse:[ |
1067 |
rslt := ok := OperatingSystem executeCommand:command |
|
1068 |
inputFrom:inputStream |
|
1069 |
outputTo:nil |
|
1070 |
errorTo:nil |
|
1071 |
auxFrom:nil |
|
1072 |
inDirectory:pathOfDir |
|
1073 |
lineWise:true |
|
1074 |
onError:[:status| false]. |
|
1075 |
] ifTrue:[ |
|
1076 |
PerforceCommandSemaphore critical:[ |
|
1077 |
|p errOut| |
|
2330 | 1078 |
|
2349 | 1079 |
errOut := WriteStream on:String new. |
1080 |
p := [ |
|
1081 |
rslt := ok := OperatingSystem executeCommand:command |
|
1082 |
inputFrom:inputStream |
|
1083 |
outputTo:nil |
|
1084 |
errorTo:nil |
|
1085 |
auxFrom:nil |
|
1086 |
inDirectory:pathOfDir |
|
1087 |
lineWise:true |
|
1088 |
onError:[:status| false]. |
|
1089 |
] fork. |
|
2330 | 1090 |
|
2349 | 1091 |
(p waitUntilTerminatedWithTimeout:300) ifTrue:[ |
1092 |
('PerforceSourceCodeManager [info]: command timeout: ' , command) errorPrintCR. |
|
1093 |
ok := false. |
|
1094 |
errorString := 'Perforce command timeout'. |
|
1095 |
] ifFalse:[ |
|
1096 |
ok ifFalse:[ |
|
1097 |
errorString := errOut contents. |
|
1098 |
]. |
|
1099 |
]. |
|
1100 |
]. |
|
1101 |
]. |
|
2330 | 1102 |
]. |
1103 |
||
1104 |
ok ifFalse:[ |
|
2349 | 1105 |
('PerforceSourceCodeManager [info]: command failed: ' , command) errorPrintCR. |
2330 | 1106 |
|
2349 | 1107 |
SourceCodeManagerError isHandled ifTrue:[ |
1108 |
SourceCodeManagerError raiseErrorString:(errorString ? 'Perforce Error'). |
|
1109 |
]. |
|
2330 | 1110 |
]. |
1111 |
^ rslt. |
|
1112 |
||
1113 |
"Modified: / 23-04-1996 / 15:24:00 / stefan" |
|
1114 |
"Created: / 20-05-1998 / 16:06:34 / cg" |
|
1115 |
"Modified: / 29-09-2006 / 15:06:42 / cg" |
|
1116 |
! ! |
|
1117 |
||
1118 |
!PerforceSourceCodeManager class methodsFor:'private'! |
|
1119 |
||
1120 |
checkinTroubleDialog:title message:message log:log abortable:abortable option:optionTitle |
|
1121 |
"trouble checking in - open a dialog" |
|
1122 |
||
1123 |
^ self |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1124 |
checkinTroubleDialog:title |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1125 |
message:message |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1126 |
log:log |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1127 |
abortable:abortable |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1128 |
option:optionTitle |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1129 |
option2:nil |
2330 | 1130 |
|
1131 |
"Created: 10.12.1995 / 17:34:33 / cg" |
|
1132 |
"Modified: 12.9.1996 / 02:39:06 / cg" |
|
1133 |
! |
|
1134 |
||
1135 |
checkinTroubleDialog:title message:message log:log abortable:abortable option:optionTitle option2:optionTitle2 |
|
1136 |
^self |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1137 |
checkinTroubleDialog:title |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1138 |
message:message |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1139 |
log:log |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1140 |
abortable:abortable |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1141 |
option:optionTitle |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1142 |
option2:optionTitle2 |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1143 |
option3:nil |
2330 | 1144 |
! |
1145 |
||
1146 |
checkinTroubleDialog:title message:message log:log abortable:abortable option:optionTitle option2:optionTitle2 option3:optionTitle3 |
|
1147 |
"trouble checking in - open a dialog" |
|
1148 |
||
1149 |
|l box list listView optionPressed option2Pressed option3Pressed| |
|
1150 |
||
1151 |
l := log collect:[:line | line withTabsExpanded]. |
|
1152 |
list := SelectionInList with:l. |
|
1153 |
||
1154 |
box := Dialog new. |
|
1155 |
box label:(title). |
|
1156 |
||
1157 |
(box addTextLabel:message) borderWidth:0. |
|
1158 |
||
1159 |
listView := SelectionInListView on:list. |
|
1160 |
listView disable. |
|
1161 |
listView height:200. |
|
1162 |
box addComponent:(HVScrollableView forView:listView miniScrollerH:true) tabable:false. |
|
1163 |
box addVerticalSpace. |
|
1164 |
||
1165 |
abortable ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1166 |
box addAbortButton |
2330 | 1167 |
]. |
1168 |
optionTitle notNil ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1169 |
box addOkButton:(Button label:optionTitle action:[optionPressed := true. box hide]). |
2330 | 1170 |
]. |
1171 |
optionTitle2 notNil ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1172 |
box addOkButton:(Button label:optionTitle2 action:[option2Pressed := true. box hide]). |
2330 | 1173 |
]. |
1174 |
optionTitle3 notNil ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1175 |
box addOkButton:(Button label:optionTitle3 action:[option3Pressed := true. box hide]). |
2330 | 1176 |
]. |
1177 |
box addOkButton. |
|
1178 |
||
1179 |
box extent:(box preferredExtent). |
|
1180 |
box minExtent:box extent. |
|
1181 |
box maxExtent:box extent. |
|
1182 |
||
1183 |
box open. |
|
1184 |
||
1185 |
box destroy. |
|
1186 |
optionPressed == true ifTrue:[^ #option]. |
|
1187 |
option2Pressed == true ifTrue:[^ #option2]. |
|
1188 |
option3Pressed == true ifTrue:[^ #option3]. |
|
1189 |
^ box accepted |
|
1190 |
||
1191 |
"Created: 9.9.1996 / 19:12:45 / cg" |
|
1192 |
"Modified: 12.9.1996 / 02:39:10 / cg" |
|
1193 |
! |
|
1194 |
||
1195 |
createWorkspaceFor:checkInDefinition |
|
1196 |
" |
|
2349 | 1197 |
create an temporary workspace for handle checkin |
2330 | 1198 |
" |
1199 |
||
1200 |
|workSpaceName workSpaceDefinitionFilename ws cmd foundView result |
|
1201 |
workSpaceDefinition readStream moduleName modulePath directory| |
|
1202 |
||
1203 |
moduleName := checkInDefinition moduleName. |
|
1204 |
modulePath := checkInDefinition modulePath. |
|
1205 |
directory := checkInDefinition tempDirectory. |
|
1206 |
workSpaceDefinition := self getWorkSpaceForModule:moduleName modulePath:modulePath. |
|
1207 |
workSpaceDefinition isNil ifTrue:[ |
|
2349 | 1208 |
self error:('Perforce cant get workspace definition for module ', moduleName, '.'). |
1209 |
^ nil. |
|
2330 | 1210 |
]. |
1211 |
directory exists ifFalse:[ |
|
2349 | 1212 |
self error:('Perforce create workspace directory ', directory pathName, ' not exists.'). |
1213 |
^ nil. |
|
2330 | 1214 |
]. |
2349 | 1215 |
foundView := workSpaceDefinition repositoryDir. |
2330 | 1216 |
workSpaceName := UUID genUUID displayString. |
1217 |
workSpaceName := 'stxTestWorkSpace'. |
|
2349 | 1218 |
workSpaceDefinition workSpaceName:workSpaceName. |
2330 | 1219 |
workSpaceDefinitionFilename := directory asFilename construct:workSpaceName. |
2349 | 1220 |
workSpaceDefinition workSpaceDefinitionFilename:workSpaceDefinitionFilename. |
2330 | 1221 |
ws := workSpaceDefinitionFilename writeStream. |
1222 |
ws nextPutAll:'Client: '. |
|
1223 |
ws nextPutAll:workSpaceName. |
|
1224 |
ws cr. |
|
1225 |
ws nextPutAll:'Owner: '. |
|
2349 | 1226 |
ws nextPutAll:(workSpaceDefinition owner). |
2330 | 1227 |
ws cr. |
1228 |
ws nextPutAll:'Host: '. |
|
2349 | 1229 |
ws nextPutAll:(workSpaceDefinition host). |
2330 | 1230 |
ws cr. |
1231 |
ws nextPutAll:'Description: '. |
|
1232 |
ws nextPutAll:'Used temporary for Smalltalk/X'. |
|
1233 |
ws cr. |
|
1234 |
ws nextPutAll:'Root: '. |
|
1235 |
ws nextPutAll:directory asFilename pathName. |
|
1236 |
ws cr. |
|
1237 |
ws nextPutAll:'Options: '. |
|
1238 |
ws nextPutAll:'allwrite noclobber nocompress unlocked nomodtime normdir'. |
|
1239 |
ws cr. |
|
1240 |
ws nextPutAll:'SubmitOptions: '. |
|
1241 |
ws nextPutAll:'submitunchanged'. |
|
1242 |
ws cr. |
|
1243 |
ws nextPutAll:'LineEnd: '. |
|
1244 |
ws nextPutAll:'local'. |
|
1245 |
ws cr. |
|
1246 |
ws nextPutAll:'View: '. |
|
1247 |
ws nextPutAll:foundView. |
|
1248 |
ws space. |
|
1249 |
ws nextPutAll:'//', workSpaceName, '/'. |
|
1250 |
(foundView endsWith:'...') ifTrue:[ |
|
2349 | 1251 |
ws nextPutAll:'...'. |
2330 | 1252 |
]. |
1253 |
ws cr. |
|
1254 |
ws close. |
|
1255 |
readStream := ReadStream on:workSpaceDefinitionFilename contents asString. |
|
1256 |
cmd := 'client -i '. |
|
1257 |
result := self executePerforceCommand:cmd |
|
2349 | 1258 |
module:moduleName |
1259 |
inDirectory:directory pathName |
|
1260 |
log:true |
|
1261 |
pipe:false |
|
1262 |
clientName:nil |
|
1263 |
inputFrom:readStream. |
|
2330 | 1264 |
result ifFalse:[ |
2349 | 1265 |
('PerforceSourceCodeManager [error]: cannot create perforce client ', workSpaceDefinitionFilename baseName) errorPrintCR. |
1266 |
^ nil |
|
2330 | 1267 |
]. |
1268 |
||
1269 |
^ workSpaceDefinition. |
|
1270 |
! |
|
1271 |
||
1272 |
diffTextComment |
|
1273 |
||
1274 |
|ws| |
|
1275 |
||
1276 |
ws := WriteStream on:''. |
|
1277 |
ws nextPutLine:'"/ ***************************************************************'. |
|
1278 |
ws nextPutLine:'"/ This text contains your current versions code (blue)'. |
|
1279 |
ws nextPutLine:'"/ merged with the conflicting code as found in the repository (red) which resulted'. |
|
1280 |
ws nextPutLine:'"/ from some other checkin.'. |
|
1281 |
ws nextPutLine:'"/ Each such conflict is surrounded by green text (like this paragraph).'. |
|
1282 |
ws nextPutLine:'"/ '. |
|
1283 |
ws nextPutLine:'"/ Please have a look at ALL the conflicts and fix things as appropriate.'. |
|
1284 |
ws nextPutLine:'"/ Delete the green lines as a confirmation - I will not checkin the changed text,'. |
|
1285 |
ws nextPutLine:'"/ unless no more green parts are present. This includes this comment at the top.'. |
|
1286 |
ws nextPutLine:'"/ ***************************************************************'. |
|
1287 |
^ ws contents |
|
1288 |
! |
|
1289 |
||
2349 | 1290 |
getWorkSpaceDepotPrefixToModuleFrom:workSpaceDefinition |
1291 |
! |
|
1292 |
||
2330 | 1293 |
getWorkSpaceForModule:aModule |
1294 |
" |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1295 |
create an temporary workspace for handle checkin |
2330 | 1296 |
" |
1297 |
||
1298 |
^ self getWorkSpaceForModule:aModule modulePath:nil |
|
1299 |
! |
|
1300 |
||
1301 |
getWorkSpaceForModule:aModule modulePath:modulePath |
|
1302 |
" |
|
2349 | 1303 |
create an temporary workspace for handle checkin |
2330 | 1304 |
" |
1305 |
||
1306 |
|cmd inStream line views nextKey root myBaseDirectory client localDir position |
|
2349 | 1307 |
newLocalDir foundDir foundView workSpaceDefinition pathToModule restAfterRoot| |
2330 | 1308 |
|
2349 | 1309 |
pathToModule := Smalltalk packageDirectoryForPackageId:aModule. |
1310 |
workSpaceDefinition := WorkSpaceDefinition new. |
|
2330 | 1311 |
cmd := 'client -o'. |
1312 |
myBaseDirectory := (Filename currentDirectory asAbsoluteFilename) pathName. |
|
1313 |
inStream := self executePerforceCommand:cmd |
|
2349 | 1314 |
module:aModule |
1315 |
inDirectory:myBaseDirectory |
|
1316 |
log:true |
|
1317 |
pipe:true. |
|
2330 | 1318 |
inStream isNil ifTrue:[ |
2349 | 1319 |
('PerforceSourceCodeManager [error]: cannot open pipe to perforce client ') errorPrintCR. |
1320 |
^ nil |
|
2330 | 1321 |
]. |
1322 |
views := OrderedCollection new. |
|
1323 |
[inStream atEnd not] whileTrue:[ |
|
2349 | 1324 |
line:= inStream nextLine. |
1325 |
line notEmptyOrNil ifTrue:[ |
|
1326 |
line first = $# ifFalse:[ |
|
1327 |
(line startsWith:'Owner:') ifTrue:[ |
|
1328 |
workSpaceDefinition owner:line asCollectionOfWords second. |
|
1329 |
]. |
|
1330 |
(line startsWith:'Host:') ifTrue:[ |
|
1331 |
workSpaceDefinition host:line asCollectionOfWords second. |
|
1332 |
]. |
|
1333 |
(line startsWith:'Client:') ifTrue:[ |
|
1334 |
client := line asCollectionOfWords second. |
|
1335 |
workSpaceDefinition client:client. |
|
1336 |
]. |
|
1337 |
(line startsWith:'Root:') ifTrue:[ |
|
1338 |
root := line asCollectionOfWords second. |
|
1339 |
workSpaceDefinition root:root. |
|
1340 |
]. |
|
1341 |
(line startsWith:'View:') ifTrue:[ |
|
1342 |
nextKey := false. |
|
1343 |
[nextKey not and:[inStream atEnd not]] whileTrue:[ |
|
1344 |
line:= inStream nextLine. |
|
1345 |
line notEmptyOrNil ifTrue:[ |
|
1346 |
line first isSeparator ifTrue:[ |
|
1347 |
views add:(line asCollectionOfWords). |
|
1348 |
] ifFalse:[ |
|
1349 |
nextKey := true. |
|
1350 |
]. |
|
1351 |
]. |
|
1352 |
]. |
|
1353 |
]. |
|
1354 |
]. |
|
1355 |
]. |
|
2330 | 1356 |
]. |
2349 | 1357 |
|
2330 | 1358 |
views do:[:reposAndlocalDir | |
2349 | 1359 |
localDir := reposAndlocalDir second. |
1360 |
position := localDir findString:client ifAbsent:nil. |
|
1361 |
position isNil ifTrue:[ |
|
1362 |
('PerforceSourceCodeManager [error]: cannot get client view') errorPrintCR. |
|
1363 |
^ nil |
|
1364 |
]. |
|
1365 |
restAfterRoot := (localDir copyFrom:(position + client size + 1)). |
|
1366 |
newLocalDir := root asFilename construct:restAfterRoot. |
|
1367 |
newLocalDir asAbsoluteFilename = pathToModule ifTrue:[ |
|
1368 |
foundDir := newLocalDir. |
|
1369 |
foundView := reposAndlocalDir first. |
|
1370 |
] |
|
2330 | 1371 |
]. |
1372 |
foundDir isNil ifTrue:[ |
|
2349 | 1373 |
('PerforceSourceCodeManager [error]: cannot open find my view in perforce client ') errorPrintCR. |
1374 |
^ nil |
|
2330 | 1375 |
]. |
2354 | 1376 |
workSpaceDefinition moduleName:aModule. |
2349 | 1377 |
workSpaceDefinition localDir:foundDir. |
1378 |
workSpaceDefinition repositoryDir:foundView. |
|
2330 | 1379 |
^ workSpaceDefinition. |
1380 |
! |
|
1381 |
||
1382 |
initialCheckinFor:checkInDefinition |
|
1383 |
|modulePath checkoutName fullFileName classFileName packageDir moduleName logMsg force s class cmd result| |
|
1384 |
||
1385 |
modulePath := checkInDefinition modulePath. |
|
1386 |
checkoutName := checkInDefinition checkoutName. |
|
1387 |
classFileName := checkInDefinition classFileName. |
|
1388 |
class := checkInDefinition definitionClass. |
|
1389 |
packageDir := checkInDefinition packageDir. |
|
1390 |
moduleName := checkInDefinition moduleName. |
|
1391 |
logMsg := checkInDefinition logMessage. |
|
1392 |
force := checkInDefinition force. |
|
1393 |
||
1394 |
(class binaryRevision notNil) ifTrue:[ |
|
2542
541b543c372c
comment/format in: #initialCheckinFor:
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
1395 |
"/ the class is not a new one (either coming from another SCM or it was removed from this repository) |
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1396 |
(Dialog confirm:('Someone seems to have removed the source container for ',class name,'\\Force new checkin ?') withCRs) ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1397 |
class setBinaryRevision:nil. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1398 |
^ self checkinClass:class fileName:classFileName directory:packageDir module:moduleName logMessage:logMsg force:force. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1399 |
]. |
2330 | 1400 |
]. |
1401 |
"initial checkin here" |
|
1402 |
fullFileName := checkInDefinition tempDirectory construct:checkoutName. |
|
1403 |
fullFileName directory recursiveMakeDirectory. |
|
1404 |
s := fullFileName writeStream. |
|
1405 |
self fileOutSourceCodeOf:class on:s. |
|
1406 |
s close. |
|
1407 |
cmd := ('add -t +k ' , checkoutName). |
|
1408 |
result := self executePerforceCommand:cmd |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1409 |
module:moduleName |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1410 |
inDirectory:checkInDefinition tempDirectory |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1411 |
log:true |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1412 |
pipe:false |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1413 |
clientName:checkInDefinition workSpaceName. |
2330 | 1414 |
result ifFalse:[ |
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1415 |
('PerforceSourceCodeManager [error]: failed to add ', checkoutName) errorPrintCR. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1416 |
^ false |
2330 | 1417 |
]. |
1418 |
^ self submitModule:moduleName inDirectory:checkInDefinition tempDirectory logMessage:logMsg workSpaceDefinition:checkInDefinition workSpaceDefinition. |
|
2542
541b543c372c
comment/format in: #initialCheckinFor:
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
1419 |
|
541b543c372c
comment/format in: #initialCheckinFor:
Claus Gittinger <cg@exept.de>
parents:
2364
diff
changeset
|
1420 |
"Modified (format): / 29-09-2011 / 15:46:57 / cg" |
2330 | 1421 |
! |
1422 |
||
1423 |
mergeOrResolveConflictsFor:checkInDefinition |
|
1424 |
||
1425 |
|modulePath checkoutName classFileName packageDir moduleName logMsg force class fileNameAndRev cmd result tempdir workSpaceName |
|
1426 |
changesDict words fullFileName inStream line chunksPart s mySource mergedSource localRevision resultSource changesAsLogged msg |
|
1427 |
answer checkInRepaired emphasizedText emSep diffTextComment didAccept editor repairedText| |
|
1428 |
||
1429 |
modulePath := checkInDefinition modulePath. |
|
1430 |
checkoutName := checkInDefinition checkoutName. |
|
1431 |
classFileName := checkInDefinition classFileName. |
|
1432 |
class := checkInDefinition definitionClass. |
|
1433 |
packageDir := checkInDefinition packageDir. |
|
1434 |
tempdir := checkInDefinition tempDirectory. |
|
1435 |
moduleName := checkInDefinition moduleName. |
|
1436 |
logMsg := checkInDefinition logMessage. |
|
1437 |
force := checkInDefinition force. |
|
1438 |
workSpaceName := checkInDefinition workSpaceName. |
|
1439 |
localRevision := checkInDefinition getLocalRevision. |
|
1440 |
fullFileName := tempdir construct:checkoutName. |
|
1441 |
||
1442 |
fileNameAndRev := checkoutName, '#', localRevision printString. |
|
1443 |
||
1444 |
||
1445 |
" first we need a sync to get resolve notification " |
|
1446 |
cmd := ('sync -f ' , fileNameAndRev). |
|
1447 |
result := self executePerforceCommand:cmd |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1448 |
module:moduleName |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1449 |
inDirectory:tempdir |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1450 |
log:true |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1451 |
pipe:false |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1452 |
clientName:workSpaceName. |
2330 | 1453 |
result ifFalse:[ |
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1454 |
('PerforceSourceCodeManager [error]: could not sync ', checkoutName) errorPrintCR. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1455 |
^ false |
2330 | 1456 |
]. |
1457 |
cmd := ('edit ' , checkoutName). |
|
1458 |
result := self executePerforceCommand:cmd |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1459 |
module:moduleName |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1460 |
inDirectory:tempdir |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1461 |
log:true |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1462 |
pipe:false |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1463 |
clientName:workSpaceName. |
2330 | 1464 |
result ifFalse:[ |
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1465 |
('PerforceSourceCodeManager [error]: could not sync ', checkoutName) errorPrintCR. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1466 |
^ false |
2330 | 1467 |
]. |
1468 |
||
1469 |
"write my code" |
|
1470 |
s := fullFileName writeStream. |
|
1471 |
self fileOutSourceCodeOf:class on:s. |
|
1472 |
s close. |
|
1473 |
"before resolving we need a sync" |
|
1474 |
cmd := ('sync ' , checkoutName). |
|
1475 |
result := self executePerforceCommand:cmd |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1476 |
module:moduleName |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1477 |
inDirectory:tempdir |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1478 |
log:true |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1479 |
pipe:false |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1480 |
clientName:workSpaceName. |
2330 | 1481 |
result ifFalse:[ |
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1482 |
('PerforceSourceCodeManager [error]: could not sync ', checkoutName) errorPrintCR. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1483 |
^ false |
2330 | 1484 |
]. |
1485 |
||
1486 |
cmd := ('resolve -af ' , checkoutName). |
|
1487 |
inStream := self executePerforceCommand:cmd |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1488 |
module:moduleName |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1489 |
inDirectory:tempdir |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1490 |
log:true |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1491 |
pipe:true |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1492 |
clientName:workSpaceName. |
2330 | 1493 |
|
1494 |
||
1495 |
inStream isNil ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1496 |
('PerforceSourceCodeManager [error]: could not get Stream when resolving ', checkoutName) errorPrintCR. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1497 |
^ false |
2330 | 1498 |
]. |
1499 |
"check if we have conflicts" |
|
1500 |
changesAsLogged := StringCollection new. |
|
1501 |
[inStream atEnd not] whileTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1502 |
line:= inStream nextLine. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1503 |
line notNil ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1504 |
(line startsWith:'Diff chunks:') ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1505 |
changesAsLogged add:line. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1506 |
changesDict := Dictionary new. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1507 |
chunksPart := line copyFrom:('Diff chunks:' size + 1). |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1508 |
(chunksPart asCollectionOfSubstringsSeparatedBy:$+) do:[:eachElement| |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1509 |
words := eachElement asCollectionOfWords. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1510 |
changesDict at:words second asSymbol put:words first asNumber. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1511 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1512 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1513 |
]. |
2330 | 1514 |
]. |
1515 |
s := WriteStream on:String new. |
|
1516 |
self fileOutSourceCodeOf:class on:s. |
|
1517 |
mergedSource := fullFileName readStream contents asString. |
|
1518 |
mySource := s contents asString. |
|
1519 |
(changesDict notNil and:[(changesDict at:#conflicting) > 0]) ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1520 |
"ooops must resolve conflicts" |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1521 |
msg := self messageForConflictsInClass:class revision:localRevision. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1522 |
answer := self checkinTroubleDialog:'Version conflict' |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1523 |
message:msg |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1524 |
log:changesAsLogged |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1525 |
abortable:false |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1526 |
option:'show conflicts' |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1527 |
option2:'resolve conflicts'. |
2330 | 1528 |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1529 |
answer == #option ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1530 |
"/ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1531 |
"/ show conflicts in a 3-way DiffTextView ... |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1532 |
"/ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1533 |
Diff3TextView |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1534 |
openOnMergedText:mergedSource |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1535 |
label:'your version (checkin attempt)' |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1536 |
label:'original (base version)' |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1537 |
label:'newest repository version'. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1538 |
]. |
2330 | 1539 |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1540 |
checkInRepaired := false. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1541 |
answer == #option2 ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1542 |
"/ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1543 |
"/ allow checkin of repair version |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1544 |
"/ this is error prone ... |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1545 |
"/ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1546 |
"/ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1547 |
"/ show merged version in an editor ... |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1548 |
"/ ... accept will check it in. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1549 |
"/ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1550 |
emphasizedText := mergedSource asStringCollection. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1551 |
emSep := (Array with:(#color->Color black) |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1552 |
with:(#backgroundColor->Color green)). |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1553 |
emphasizedText := Diff3TextView |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1554 |
emphasizeMergedDiff3TextPerorce:emphasizedText |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1555 |
origEmphasize:(Array with:(#color->Color black) |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1556 |
with:(#backgroundColor->Color yellow)) |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1557 |
otherEmphasize:(Array with:(#color->Color white) |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1558 |
with:(#backgroundColor->Color red)) |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1559 |
yourEmphasize:(Array with:(#color->Color white) |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1560 |
with:(#backgroundColor->Color red)) |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1561 |
separatorEmphasize:emSep. |
2330 | 1562 |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1563 |
diffTextComment := self diffTextComment. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1564 |
diffTextComment := (Text string:diffTextComment emphasis:emSep) asStringCollection. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1565 |
emphasizedText := diffTextComment , emphasizedText. |
2330 | 1566 |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1567 |
didAccept := false. checkInRepaired := true. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1568 |
[didAccept not and:[checkInRepaired]] whileTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1569 |
editor := RCSConflictEditTextView |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1570 |
setupWith:emphasizedText |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1571 |
title:'Resolve conflicts in ' , checkoutName , ', then accept & close to checkin'. |
2330 | 1572 |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1573 |
editor acceptAction:[:dummy | |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1574 |
repairedText := editor list. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1575 |
didAccept := true. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1576 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1577 |
didAccept := false. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1578 |
editor topView openModal. |
2330 | 1579 |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1580 |
didAccept ifFalse:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1581 |
(Dialog confirm:'You did not accept the new text. Edit again ?') |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1582 |
ifFalse:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1583 |
checkInRepaired := false. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1584 |
] |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1585 |
] ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1586 |
"/ check if all green-stuff (separators) have been removed |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1587 |
(repairedText findFirst:[:line | line notNil and:[line notEmpty and:[(line emphasisAt:1) = emSep]]]) ~~ 0 ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1588 |
self warn:'You have to look at ALL conflicts, and remove ALL green lines as a confirmation !!'. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1589 |
didAccept := false. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1590 |
] |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1591 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1592 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1593 |
resultSource := repairedText asString string. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1594 |
]. |
2330 | 1595 |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1596 |
checkInRepaired ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1597 |
Transcript showCR:'checking in ' , checkoutName , ' (manually repaired version) ...' |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1598 |
] ifFalse:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1599 |
'PerforceSourceCodeManager [warning]: cannot (for now) checkin; conflicts found' infoPrintCR. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1600 |
Transcript showCR:'checkin of ' , checkoutName , ' aborted (conflicting changes; repository unchanged)'. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1601 |
^ true. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1602 |
] |
2330 | 1603 |
] ifFalse:[ |
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1604 |
mySource = mergedSource ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1605 |
msg := self messageForNoChangesInClass:class. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1606 |
self checkinTroubleDialog:'Merging versions' |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1607 |
message:msg |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1608 |
log:changesAsLogged |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1609 |
abortable:false |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1610 |
option:nil. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1611 |
] ifFalse:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1612 |
msg := self messageForChangesInClass:class revision:localRevision. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1613 |
answer := self checkinTroubleDialog:'Merging versions' |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1614 |
message:msg |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1615 |
log:changesAsLogged |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1616 |
abortable:true |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1617 |
option:'Stop - see first'. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1618 |
answer ~~ true ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1619 |
answer == #option ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1620 |
DiffCodeView |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1621 |
openOn:mySource |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1622 |
label:'current version' |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1623 |
and:mergedSource |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1624 |
label:'merged version'. |
2330 | 1625 |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1626 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1627 |
Transcript showCR:'checkin aborted - (no merge; repository unchanged)'. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1628 |
^ false. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1629 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1630 |
resultSource := mergedSource. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1631 |
]. |
2330 | 1632 |
]. |
1633 |
"now we have a merge - lets get latest revision and write on it " |
|
1634 |
cmd := ('revert ' , checkoutName). |
|
1635 |
result := self executePerforceCommand:cmd |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1636 |
module:moduleName |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1637 |
inDirectory:tempdir |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1638 |
log:true |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1639 |
pipe:false |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1640 |
clientName:workSpaceName. |
2330 | 1641 |
result ifFalse:[ |
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1642 |
('PerforceSourceCodeManager [error]: could not revert ', checkoutName) errorPrintCR. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1643 |
^ false |
2330 | 1644 |
]. |
1645 |
||
1646 |
fullFileName remove. |
|
1647 |
cmd := ('sync -f ' , checkoutName). |
|
1648 |
result := self executePerforceCommand:cmd |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1649 |
module:moduleName |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1650 |
inDirectory:tempdir |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1651 |
log:true |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1652 |
pipe:false |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1653 |
clientName:workSpaceName. |
2330 | 1654 |
result ifFalse:[ |
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1655 |
('PerforceSourceCodeManager [error]: could not sync ', checkoutName) errorPrintCR. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1656 |
^ false |
2330 | 1657 |
]. |
1658 |
cmd := ('edit ' , checkoutName). |
|
1659 |
result := self executePerforceCommand:cmd |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1660 |
module:moduleName |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1661 |
inDirectory:tempdir |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1662 |
log:true |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1663 |
pipe:false |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1664 |
clientName:workSpaceName. |
2330 | 1665 |
result ifFalse:[ |
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1666 |
('PerforceSourceCodeManager [error]: could not edit ', checkoutName) errorPrintCR. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1667 |
^ false |
2330 | 1668 |
]. |
1669 |
"write my result" |
|
1670 |
s := fullFileName writeStream. |
|
1671 |
s nextPutAll:resultSource. |
|
1672 |
s close. |
|
1673 |
||
1674 |
^ self submitModule:moduleName inDirectory:tempdir logMessage:logMsg workSpaceDefinition:checkInDefinition workSpaceDefinition. |
|
1675 |
! |
|
1676 |
||
1677 |
messageForChangesInClass:class revision:revisionNumber |
|
1678 |
||
1679 |
|msgStream| |
|
1680 |
||
1681 |
msgStream := WriteStream on:''. |
|
1682 |
msgStream nextPutAll:'The source of '; nextPutAll:class className; nextPutAll:'has been changed in the meanwhile as listed below.'. |
|
1683 |
msgStream cr. |
|
1684 |
msgStream nextPutAll:'If you continue, your new changes (based upon rev. '; nextPutAll:revisionNumber printString; nextPutAll:') will be MERGED'. |
|
1685 |
msgStream nextPutAll:'into the newest revision. This will combine the other version with your changes'. |
|
1686 |
msgStream nextPutAll:'into a new common revision which may be different from both.'. |
|
1687 |
msgStream nextPutAll:'Although this is a nice feature, it may fail to create the expected result in certain situations.'. |
|
1688 |
msgStream cr. |
|
1689 |
msgStream nextPutAll:'You should carefully check the result - by comparing the current version with the'. |
|
1690 |
msgStream nextPutAll:'most recent version in the repository. If that does not contain an acceptable version,'. |
|
1691 |
msgStream nextPutAll:'change methods as required and check in again.'. |
|
1692 |
msgStream nextPutAll:'Be aware, that after that, the actual repository version is different from your current classes,'. |
|
1693 |
msgStream nextPutAll:'and you should update your class from the repository.'. |
|
1694 |
msgStream cr. |
|
1695 |
msgStream nextPutAll:'Continue ?'. |
|
1696 |
^ msgStream contents |
|
1697 |
! |
|
1698 |
||
1699 |
messageForConflictsInClass:class revision:revisionNumber |
|
1700 |
||
1701 |
|msgStream| |
|
1702 |
||
1703 |
msgStream := WriteStream on:''. |
|
1704 |
msgStream nextPutAll:'The source of '; nextPutAll:class className; nextPutAll:'has been changed in the meanwhile as listed below.'. |
|
1705 |
msgStream cr. |
|
1706 |
msgStream nextPutAll:'Your new changes (based upon rev. '; nextPutAll:revisionNumber printString; nextPutAll:') CONFLICT with those changes'. |
|
1707 |
msgStream cr. |
|
1708 |
msgStream nextPutAll:'You should fix things by comparing your class with the most recent repository version'. |
|
1709 |
msgStream nextPutAll:'and change your methods avoiding conflicts. The checkin again.'. |
|
1710 |
msgStream cr. |
|
1711 |
^ msgStream contents |
|
1712 |
! |
|
1713 |
||
1714 |
messageForNoChangesInClass:class |
|
1715 |
||
1716 |
|msgStream| |
|
1717 |
||
1718 |
msgStream := WriteStream on:''. |
|
1719 |
msgStream nextPutAll:'The source of '; nextPutAll:class className; nextPutAll:'has been changed in the meanwhile as listed below.'. |
|
1720 |
msgStream cr. |
|
1721 |
msgStream nextPutAll:'I have merged your version with the newest repository version,'. |
|
1722 |
msgStream nextPutAll:'and found no differences between the result and your current version'. |
|
1723 |
msgStream nextPutAll:'(i.e. your version seemed up-to-date).'. |
|
1724 |
^ msgStream contents |
|
1725 |
! |
|
1726 |
||
1727 |
postCheckInClass:class checkInDefinition:checkInDefinition |
|
1728 |
||
1729 |
|newestRevisionAfterSubmit checkoutName localRevision newRevisionLog| |
|
1730 |
||
1731 |
checkoutName := checkInDefinition checkoutName. |
|
1732 |
localRevision := checkInDefinition getLocalRevision asNumber. |
|
1733 |
checkInDefinition newestRevision:nil. |
|
1734 |
newestRevisionAfterSubmit := checkInDefinition getNewestRevisionNumber. |
|
1735 |
newestRevisionAfterSubmit isNil ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1736 |
('PerforceSourceCodeManager [error]: failed to get revision log after checkin for ', checkoutName) errorPrintCR. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1737 |
^ false |
2330 | 1738 |
]. |
1739 |
newestRevisionAfterSubmit > localRevision ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1740 |
newRevisionLog := self updatedRevisionStringOf:class forRevision:newestRevisionAfterSubmit with:class revisionInfo getVersionString. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1741 |
class updateVersionMethodFor:newRevisionLog. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1742 |
class revision ~= newestRevisionAfterSubmit asString ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1743 |
'PerforceSourceCodeManager [error]: failed to update revisionString' errorPrintCR. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1744 |
^ false |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1745 |
] |
2330 | 1746 |
] ifFalse:[ |
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1747 |
self error:'ooops no new version ????'. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1748 |
self postCheckInClass:class. |
2330 | 1749 |
]. |
1750 |
^ true |
|
1751 |
! |
|
1752 |
||
1753 |
standardCheckinFor:checkInDefinition localRevision:locRevision |
|
1754 |
||
1755 |
|modulePath checkoutName fullFileName classFileName packageDir moduleName |
|
1756 |
logMsg force s class cmd result fileNameAndRev tempdir workSpaceName fullFileNameAndRev |
|
1757 |
workSpaceDefinition newestRevision| |
|
1758 |
||
1759 |
modulePath := checkInDefinition modulePath. |
|
1760 |
checkoutName := checkInDefinition checkoutName. |
|
1761 |
classFileName := checkInDefinition classFileName. |
|
1762 |
class := checkInDefinition definitionClass. |
|
1763 |
packageDir := checkInDefinition packageDir. |
|
1764 |
moduleName := checkInDefinition moduleName. |
|
1765 |
newestRevision := checkInDefinition newestRevision. |
|
1766 |
logMsg := checkInDefinition logMessage. |
|
1767 |
force := checkInDefinition force. |
|
1768 |
tempdir := checkInDefinition tempDirectory. |
|
1769 |
workSpaceName := checkInDefinition workSpaceName. |
|
1770 |
workSpaceDefinition := checkInDefinition workSpaceDefinition. |
|
1771 |
fullFileName := tempdir construct:checkoutName. |
|
1772 |
||
1773 |
fileNameAndRev := checkoutName, '#', newestRevision printString. |
|
1774 |
||
1775 |
||
1776 |
cmd := ('sync ' , fileNameAndRev). |
|
1777 |
result := self executePerforceCommand:cmd |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1778 |
module:moduleName |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1779 |
inDirectory:tempdir |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1780 |
log:true |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1781 |
pipe:false |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1782 |
clientName:workSpaceName. |
2330 | 1783 |
fullFileNameAndRev := tempdir construct:fileNameAndRev. |
1784 |
fullFileName copyTo:fullFileNameAndRev. |
|
1785 |
||
1786 |
cmd := ('edit ' , checkoutName). |
|
1787 |
result := self executePerforceCommand:cmd |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1788 |
module:moduleName |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1789 |
inDirectory:tempdir |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1790 |
log:true |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1791 |
pipe:false |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1792 |
clientName:workSpaceName. |
2330 | 1793 |
result ifFalse:[ |
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1794 |
('PerforceSourceCodeManager [error]: failed to edit ', checkoutName) errorPrintCR. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1795 |
^ false |
2330 | 1796 |
]. |
1797 |
s := fullFileName writeStream. |
|
1798 |
self fileOutSourceCodeOf:class on:s. |
|
1799 |
s close. |
|
1800 |
result := self submitModule:moduleName inDirectory:tempdir logMessage:checkInDefinition logMessage workSpaceDefinition:workSpaceDefinition. |
|
1801 |
result ifFalse:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1802 |
('PerforceSourceCodeManager [error]: failed to edit ', checkoutName) errorPrintCR. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1803 |
^ false |
2330 | 1804 |
]. |
1805 |
^ true |
|
1806 |
! |
|
1807 |
||
1808 |
submitModule:moduleDir inDirectory:inDirectory logMessage:logMessage workSpaceDefinition:workSpaceDefinition |
|
1809 |
||
1810 |
|cmd changeListStream result workSpaceName changeListFile inStream logLines line lastLineWasFiles elements changes currentDefinition currentContent changeFiles readStream| |
|
1811 |
||
1812 |
workSpaceName := workSpaceDefinition at:#workSpaceName ifAbsent:nil. |
|
1813 |
cmd := 'change -o'. |
|
1814 |
inStream := self executePerforceCommand:cmd |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1815 |
module:moduleDir |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1816 |
inDirectory:inDirectory |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1817 |
log:true |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1818 |
pipe:true |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1819 |
clientName:workSpaceName. |
2330 | 1820 |
|
1821 |
inStream isNil ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1822 |
('PerforceSourceCodeManager [error]: could not get Stream from ', cmd) errorPrintCR. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1823 |
^ false |
2330 | 1824 |
]. |
1825 |
changes := Dictionary new. |
|
1826 |
logLines := logMessage asStringCollection. |
|
1827 |
changeListFile := inDirectory construct:'change'. |
|
1828 |
changeListStream := changeListFile writeStream. |
|
1829 |
lastLineWasFiles := false. |
|
1830 |
[inStream atEnd not] whileTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1831 |
line:= inStream nextLine. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1832 |
line notNil ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1833 |
(line notEmpty and:[line first isSeparator or:[line first = $#]]) ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1834 |
currentContent := line. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1835 |
] ifFalse:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1836 |
elements := line asCollectionOfSubstringsSeparatedBy:$:. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1837 |
elements size > 1 ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1838 |
currentDefinition := elements first. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1839 |
currentContent := (line copyFrom:currentDefinition size + 2). |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1840 |
] ifFalse:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1841 |
currentContent := line. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1842 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1843 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1844 |
(currentDefinition notNil and:[currentDefinition = 'Files' and:[currentContent notEmptyOrNil]]) ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1845 |
elements := currentContent asCollectionOfWords. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1846 |
elements size > 2 ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1847 |
changeFiles := changes at:elements second ifAbsent:nil. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1848 |
changeFiles isNil ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1849 |
changeFiles := OrderedCollection new. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1850 |
changes at:elements third put:changeFiles. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1851 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1852 |
changeFiles add:elements first. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1853 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1854 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1855 |
(line includesString:'<enter description here>') ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1856 |
logLines do:[:aLine| |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1857 |
changeListStream nextPut:Character tab. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1858 |
changeListStream nextPutLine:aLine. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1859 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1860 |
] ifFalse:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1861 |
changeListStream nextPutLine:line. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1862 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1863 |
]. |
2330 | 1864 |
]. |
1865 |
changeListStream close. |
|
1866 |
readStream := changeListFile contents asString readStream. |
|
1867 |
cmd := ('submit -f submitunchanged -i '). |
|
1868 |
result := self executePerforceCommand:cmd |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1869 |
module:moduleDir |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1870 |
inDirectory:inDirectory |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1871 |
log:true |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1872 |
pipe:false |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1873 |
clientName:workSpaceName |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1874 |
inputFrom:readStream. |
2330 | 1875 |
result ifFalse:[ |
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1876 |
('PerforceSourceCodeManager [error]: could not submit ', cmd) errorPrintCR. |
2330 | 1877 |
]. |
1878 |
^ result |
|
1879 |
! |
|
1880 |
||
1881 |
updatedRevisionStringOf:aClass forRevision:newRevision with:originalVersionString |
|
1882 |
"update a revision string" |
|
1883 |
||
1884 |
|versionInfo| |
|
1885 |
||
1886 |
originalVersionString isEmptyOrNil ifTrue:[^ nil]. |
|
1887 |
versionInfo := PerforceVersionInfo fromRCSString:originalVersionString. |
|
1888 |
versionInfo revision:newRevision printString. |
|
1889 |
^ versionInfo getVersionString. |
|
1890 |
||
1891 |
||
1892 |
||
1893 |
" |
|
1894 |
self updatedRevisionStringOf:nil |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1895 |
forRevision:'6' |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1896 |
with:'$','Header','$' |
2330 | 1897 |
" |
1898 |
! ! |
|
1899 |
||
1900 |
!PerforceSourceCodeManager class methodsFor:'queries'! |
|
1901 |
||
1902 |
getPerforceClientForModule:aModuleName |
|
1903 |
||
1904 |
| settings settingsString| |
|
1905 |
||
1906 |
aModuleName isNil ifTrue:[^ nil]. |
|
1907 |
settingsString := self getPerforceSettingsForModule:aModuleName. |
|
1908 |
settingsString isNil ifTrue:[^ PerforceClient]. |
|
1909 |
settings := self getPerforceSettingsFromString:settingsString. |
|
1910 |
^ settings at:#client ifAbsent:PerforceClient. |
|
1911 |
! |
|
1912 |
||
1913 |
getPerforceDefaultSettingsString |
|
1914 |
||
2340
bffc953726dc
oops wrong local variable name
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1915 |
^(PerforceSourceCodeManager perforceClient ,':', |
bffc953726dc
oops wrong local variable name
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
1916 |
PerforceSourceCodeManager perforceUser, ':', |
2341 | 1917 |
(PerforceSourceCodeManager perforcePassword), '@', |
2330 | 1918 |
PerforceSourceCodeManager perforcePort). |
2341 | 1919 |
|
1920 |
"Modified: / 19-04-2011 / 10:46:37 / cg" |
|
2330 | 1921 |
! |
1922 |
||
1923 |
getPerforcePasswordForModule:aModuleName |
|
1924 |
||
1925 |
| settings settingsString| |
|
1926 |
||
1927 |
aModuleName isNil ifTrue:[^ nil]. |
|
1928 |
settingsString := self getPerforceSettingsForModule:aModuleName. |
|
1929 |
settingsString isNil ifTrue:[^ PerforcePassword]. |
|
1930 |
settings := self getPerforceSettingsFromString:settingsString. |
|
1931 |
^ settings at:#password ifAbsent:PerforcePassword. |
|
1932 |
! |
|
1933 |
||
1934 |
getPerforcePortForModule:aModuleName |
|
1935 |
||
1936 |
| settings settingsString| |
|
1937 |
||
1938 |
aModuleName isNil ifTrue:[^ nil]. |
|
1939 |
settingsString := self getPerforceSettingsForModule:aModuleName. |
|
1940 |
settingsString isNil ifTrue:[^ PerforcePort]. |
|
1941 |
settings := self getPerforceSettingsFromString:settingsString. |
|
1942 |
^ settings at:#port ifAbsent:PerforcePort. |
|
1943 |
! |
|
1944 |
||
1945 |
getPerforceSettingsForModule:aModuleName |
|
1946 |
||
1947 |
|settingsString| |
|
1948 |
||
1949 |
PerforceModuleRoots isNil ifTrue:[^ nil]. |
|
1950 |
aModuleName isNil ifTrue:[^ nil]. |
|
1951 |
settingsString := PerforceModuleRoots at:aModuleName ifAbsent:nil. |
|
1952 |
settingsString isNil ifTrue:[^ nil]. |
|
1953 |
^ self getPerforceSettingsFromString:settingsString. |
|
1954 |
! |
|
1955 |
||
1956 |
getPerforceSettingsFromString:aString |
|
1957 |
||
1958 |
|clientAndPort noOfClientAndPortElements userAndClientAndPassword noOfUserAndClient settings | |
|
1959 |
||
1960 |
settings := Dictionary new. |
|
1961 |
clientAndPort := aString asCollectionOfSubstringsSeparatedBy:$@. |
|
1962 |
noOfClientAndPortElements := clientAndPort size. |
|
1963 |
noOfClientAndPortElements > 0 ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1964 |
userAndClientAndPassword := clientAndPort first asCollectionOfSubstringsSeparatedBy:$:. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1965 |
noOfUserAndClient := userAndClientAndPassword size. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1966 |
noOfUserAndClient > 0 ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1967 |
settings at:#client put:userAndClientAndPassword first. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1968 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1969 |
noOfUserAndClient > 1 ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1970 |
settings at:#user put:userAndClientAndPassword second. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1971 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1972 |
noOfUserAndClient > 2 ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1973 |
settings at:#password put:userAndClientAndPassword third. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1974 |
]. |
2330 | 1975 |
]. |
1976 |
noOfClientAndPortElements > 1 ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
1977 |
settings at:#port put:clientAndPort second. |
2330 | 1978 |
]. |
1979 |
^ settings |
|
1980 |
! |
|
1981 |
||
1982 |
getPerforceUserForModule:aModuleName |
|
1983 |
||
1984 |
| settings settingsString| |
|
1985 |
||
1986 |
aModuleName isNil ifTrue:[^ nil]. |
|
1987 |
settingsString := self getPerforceSettingsForModule:aModuleName. |
|
1988 |
settingsString isNil ifTrue:[^ PerforcePassword]. |
|
1989 |
settings := self getPerforceSettingsFromString:settingsString. |
|
1990 |
^ settings at:#password ifAbsent:PerforcePassword. |
|
1991 |
! |
|
1992 |
||
1993 |
isPerforce |
|
1994 |
"Superclass AbstractSourceCodeManager class says that I am responsible to implement this method" |
|
1995 |
||
1996 |
^ true |
|
1997 |
! |
|
1998 |
||
2567 | 1999 |
isResponsibleForPackage:aStringOrSymbol |
2000 |
"superclass AbstractSourceCodeManager class says that I am responsible to implement this method" |
|
2001 |
||
2002 |
^ self shouldImplement |
|
2003 |
! |
|
2004 |
||
2330 | 2005 |
managerTypeName |
2006 |
"Superclass AbstractSourceCodeManager class says that I am responsible to implement this method" |
|
2007 |
||
2008 |
^ 'Perforce' |
|
2009 |
! |
|
2010 |
||
2551
baaf89f420fa
- more subclassReponsibilities to AbstractSourceCodeManager
vrany
parents:
2542
diff
changeset
|
2011 |
managerTypeNameShort |
baaf89f420fa
- more subclassReponsibilities to AbstractSourceCodeManager
vrany
parents:
2542
diff
changeset
|
2012 |
"Answers short version manager name suitable for UI, |
baaf89f420fa
- more subclassReponsibilities to AbstractSourceCodeManager
vrany
parents:
2542
diff
changeset
|
2013 |
i,e., CVS, SVN, P4. Used in cases where sorter strings |
baaf89f420fa
- more subclassReponsibilities to AbstractSourceCodeManager
vrany
parents:
2542
diff
changeset
|
2014 |
are preferred. Defaults to #managerTypeName" |
baaf89f420fa
- more subclassReponsibilities to AbstractSourceCodeManager
vrany
parents:
2542
diff
changeset
|
2015 |
|
baaf89f420fa
- more subclassReponsibilities to AbstractSourceCodeManager
vrany
parents:
2542
diff
changeset
|
2016 |
^'P4' |
baaf89f420fa
- more subclassReponsibilities to AbstractSourceCodeManager
vrany
parents:
2542
diff
changeset
|
2017 |
|
baaf89f420fa
- more subclassReponsibilities to AbstractSourceCodeManager
vrany
parents:
2542
diff
changeset
|
2018 |
"Created: / 03-10-2011 / 13:28:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2639
11a1cea10275
changed: #managerTypeNameShort
Claus Gittinger <cg@exept.de>
parents:
2599
diff
changeset
|
2019 |
"Modified (format): / 04-12-2011 / 10:15:31 / cg" |
2551
baaf89f420fa
- more subclassReponsibilities to AbstractSourceCodeManager
vrany
parents:
2542
diff
changeset
|
2020 |
! |
baaf89f420fa
- more subclassReponsibilities to AbstractSourceCodeManager
vrany
parents:
2542
diff
changeset
|
2021 |
|
2330 | 2022 |
nameOfVersionMethodForExtensions |
2023 |
^ #'extensionsVersion_P4' |
|
2024 |
! |
|
2025 |
||
2026 |
nameOfVersionMethodInClasses |
|
2027 |
^ #'version_P4' |
|
2028 |
! |
|
2029 |
||
2030 |
perforceTmpDirectory |
|
2031 |
"return the name of the tmp repository. |
|
2032 |
Thats the directory, where temporary files are created for checkin/checkout. |
|
2033 |
If nil, the systems default tempDirectory is used." |
|
2034 |
||
2035 |
^ (PerforceTempDir ? Filename tempDirectory pathName) |
|
2036 |
||
2037 |
" |
|
2038 |
PerforceTempDir := nil |
|
2039 |
" |
|
2345
2dde5bda539c
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
2040 |
! |
2dde5bda539c
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
2041 |
|
2dde5bda539c
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
2042 |
settingsApplicationClass |
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
2043 |
"link to my settings application (needed for the settings dialog" |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
2044 |
|
2359
62c8ea518b59
changed: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
2045 |
^ PerforceSourceCodeManagementSettingsAppl |
2345
2dde5bda539c
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
2046 |
|
2dde5bda539c
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
2047 |
"Created: / 19-04-2011 / 12:45:13 / cg" |
2359
62c8ea518b59
changed: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
2048 |
"Modified: / 20-04-2011 / 12:49:41 / cg" |
2330 | 2049 |
! ! |
2050 |
||
2051 |
!PerforceSourceCodeManager class methodsFor:'source code administration'! |
|
2052 |
||
2053 |
getExistingContainersInModule:aModule directory:aPackage |
|
2054 |
"{ Pragma: +optSpace }" |
|
2055 |
||
2056 |
self shouldImplement |
|
2057 |
! |
|
2058 |
||
2059 |
getExistingDirectoriesInModule:aModule |
|
2060 |
"{ Pragma: +optSpace }" |
|
2061 |
||
2062 |
self shouldImplement |
|
2063 |
! |
|
2064 |
||
2065 |
getExistingModules |
|
2066 |
"{ Pragma: +optSpace }" |
|
2067 |
||
2068 |
self shouldImplement |
|
2069 |
! |
|
2070 |
||
2071 |
revisionInfoFromString:aString |
|
2072 |
"{ Pragma: +optSpace }" |
|
2073 |
||
2074 |
^ PerforceVersionInfo fromRCSString:aString. |
|
2075 |
||
2076 |
" |
|
2077 |
|stream| |
|
2078 |
stream := WriteStream on:''. |
|
2079 |
SourceCodeManagerUtilities repositoryLogOf:ExtIF onto:stream. |
|
2080 |
^ stream contents. |
|
2081 |
" |
|
2082 |
! ! |
|
2083 |
||
2084 |
!PerforceSourceCodeManager class methodsFor:'subclass responsibility'! |
|
2085 |
||
2086 |
reportHistoryLogSince:timeGoal filterSTSources:filter filterUser:userFilter filterRepository:repositoryFilter filterModules:moduleFilter inTo:aBlock |
|
2087 |
"Superclass AbstractSourceCodeManager class says that I am responsible to implement this method" |
|
2088 |
||
2089 |
self shouldImplement |
|
2090 |
! ! |
|
2091 |
||
2092 |
!PerforceSourceCodeManager::CheckInDefinition methodsFor:'accessing'! |
|
2093 |
||
2094 |
classFileName |
|
2095 |
^ classFileName |
|
2096 |
! |
|
2097 |
||
2098 |
classFileName:something |
|
2099 |
classFileName := something. |
|
2100 |
! |
|
2101 |
||
2102 |
definitionClass |
|
2103 |
^ definitionClass |
|
2104 |
! |
|
2105 |
||
2106 |
definitionClass:something |
|
2107 |
definitionClass := something. |
|
2108 |
! |
|
2109 |
||
2110 |
force |
|
2111 |
^ force |
|
2112 |
! |
|
2113 |
||
2114 |
force:something |
|
2115 |
force := something. |
|
2116 |
! |
|
2117 |
||
2118 |
logMessage |
|
2119 |
^ logMessage |
|
2120 |
! |
|
2121 |
||
2122 |
logMessage:something |
|
2123 |
logMessage := something. |
|
2124 |
! |
|
2125 |
||
2126 |
manager |
|
2127 |
||
2128 |
^ manager |
|
2129 |
! |
|
2130 |
||
2131 |
manager:something |
|
2132 |
manager := something. |
|
2133 |
! |
|
2134 |
||
2135 |
moduleName |
|
2136 |
^ moduleName |
|
2137 |
! |
|
2138 |
||
2139 |
moduleName:something |
|
2140 |
moduleName := something. |
|
2141 |
! |
|
2142 |
||
2143 |
newestRevision |
|
2144 |
^ newestRevision |
|
2145 |
! |
|
2146 |
||
2147 |
newestRevision:something |
|
2148 |
newestRevision := something. |
|
2149 |
! |
|
2150 |
||
2151 |
packageDir |
|
2152 |
^ packageDir |
|
2153 |
! |
|
2154 |
||
2155 |
packageDir:something |
|
2156 |
packageDir := something. |
|
2157 |
! |
|
2158 |
||
2159 |
setLogMessage:something |
|
2160 |
something isNil ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
2161 |
logMessage := ''. |
2330 | 2162 |
] ifFalse:[ |
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
2163 |
logMessage := something asSingleByteStringIfPossible. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
2164 |
logMessage bitsPerCharacter ~~ 8 ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
2165 |
^ false. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
2166 |
]. |
2330 | 2167 |
]. |
2168 |
^ true |
|
2169 |
! |
|
2170 |
||
2171 |
sourceFileName |
|
2172 |
^ sourceFileName |
|
2173 |
! |
|
2174 |
||
2175 |
sourceFileName:something |
|
2176 |
sourceFileName := something. |
|
2177 |
! |
|
2178 |
||
2179 |
tempDirectory |
|
2180 |
||
2181 |
tempDirectory isNil ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
2182 |
tempDirectory := self manager createTempDirectory:nil forModule:nil. |
2330 | 2183 |
]. |
2184 |
^ tempDirectory |
|
2185 |
! |
|
2186 |
||
2187 |
tempDirectory:something |
|
2188 |
tempDirectory := something. |
|
2189 |
! |
|
2190 |
||
2191 |
workSpaceDefinition |
|
2192 |
^ workSpaceDefinition |
|
2193 |
! |
|
2194 |
||
2195 |
workSpaceDefinition:something |
|
2196 |
workSpaceDefinition := something. |
|
2197 |
! ! |
|
2198 |
||
2199 |
!PerforceSourceCodeManager::CheckInDefinition methodsFor:'actions'! |
|
2200 |
||
2201 |
getBinaryRevision |
|
2202 |
||
2203 |
|locRevision | |
|
2204 |
||
2205 |
locRevision := definitionClass binaryRevision. |
|
2206 |
^ locRevision |
|
2207 |
! |
|
2208 |
||
2209 |
getBinaryRevisionNumber |
|
2210 |
||
2211 |
|locRevision | |
|
2212 |
||
2213 |
locRevision := self getBinaryRevision. |
|
2214 |
locRevision notNil ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
2215 |
locRevision := locRevision asNumber. |
2330 | 2216 |
]. |
2217 |
^ locRevision |
|
2218 |
! |
|
2219 |
||
2220 |
getLocalRevision |
|
2221 |
||
2222 |
|locRevision | |
|
2223 |
||
2224 |
locRevision := definitionClass revision. |
|
2225 |
^ locRevision |
|
2226 |
! |
|
2227 |
||
2228 |
getLocalRevisionFromRepository |
|
2229 |
||
2230 |
|locRevision | |
|
2231 |
||
2232 |
locRevision := self manager newestRevisionOf:definitionClass. |
|
2233 |
locRevision isNil ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
2234 |
force ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
2235 |
locRevision := self manager newestRevisionInFile:classFileName directory:packageDir module:moduleName. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
2236 |
locRevision isNil ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
2237 |
locRevision := '1' "/ initial checkin |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
2238 |
]. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
2239 |
] ifFalse:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
2240 |
locRevision := '1' "/ initial checkin |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
2241 |
] |
2330 | 2242 |
] ifFalse:[ |
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
2243 |
locRevision == #deleted ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
2244 |
locRevision := '0' "/ to force cvs-adding, which resurrects the file from the Attic |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
2245 |
]. |
2330 | 2246 |
]. |
2247 |
^ locRevision |
|
2248 |
! |
|
2249 |
||
2250 |
getLocalRevisionNumber |
|
2251 |
||
2252 |
|locRevision | |
|
2253 |
||
2254 |
locRevision := self getLocalRevision. |
|
2255 |
locRevision notNil ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
2256 |
locRevision := locRevision asNumber. |
2330 | 2257 |
]. |
2258 |
^ locRevision |
|
2259 |
! |
|
2260 |
||
2261 |
getLocalRevisionNumberFromRepository |
|
2262 |
||
2263 |
|locRevision | |
|
2264 |
||
2265 |
locRevision := self getLocalRevisionFromRepository. |
|
2266 |
locRevision notNil ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
2267 |
locRevision := locRevision asNumber. |
2330 | 2268 |
]. |
2269 |
^ locRevision |
|
2270 |
! |
|
2271 |
||
2272 |
getNewestRevision |
|
2273 |
||
2274 |
newestRevision := self manager newestRevisionOf:definitionClass. |
|
2275 |
^ newestRevision |
|
2276 |
! |
|
2277 |
||
2278 |
getNewestRevisionNumber |
|
2279 |
||
2280 |
newestRevision isNil ifTrue:[ |
|
2353
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
2281 |
newestRevision := self getNewestRevision. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
2282 |
newestRevision notNil ifTrue:[ |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
2283 |
newestRevision := newestRevision asNumber. |
8841e465eb49
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2349
diff
changeset
|
2284 |
]. |
2330 | 2285 |
]. |
2286 |
^ newestRevision |
|
2287 |
! ! |
|
2288 |
||
2289 |
!PerforceSourceCodeManager::CheckInDefinition methodsFor:'queries'! |
|
2290 |
||
2291 |
className |
|
2292 |
||
2293 |
^ definitionClass name. |
|
2294 |
! |
|
2295 |
||
2296 |
workSpaceDefinitionFilename |
|
2297 |
||
2298 |
workSpaceDefinition isNil ifTrue:[ ^ nil ]. |
|
2299 |
^ workSpaceDefinition at:#workSpaceDefinitionFilename ifAbsent:nil. |
|
2300 |
! ! |
|
2301 |
||
2355
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2302 |
!PerforceSourceCodeManager::PerforceVersionInfo class methodsFor:'documentation'! |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2303 |
|
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2304 |
documentation |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2305 |
" |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2306 |
Class used to return a Dictionary when asked for versionInfo. |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2307 |
This has been replaced by instances of VersionInfo and subclasses. |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2308 |
|
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2309 |
Notice, that CVSVersionInfo adds some CVS specific data. |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2310 |
|
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2311 |
[author:] |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2312 |
cg (cg@AQUA-DUO) |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2313 |
" |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2314 |
! ! |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2315 |
|
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2316 |
!PerforceSourceCodeManager::PerforceVersionInfo class methodsFor:'instance creation'! |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2317 |
|
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2318 |
fromRCSString:aString |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2319 |
"{ Pragma: +optSpace }" |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2320 |
|
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2321 |
"I know how to parse RCS/CVS version id strings. |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2322 |
Return an instance filled with revision info which is |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2323 |
extracted from aString. This must be in RCS/CVS format." |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2324 |
|
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2325 |
|words firstWord info nm indexOfLastHash| |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2326 |
|
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2327 |
words := aString asCollectionOfWords. |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2328 |
words size < 2 ifTrue:[ |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2329 |
^ nil |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2330 |
]. |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2331 |
firstWord := words first. |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2332 |
|
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2333 |
info := self new. |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2334 |
|
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2335 |
"/ |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2336 |
"/ supported formats: |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2337 |
"/ |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2338 |
"/ $-Header: pathName#rev $ |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2339 |
|
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2340 |
(firstWord = '$Header:') ifTrue:[ |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2341 |
nm := words second. |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2342 |
indexOfLastHash := nm lastIndexOf:$#. |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2343 |
indexOfLastHash ~= 0 ifTrue:[ |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2344 |
info fileName:((nm copyTo:(indexOfLastHash - 1)) asFilename baseName). |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2345 |
info repositoryPathName:(nm copyTo:(indexOfLastHash - 1)). |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2346 |
info revision:((nm copyFrom:indexOfLastHash + 1) asCollectionOfWords first). |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2347 |
]. |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2348 |
^ info |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2349 |
]. |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2350 |
|
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2351 |
|
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2352 |
^ nil |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2353 |
|
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2354 |
" |
2646 | 2355 |
PerforceVersionInfo fromRCSString:'$Header: /cvs/stx/stx/libbasic3/PerforceSourceCodeManager.st,v 1.18 2011-12-21 15:11:04 cg Exp $' |
2355
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2356 |
" |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2357 |
|
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2358 |
"Modified: / 22-10-2008 / 20:17:00 / cg" |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2359 |
! ! |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2360 |
|
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2361 |
!PerforceSourceCodeManager::PerforceVersionInfo methodsFor:'accessing'! |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2362 |
|
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2363 |
repositoryPathName |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2364 |
^ repositoryPathName |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2365 |
! |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2366 |
|
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2367 |
repositoryPathName:something |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2368 |
repositoryPathName := something. |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2369 |
! |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2370 |
|
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2371 |
state |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2372 |
^ '' |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2373 |
! |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2374 |
|
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2375 |
timeZone |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2376 |
^ '' |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2377 |
! |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2378 |
|
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2379 |
timezone |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2380 |
^ '' |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2381 |
|
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2382 |
"Created: / 22-10-2008 / 20:50:39 / cg" |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2383 |
! ! |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2384 |
|
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2385 |
!PerforceSourceCodeManager::PerforceVersionInfo methodsFor:'queries'! |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2386 |
|
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2387 |
getVersionString |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2388 |
|
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2389 |
|stream| |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2390 |
|
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2391 |
stream := WriteStream on:''. |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2392 |
stream nextPutAll:'$Header:'. |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2393 |
stream space. |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2394 |
stream nextPutAll:repositoryPathName. |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2395 |
stream nextPut:$#. |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2396 |
stream nextPutAll:revision printString. |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2397 |
stream space. |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2398 |
stream nextPut:$$. |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2399 |
^ stream contents |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2400 |
! ! |
6c21470136d2
PerforceVersion as private class
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
2401 |
|
2349 | 2402 |
!PerforceSourceCodeManager::WorkSpaceDefinition methodsFor:'accessing'! |
2403 |
||
2404 |
client |
|
2405 |
^ client |
|
2406 |
! |
|
2407 |
||
2408 |
client:something |
|
2409 |
client := something. |
|
2410 |
! |
|
2411 |
||
2412 |
host |
|
2413 |
^ host |
|
2414 |
! |
|
2415 |
||
2416 |
host:something |
|
2417 |
host := something. |
|
2418 |
! |
|
2419 |
||
2420 |
localDir |
|
2421 |
^ localDir |
|
2422 |
! |
|
2423 |
||
2424 |
localDir:something |
|
2425 |
localDir := something. |
|
2426 |
! |
|
2427 |
||
2354 | 2428 |
moduleName |
2429 |
^ moduleName |
|
2430 |
! |
|
2431 |
||
2432 |
moduleName:something |
|
2433 |
moduleName := something. |
|
2434 |
! |
|
2435 |
||
2349 | 2436 |
owner |
2437 |
^ owner |
|
2438 |
! |
|
2439 |
||
2440 |
owner:something |
|
2441 |
owner := something. |
|
2442 |
! |
|
2443 |
||
2444 |
repositoryDir |
|
2445 |
^ repositoryDir |
|
2446 |
! |
|
2447 |
||
2448 |
repositoryDir:something |
|
2449 |
repositoryDir := something. |
|
2450 |
! |
|
2451 |
||
2452 |
root |
|
2453 |
^ root |
|
2454 |
! |
|
2455 |
||
2456 |
root:something |
|
2457 |
root := something. |
|
2458 |
! |
|
2459 |
||
2460 |
workSpaceDefinitionFilename |
|
2461 |
^ workSpaceDefinitionFilename |
|
2462 |
! |
|
2463 |
||
2464 |
workSpaceDefinitionFilename:something |
|
2465 |
workSpaceDefinitionFilename := something. |
|
2466 |
! |
|
2467 |
||
2468 |
workSpaceName |
|
2469 |
^ workSpaceName |
|
2470 |
! |
|
2471 |
||
2472 |
workSpaceName:something |
|
2473 |
workSpaceName := something. |
|
2474 |
! ! |
|
2475 |
||
2354 | 2476 |
!PerforceSourceCodeManager::WorkSpaceDefinition methodsFor:'queries'! |
2477 |
||
2478 |
getDepotPackageDirDorModule:modulePath classFileName:classFileName |
|
2479 |
||
2480 |
|foundView localDirComponents localComponentsModulIndex| |
|
2481 |
||
2482 |
foundView := self repositoryDir. |
|
2483 |
(foundView endsWith:'...') ifTrue:[ |
|
2484 |
foundView := foundView copyTo:(foundView size - 3). |
|
2485 |
]. |
|
2486 |
localDirComponents := localDir components. |
|
2487 |
localComponentsModulIndex := localDirComponents findLast:[:aComponent| aComponent = moduleName]. |
|
2488 |
localComponentsModulIndex = 0 ifTrue:[ |
|
2489 |
^ nil |
|
2490 |
]. |
|
2491 |
localDirComponents from:localComponentsModulIndex to:localDirComponents size do:[:aComponent| |
|
2492 |
aComponent ~= '...' ifTrue:[ |
|
2493 |
foundView := foundView, '/', aComponent. |
|
2494 |
]. |
|
2495 |
]. |
|
2496 |
modulePath notNil ifTrue:[ |
|
2497 |
foundView := foundView, '/', modulePath. |
|
2498 |
]. |
|
2499 |
classFileName notNil ifTrue:[ |
|
2500 |
foundView := foundView, '/', classFileName. |
|
2501 |
]. |
|
2502 |
^foundView |
|
2503 |
! ! |
|
2504 |
||
2330 | 2505 |
!PerforceSourceCodeManager class methodsFor:'documentation'! |
2506 |
||
2507 |
version_CVS |
|
2646 | 2508 |
^ '$Header: /cvs/stx/stx/libbasic3/PerforceSourceCodeManager.st,v 1.18 2011-12-21 15:11:04 cg Exp $' |
2330 | 2509 |
! ! |
2510 |
||
2511 |
PerforceSourceCodeManager initialize! |