author | Stefan Vogel <sv@exept.de> |
Fri, 31 Mar 2006 12:17:13 +0200 | |
changeset 1481 | 893aa9458a8f |
parent 1477 | bea2ad3479eb |
child 1482 | 1492af4820e0 |
permissions | -rw-r--r-- |
1362 | 1 |
" |
2 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
"{ Package: 'stx:libbasic3' }" |
|
14 |
||
15 |
AbstractSourceCodeManager subclass:#CVSSourceCodeManager |
|
16 |
instanceVariableNames:'' |
|
17 |
classVariableNames:'Verbose CVSRoot CVSWorkDirectory RemoteCVS CVSBinDir |
|
18 |
CVSModuleRoots CMD_checkout CVSTempDir DisabledModules' |
|
19 |
poolDictionaries:'' |
|
20 |
category:'System-SourceCodeManagement' |
|
21 |
! |
|
22 |
||
23 |
!CVSSourceCodeManager class methodsFor:'documentation'! |
|
24 |
||
25 |
copyright |
|
130 | 26 |
" |
27 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
807
f84a9377278e
Fix .stxCvsDummy / import stuff.
Stefan Vogel <sv@exept.de>
parents:
806
diff
changeset
|
28 |
All Rights Reserved |
130 | 29 |
|
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
1362 | 37 |
! |
38 |
||
39 |
documentation |
|
40 |
" |
|
41 |
SourceCodeManager which accesses the sourcecode through cvs. |
|
42 |
It requires the shell environment variable CVSROOT to be set |
|
43 |
to the top of the repository tree. (or alternatively, the CVSRoot |
|
44 |
variable being set by a private.rc file). |
|
45 |
Under that top, for each module (especially the stx module itself), |
|
46 |
a subdirectory containing that modules directories must exist. |
|
47 |
||
48 |
If not specified otherwise, the module defaults to 'stx'. |
|
49 |
If a class has its home in another module, it has to be compiled |
|
50 |
with a corresponding entry in the package string (see below). |
|
51 |
Within a module, classes are organized in classlibraries, and the corresponding |
|
52 |
source code is found in various subdirectories of CVSROOT. The directories |
|
53 |
name can also be provided by the package string - if not, it defaults to the |
|
54 |
libraries name. |
|
55 |
The package string controls all this, and is REQUIRED in order for the sourceCodeManager |
|
56 |
to be able to retrieve a classes source. |
|
57 |
The package strings format is: |
|
58 |
'...any infotext....(sourceCodeInfo)' |
|
59 |
the sourceCOdeInfo consists of multiple entries, separated by colons. |
|
60 |
The following formats are allowed: |
|
61 |
(libraryName) - module defaults to 'stx'; directory to the name of the library |
|
62 |
(foo/bar/x) - module defaults to 'stx'; dir is 'foo/bar/x'; library name defaults to x |
|
63 |
(module:directory:libname) - specifies all components |
|
64 |
The first formats are intermediate, for backward compatibility. We urge everyone |
|
65 |
to use the last format (by changing the Make.proto files and add a -P flag to |
|
66 |
the stc compiler flags (see libbasic/Make.proto as an example). |
|
67 |
||
68 |
Notice, that the sourceCodeManager is (currently) only consulted, if no |
|
69 |
source subdirectory exists, or no source file is found there. If it does exist, |
|
70 |
that one is supposed to contain an up-to-date version of the classes source |
|
71 |
(this is temporary - in the future the probe order will be reversed, trying |
|
72 |
the source repository first). |
|
73 |
The source directory is required for systems which do NO source code control. |
|
74 |
||
75 |
Setup: |
|
76 |
- make certain, that the commands 'cvs' and 'co' are available on your system. |
|
77 |
- add setup for the CVSROOT environment variable to your .bashrc / .login / .profile |
|
78 |
- Make certain that either no local source directory exists, or it is empty or it contains |
|
79 |
only source code for files NOT found in the repository (this will not be required in future versions). |
|
80 |
||
81 |
Caveat: |
|
82 |
currently, the rcs container is accessed directly, since cvs mangles the files ident-string and |
|
83 |
thus does not correctly recreate the original file (all source is offset by some characters w.r.t. the |
|
84 |
compiled file). |
|
85 |
Therefore, sevrer-mode CVS is not supported. |
|
86 |
||
87 |
[class variables:] |
|
88 |
CVSTempDir <String | nil> where a directory tree is |
|
89 |
generated temporarily for checkin/checkout |
|
1407 | 90 |
(default is nil -> systems tmp-dir) |
1362 | 91 |
|
92 |
CVSRoot <String> the CVS root. Imported from the |
|
93 |
CVSROOT shell variable. |
|
94 |
||
95 |
RemoteCVS <Boolean> if true, remote CVS access is used |
|
96 |
(i.e. via a socket to a CVS server). |
|
97 |
if false, disk access is used; |
|
98 |
files in CVSRoot must be accessable. |
|
99 |
||
100 |
CVSWorkDirectory not yet supported/implemented. |
|
101 |
PLANNED: name of a directory hierarchy, |
|
102 |
which is kept in sync with the current |
|
103 |
version. |
|
104 |
||
105 |
CVSBinDir where the CVS commands are found |
|
106 |
||
107 |
CVSModuleRoots <Directory> per-module roots. |
|
108 |
If empty, or no entry is found for a |
|
109 |
module is found, CVSRoot is used. |
|
110 |
Otherwise, specifies a per-module CVSRoot. |
|
111 |
(allows multiple CVS hierarchies) |
|
112 |
||
113 |
[author:] |
|
114 |
Claus Gittinger |
|
115 |
||
116 |
[see also:] |
|
117 |
( cvs manual page :man: cvs ) |
|
118 |
( Coding style used in Smalltalk/X classes :html: programming/codingStyle.html ) |
|
119 |
||
120 |
[restrictions:] |
|
121 |
commercial version only |
|
122 |
" |
|
123 |
! |
|
124 |
||
125 |
examples |
|
126 |
" |
|
127 |
Default setup: |
|
128 |
This setup accesses all sources from a single repository: /files/CVS. |
|
129 |
Actually, this is the setup as used within eXept for development. |
|
130 |
||
131 |
CVSSourceCodeManager initializeForRepository:'/files/CVS'. |
|
132 |
||
133 |
||
134 |
Dual repository setup: |
|
135 |
This accesses all ST/X standard classes' source from the /files/CVS |
|
136 |
repository, while your private classes are created in and accessed from |
|
137 |
'/files/myCVS'. |
|
138 |
This setup is useful, if you need revision management on the |
|
139 |
ST/X standard classes as well as for your own classes. |
|
140 |
In order to do this, you should (manually) check in all ST/X classes |
|
141 |
into a private repository WHILE preserving the original revision numbers. |
|
142 |
A shell-procedure similar to: |
|
143 |
||
144 |
for i in lib*/*.st |
|
145 |
do |
|
146 |
id=`ident $i` |
|
147 |
set $id |
|
148 |
rev=$3 |
|
149 |
ci -r$rev <CVSDIR>/$i $i |
|
150 |
done |
|
151 |
||
152 |
should acomplish this. |
|
153 |
Now, that you have all ST/X files in your own repository (and with the |
|
154 |
original revision numbers), access is possible by defining CVSROOT |
|
155 |
as above. However, in order to have your own files being stored in |
|
156 |
another repository, you have to give a per-module repository. |
|
157 |
||
158 |
This defines the default repository (for your containers): |
|
159 |
||
160 |
CVSSourceCodeManager initializeForRepository:'/files/myCVS'. |
|
161 |
||
162 |
and this specifies a repository for all standard ST/X classes (in the stx module): |
|
163 |
||
164 |
CVSSourceCodeManager repositoryName:'/files/CVS' forModule:'stx' |
|
165 |
||
166 |
Dual repository setup for eXept customers with a full licence |
|
167 |
(these can access our in-house master repository, for convenient software update |
|
168 |
and uploading): |
|
169 |
All class sourcees under the 'stx' module (i.e. packageID is 'stx:*') can be accessed |
|
170 |
from the eXept cvs server (i.e. CVSROOT for them is :pserver:userName@exept.de:/files/CVS/stc). |
|
171 |
All local classes should be maintained in and accessed from a local cvs repository |
|
172 |
such as '/files/myCVS'. |
|
173 |
||
174 |
Then, tell the CVSSourceCodeManager about this; |
|
175 |
first the default repository: |
|
176 |
||
177 |
CVSSourceCodeManager initializeForRepository:'/files/myCVS'. |
|
178 |
||
179 |
and the repository for all standard ST/X classes (in the stx module): |
|
180 |
||
181 |
CVSSourceCodeManager repositoryName:':pserver:userName@exept.de:/files/CVS' forModule:'stx' |
|
182 |
" |
|
183 |
! ! |
|
184 |
||
185 |
!CVSSourceCodeManager class methodsFor:'initialization'! |
|
186 |
||
187 |
forgetDisabledModules |
|
188 |
DisabledModules := nil. |
|
189 |
! |
|
190 |
||
191 |
initCommands |
|
192 |
CMD_checkout := 'cvs -n checkout %1'. |
|
193 |
! |
|
194 |
||
195 |
initialize |
|
196 |
"check if $CVSROOT (the shell variable) or CVSRoot (the smalltalk global) |
|
197 |
is set, check if cvs commands can be executed and install myself as the |
|
198 |
SourceCodeManager if this works out ok" |
|
199 |
||
200 |
| s f top ok triedPath cvsCmd cmdName | |
|
201 |
||
1465 | 202 |
RemoteCVS := true. |
1362 | 203 |
DisabledModules := nil. |
1481 | 204 |
CVSModuleRoots isNil ifTrue:[ |
205 |
CVSModuleRoots := Dictionary new. |
|
206 |
]. |
|
207 |
||
1362 | 208 |
|
209 |
"/ |
|
210 |
"/ if CVSROOT is non-empty and both cvs and co are available |
|
211 |
"/ as commands, assume this system uses a cvs source code management. |
|
212 |
"/ |
|
213 |
CVSRoot ifNil:[ |
|
1407 | 214 |
CVSRoot := OperatingSystem getEnvironment:'CVSROOT'. |
215 |
CVSRoot ifNil:[ |
|
216 |
"disabled since $CVSROOT is not set" |
|
217 |
^ self |
|
218 |
]. |
|
1362 | 219 |
]. |
220 |
||
221 |
OperatingSystem isMSDOSlike ifTrue:[ |
|
222 |
cvsCmd := 'cvs.exe' |
|
223 |
] ifFalse:[ |
|
224 |
cvsCmd := 'cvs' |
|
225 |
]. |
|
226 |
||
227 |
CVSBinDir size > 0 ifTrue:[ |
|
228 |
OperatingSystem isMSDOSlike ifTrue:[ |
|
229 |
cmdName := CVSBinDir asFilename constructString:cvsCmd. |
|
230 |
( OperatingSystem canExecuteCommand:cmdName) ifFalse:[ |
|
231 |
CVSBinDir := ''. |
|
232 |
] ifTrue:[ |
|
233 |
CVSBinDir := CVSBinDir asFilename pathName |
|
234 |
] |
|
235 |
] |
|
236 |
]. |
|
237 |
||
238 |
CVSBinDir size == 0 ifTrue:[ |
|
239 |
CVSBinDir := ''. |
|
240 |
(ok := OperatingSystem canExecuteCommand:cvsCmd) ifFalse:[ |
|
241 |
"/ mhmh - no cvs; |
|
242 |
||
243 |
OperatingSystem isUNIXlike ifTrue:[ |
|
244 |
triedPath := #( '/usr/local/bin' ). |
|
245 |
] ifFalse:[ |
|
246 |
OperatingSystem isMSDOSlike ifTrue:[ |
|
247 |
triedPath := Array with:'c:\bin' |
|
248 |
with:(Filename currentDirectory pathName) |
|
249 |
with:(OperatingSystem stxBinDirPath ? 'c:\windows'). |
|
250 |
] ifFalse:[ |
|
251 |
triedPath := #() |
|
252 |
] |
|
253 |
]. |
|
254 |
||
255 |
triedPath do:[:eachTriedDir | |
|
256 |
ok ifFalse:[ |
|
257 |
(OperatingSystem canExecuteCommand:(eachTriedDir asFilename constructString:cvsCmd)) ifTrue:[ |
|
258 |
ok := true. |
|
259 |
CVSBinDir := eachTriedDir. |
|
260 |
] |
|
261 |
] |
|
262 |
]. |
|
263 |
]. |
|
264 |
] ifFalse:[ |
|
265 |
ok := OperatingSystem canExecuteCommand:(CVSBinDir asFilename constructString:cvsCmd). |
|
266 |
]. |
|
267 |
||
268 |
ok ifFalse:[ |
|
269 |
'CVSSourceCodeManager [warning]: disabled since no >> cvs << command found' infoPrintCR. |
|
270 |
^ self |
|
271 |
]. |
|
272 |
||
273 |
"/ (OperatingSystem canExecuteCommand:(CVSBinDir , 'co')) ifFalse:[ |
|
274 |
"/ 'CVSSourceCodeManager [warning]: limited functionality - no >> co << command found' infoPrintCR. |
|
275 |
"/ ]. |
|
276 |
"/ (OperatingSystem canExecuteCommand:(CVSBinDir , 'rlog')) ifFalse:[ |
|
277 |
"/ 'CVSSourceCodeManager [warning]: limited functionality - no >> rlog << command found' infoPrintCR. |
|
278 |
"/ ]. |
|
279 |
"/ (OperatingSystem canExecuteCommand:(CVSBinDir , 'patch')) ifFalse:[ |
|
280 |
"/ 'CVSSourceCodeManager [warning]: limited functionality - no >> patch << command found' infoPrintCR. |
|
281 |
"/ ]. |
|
282 |
||
283 |
UseWorkTree := false. |
|
284 |
||
285 |
CacheDirectoryName ifNil:[ |
|
286 |
self initCacheDirPath. |
|
287 |
]. |
|
288 |
CachingSources ifNil:[ |
|
289 |
CachingSources := true. |
|
290 |
]. |
|
291 |
||
292 |
"/ |
|
293 |
"/ check if there is an stx directory there |
|
294 |
"/ |
|
295 |
((f := CVSRoot asFilename) isDirectory |
|
296 |
and:[(top := f construct:'stx') isDirectory |
|
297 |
and:[top isReadable]]) ifTrue:[ |
|
298 |
RemoteCVS := false |
|
299 |
]. |
|
300 |
||
301 |
Smalltalk at:#SourceCodeManager put:self. |
|
302 |
DefaultManager := self. |
|
303 |
||
304 |
('CVSSourceCodeManager [info]: repository CVSROOT is ''' , CVSRoot , '''.') infoPrintCR. |
|
305 |
RemoteCVS ifTrue:[ |
|
306 |
'CVSSourceCodeManager [info]: assume remote CVS mode (no stx found in CVSROOT)' infoPrintCR. |
|
307 |
^ self |
|
308 |
]. |
|
309 |
||
310 |
"/ |
|
311 |
"/ optionally set the WorkTreeDirectoryName from $STX_WORKTREE; |
|
312 |
"/ if non-nil, a working tree is kept there |
|
313 |
"/ and updated/commited files are not removed. |
|
314 |
"/ If you use a regular (make-) tree, |
|
315 |
"/ set WorkTreeDirectoryName (or the environment variable) to that. |
|
316 |
"/ |
|
317 |
"/ this is not yet finished. |
|
318 |
"/ |
|
319 |
s := OperatingSystem getEnvironment:'STX_WORKTREE'. |
|
320 |
s notNil ifTrue:[ |
|
321 |
WorkTreeDirectoryName := s. |
|
322 |
UseWorkTree := true. |
|
323 |
] |
|
324 |
||
325 |
" |
|
326 |
AbstractSourceCodeManager initialize |
|
327 |
CVSSourceCodeManager initialize |
|
328 |
" |
|
329 |
||
330 |
" |
|
331 |
CVSRoot := '/files/CVS'. |
|
332 |
AbstractSourceCodeManager initialize. |
|
333 |
CVSSourceCodeManager initialize. |
|
334 |
" |
|
335 |
||
336 |
"Created: / 4.11.1995 / 19:14:38 / cg" |
|
337 |
"Modified: / 19.12.1995 / 14:25:46 / stefan" |
|
338 |
"Modified: / 5.12.2001 / 18:52:00 / cg" |
|
339 |
! |
|
340 |
||
341 |
initializeForRepository:aDirectoryName |
|
342 |
"set the global CVSROOT directory (i.e. the repositories name). |
|
343 |
And reinitialize. |
|
344 |
Can be used from the launcher to change/configure the repository." |
|
345 |
||
346 |
self repositoryName:aDirectoryName. |
|
347 |
AbstractSourceCodeManager initialize. |
|
348 |
CVSSourceCodeManager initialize. |
|
349 |
||
350 |
" |
|
351 |
CVSSourceCodeManager initializeForRepository:'/files/CVS' |
|
352 |
CVSSourceCodeManager initializeForRepository:'ibm:/files/CVS' |
|
353 |
" |
|
354 |
||
355 |
"Created: / 13.8.1997 / 17:20:57 / cg" |
|
356 |
"Modified: / 25.9.1997 / 12:28:05 / stefan" |
|
357 |
"Modified: / 2.11.1997 / 17:08:27 / cg" |
|
358 |
! ! |
|
359 |
||
360 |
!CVSSourceCodeManager class methodsFor:'accessing'! |
|
361 |
||
362 |
cvsBinDirectory |
|
363 |
"return the name of the bin repository. |
|
364 |
Thats the directory, where the cvs / cvs.exe command is found." |
|
365 |
||
366 |
^ CVSBinDir |
|
367 |
! |
|
368 |
||
369 |
cvsBinDirectory:aString |
|
370 |
"set the name of the bin repository. |
|
371 |
Thats the directory, where the cvs / cvs.exe command is found." |
|
372 |
||
373 |
aString isEmpty ifTrue:[ |
|
374 |
CVSBinDir := aString |
|
375 |
] ifFalse:[ |
|
376 |
CVSBinDir := aString asFilename pathName. |
|
377 |
(CVSBinDir endsWith:Filename separator) ifTrue:[ |
|
378 |
CVSBinDir := CVSBinDir copyWithoutLast:1. |
|
379 |
] |
|
380 |
]. |
|
381 |
! |
|
382 |
||
1407 | 383 |
cvsTmpDirectory |
384 |
"return the name of the tmp repository. |
|
385 |
Thats the directory, where temporary files are created for checkin/checkout. |
|
386 |
If nil, the systems default tempDirectory is used." |
|
387 |
||
388 |
^ (CVSTempDir ? Filename tempDirectory pathName) |
|
389 |
||
390 |
" |
|
391 |
CVSTempDir := nil |
|
392 |
" |
|
393 |
! |
|
394 |
||
395 |
cvsTmpDirectory:aPathNameString |
|
396 |
"set the name of the tmp repository. |
|
397 |
Thats the directory, where temporary files are created for checkin/checkout. |
|
398 |
If nil, the systems default tempDirectory is used." |
|
399 |
||
400 |
CVSTempDir := aPathNameString |
|
401 |
! |
|
402 |
||
1481 | 403 |
knownModules |
404 |
"return the modules, we currently know" |
|
405 |
||
406 |
^ CVSModuleRoots keys |
|
407 |
! |
|
408 |
||
1362 | 409 |
repositoryName |
410 |
"return the name of the global repository. |
|
411 |
This is used, if no per-module repository is defined." |
|
412 |
||
413 |
^ CVSRoot |
|
414 |
||
415 |
"Created: 14.9.1996 / 13:22:05 / cg" |
|
416 |
"Modified: 19.9.1997 / 06:12:02 / cg" |
|
417 |
! |
|
418 |
||
419 |
repositoryName:aDirectoryName |
|
420 |
"set the name of the repository; |
|
421 |
thats the name of the global CVSROOT directory, which is used |
|
422 |
if no specific repository was defined for a module. |
|
423 |
Can be used from an rc-script, to override the CVSROOT shell |
|
424 |
variable setting." |
|
425 |
||
426 |
DisabledModules := nil. |
|
427 |
CVSRoot := aDirectoryName. |
|
428 |
||
429 |
"Created: 14.9.1996 / 13:22:24 / cg" |
|
430 |
"Modified: 19.9.1997 / 06:10:31 / cg" |
|
431 |
! |
|
432 |
||
433 |
repositoryName:aRepositoryName forModule:aModuleName |
|
434 |
"set the CVSROOT directory which provides the sources for all |
|
435 |
classes in a particular module. |
|
436 |
This can be used from an rc-script, to specify a repository |
|
437 |
for a particular module. |
|
438 |
If left unspecified, the global (i.e. fallBack) repository is used." |
|
439 |
||
440 |
DisabledModules := nil. |
|
441 |
CVSModuleRoots at:aModuleName put:aRepositoryName |
|
442 |
||
443 |
"Modified: 19.9.1997 / 06:09:40 / cg" |
|
444 |
! |
|
445 |
||
446 |
repositoryNameForModule:aModuleName |
|
447 |
"return the CVSROOT directory which provides the sources for all |
|
448 |
classes in a particular module. |
|
449 |
Nil is returned for unspecified moduleRoots; in this case, |
|
450 |
the global (i.e. fallBack) repository will be used for source access." |
|
451 |
||
452 |
^ CVSModuleRoots at:aModuleName ifAbsent:nil. |
|
453 |
||
454 |
"Modified: 19.9.1997 / 06:09:40 / cg" |
|
455 |
"Created: 19.9.1997 / 06:13:06 / cg" |
|
456 |
! |
|
457 |
||
458 |
repositoryNamesPerModule |
|
459 |
"return the dictionary, which associates CVSRoots to module names. |
|
460 |
If no entry is contained in this dictionary for some module, |
|
461 |
the default cvsRoot (CVSRoot) will be used." |
|
462 |
||
1481 | 463 |
^ CVSModuleRoots |
1362 | 464 |
! |
465 |
||
466 |
repositoryNamesPerModule:aDictionary |
|
467 |
"set the dictionary, which associates CVSRoots to module names. |
|
468 |
If no entry is contained in this dictionary for some module, |
|
469 |
the default cvsRoot (CVSRoot) will be used." |
|
470 |
||
471 |
CVSModuleRoots := aDictionary |
|
472 |
! ! |
|
473 |
||
474 |
!CVSSourceCodeManager class methodsFor:'private'! |
|
475 |
||
476 |
checkOut:relativeFilename module:moduleDir in:tempdir |
|
477 |
"checkout realtiveFilename in tempdir" |
|
478 |
||
479 |
|cmd| |
|
480 |
||
481 |
cmd := 'checkout -l ' , relativeFilename. |
|
482 |
^ self |
|
483 |
executeCVSCommand:cmd |
|
484 |
module:moduleDir |
|
485 |
inDirectory:tempdir name |
|
486 |
log:false |
|
487 |
||
488 |
||
489 |
" |
|
490 |
self checkOut:'stx/libbasic/Integer.st' asFilename in:'/tmp' asFilename |
|
491 |
" |
|
492 |
||
493 |
"Created: / 18.1.2000 / 20:30:01 / cg" |
|
494 |
"Modified: / 18.1.2000 / 20:35:06 / cg" |
|
495 |
! |
|
496 |
||
497 |
checkinTroubleDialog:title message:message log:log abortable:abortable option:optionTitle |
|
498 |
"trouble checking in - open a dialog" |
|
499 |
||
500 |
^ self |
|
501 |
checkinTroubleDialog:title |
|
502 |
message:message |
|
503 |
log:log |
|
504 |
abortable:abortable |
|
505 |
option:optionTitle |
|
506 |
option2:nil |
|
507 |
||
508 |
"Created: 10.12.1995 / 17:34:33 / cg" |
|
509 |
"Modified: 12.9.1996 / 02:39:06 / cg" |
|
510 |
! |
|
511 |
||
512 |
checkinTroubleDialog:title message:message log:log abortable:abortable option:optionTitle option2:optionTitle2 |
|
513 |
^self |
|
514 |
checkinTroubleDialog:title |
|
515 |
message:message |
|
516 |
log:log |
|
517 |
abortable:abortable |
|
518 |
option:optionTitle |
|
519 |
option2:optionTitle2 |
|
520 |
option3:nil |
|
521 |
! |
|
522 |
||
523 |
checkinTroubleDialog:title message:message log:log abortable:abortable option:optionTitle option2:optionTitle2 option3:optionTitle3 |
|
524 |
"trouble checking in - open a dialog" |
|
525 |
||
526 |
|l box list listView optionPressed option2Pressed option3Pressed| |
|
527 |
||
528 |
l := log collect:[:line | line withTabsExpanded]. |
|
529 |
list := SelectionInList with:l. |
|
530 |
||
531 |
box := Dialog new. |
|
532 |
box label:(title). |
|
533 |
||
534 |
(box addTextLabel:message) borderWidth:0. |
|
535 |
||
536 |
listView := SelectionInListView on:list. |
|
537 |
listView disable. |
|
538 |
listView height:200. |
|
539 |
box addComponent:(HVScrollableView forView:listView miniScrollerH:true) tabable:false. |
|
540 |
box addVerticalSpace. |
|
541 |
||
542 |
abortable ifTrue:[ |
|
543 |
box addAbortButton |
|
544 |
]. |
|
545 |
optionTitle notNil ifTrue:[ |
|
546 |
box addOkButton:(Button label:optionTitle action:[optionPressed := true. box hide]). |
|
547 |
]. |
|
548 |
optionTitle2 notNil ifTrue:[ |
|
549 |
box addOkButton:(Button label:optionTitle2 action:[option2Pressed := true. box hide]). |
|
550 |
]. |
|
551 |
optionTitle3 notNil ifTrue:[ |
|
552 |
box addOkButton:(Button label:optionTitle3 action:[option3Pressed := true. box hide]). |
|
553 |
]. |
|
554 |
box addOkButton. |
|
555 |
||
556 |
box extent:(box preferredExtent). |
|
557 |
box minExtent:box extent. |
|
558 |
box maxExtent:box extent. |
|
559 |
||
560 |
box open. |
|
561 |
||
562 |
box destroy. |
|
563 |
optionPressed == true ifTrue:[^ #option]. |
|
564 |
option2Pressed == true ifTrue:[^ #option2]. |
|
565 |
option3Pressed == true ifTrue:[^ #option3]. |
|
566 |
^ box accepted |
|
567 |
||
568 |
"Created: 9.9.1996 / 19:12:45 / cg" |
|
569 |
"Modified: 12.9.1996 / 02:39:10 / cg" |
|
570 |
! |
|
571 |
||
572 |
createEntryFor:pathInRepository module:aModule in:aDirectory revision:rev date:date special:special overwrite:overwrite |
|
573 |
"create an CVS/Repository and CVS/Entries entry for filename. |
|
574 |
If the path does not exist, it will be created |
|
575 |
If overwrite is true, an existing Entry will be overwritten. |
|
576 |
" |
|
577 |
||
578 |
|filename cvsRoot cvsDir name entries firstPart s path| |
|
579 |
||
580 |
filename := pathInRepository asFilename. |
|
581 |
cvsDir := (aDirectory asFilename construct:'CVS') recursiveMakeDirectory. |
|
582 |
entries := cvsDir construct:'Entries'. |
|
583 |
name := filename baseName. |
|
584 |
firstPart := '/', name, '/'. |
|
585 |
||
586 |
s := entries readStreamOrNil. |
|
587 |
s isNil ifTrue:[ |
|
588 |
"/ |
|
589 |
"/ no Repository yet, create one |
|
590 |
"/ |
|
591 |
|index root| |
|
592 |
||
593 |
cvsRoot := self getCVSROOTForModule:aModule. |
|
594 |
"/ |
|
595 |
"/ match for first '/', to get the path portion without :pserver:host: |
|
596 |
"/ |
|
597 |
index := cvsRoot indexOf:$/. |
|
598 |
index > 0 ifTrue:[ |
|
599 |
root := cvsRoot copyFrom:(index). |
|
600 |
] ifFalse:[ |
|
601 |
root := cvsRoot. |
|
602 |
]. |
|
603 |
"/ create Repository |
|
604 |
"/ (notice, contents must be a Unix filename ... |
|
605 |
||
606 |
s := (cvsDir construct:'Repository') writeStream. |
|
607 |
path := Filename components:filename directory name. |
|
608 |
path := path asStringWith:$/. |
|
609 |
s nextPutLine:(root, '/', path). |
|
610 |
s close. |
|
611 |
||
612 |
"/ make new Entries file. |
|
613 |
s := entries writeStream. |
|
614 |
] ifFalse:[ |
|
615 |
|newName newStream line| |
|
616 |
||
617 |
newName := Filename newTemporaryIn:cvsDir. |
|
618 |
newStream := newName writeStream. |
|
619 |
[(line := s nextLine) notNil] whileTrue:[ |
|
620 |
(line findString:firstPart) ~= 1 ifTrue:[ |
|
621 |
"/ we have found an entry for ourself. |
|
622 |
"/ If we do not want to overwrite it, clean up everything and return. |
|
623 |
overwrite ifFalse:[ |
|
624 |
newName remove. |
|
625 |
newStream close. |
|
626 |
s close. |
|
627 |
^ self |
|
628 |
]. |
|
629 |
newStream nextPutLine:line |
|
630 |
]. |
|
631 |
]. |
|
632 |
newName renameTo:entries. |
|
633 |
s close. |
|
634 |
s := newStream. |
|
635 |
]. |
|
636 |
s nextPutLine:firstPart, rev, '/', date, '/', special, '/'. |
|
637 |
s close. |
|
638 |
||
639 |
" |
|
640 |
self createEntryFor:'foo/xxx/yyy' in:'foo/xxx' revision:'1.22' date:'dummy' special:'' |
|
641 |
self createEntryFor:'foo/xxx/yyy' in:'foo/xxx' revision:'3.44' date:'new dummy' special:'special' |
|
642 |
" |
|
643 |
||
644 |
"Created: / 19.9.1997 / 06:21:02 / cg" |
|
645 |
"Modified: / 7.1.1998 / 14:15:35 / stefan" |
|
646 |
"Modified: / 20.8.1998 / 00:12:11 / cg" |
|
647 |
! |
|
648 |
||
649 |
createLocalDirectory:packageDir inModule:moduleDir |
|
650 |
"create a local working directory for module/package. |
|
651 |
To speed up things, we checkout the file '.cvsignore', to create |
|
652 |
the whole tree. If the file is not present, we will create it as empty file. |
|
653 |
Return the name of a temporary directory containing the package" |
|
654 |
||
655 |
^ self |
|
656 |
createLocalDirectory:packageDir |
|
657 |
inModule:moduleDir |
|
658 |
with:'.cvsignore' |
|
659 |
||
660 |
" |
|
661 |
self createLocalDirectory:'libbasic' inModule:'stx' |
|
662 |
" |
|
663 |
||
664 |
"Created: / 23.7.1999 / 19:14:28 / stefan" |
|
665 |
"Modified: / 26.7.1999 / 17:43:35 / stefan" |
|
666 |
"Modified: / 18.1.2000 / 20:56:19 / cg" |
|
667 |
! |
|
668 |
||
669 |
createLocalDirectory:packageDir inModule:moduleDir with:fileToCheckout |
|
670 |
"create a local working directory for module/package, and checkout the |
|
671 |
given file there. |
|
672 |
Return the name of a temporary directory containing the package, or nil" |
|
673 |
||
674 |
|path absolutePath tempdir workingDir unixPath| |
|
675 |
||
676 |
path := (moduleDir asFilename construct:packageDir) construct:fileToCheckout. |
|
677 |
||
678 |
tempdir := self createTempDirectory:nil forModule:nil. |
|
679 |
tempdir isNil ifTrue:[ |
|
680 |
('CVSSourceCodeManager [error]: no tempDir - cannot checkout') errorPrintCR. |
|
681 |
^ nil |
|
682 |
]. |
|
683 |
||
684 |
[ |
|
685 |
OperatingSystem isUNIXlike ifTrue:[ |
|
686 |
unixPath := path name. |
|
687 |
] ifFalse:[ |
|
688 |
OperatingSystem isVMSlike ifTrue:[ |
|
689 |
self error:'VMS case not yet implemented' |
|
690 |
]. |
|
691 |
unixPath := path name copy replaceAll:$\ with:$/ |
|
692 |
]. |
|
693 |
||
694 |
(self checkOut:unixPath module:moduleDir in:tempdir) ifFalse:[ |
|
695 |
"dummy file does not exist, so create it" |
|
696 |
||
697 |
absolutePath := tempdir construct:path. |
|
698 |
absolutePath directory recursiveMakeDirectory. |
|
699 |
"now create the file" |
|
700 |
(absolutePath writeStream close) isNil ifTrue:[ |
|
701 |
('CVSSourceCodeManager [error]: cannot create dummy') errorPrintCR. |
|
702 |
tempdir recursiveRemove. |
|
703 |
^ nil. |
|
704 |
]. |
|
705 |
||
706 |
"now create the dummy file in the repository" |
|
707 |
(self import:moduleDir in:tempdir) ifFalse:[ |
|
708 |
('CVSSourceCodeManager [error]: cannot import dummy') errorPrintCR. |
|
709 |
]. |
|
710 |
||
711 |
"remove the path, so that checkout works" |
|
712 |
(tempdir construct:moduleDir) recursiveRemove. |
|
713 |
||
714 |
"checkout the dummy, the intermediate directories will be created" |
|
715 |
(self checkOut:unixPath module:moduleDir in:tempdir) ifFalse:[ |
|
716 |
('CVSSourceCodeManager [warning]: import failed (to create working dir)') errorPrintCR. |
|
717 |
"/false ifTrue:[ |
|
718 |
"/ "/ manually create it |
|
719 |
"/ |
|
720 |
"/ (tempdir construct:unixPath) directory recursiveMakeDirectory. |
|
721 |
"/ workingDir := tempdir. |
|
722 |
"/ unixPath asFilename directory components do:[:each | |
|
723 |
"/ self executeCVSCommand:('add ' , each) module:moduleDir inDirectory:workingDir. |
|
724 |
"/ workingDir := workingDir construct:each. |
|
725 |
"/ ]. |
|
726 |
"/ (absolutePath writeStream close) isNil ifTrue:[ |
|
727 |
"/ ('CVSSourceCodeManager [error]: cannot create dummy') errorPrintCR. |
|
728 |
"/ tempdir recursiveRemove. |
|
729 |
"/ ^ nil. |
|
730 |
"/ ]. |
|
731 |
"/ self executeCVSCommand:('add ' , fileToCheckout) module:moduleDir inDirectory:workingDir. |
|
732 |
"/ self executeCVSCommand:('commit ' , fileToCheckout) module:moduleDir inDirectory:workingDir. |
|
733 |
"/ |
|
734 |
"/ ^ tempdir |
|
735 |
"/]. |
|
736 |
tempdir recursiveRemove. |
|
737 |
^ nil. |
|
738 |
]. |
|
739 |
]. |
|
1406 | 740 |
] ifCurtailed:[ |
1362 | 741 |
tempdir recursiveRemove. |
742 |
]. |
|
743 |
||
744 |
^ tempdir. |
|
745 |
||
746 |
" |
|
747 |
self createLocalDirectory:'libbasic' inModule:'stx' |
|
748 |
" |
|
749 |
||
750 |
"Modified: / 26.7.1999 / 17:43:35 / stefan" |
|
751 |
"Created: / 18.1.2000 / 20:55:52 / cg" |
|
752 |
"Modified: / 18.1.2000 / 20:56:45 / cg" |
|
753 |
! |
|
754 |
||
755 |
createTempDirectory:packageDir forModule:moduleDir |
|
756 |
"create a temp directory for checking out" |
|
757 |
||
758 |
|tempdir dir| |
|
759 |
||
760 |
"/ if CVSTempDir isNil, use current. |
|
1407 | 761 |
tempdir := Filename newTemporaryIn:(self cvsTmpDirectory). |
1362 | 762 |
tempdir exists ifTrue:[ |
763 |
tempdir recursiveRemove. |
|
764 |
]. |
|
765 |
OperatingSystem errorSignal handle:[:ex | |
|
766 |
'SourceCodemanager [error]: cannot create temporary directory' errorPrintCR. |
|
767 |
^ nil. |
|
768 |
] do:[ |
|
769 |
tempdir makeDirectory. |
|
770 |
]. |
|
771 |
||
772 |
moduleDir notNil ifTrue:[ |
|
773 |
dir := tempdir construct:moduleDir. |
|
774 |
dir makeDirectory. |
|
775 |
||
776 |
packageDir notNil ifTrue:[ |
|
777 |
dir := dir construct:packageDir. |
|
778 |
dir recursiveMakeDirectory. |
|
779 |
]. |
|
780 |
dir exists ifFalse:[ |
|
781 |
tempdir recursiveRemove. |
|
782 |
'SourceCodemanager [error]: cannot create temporary directory' errorPrintCR. |
|
783 |
^ nil. |
|
784 |
]. |
|
785 |
]. |
|
786 |
^ tempdir |
|
787 |
||
788 |
"self createTempDirectory:'fooPackage' forModule:'fooModule'" |
|
789 |
||
790 |
"Created: 9.12.1995 / 19:14:35 / cg" |
|
791 |
"Modified: 19.12.1995 / 16:13:02 / stefan" |
|
792 |
"Modified: 18.8.1997 / 19:06:52 / cg" |
|
793 |
! |
|
794 |
||
795 |
cvsTimeString:absoluteTime |
|
1388
6fae02877da5
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
1387
diff
changeset
|
796 |
"convert a Timestamp to a string suitable for the CVS/Entries file: |
1362 | 797 |
|
798 |
123456789012345678901234 |
|
799 |
Tue Dec 19 20:56:26 1995 |
|
800 |
" |
|
801 |
||
802 |
|date time stream| |
|
803 |
||
804 |
date := absoluteTime asDate. |
|
805 |
time := absoluteTime asTime. |
|
806 |
stream := WriteStream on:(String new:24). |
|
807 |
||
808 |
(#('Mon' 'Tue' 'Wed' 'Thu' 'Fri' 'Sat' 'Sun') at:(date dayInWeek)) printOn:stream. |
|
809 |
stream space. |
|
810 |
||
811 |
(#('Jan' 'Feb' 'Mar' 'Apr' 'May' 'Jun' 'Jul' 'Aug' 'Sep' 'Oct' 'Nov' 'Dec') |
|
812 |
at:(date month)) printOn:stream. |
|
813 |
stream space. |
|
814 |
||
815 |
date day printOn:stream. |
|
816 |
stream space. |
|
817 |
||
818 |
time print24HourFormatOn: stream. |
|
819 |
stream space. |
|
820 |
||
821 |
date year printOn:stream. |
|
822 |
||
823 |
^ stream contents |
|
824 |
||
825 |
||
826 |
" |
|
1388
6fae02877da5
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
1387
diff
changeset
|
827 |
CVSSourceCodeManager cvsTimeString:(Timestamp now) |
1362 | 828 |
" |
829 |
||
830 |
"Modified: 20.12.1995 / 11:03:32 / stefan" |
|
831 |
! |
|
832 |
||
833 |
executeCVSCommand:cvsCommand module:moduleName inDirectory:dir |
|
834 |
"execute command and prepend cvs command name and global options. |
|
835 |
if dir ~= nil, execute command in that directory. |
|
836 |
This also leads to a log-entry to be added to cvs's logfile." |
|
837 |
||
838 |
^ self |
|
839 |
executeCVSCommand:cvsCommand |
|
840 |
module:moduleName |
|
841 |
inDirectory:dir |
|
842 |
log:true |
|
843 |
||
844 |
"Modified: / 20.5.1998 / 16:07:28 / cg" |
|
845 |
! |
|
846 |
||
847 |
executeCVSCommand:cvsCommand module:moduleName inDirectory:dir log:doLog |
|
848 |
"execute command and prepend cvs command name and global options. |
|
849 |
if dir ~= nil, execute command in that directory. |
|
850 |
The doLog argument, if false supresses a logEntry to be added |
|
851 |
in the cvs log file (used when reading / extracting history)" |
|
852 |
||
853 |
^ self |
|
854 |
executeCVSCommand:cvsCommand module:moduleName inDirectory:dir log:doLog |
|
855 |
pipe:false |
|
856 |
! |
|
857 |
||
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
858 |
executeCVSCommand:cvsCommand module:moduleName inDirectory:dirArg log:doLog errorTo:errorStream |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
859 |
^ self |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
860 |
executeCVSCommand:cvsCommand |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
861 |
module:moduleName |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
862 |
inDirectory:dirArg |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
863 |
log:doLog |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
864 |
outputTo:nil |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
865 |
errorTo:errorStream |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
866 |
! |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
867 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
868 |
executeCVSCommand:cvsCommand module:moduleName inDirectory:dirArg log:doLog outputTo:outStream errorTo:errorStream |
1390
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
869 |
"execute command and prepend cvs command name and global options. |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
870 |
execute command in the dirArg directory. |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
871 |
The doLog argument, if false supresses a logEntry to be added |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
872 |
in the cvs log file (used when reading / extracting history)" |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
873 |
|
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
874 |
|command cvsRoot rslt ok pathOfDir p dir| |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
875 |
|
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
876 |
dirArg notNil ifTrue:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
877 |
dir := dirArg asFilename. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
878 |
pathOfDir := dir pathName. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
879 |
]. |
1390
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
880 |
|
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
881 |
cvsRoot := self getCVSROOTForModule:moduleName. |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
882 |
|
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
883 |
command := CVSBinDir. |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
884 |
command size > 0 ifTrue:[ |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
885 |
(command endsWith:Filename separator) ifFalse:[ |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
886 |
command := command , (Filename separator) |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
887 |
] |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
888 |
]. |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
889 |
command := command , 'cvs'. |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
890 |
(command includes:Character space) ifTrue:[ |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
891 |
command := '"' , command , '"' |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
892 |
]. |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
893 |
|
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
894 |
doLog ifFalse:[ |
1393
28d04a5111c6
cvs V1.11.14 does not support the 'cvs -l' option any longer and breaks
Stefan Vogel <sv@exept.de>
parents:
1390
diff
changeset
|
895 |
"/ cvs 1.11.14 fails with -l option |
28d04a5111c6
cvs V1.11.14 does not support the 'cvs -l' option any longer and breaks
Stefan Vogel <sv@exept.de>
parents:
1390
diff
changeset
|
896 |
"/ command := command , ' -l'. |
1390
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
897 |
]. |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
898 |
command := command , ' -d "', cvsRoot, '" ', cvsCommand. |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
899 |
|
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
900 |
Verbose == true ifTrue:[ |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
901 |
('CVSSourceCodeManager [info]: executing: ' , command , ' [in ' , pathOfDir , ']') infoPrintCR. |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
902 |
]. |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
903 |
|
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
904 |
Processor isDispatching ifFalse:[ |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
905 |
rslt := ok := OperatingSystem executeCommand:command |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
906 |
inputFrom:nil |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
907 |
outputTo:outStream |
1390
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
908 |
errorTo:errorStream |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
909 |
auxFrom:nil |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
910 |
inDirectory:pathOfDir |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
911 |
lineWise:false |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
912 |
onError:[:status| false]. |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
913 |
] ifTrue:[ |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
914 |
p := [ |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
915 |
rslt := ok := OperatingSystem executeCommand:command |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
916 |
inputFrom:nil |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
917 |
outputTo:outStream |
1390
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
918 |
errorTo:errorStream |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
919 |
auxFrom:nil |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
920 |
inDirectory:pathOfDir |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
921 |
lineWise:false |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
922 |
onError:[:status| false]. |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
923 |
] fork. |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
924 |
|
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
925 |
(p waitUntilTerminatedWithTimeout:300) ifTrue:[ |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
926 |
('CVSSourceCodeManager [info]: command timeout: ' , command) errorPrintCR. |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
927 |
^ false |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
928 |
]. |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
929 |
]. |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
930 |
|
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
931 |
ok ifFalse:[ |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
932 |
('CVSSourceCodeManager [info]: command failed: ' , command) errorPrintCR. |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
933 |
]. |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
934 |
^ rslt |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
935 |
|
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
936 |
"Modified: / 23.4.1996 / 15:24:00 / stefan" |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
937 |
"Created: / 20.5.1998 / 16:06:34 / cg" |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
938 |
"Modified: / 19.5.1999 / 10:43:57 / cg" |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
939 |
! |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
940 |
|
1362 | 941 |
executeCVSCommand:cvsCommand module:moduleName inDirectory:dirArg log:doLog pipe:doPipe |
942 |
"execute command and prepend cvs command name and global options. |
|
943 |
execute command in the dirArg directory. |
|
944 |
The doLog argument, if false supresses a logEntry to be added |
|
945 |
in the cvs log file (used when reading / extracting history)" |
|
946 |
||
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
947 |
|command cvsRoot rslt ok pathOfDir p| |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
948 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
949 |
dirArg notNil ifTrue:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
950 |
pathOfDir := dirArg asFilename pathName. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
951 |
]. |
1362 | 952 |
|
953 |
cvsRoot := self getCVSROOTForModule:moduleName. |
|
954 |
||
955 |
command := CVSBinDir. |
|
956 |
command size > 0 ifTrue:[ |
|
957 |
(command endsWith:Filename separator) ifFalse:[ |
|
1387 | 958 |
command := command , (Filename separator) |
1362 | 959 |
] |
960 |
]. |
|
961 |
command := command , 'cvs'. |
|
962 |
(command includes:Character space) ifTrue:[ |
|
963 |
command := '"' , command , '"' |
|
964 |
]. |
|
965 |
||
966 |
doLog ifFalse:[ |
|
1393
28d04a5111c6
cvs V1.11.14 does not support the 'cvs -l' option any longer and breaks
Stefan Vogel <sv@exept.de>
parents:
1390
diff
changeset
|
967 |
"/ cvs 1.11.14 fails with -l option |
28d04a5111c6
cvs V1.11.14 does not support the 'cvs -l' option any longer and breaks
Stefan Vogel <sv@exept.de>
parents:
1390
diff
changeset
|
968 |
"/ command := command , ' -l'. |
1362 | 969 |
]. |
970 |
command := command , ' -d "', cvsRoot, '" ', cvsCommand. |
|
971 |
||
972 |
Verbose == true ifTrue:[ |
|
973 |
('CVSSourceCodeManager [info]: executing: ' , command , ' [in ' , pathOfDir , ']') infoPrintCR. |
|
974 |
]. |
|
975 |
||
976 |
doPipe ifTrue:[ |
|
977 |
rslt := PipeStream readingFrom:command inDirectory:pathOfDir. |
|
978 |
ok := rslt notNil. |
|
979 |
] ifFalse:[ |
|
980 |
Processor isDispatching ifFalse:[ |
|
981 |
rslt := ok := OperatingSystem executeCommand:command inDirectory:pathOfDir. |
|
982 |
] ifTrue:[ |
|
983 |
p := [ |
|
984 |
rslt := ok := OperatingSystem executeCommand:command inDirectory:pathOfDir. |
|
985 |
] fork. |
|
986 |
||
987 |
(p waitUntilTerminatedWithTimeout:300) ifTrue:[ |
|
988 |
('CVSSourceCodeManager [info]: command timeout: ' , command) errorPrintCR. |
|
989 |
^ false |
|
990 |
]. |
|
991 |
]. |
|
992 |
]. |
|
993 |
||
994 |
ok ifFalse:[ |
|
995 |
('CVSSourceCodeManager [info]: command failed: ' , command) errorPrintCR. |
|
996 |
]. |
|
997 |
^ rslt |
|
998 |
||
999 |
"Modified: / 23.4.1996 / 15:24:00 / stefan" |
|
1000 |
"Created: / 20.5.1998 / 16:06:34 / cg" |
|
1001 |
"Modified: / 19.5.1999 / 10:43:57 / cg" |
|
1002 |
! |
|
1003 |
||
1004 |
getCVSROOTForModule:aModuleName |
|
1005 |
"internal: used when accessing a source repository. |
|
1006 |
Return the CVSROOT which provides the sources for a particular module. |
|
1007 |
If no specific root was defined for that module, return the value of |
|
1008 |
the global (fallBack) CVSRoot. |
|
1009 |
Nil is returned if no repository is available." |
|
1010 |
||
1011 |
CVSModuleRoots isNil ifTrue:[^ CVSRoot]. |
|
1012 |
aModuleName isNil ifTrue:[^ CVSRoot]. |
|
1481 | 1013 |
^ CVSModuleRoots at:aModuleName ifAbsent:CVSRoot. |
1362 | 1014 |
|
1015 |
"Created: / 19.9.1997 / 06:18:07 / cg" |
|
1016 |
"Modified: / 20.5.1998 / 16:30:12 / cg" |
|
1017 |
! |
|
1018 |
||
1019 |
getCVSROOTsPerModule |
|
1020 |
"return a dictionary, which associates CVSRoots to modules" |
|
1021 |
||
1022 |
^ CVSModuleRoots ? #() |
|
1023 |
! |
|
1024 |
||
1025 |
import:moduleDir in:tempdir |
|
1026 |
"import the existing tree in tempdir as repository" |
|
1027 |
||
1028 |
|cmd| |
|
1029 |
||
1030 |
cmd := 'import -m "checkin from stx browser" . initialV initialR'. |
|
1031 |
^ self |
|
1032 |
executeCVSCommand:cmd |
|
1033 |
module:moduleDir |
|
1034 |
inDirectory:tempdir name |
|
1035 |
log:false |
|
1036 |
||
1037 |
||
1038 |
" |
|
1039 |
|f d| |
|
1040 |
f := 'stefan/dummy/fasel'. |
|
1041 |
d := '/tmp/tt' asFilename construct:f. |
|
1042 |
d directory recursiveMakeDirectory. |
|
1043 |
d writeStream close. |
|
1044 |
self import:'stefan' in:'/tmp/tt/stefan' asFilename |
|
1045 |
" |
|
1046 |
||
1047 |
"Created: / 23.7.1999 / 19:19:34 / stefan" |
|
1048 |
"Modified: / 26.7.1999 / 17:46:29 / stefan" |
|
1049 |
"Modified: / 18.1.2000 / 20:21:32 / cg" |
|
1050 |
! |
|
1051 |
||
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1052 |
readRevisionLogEntryFromStream:inStream |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1053 |
"read and parse a single revision info-entry from the cvs log output. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1054 |
Return nil on end. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1055 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1056 |
The returned information is a structure (IdentityDictionary) |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1057 |
filled with: |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1058 |
#revision -> the revision string |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1059 |
#author -> who checked that revision into the repository |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1060 |
#date -> when was it checked in |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1061 |
#state -> the RCS state |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1062 |
#numberOfChangedLines -> the number of changed line w.r.t the previous |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1063 |
#logMessage -> the checkIn log message |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1064 |
" |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1065 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1066 |
|revLine1 revLine2 record s line atEnd| |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1067 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1068 |
atEnd := false. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1069 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1070 |
revLine1 := inStream nextLine. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1071 |
[revLine1 notNil and:[(revLine1 startsWith:'revision ') not]] |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1072 |
whileTrue:[inStream atEnd ifTrue:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1073 |
revLine1 := nil |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1074 |
] ifFalse:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1075 |
revLine1 := inStream nextLine. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1076 |
] |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1077 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1078 |
revLine2 := inStream nextLine. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1079 |
(revLine1 notNil and:[revLine2 notNil]) ifTrue:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1080 |
record := IdentityDictionary new. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1081 |
record at:#revision put:(revLine1 asCollectionOfWords at:2). |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1082 |
"/ decompose date/author/state etc. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1083 |
(revLine2 asCollectionOfSubstringsSeparatedBy:$;) do:[:info | |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1084 |
|subEntry| |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1085 |
subEntry := info withoutSeparators. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1086 |
#('date:' #date |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1087 |
'author:' #author |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1088 |
'state:' #state |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1089 |
'lines:' #numberOfChangedLines |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1090 |
) pairWiseDo:[:word :key | |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1091 |
s := subEntry restAfter:word withoutSeparators:true. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1092 |
s notNil ifTrue:[record at:key put:s.]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1093 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1094 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1095 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1096 |
"first revision does not hav a 'lines:' entry" |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1097 |
(record includesKey:#numberOfChangedLines) ifFalse:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1098 |
record at:#numberOfChangedLines put:'' |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1099 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1100 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1101 |
s := nil. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1102 |
line := inStream nextLine. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1103 |
[atEnd or:[line isNil or:[line startsWith:'--------']]] whileFalse:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1104 |
(line startsWith:'==========') ifTrue:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1105 |
atEnd := true. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1106 |
] ifFalse:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1107 |
(line withoutSpaces = '.') ifTrue:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1108 |
line := '*** empty log message ***' |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1109 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1110 |
s isNil ifTrue:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1111 |
s := line |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1112 |
] ifFalse:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1113 |
s := s , Character cr asString , line. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1114 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1115 |
line := inStream nextLine. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1116 |
] |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1117 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1118 |
record at:#logMessage put:s. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1119 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1120 |
^record. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1121 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1122 |
! |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1123 |
|
1362 | 1124 |
releaseAndRemove:tempdir module:moduleDir outputTo:outputFilename |
1125 |
"cleanup; release tree towards cvs and remove the temporary tree" |
|
1126 |
||
1127 |
|cmd redirect| |
|
1128 |
||
1129 |
outputFilename isNil ifTrue:[ |
|
1130 |
OperatingSystem isMSDOSlike ifTrue:[ |
|
1131 |
redirect := 'NUL' |
|
1132 |
] ifFalse:[ |
|
1133 |
redirect := '/dev/null' |
|
1134 |
] |
|
1135 |
] ifFalse:[ |
|
1136 |
redirect := outputFilename name |
|
1137 |
]. |
|
1138 |
||
1139 |
"/ |
|
1140 |
"/ release it towards cvs |
|
1141 |
"/ |
|
1393
28d04a5111c6
cvs V1.11.14 does not support the 'cvs -l' option any longer and breaks
Stefan Vogel <sv@exept.de>
parents:
1390
diff
changeset
|
1142 |
cmd := 'release > ' , redirect. |
1362 | 1143 |
(self |
1144 |
executeCVSCommand:cmd |
|
1145 |
module:moduleDir |
|
1146 |
inDirectory:tempdir name |
|
1147 |
log:false |
|
1148 |
) ifFalse:[ |
|
1149 |
"/ 'CVSMGR: failed to release: ' errorPrint. cmd errorPrintNL. |
|
1150 |
]. |
|
1151 |
||
1152 |
tempdir recursiveRemove. |
|
1153 |
||
1154 |
"Modified: / 23.4.1996 / 14:29:49 / stefan" |
|
1155 |
"Created: / 19.9.1997 / 06:28:02 / cg" |
|
1156 |
"Modified: / 20.5.1998 / 16:44:07 / cg" |
|
1157 |
"Modified: / 3.9.1999 / 14:51:29 / ps" |
|
1158 |
! |
|
1159 |
||
1160 |
repositoryTopDirectory |
|
1161 |
"return the top of the repository. This handles remote CVS connections |
|
1162 |
as well" |
|
1163 |
||
1164 |
CVSRoot isNil ifTrue:[^ nil]. |
|
1165 |
^ self repositoryTopDirectory:CVSRoot. |
|
1166 |
||
1167 |
" |
|
1168 |
CVSSourceCodeManager repositoryTopDirectory |
|
1169 |
" |
|
1170 |
||
1171 |
"Created: / 25.11.1995 / 18:39:19 / cg" |
|
1172 |
"Modified: / 16.1.1998 / 17:33:31 / stefan" |
|
1173 |
! |
|
1174 |
||
1175 |
repositoryTopDirectory:aString |
|
1176 |
"return the top of the repository (without remote prefix)" |
|
1177 |
||
1178 |
|idx| |
|
1179 |
||
1180 |
idx := aString indexOf:$/. |
|
1181 |
idx <= 1 ifTrue:[ |
|
1182 |
^ aString. |
|
1183 |
]. |
|
1184 |
^ aString copyFrom:idx. |
|
1185 |
||
1186 |
" |
|
1187 |
CVSSourceCodeManager repositoryTopDirectory:':pserver:stefan@ibm.exept.de:/archiv/cvs' |
|
1188 |
CVSSourceCodeManager repositoryTopDirectory:'exept:/files/CVS' |
|
1189 |
CVSSourceCodeManager repositoryTopDirectory:'/archiv/cvs' |
|
1190 |
" |
|
1191 |
||
1192 |
"Modified: / 16.1.1998 / 17:32:03 / stefan" |
|
1193 |
! |
|
1194 |
||
1195 |
revisionStringFromLog:log entry:entry forClass:aClass |
|
1196 |
"given a log entry, extract a revision string" |
|
1197 |
||
1198 |
|oldRev idx special| |
|
1199 |
||
1200 |
oldRev := aClass revisionString. |
|
1201 |
special := ''. |
|
1202 |
||
1203 |
oldRev notNil ifTrue:[ |
|
1204 |
idx := oldRev lastIndexOf:$[. |
|
1205 |
idx ~~ 0 ifTrue:[ |
|
1206 |
idx := oldRev indexOf:$[ startingAt:idx+1. |
|
1207 |
idx ~~ 0 ifTrue:[ |
|
1208 |
special := ' ' , (oldRev copyFrom:idx). |
|
1209 |
] |
|
1210 |
]. |
|
1211 |
]. |
|
1212 |
||
1213 |
^ '$Header: ' , (log at:#container) , |
|
1214 |
' ' , (entry at:#revision) , |
|
1215 |
' ' , (entry at:#date) , |
|
1216 |
' ' , (entry at:#author) , |
|
1217 |
' ' , (entry at:#state) , |
|
1218 |
' $' , |
|
1219 |
special |
|
1220 |
||
1221 |
"Created: 16.9.1996 / 20:24:14 / cg" |
|
1222 |
"Modified: 3.3.1997 / 22:31:51 / cg" |
|
1223 |
! |
|
1224 |
||
1225 |
updatedRevisionStringOf:aClass forRevision:newRevision with:originalVersionString |
|
1226 |
"update a revision string" |
|
1227 |
||
1228 |
|idx leftPart rightPart vsnString newVsn| |
|
1229 |
||
1230 |
"/ search for ,v |
|
1231 |
idx := originalVersionString indexOfSubCollection:'.st,v'. |
|
1232 |
idx == 0 ifTrue:[^ nil]. |
|
1233 |
||
1234 |
leftPart := originalVersionString copyTo:(idx - 1 + 5). |
|
1235 |
rightPart := (originalVersionString copyFrom:(idx + 5)) withoutSpaces. |
|
1236 |
idx := rightPart indexOfSeparator. |
|
1237 |
idx == 0 ifTrue:[^ nil]. |
|
1238 |
||
1239 |
vsnString := rightPart copyTo:idx - 1. |
|
1240 |
rightPart := rightPart copyFrom:idx + 1. |
|
1241 |
||
1242 |
newRevision isNil ifTrue:[ |
|
1243 |
(vsnString endsWith:'m') ifTrue:[ |
|
1244 |
"/ alread a modified class |
|
1245 |
"/ ('already modified: ' , vsnString) printNL. |
|
1246 |
^ nil |
|
1247 |
]. |
|
1248 |
newVsn := vsnString , 'm' |
|
1249 |
] ifFalse:[ |
|
1250 |
newVsn := newRevision |
|
1251 |
]. |
|
1252 |
||
1253 |
^ leftPart , ' ' , newVsn , ' ' , rightPart |
|
1254 |
||
1255 |
"Created: 7.12.1995 / 20:23:38 / cg" |
|
1256 |
"Modified: 16.9.1996 / 20:24:28 / cg" |
|
1464
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
1257 |
! |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
1258 |
|
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
1259 |
use_rlog |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
1260 |
^ OperatingSystem isMSWINDOWSlike not |
1362 | 1261 |
! ! |
1262 |
||
1263 |
!CVSSourceCodeManager class methodsFor:'source code access'! |
|
1264 |
||
1265 |
checkin:containerFilename text:someText directory:packageDir module:moduleDir logMessage:logMessage force:force |
|
1266 |
"enter some (source) code (which is someText) |
|
1267 |
into the source repository. If the force argument is true, no merge is done; |
|
1268 |
instead, the code is checked in as given (Dangerous). |
|
1269 |
Return true if ok, false if not." |
|
1270 |
||
1271 |
|tempdir cmd checkoutName logMsg revision logTmp |
|
1272 |
cmdOut whatHappened s idx changeLog changesAsLogged l |
|
1273 |
newRevision msg answer didMerge |
|
1408 | 1274 |
modulePath time |
1362 | 1275 |
editor checkInRepaired didAccept emphasizedText repairedText out |
1276 |
emSep comment| |
|
1277 |
||
1278 |
revision := self newestRevisionInFile:containerFilename directory:packageDir module:moduleDir. |
|
1279 |
||
1280 |
logMsg := logMessage. |
|
1447
2ac1cf09722b
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
1281 |
(logMsg isEmptyOrNil) ifTrue:[ |
1362 | 1282 |
logMsg := 'checkin from browser'. |
1283 |
]. |
|
1284 |
||
1285 |
cmdOut := Filename newTemporary. |
|
1286 |
cmdOut exists ifTrue:[ |
|
1287 |
cmdOut remove. |
|
1288 |
]. |
|
1289 |
||
1290 |
"/ |
|
1291 |
"/ in CVS, we have to checkout the file first, in order |
|
1292 |
"/ to get up-to-date CVS entries, and also to be able to merge in |
|
1293 |
"/ other users changes. |
|
1294 |
"/ |
|
1295 |
||
1296 |
"/ |
|
1297 |
"/ first, create a temporary work tree |
|
1298 |
"/ |
|
1299 |
tempdir := self createTempDirectory:nil forModule:nil. |
|
1300 |
tempdir isNil ifTrue:[ |
|
1301 |
('CVSSourceCodeManager [error]: no tempDir - cannot checkin ' , containerFilename) errorPrintCR. |
|
1302 |
^ false |
|
1303 |
]. |
|
1304 |
||
1305 |
"/ |
|
1306 |
"/ next, create CVS/Entries and CVS/Repository with version information of current version |
|
1307 |
"/ |
|
1308 |
modulePath := moduleDir , '/' , packageDir. |
|
1309 |
checkoutName := modulePath , '/' , containerFilename. |
|
1310 |
||
1311 |
revision isNil ifTrue:[ |
|
1312 |
"/ a new file ... |
|
1313 |
^ self |
|
1314 |
createContainerForText:someText inModule:moduleDir package:packageDir container:containerFilename |
|
1315 |
]. |
|
1316 |
||
1317 |
"/ |
|
1318 |
"/ correct our current time, so that converting it will give us UTC |
|
1319 |
"/ |
|
1388
6fae02877da5
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
1387
diff
changeset
|
1320 |
time := Timestamp now subtractSeconds:1. |
1362 | 1321 |
time := time addSeconds:(time utcOffset). |
1322 |
||
1323 |
self createEntryFor:checkoutName |
|
1324 |
module:moduleDir |
|
1325 |
in:(tempdir construct:modulePath) |
|
1326 |
revision:revision |
|
1327 |
date:(self cvsTimeString:time) |
|
1328 |
special:'' |
|
1329 |
overwrite:true. |
|
1330 |
||
1331 |
"/ |
|
1332 |
"/ copy-over our current version |
|
1333 |
"/ |
|
1334 |
Stream errorSignal handle:[:ex| |
|
1335 |
tempdir recursiveRemove. |
|
1336 |
'CVSSourceCodeManager [error]: cannot copy-over filedOut class source' errorPrintCR. |
|
1337 |
^ false. |
|
1338 |
] do:[ |
|
1339 |
s := (tempdir construct:checkoutName) writeStream. |
|
1340 |
s nextPutAll:someText. |
|
1341 |
s close. |
|
1342 |
]. |
|
1343 |
||
1344 |
"/ |
|
1345 |
"/ synchronize i.e. merge in any changes |
|
1346 |
"/ |
|
1347 |
self activityNotification:'merging ' , containerFilename , ' with repository version ...'. |
|
1348 |
||
1349 |
cmd := 'update ', containerFilename, ' >', '"' , cmdOut name , '"'. |
|
1350 |
(self |
|
1351 |
executeCVSCommand:cmd |
|
1352 |
module:moduleDir |
|
1353 |
inDirectory:((tempdir construct:moduleDir) constructString:packageDir) |
|
1354 |
) ifFalse:[ |
|
1355 |
force ifFalse:[ |
|
1356 |
'CVSSourceCodeManager [error]: failed to execute: ' errorPrint. cmd errorPrintCR. |
|
1357 |
tempdir recursiveRemove. |
|
1358 |
cmdOut remove. |
|
1359 |
'CVSSourceCodeManager [error]: cannot merge current source with repository version' errorPrintCR. |
|
1360 |
^ false. |
|
1361 |
]. |
|
1362 |
] ifTrue:[ |
|
1363 |
"/ |
|
1364 |
"/ check what happened - the contents of the cmdOut file may be: |
|
1365 |
"/ empty -> nothing changed |
|
1366 |
"/ M xxx -> merged-in changes from other users |
|
1367 |
"/ C xxx -> a conflict occured and the differences have been merged into the source |
|
1368 |
"/ needs special action |
|
1369 |
"/ |
|
1370 |
(cmdOut exists and:[cmdOut fileSize > 0]) ifTrue:[ |
|
1371 |
whatHappened := cmdOut contentsOfEntireFile asString. |
|
1372 |
]. |
|
1373 |
]. |
|
1374 |
cmdOut remove. |
|
1375 |
||
1447
2ac1cf09722b
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
1376 |
(whatHappened isEmptyOrNil) ifTrue:[ |
1362 | 1377 |
"/ |
1378 |
"/ no change |
|
1379 |
"/ |
|
1380 |
"/ Transcript showCR:'no change in ' , containerFilename , ' (repository unchanged)'. |
|
1381 |
force ifFalse:[ |
|
1424
2b531fae15e5
oops - must proceed after catching a UserNotification
Claus Gittinger <cg@exept.de>
parents:
1419
diff
changeset
|
1382 |
self halt. |
1362 | 1383 |
self information:'nothing changed in ' , containerFilename , ' (repository unchanged)'. |
1384 |
]. |
|
1385 |
tempdir recursiveRemove. |
|
1386 |
^ true |
|
1387 |
]. |
|
1388 |
||
1389 |
Verbose == true ifTrue:[ |
|
1390 |
('CVSMGR: result is: ' , whatHappened) infoPrintCR. |
|
1391 |
]. |
|
1392 |
||
1393 |
force ifFalse:[ |
|
1394 |
revision isNil ifTrue:[ |
|
1395 |
changeLog := self revisionLogOfContainer:containerFilename directory:packageDir module:moduleDir. |
|
1396 |
] ifFalse:[ |
|
1397 |
changeLog := self revisionLogOfContainer:containerFilename module:moduleDir package:packageDir fromRevision:(self revisionAfter:revision) toRevision:nil. |
|
1398 |
]. |
|
1399 |
changeLog notNil ifTrue:[ |
|
1400 |
s := WriteStream on:String new. |
|
1401 |
self writeRevisionLogMessagesFrom:changeLog withHeader:false to:s. |
|
1402 |
changesAsLogged := s contents. |
|
1403 |
] ifFalse:[ |
|
1404 |
"/ mhmh - that should not happen |
|
1405 |
changesAsLogged := ''. |
|
1406 |
]. |
|
1407 |
]. |
|
1408 |
||
1409 |
didMerge := false. |
|
1410 |
||
1411 |
"/ |
|
1412 |
"/ cvs above rel10 returns a multiline info ... |
|
1413 |
"/ we have to extract the one line which states what happened. |
|
1414 |
"/ |
|
1415 |
whatHappened := whatHappened asCollectionOfLines asStringCollection. |
|
1416 |
whatHappened := whatHappened select:[:line | |
|
1417 |
(line startsWith:'RCS file') not |
|
1418 |
and:[(line startsWith:'retrieving') not |
|
1419 |
and:[(line startsWith:'Merging') not |
|
1420 |
and:[line size > 0]]] |
|
1421 |
]. |
|
1422 |
whatHappened := whatHappened asString. |
|
1423 |
||
1424 |
(force or:[whatHappened startsWith:'M ']) ifTrue:[ |
|
1425 |
"/ |
|
1426 |
"/ merged in changes |
|
1427 |
"/ |
|
1428 |
(force |
|
1429 |
or:[changeLog isNil |
|
1430 |
or:[(changeLog at:#revisions) isEmpty]]) ifTrue:[ |
|
1431 |
"/ |
|
1432 |
"/ pretty good - nothing has changed in the meanwhile |
|
1433 |
"/ |
|
1434 |
Transcript showCR:'checking in ' , containerFilename , ' ...' |
|
1435 |
] ifFalse:[ |
|
1408 | 1436 |
| mySource mergedSource | |
1437 |
||
1362 | 1438 |
"/ |
1439 |
"/ someone else has changed things in the meanwhile, but there is no conflict |
|
1440 |
"/ and version have been merged. |
|
1441 |
"/ |
|
1442 |
didMerge := true. |
|
1443 |
changesAsLogged := changesAsLogged asCollectionOfLines. |
|
1444 |
||
1445 |
s := WriteStream on:String new. |
|
1446 |
s nextPutAll:someText. |
|
1447 |
mySource := s contents asString. |
|
1448 |
mergedSource := (tempdir construct:checkoutName) readStream contents asString. |
|
1449 |
||
1450 |
mySource = mergedSource ifTrue:[ |
|
1451 |
msg := 'The source of ' , containerFilename , ' has been changed in the meanwhile as listed below. |
|
1452 |
||
1453 |
I have merged your version with the newest repository version, |
|
1454 |
and found no differences between the result and your current version |
|
1455 |
(i.e. your version seemed up-to-date).'. |
|
1456 |
||
1457 |
self checkinTroubleDialog:'Merging versions' |
|
1458 |
message:msg |
|
1459 |
log:changesAsLogged |
|
1460 |
abortable:false |
|
1461 |
option:nil. |
|
1462 |
didMerge := false. |
|
1463 |
] ifFalse:[ |
|
1464 |
msg := 'The source of ' , containerFilename , ' has been changed in the meanwhile as listed below. |
|
1465 |
||
1466 |
If you continue, your new changes (based upon rev. ' , revision printString , ') will be MERGED |
|
1467 |
into the newest revision. This will combine the other version with your changes |
|
1468 |
into a new common revision which may be different from both. |
|
1469 |
Although this is a nice feature, it may fail to create the expected result in certain situations. |
|
1470 |
||
1471 |
You should carefully check the result - by comparing the current version with the |
|
1472 |
most recent version in the repository. If that does not contain an acceptable version, |
|
1473 |
change methods as required and check in again. |
|
1474 |
Be aware, that after that, the actual repository version is different from your current classes, |
|
1475 |
and you should update your class from the repository. |
|
1476 |
||
1477 |
Continue ?'. |
|
1478 |
||
1479 |
answer := self checkinTroubleDialog:'Merging versions' |
|
1480 |
message:msg |
|
1481 |
log:changesAsLogged |
|
1482 |
abortable:true |
|
1483 |
option:'Stop - see first'. |
|
1484 |
answer ~~ true ifTrue:[ |
|
1485 |
answer == #option ifTrue:[ |
|
1486 |
DiffTextView |
|
1487 |
openOn:mySource |
|
1488 |
label:'current version' |
|
1489 |
and:mergedSource |
|
1490 |
label:'merged version'. |
|
1491 |
||
1492 |
]. |
|
1493 |
Transcript showCR:'checkin aborted - (no merge; repository unchanged)'. |
|
1494 |
tempdir recursiveRemove. |
|
1495 |
^ false. |
|
1496 |
]. |
|
1497 |
]. |
|
1498 |
||
1499 |
"/ changesAsLogged := (changesAsLogged asStringCollection collect:[:line | line withTabsExpanded]) asString. |
|
1500 |
"/ msg := 'The source of ' , containerFilename , ' has been changed in the meanwhile as follows: |
|
1501 |
"/' , changesAsLogged , ' |
|
1502 |
"/ |
|
1503 |
"/If you continue, your new changes (based upon rev. ' , revision , ') will be MERGED |
|
1504 |
"/into the newest revision. This will combine the other version with your changes |
|
1505 |
"/into a new common revision which is different from both. |
|
1506 |
"/Although convenient, it may fail to create the expected result in certain situations. |
|
1507 |
"/ |
|
1508 |
"/You should carefully check the result - by comparing the current version with the |
|
1509 |
"/most recent version in the repository. If that does not contain an acceptable version, |
|
1510 |
"/change methods as required and check in again. Be aware, that the actual repository version |
|
1511 |
"/is different from your current classes. |
|
1512 |
"/ |
|
1513 |
"/Continue ?'. |
|
1514 |
"/ (self confirm:msg) ifFalse:[ |
|
1515 |
"/ Transcript showCR:'checkin aborted - (no merge; repository unchanged)'. |
|
1516 |
"/ tempdir recursiveRemove. |
|
1517 |
"/ ^ false. |
|
1518 |
"/ ]. |
|
1519 |
Transcript showCR:'checking in ' , containerFilename , ' (merged other changes) ...' |
|
1520 |
] |
|
1521 |
] ifFalse:[ |
|
1522 |
(whatHappened startsWith:'C ') ifTrue:[ |
|
1523 |
"/ |
|
1524 |
"/ conflict; someone else checked in something in the meanwhile, |
|
1525 |
"/ and there is a conflict between this version and the checked in version. |
|
1526 |
"/ |
|
1527 |
||
1528 |
changesAsLogged := changesAsLogged asCollectionOfLines. |
|
1529 |
||
1530 |
msg := 'The source of ' , containerFilename , ' has been changed in the meanwhile as listed below. |
|
1531 |
||
1532 |
Your new changes (based upon rev. ' , revision printString , ') CONFLICT with those changes. |
|
1533 |
||
1534 |
You should fix things by comparing your class with the most recent repository version |
|
1535 |
and change your methods avoiding conflicts. The checkin again. |
|
1536 |
'. |
|
1537 |
||
1538 |
answer := self checkinTroubleDialog:'Version conflict' |
|
1539 |
message:msg |
|
1540 |
log:changesAsLogged |
|
1541 |
abortable:false |
|
1542 |
option:'show conflicts' |
|
1543 |
option2:'resolve conflicts'. |
|
1544 |
||
1545 |
answer == #option ifTrue:[ |
|
1546 |
"/ |
|
1547 |
"/ show conflicts in a 3-way DiffTextView ... |
|
1548 |
"/ |
|
1549 |
Diff3TextView |
|
1550 |
openOnMergedText:(tempdir construct:checkoutName) readStream contents |
|
1551 |
label:'your version (checkin attempt)' |
|
1552 |
label:'original (base version)' |
|
1553 |
label:'newest repository version'. |
|
1554 |
]. |
|
1555 |
||
1556 |
checkInRepaired := false. |
|
1557 |
answer == #option2 ifTrue:[ |
|
1558 |
"/ |
|
1559 |
"/ allow checkin of repair version |
|
1560 |
"/ this is error prone ... |
|
1561 |
"/ |
|
1562 |
"/ |
|
1563 |
"/ show merged version in an editor ... |
|
1564 |
"/ ... accept will check it in. |
|
1565 |
"/ |
|
1566 |
emphasizedText := (tempdir construct:checkoutName) readStream contents. |
|
1567 |
emSep := (Array with:(#color->Color black) |
|
1568 |
with:(#backgroundColor->Color green)). |
|
1569 |
emphasizedText := Diff3TextView |
|
1570 |
emphasizeMergedDiff3Text:emphasizedText |
|
1571 |
emphasize1:(Array with:(#color->Color white) |
|
1572 |
with:(#backgroundColor->Color blue)) |
|
1573 |
emphasize2:(Array with:(#color->Color white) |
|
1574 |
with:(#backgroundColor->Color red)) |
|
1575 |
emphasizeSep:emSep. |
|
1576 |
||
1577 |
comment := |
|
1578 |
'"/ *************************************************************** |
|
1579 |
"/ This text contains your current versions code (blue) |
|
1580 |
"/ merged with the conflicting code as found in the repository (red) which resulted |
|
1581 |
"/ from some other checkin. |
|
1582 |
"/ Each such conflict is surrounded by green text (like this paragraph). |
|
1583 |
"/ |
|
1584 |
"/ Please have a look at ALL the conflicts and fix things as appropriate. |
|
1585 |
"/ Delete the green lines as a confirmation - I will not checkin the changed text, |
|
1586 |
"/ unless no more green parts are present. This includes this comment at the top. |
|
1587 |
"/ *************************************************************** |
|
1588 |
'. |
|
1589 |
comment := (Text string:comment emphasis:emSep) asStringCollection. |
|
1590 |
emphasizedText := comment , emphasizedText. |
|
1591 |
||
1592 |
didAccept := false. checkInRepaired := true. |
|
1593 |
[didAccept not and:[checkInRepaired]] whileTrue:[ |
|
1594 |
editor := RCSConflictEditTextView |
|
1595 |
setupWith:emphasizedText |
|
1596 |
title:'Resolve conflicts in ' , containerFilename , ', then accept & close to checkin'. |
|
1597 |
||
1598 |
editor acceptAction:[:dummy | |
|
1599 |
repairedText := editor list. |
|
1600 |
didAccept := true. |
|
1601 |
]. |
|
1602 |
didAccept := false. |
|
1603 |
editor topView openModal. |
|
1604 |
||
1605 |
didAccept ifFalse:[ |
|
1606 |
(Dialog confirm:'You did not accept the new text. Edit again ?') |
|
1607 |
ifFalse:[ |
|
1608 |
checkInRepaired := false. |
|
1609 |
] |
|
1610 |
] ifTrue:[ |
|
1611 |
"/ check if all green-stuff (separators) have been removed |
|
1612 |
(repairedText findFirst:[:line | line notNil and:[line notEmpty and:[(line emphasisAt:1) = emSep]]]) ~~ 0 ifTrue:[ |
|
1613 |
self warn:'You have to look at ALL conflicts, and remove ALL green lines as a confirmation !!'. |
|
1614 |
didAccept := false. |
|
1615 |
] |
|
1616 |
]. |
|
1617 |
||
1618 |
]. |
|
1619 |
||
1620 |
checkInRepaired ifTrue:[ |
|
1621 |
[ |
|
1622 |
out := (tempdir construct:checkoutName) writeStream. |
|
1623 |
out nextPutAll:(repairedText asString string). |
|
1624 |
didAccept := true. |
|
1625 |
out close. |
|
1626 |
] on:FileStream openErrorSignal do:[:ex| |
|
1627 |
self warn:'could not write file ' , (tempdir constructString:checkoutName). |
|
1628 |
checkInRepaired := false. |
|
1629 |
]. |
|
1630 |
] |
|
1631 |
]. |
|
1632 |
||
1633 |
checkInRepaired ifTrue:[ |
|
1634 |
Transcript showCR:'checking in ' , containerFilename , ' (manually repaired version) ...' |
|
1635 |
] ifFalse:[ |
|
1636 |
'CVSSourceCodeManager [warning]: cannot (for now) checkin; conflicts found' infoPrintCR. |
|
1637 |
Transcript showCR:'checkin of ' , containerFilename , ' aborted (conflicting changes; repository unchanged)'. |
|
1638 |
tempdir recursiveRemove. |
|
1639 |
^ false. |
|
1640 |
] |
|
1641 |
] ifFalse:[ |
|
1642 |
(whatHappened startsWith:'U ') ifTrue:[ |
|
1643 |
"/ |
|
1644 |
"/ nothing changed here, but the repository already contains |
|
1645 |
"/ a newer version. |
|
1646 |
"/ |
|
1647 |
tempdir recursiveRemove. |
|
1648 |
||
1649 |
self information:'nothing changed in your ''' , containerFilename , '''; |
|
1650 |
but repository already contains a newer version (repository unchanged).'. |
|
1651 |
^ true. |
|
1652 |
] ifFalse:[ |
|
1653 |
"/ |
|
1654 |
"/ unexpected |
|
1655 |
"/ |
|
1656 |
self warn:'unexpected message from CVS: |
|
1657 |
' , whatHappened , ' |
|
1658 |
||
1659 |
No checkin performed.'. |
|
1660 |
Transcript showCR:'*** cannot checkin ' , containerFilename , ' (unexpected CVS response; repository unchanged)'. |
|
1661 |
tempdir recursiveRemove. |
|
1662 |
^ false. |
|
1663 |
] |
|
1664 |
] |
|
1665 |
]. |
|
1666 |
||
1667 |
||
1668 |
"/ |
|
1669 |
"/ now check it in again |
|
1670 |
"/ |
|
1671 |
self activityNotification:'saving ' , containerFilename , ' in repository ...'. |
|
1672 |
||
1673 |
logMsg := logMsg replChar:$" withString:'\"'. |
|
1674 |
||
1675 |
OperatingSystem isUNIXlike ifFalse:[ |
|
1676 |
"/ save the log message into another tempFile ... |
|
1677 |
logTmp := Filename newTemporaryIn:tempdir. |
|
1678 |
s := logTmp writeStream. |
|
1679 |
s nextPutAll:logMsg. |
|
1680 |
s close. |
|
1681 |
||
1682 |
cmd := 'commit -F "', logTmp baseName, '" ', checkoutName, ' >', '"' , cmdOut name , '"'. |
|
1683 |
] ifTrue:[ |
|
1684 |
"/ |
|
1685 |
"/ CVS up to V1.9.14 prints the 'new revision' to stderr, |
|
1686 |
"/ CVS V1.9.16 to stdout. |
|
1687 |
"/ |
|
1688 |
cmd := 'commit -m "', logMsg, '" ', checkoutName, ' >', '"' , cmdOut name , '"' , ' 2>&1'. |
|
1689 |
]. |
|
1690 |
||
1691 |
(self |
|
1692 |
executeCVSCommand:cmd |
|
1693 |
module:moduleDir |
|
1694 |
inDirectory:tempdir name |
|
1695 |
) ifFalse:[ |
|
1696 |
'CVSSourceCodeManager [error]: failed to execute: ' errorPrint. cmd errorPrintCR. |
|
1697 |
||
1698 |
(cmdOut exists and:[cmdOut fileSize > 0]) ifTrue:[ |
|
1699 |
whatHappened := cmdOut contentsOfEntireFile asString. |
|
1700 |
] ifFalse:[ |
|
1701 |
whatHappened := '<< no message >>' |
|
1702 |
]. |
|
1703 |
self warn:'The following problem was reported by cvs: |
|
1704 |
||
1705 |
' , whatHappened , ' |
|
1706 |
||
1707 |
The class has NOT been checked into the repository.'. |
|
1708 |
||
1709 |
('CVSSourceCodeManager [error]: cvs: ' , whatHappened) errorPrintCR. |
|
1710 |
'CVSSourceCodeManager [error]: cannot checkin modified class source' errorPrintCR. |
|
1711 |
logTmp notNil ifTrue:[logTmp remove]. |
|
1712 |
cmdOut remove. |
|
1713 |
tempdir recursiveRemove. |
|
1714 |
^ false. |
|
1715 |
]. |
|
1716 |
logTmp notNil ifTrue:[logTmp remove]. |
|
1717 |
(cmdOut exists and:[cmdOut fileSize > 0]) ifTrue:[ |
|
1718 |
whatHappened := cmdOut contentsOfEntireFile asString. |
|
1719 |
] ifFalse:[ |
|
1720 |
whatHappened := nil |
|
1721 |
]. |
|
1722 |
||
1723 |
tempdir recursiveRemove. |
|
1724 |
cmdOut remove. |
|
1725 |
||
1726 |
"/ |
|
1727 |
"/ fetch the new revision nr as found in the commit commands output |
|
1728 |
"/ |
|
1729 |
||
1447
2ac1cf09722b
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
1730 |
(whatHappened isEmptyOrNil) ifTrue:[ |
1362 | 1731 |
'CVSSourceCodeManager [error]: unexpected empty checkin command output' errorPrintCR. |
1732 |
] ifFalse:[ |
|
1733 |
whatHappened := whatHappened asCollectionOfLines asStringCollection. |
|
1734 |
idx := whatHappened indexOfLineStartingWith:'new revision:'. |
|
1735 |
idx == 0 ifTrue:[ |
|
1736 |
'CVSSourceCodeManager [error]: unexpected checkin command output (no new-revision info)' errorPrintCR. |
|
1737 |
] ifFalse:[ |
|
1738 |
l := whatHappened at:idx. |
|
1739 |
newRevision := (l copyFrom:14 to:(l indexOf:$; startingAt:14)-1) withoutSpaces. |
|
1740 |
] |
|
1741 |
]. |
|
1742 |
^ true |
|
1743 |
! |
|
1744 |
||
1745 |
checkinClass:cls fileName:classFileName directory:packageDir module:moduleDir source:sourceFileName logMessage:logMessage force:forceArg |
|
1746 |
"enter a classes source code (which has been already filed out into sourceFileName) |
|
1747 |
into the source repository. If the force argument is true, no merge is done; |
|
1748 |
instead, the code is checked in as given (Dangerous). |
|
1749 |
Return true if ok, false if not." |
|
1750 |
||
1751 |
|tempdir cmd checkoutName logMsg revision logTmp |
|
1752 |
cmdOut whatHappened s entry idx changeLog changesAsLogged l |
|
1753 |
newRevision newString binRevision className msg answer didMerge |
|
1408 | 1754 |
modulePath time |
1362 | 1755 |
editor checkInRepaired checkInNew didAccept emphasizedText repairedText out |
1756 |
emSep comment force| |
|
1757 |
||
1758 |
force := forceArg. |
|
1759 |
||
1760 |
className := cls name. |
|
1761 |
cls isPrivate ifTrue:[ |
|
1762 |
self error:'refuse to check in private classes.'. |
|
1763 |
]. |
|
1764 |
revision := cls revision. |
|
1765 |
(revision notNil |
|
1766 |
and:[revision endsWith:$m]) |
|
1767 |
ifTrue:[ |
|
1768 |
"/ this class has already been checked in with a merge, |
|
1769 |
"/ but not reloaded from the repository. |
|
1770 |
"/ must use the original revision string. |
|
1771 |
revision := revision copyWithoutLast:1. |
|
1772 |
]. |
|
1773 |
(binRevision := cls binaryRevision) notNil ifTrue:[ |
|
1774 |
revision ~= binRevision ifTrue:[ |
|
1775 |
('CVSSourceCodeManager [info]: class ' , className , ' is based upon ' , binRevision , ' but has revision ' , (revision ? '?')) infoPrintCR |
|
1776 |
] |
|
1777 |
]. |
|
1778 |
||
1779 |
revision isNil ifTrue:[ |
|
1780 |
revision := self newestRevisionOf:cls. |
|
1781 |
revision isNil ifTrue:[ |
|
1782 |
force ifTrue:[ |
|
1783 |
revision := self newestRevisionInFile:classFileName directory:packageDir module:moduleDir. |
|
1784 |
] ifFalse:[ |
|
1785 |
revision := '1.0' |
|
1786 |
] |
|
1787 |
] |
|
1788 |
]. |
|
1789 |
||
1373
65473183582d
Check for unicode in cvs log message (cvs cannot handle this)
Stefan Vogel <sv@exept.de>
parents:
1365
diff
changeset
|
1790 |
logMessage isNil ifTrue:[ |
65473183582d
Check for unicode in cvs log message (cvs cannot handle this)
Stefan Vogel <sv@exept.de>
parents:
1365
diff
changeset
|
1791 |
logMsg := ''. |
65473183582d
Check for unicode in cvs log message (cvs cannot handle this)
Stefan Vogel <sv@exept.de>
parents:
1365
diff
changeset
|
1792 |
] ifFalse:[ |
65473183582d
Check for unicode in cvs log message (cvs cannot handle this)
Stefan Vogel <sv@exept.de>
parents:
1365
diff
changeset
|
1793 |
logMsg := logMessage asSingleByteStringIfPossible. |
65473183582d
Check for unicode in cvs log message (cvs cannot handle this)
Stefan Vogel <sv@exept.de>
parents:
1365
diff
changeset
|
1794 |
logMsg bitsPerCharacter ~~ 8 ifTrue:[ |
65473183582d
Check for unicode in cvs log message (cvs cannot handle this)
Stefan Vogel <sv@exept.de>
parents:
1365
diff
changeset
|
1795 |
'CVSSourceCodeManager [error]: cvs cannot handle unicode in logMessage' errorPrintCR. |
65473183582d
Check for unicode in cvs log message (cvs cannot handle this)
Stefan Vogel <sv@exept.de>
parents:
1365
diff
changeset
|
1796 |
^ false. |
65473183582d
Check for unicode in cvs log message (cvs cannot handle this)
Stefan Vogel <sv@exept.de>
parents:
1365
diff
changeset
|
1797 |
]. |
1362 | 1798 |
]. |
1799 |
||
1800 |
cmdOut := Filename newTemporary. |
|
1801 |
cmdOut exists ifTrue:[ |
|
1802 |
cmdOut remove. |
|
1803 |
]. |
|
1804 |
||
1805 |
"/ |
|
1806 |
"/ in CVS, we have to checkout the file first, in order |
|
1807 |
"/ to get up-to-date CVS entries, and also to be able to merge in |
|
1808 |
"/ other users changes. |
|
1809 |
"/ |
|
1810 |
||
1811 |
"/ |
|
1812 |
"/ first, create a temporary work tree |
|
1813 |
"/ |
|
1814 |
tempdir := self createTempDirectory:nil forModule:nil. |
|
1815 |
tempdir isNil ifTrue:[ |
|
1816 |
('CVSSourceCodeManager [error]: no tempDir - cannot checkin ' , className) errorPrintCR. |
|
1817 |
^ false |
|
1818 |
]. |
|
1819 |
||
1820 |
"/ |
|
1821 |
"/ next, create CVS/Entries and CVS/Repository with version information of current version |
|
1822 |
"/ |
|
1823 |
modulePath := moduleDir , '/' , packageDir. |
|
1824 |
checkoutName := modulePath , '/' , classFileName. |
|
1825 |
||
1826 |
"/ |
|
1827 |
"/ correct our current time, so that converting it will give us UTC |
|
1828 |
"/ |
|
1388
6fae02877da5
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
1387
diff
changeset
|
1829 |
time := Timestamp now subtractSeconds:1. |
1362 | 1830 |
time := time addSeconds:(time utcOffset). |
1831 |
||
1832 |
self createEntryFor:checkoutName |
|
1833 |
module:moduleDir |
|
1834 |
in:(tempdir construct:modulePath) |
|
1835 |
revision:revision |
|
1836 |
date:(self cvsTimeString:time) |
|
1837 |
special:'' |
|
1838 |
overwrite:true. |
|
1839 |
||
1840 |
"/ |
|
1841 |
"/ copy-over our current version |
|
1842 |
"/ |
|
1843 |
Error handle:[:ex| |
|
1844 |
tempdir recursiveRemove. |
|
1845 |
'CVSSourceCodeManager [error]: cannot copy-over filedOut class source' errorPrintCR. |
|
1846 |
^ false. |
|
1847 |
] do:[ |
|
1848 |
sourceFileName asFilename copyTo:(tempdir construct:checkoutName). |
|
1849 |
]. |
|
1850 |
||
1851 |
"/ |
|
1852 |
"/ synchronize i.e. merge in any changes |
|
1853 |
"/ |
|
1854 |
self activityNotification:'merging ' , cls name , ' with repository version ...'. |
|
1855 |
||
1856 |
cmd := 'update ', classFileName, ' >', '"' , cmdOut name , '"'. |
|
1857 |
(self |
|
1858 |
executeCVSCommand:cmd |
|
1859 |
module:moduleDir |
|
1860 |
inDirectory:((tempdir construct:moduleDir) constructString:packageDir) |
|
1861 |
) ifFalse:[ |
|
1862 |
force ifFalse:[ |
|
1863 |
"/ someone fiddled around with repository ? |
|
1864 |
(cls binaryRevision notNil |
|
1865 |
and:[(self checkForExistingContainerInModule:moduleDir package:packageDir container:classFileName) not ]) |
|
1866 |
ifTrue:[ |
|
1867 |
(Dialog confirm:('Someone seems to have removed the source container for ' , cls name , '\\Force new checkin ?') withCRs) |
|
1868 |
ifTrue:[ |
|
1869 |
cls setBinaryRevision:nil. |
|
1373
65473183582d
Check for unicode in cvs log message (cvs cannot handle this)
Stefan Vogel <sv@exept.de>
parents:
1365
diff
changeset
|
1870 |
^ self checkinClass:cls fileName:classFileName directory:packageDir module:moduleDir source:sourceFileName logMessage:logMsg force:force. |
1362 | 1871 |
]. |
1872 |
]. |
|
1873 |
]. |
|
1874 |
force ifFalse:[ |
|
1875 |
'CVSSourceCodeManager [error]: failed to execute: ' errorPrint. cmd errorPrintCR. |
|
1876 |
tempdir recursiveRemove. |
|
1877 |
cmdOut remove. |
|
1878 |
'CVSSourceCodeManager [error]: cannot merge current source with repository version' errorPrintCR. |
|
1879 |
^ false. |
|
1880 |
]. |
|
1881 |
] ifTrue:[ |
|
1882 |
"/ |
|
1883 |
"/ check what happened - the contents of the cmdOut file may be: |
|
1884 |
"/ empty -> nothing changed |
|
1885 |
"/ M xxx -> merged-in changes from other users |
|
1886 |
"/ C xxx -> a conflict occured and the differences have been merged into the source |
|
1887 |
"/ needs special action |
|
1888 |
"/ |
|
1889 |
(cmdOut exists and:[cmdOut fileSize > 0]) ifTrue:[ |
|
1890 |
whatHappened := cmdOut contentsOfEntireFile asString. |
|
1891 |
]. |
|
1892 |
]. |
|
1893 |
cmdOut remove. |
|
1894 |
||
1447
2ac1cf09722b
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
1895 |
(whatHappened isEmptyOrNil) ifTrue:[ |
1362 | 1896 |
"/ |
1897 |
"/ no change |
|
1898 |
"/ |
|
1899 |
"/ Transcript showCR:'no change in ' , className , ' (repository unchanged)'. |
|
1900 |
tempdir recursiveRemove. |
|
1901 |
||
1902 |
force ifFalse:[ |
|
1903 |
"/ (ChangeSet current includesChangeForClass:cls) ifTrue:[ |
|
1904 |
"/ (self confirm:('Nothing changed in %1 (repository unchanged).\\Remove entries from changeSet ?' bindWith:className) withCRs) ifTrue:[ |
|
1905 |
"/ ChangeSet current condenseChangesForClass:cls. |
|
1906 |
"/ ]. |
|
1907 |
"/ ] ifFalse:[ |
|
1425 | 1908 |
"/ self information:('Nothing changed in %1 (repository unchanged)' bindWith:className). |
1362 | 1909 |
"/ ]. |
1910 |
self postCheckInClass:cls. |
|
1911 |
] ifTrue:[ |
|
1912 |
changeLog := self revisionLogOfContainer:classFileName directory:packageDir module:moduleDir. |
|
1913 |
(changeLog isNil or:[(changeLog at:#revisions) size ~~ 1]) ifTrue:[ |
|
1914 |
'CVSSourceCodeManager [error]: failed to update revisionString (no log)' errorPrintCR. |
|
1915 |
cls updateVersionMethodFor:'$' , 'Header' , '$'. "/ concatenated to avoid RCS expansion |
|
1916 |
] ifFalse:[ |
|
1917 |
entry := (changeLog at:#revisions) first. |
|
1918 |
newString := self revisionStringFromLog:changeLog entry:entry forClass:cls. |
|
1919 |
cls updateVersionMethodFor:newString. |
|
1920 |
cls revision ~= newRevision ifTrue:[ |
|
1921 |
'CVSSourceCodeManager [error]: failed to update revisionString' errorPrintCR |
|
1922 |
] |
|
1923 |
] |
|
1924 |
]. |
|
1925 |
||
1926 |
^ true |
|
1927 |
]. |
|
1928 |
||
1929 |
Verbose == true ifTrue:[ |
|
1930 |
('CVSMGR: result is: ' , whatHappened) infoPrintCR. |
|
1931 |
]. |
|
1932 |
||
1933 |
force ifFalse:[ |
|
1934 |
revision isNil ifTrue:[ |
|
1935 |
changeLog := self revisionLogOf:cls. |
|
1936 |
] ifFalse:[ |
|
1937 |
changeLog := self revisionLogOf:cls fromRevision:(self revisionAfter:revision) toRevision:nil. |
|
1938 |
]. |
|
1939 |
changeLog notNil ifTrue:[ |
|
1940 |
s := WriteStream on:String new. |
|
1941 |
self writeRevisionLogMessagesFrom:changeLog withHeader:false to:s. |
|
1942 |
changesAsLogged := s contents. |
|
1943 |
] ifFalse:[ |
|
1944 |
"/ mhmh - that should not happen |
|
1945 |
changesAsLogged := ''. |
|
1946 |
]. |
|
1947 |
]. |
|
1948 |
||
1949 |
didMerge := false. |
|
1950 |
checkInRepaired := checkInNew := false. |
|
1951 |
||
1952 |
"/ |
|
1953 |
"/ cvs above rel10 returns a multiline info ... |
|
1954 |
"/ we have to extract the one line which states what happened. |
|
1955 |
"/ |
|
1956 |
whatHappened := whatHappened asCollectionOfLines asStringCollection. |
|
1957 |
whatHappened := whatHappened select:[:line | |
|
1958 |
(line startsWith:'RCS file') not |
|
1959 |
and:[(line startsWith:'retrieving') not |
|
1960 |
and:[(line startsWith:'Merging') not |
|
1961 |
and:[line size > 0]]] |
|
1962 |
]. |
|
1963 |
whatHappened := whatHappened asString. |
|
1964 |
||
1965 |
(force or:[whatHappened startsWith:'M ']) ifTrue:[ |
|
1966 |
"/ |
|
1967 |
"/ merged in changes |
|
1968 |
"/ |
|
1969 |
(force |
|
1970 |
or:[changeLog isNil |
|
1971 |
or:[(changeLog at:#revisions) isEmpty]]) ifTrue:[ |
|
1972 |
"/ |
|
1973 |
"/ pretty good - nothing has changed in the meanwhile |
|
1974 |
"/ |
|
1975 |
Transcript showCR:'checking in ' , className , ' ...' |
|
1976 |
] ifFalse:[ |
|
1408 | 1977 |
|mySource mergedSource | |
1978 |
||
1362 | 1979 |
"/ |
1980 |
"/ someone else has changed things in the meanwhile, but there is no conflict |
|
1981 |
"/ and version have been merged. |
|
1982 |
"/ |
|
1983 |
didMerge := true. |
|
1984 |
changesAsLogged := changesAsLogged asCollectionOfLines. |
|
1985 |
||
1986 |
s := WriteStream on:String new. |
|
1987 |
cls fileOutOn:s withTimeStamp:false. |
|
1988 |
mySource := s contents asString. |
|
1989 |
mergedSource := (tempdir construct:checkoutName) readStream contents asString. |
|
1990 |
||
1991 |
mySource = mergedSource ifTrue:[ |
|
1992 |
msg := 'The source of ' , className , ' has been changed in the meanwhile as listed below. |
|
1993 |
||
1994 |
I have merged your version with the newest repository version, |
|
1995 |
and found no differences between the result and your current version |
|
1996 |
(i.e. your version seemed up-to-date).'. |
|
1997 |
||
1998 |
self checkinTroubleDialog:'Merging versions' |
|
1999 |
message:msg |
|
2000 |
log:changesAsLogged |
|
2001 |
abortable:false |
|
2002 |
option:nil. |
|
2003 |
didMerge := false. |
|
2004 |
] ifFalse:[ |
|
2005 |
msg := 'The source of ' , className , ' has been changed in the meanwhile as listed below. |
|
2006 |
||
2007 |
If you continue, your new changes (based upon rev. ' , revision printString , ') will be MERGED |
|
2008 |
into the newest revision. This will combine the other version with your changes |
|
2009 |
into a new common revision which may be different from both. |
|
2010 |
Although this is a nice feature, it may fail to create the expected result in certain situations. |
|
2011 |
||
2012 |
You should carefully check the result - by comparing the current version with the |
|
2013 |
most recent version in the repository. If that does not contain an acceptable version, |
|
2014 |
change methods as required and check in again. |
|
2015 |
Be aware, that after that, the actual repository version is different from your current classes, |
|
2016 |
and you should update your class from the repository. |
|
2017 |
||
2018 |
Continue ?'. |
|
2019 |
||
2020 |
answer := self checkinTroubleDialog:'Merging versions' |
|
2021 |
message:msg |
|
2022 |
log:changesAsLogged |
|
2023 |
abortable:true |
|
2024 |
option:'Stop - see first' |
|
2025 |
option2:'Do NOT Merge - Force my Code'. |
|
2026 |
||
2027 |
answer == #option2 ifTrue:[ |
|
2028 |
(Dialog confirm:'Are you certain that you want to suppress a merge and force your code to be checked in ?') |
|
2029 |
ifTrue:[ |
|
2030 |
s := (tempdir construct:checkoutName) writeStream. |
|
2031 |
cls fileOutOn:s withTimeStamp:false. |
|
2032 |
s close. |
|
2033 |
answer := true. |
|
2034 |
] |
|
2035 |
]. |
|
2036 |
||
2037 |
answer ~~ true ifTrue:[ |
|
2038 |
answer == #option ifTrue:[ |
|
2039 |
DiffTextView |
|
2040 |
openOn:mySource |
|
2041 |
label:'current version' |
|
2042 |
and:mergedSource |
|
2043 |
label:'merged version'. |
|
2044 |
||
2045 |
]. |
|
2046 |
Transcript showCR:'checkin aborted - (no merge; repository unchanged)'. |
|
2047 |
tempdir recursiveRemove. |
|
2048 |
^ false. |
|
2049 |
]. |
|
2050 |
]. |
|
2051 |
||
2052 |
"/ changesAsLogged := (changesAsLogged asStringCollection collect:[:line | line withTabsExpanded]) asString. |
|
2053 |
"/ msg := 'The source of ' , className , ' has been changed in the meanwhile as follows: |
|
2054 |
"/' , changesAsLogged , ' |
|
2055 |
"/ |
|
2056 |
"/If you continue, your new changes (based upon rev. ' , revision , ') will be MERGED |
|
2057 |
"/into the newest revision. This will combine the other version with your changes |
|
2058 |
"/into a new common revision which is different from both. |
|
2059 |
"/Although convenient, it may fail to create the expected result in certain situations. |
|
2060 |
"/ |
|
2061 |
"/You should carefully check the result - by comparing the current version with the |
|
2062 |
"/most recent version in the repository. If that does not contain an acceptable version, |
|
2063 |
"/change methods as required and check in again. Be aware, that the actual repository version |
|
2064 |
"/is different from your current classes. |
|
2065 |
"/ |
|
2066 |
"/Continue ?'. |
|
2067 |
"/ (self confirm:msg) ifFalse:[ |
|
2068 |
"/ Transcript showCR:'checkin aborted - (no merge; repository unchanged)'. |
|
2069 |
"/ tempdir recursiveRemove. |
|
2070 |
"/ ^ false. |
|
2071 |
"/ ]. |
|
2072 |
Transcript showCR:'checking in ' , className , ' (merged other changes) ...' |
|
2073 |
] |
|
2074 |
] ifFalse:[ |
|
2075 |
(whatHappened startsWith:'C ') ifTrue:[ |
|
2076 |
"/ |
|
2077 |
"/ conflict; someone else checked in something in the meanwhile, |
|
2078 |
"/ and there is a conflict between this version and the checked in version. |
|
2079 |
"/ |
|
2080 |
||
2081 |
changesAsLogged := changesAsLogged asCollectionOfLines. |
|
2082 |
||
2083 |
msg := 'The source of ' , className , ' has been changed in the meanwhile as listed below. |
|
2084 |
||
2085 |
Your new changes (based upon rev. ' , revision printString , ') CONFLICT with those changes. |
|
2086 |
||
2087 |
You should fix things by comparing your class with the most recent repository version |
|
2088 |
and change your methods avoiding conflicts. The checkin again. |
|
2089 |
'. |
|
2090 |
||
2091 |
answer := self checkinTroubleDialog:'Version conflict' |
|
2092 |
message:msg |
|
2093 |
log:changesAsLogged |
|
2094 |
abortable:false |
|
2095 |
option:'Show conflicts' |
|
2096 |
option2:'Resolve conflicts' |
|
2097 |
option3:'Do NOT Merge - Force my Code'. |
|
2098 |
||
2099 |
answer == #option ifTrue:[ |
|
2100 |
"/ |
|
2101 |
"/ show conflicts in a 3-way DiffTextView ... |
|
2102 |
"/ |
|
2103 |
Diff3TextView |
|
2104 |
openOnMergedText:(tempdir construct:checkoutName) readStream contents |
|
2105 |
label:'your version (checkin attempt)' |
|
2106 |
label:'original (base version)' |
|
2107 |
label:'newest repository version'. |
|
2108 |
]. |
|
2109 |
||
2110 |
answer == #option2 ifTrue:[ |
|
2111 |
"/ |
|
2112 |
"/ allow checkin of repair version |
|
2113 |
"/ this is error prone ... |
|
2114 |
"/ |
|
2115 |
"/ |
|
2116 |
"/ show merged version in an editor ... |
|
2117 |
"/ ... accept will check it in. |
|
2118 |
"/ |
|
2119 |
emphasizedText := (tempdir construct:checkoutName) readStream contents. |
|
2120 |
emSep := (Array with:(#color->Color black) |
|
2121 |
with:(#backgroundColor->Color green)). |
|
2122 |
emphasizedText := Diff3TextView |
|
2123 |
emphasizeMergedDiff3Text:emphasizedText |
|
2124 |
emphasize1:(Array with:(#color->Color white) |
|
2125 |
with:(#backgroundColor->Color blue)) |
|
2126 |
emphasize2:(Array with:(#color->Color white) |
|
2127 |
with:(#backgroundColor->Color red)) |
|
2128 |
emphasizeSep:emSep. |
|
2129 |
||
2130 |
comment := |
|
2131 |
'"/ *************************************************************** |
|
2132 |
"/ This text contains your current versions code (blue) |
|
2133 |
"/ merged with the conflicting code as found in the repository (red) which resulted |
|
2134 |
"/ from some other checkin. |
|
2135 |
"/ Each such conflict is surrounded by green text (like this paragraph). |
|
2136 |
"/ |
|
2137 |
"/ Please have a look at ALL the conflicts and fix things as appropriate. |
|
2138 |
"/ Delete the green lines as a confirmation - I will not checkin the changed text, |
|
2139 |
"/ unless no more green parts are present. This includes this comment at the top. |
|
2140 |
"/ *************************************************************** |
|
2141 |
'. |
|
2142 |
comment := (Text string:comment emphasis:emSep) asStringCollection. |
|
2143 |
emphasizedText := comment , emphasizedText. |
|
2144 |
||
2145 |
didAccept := false. checkInRepaired := true. |
|
2146 |
[didAccept not and:[checkInRepaired]] whileTrue:[ |
|
2147 |
editor := RCSConflictEditTextView |
|
2148 |
setupWith:emphasizedText |
|
2149 |
title:'Resolve conflicts in ' , className , ', then accept & close to checkin'. |
|
2150 |
||
2151 |
editor acceptAction:[:dummy | |
|
2152 |
repairedText := editor list. |
|
2153 |
didAccept := true. |
|
2154 |
]. |
|
2155 |
didAccept := false. |
|
2156 |
editor topView openModal. |
|
2157 |
||
2158 |
didAccept ifFalse:[ |
|
2159 |
(Dialog confirm:'You did not accept the new text. Edit again ?') |
|
2160 |
ifFalse:[ |
|
2161 |
checkInRepaired := false. |
|
2162 |
] |
|
2163 |
] ifTrue:[ |
|
2164 |
"/ check if all green-stuff (separators) have been removed |
|
2165 |
(repairedText findFirst:[:line | line notNil and:[line notEmpty and:[(line emphasisAt:1) = emSep]]]) ~~ 0 ifTrue:[ |
|
2166 |
self warn:'You have to look at ALL conflicts, and remove ALL green lines as a confirmation !!'. |
|
2167 |
didAccept := false. |
|
2168 |
] |
|
2169 |
]. |
|
2170 |
||
2171 |
]. |
|
2172 |
||
2173 |
checkInRepaired ifTrue:[ |
|
2174 |
[ |
|
2175 |
out := (tempdir construct:checkoutName) writeStream. |
|
2176 |
out nextPutAll:(repairedText asString string). |
|
2177 |
didAccept := true. |
|
2178 |
out close. |
|
2179 |
] on:FileStream openErrorSignal do:[:ex| |
|
2180 |
self warn:'could not write file ' , (tempdir constructString:checkoutName). |
|
2181 |
checkInRepaired := false. |
|
2182 |
]. |
|
2183 |
] |
|
2184 |
]. |
|
2185 |
||
2186 |
answer == #option3 ifTrue:[ |
|
2187 |
"/ |
|
2188 |
"/ force checkin of new version |
|
2189 |
"/ |
|
2190 |
"/ |
|
2191 |
"/ show merged version in an editor ... |
|
2192 |
"/ ... accept will check it in. |
|
2193 |
"/ |
|
2194 |
[ |
|
2195 |
out := (tempdir construct:checkoutName) writeStream. |
|
1408 | 2196 |
cls fileOutOn:out withTimeStamp:false. |
2197 |
out close. |
|
1362 | 2198 |
didAccept := true. |
2199 |
checkInNew := checkInRepaired := true. |
|
2200 |
] on:FileStream openErrorSignal do:[:ex| |
|
2201 |
self warn:'could not write file ' , (tempdir constructString:checkoutName). |
|
2202 |
]. |
|
2203 |
]. |
|
2204 |
||
2205 |
checkInRepaired ifTrue:[ |
|
2206 |
checkInNew ifTrue:[ |
|
2207 |
Transcript showCR:'checking in ' , className , ' (force new version)...' |
|
2208 |
] ifFalse:[ |
|
2209 |
Transcript showCR:'checking in ' , className , ' (manually repaired version)...' |
|
2210 |
]. |
|
2211 |
] ifFalse:[ |
|
2212 |
'CVSSourceCodeManager [warning]: cannot (for now) checkin; conflicts found' infoPrintCR. |
|
2213 |
Transcript showCR:'checkin of ' , className , ' aborted (conflicting changes; repository unchanged)'. |
|
2214 |
tempdir recursiveRemove. |
|
2215 |
^ false. |
|
2216 |
] |
|
2217 |
] ifFalse:[ |
|
2218 |
((whatHappened startsWith:'U ') |
|
2219 |
or:[ (whatHappened startsWith:'P ') ]) ifTrue:[ |
|
2220 |
"/ |
|
2221 |
"/ nothing changed here, but the repository already contains |
|
2222 |
"/ a newer version. |
|
2223 |
"/ |
|
2224 |
tempdir recursiveRemove. |
|
2225 |
||
2226 |
self information:'nothing changed in your ''' , className , '''; |
|
2227 |
but repository already contains a newer version (repository unchanged).'. |
|
2228 |
^ true. |
|
2229 |
] ifFalse:[ |
|
2230 |
"/ |
|
2231 |
"/ unexpected |
|
2232 |
"/ |
|
2233 |
self warn:'unexpected message from CVS: |
|
2234 |
' , whatHappened , ' |
|
2235 |
||
2236 |
No checkin performed.'. |
|
2237 |
Transcript showCR:'*** cannot checkin ' , className , ' (unexpected CVS response; repository unchanged)'. |
|
2238 |
tempdir recursiveRemove. |
|
2239 |
^ false. |
|
2240 |
] |
|
2241 |
] |
|
2242 |
]. |
|
2243 |
||
2244 |
||
2245 |
"/ |
|
2246 |
"/ now check it in again |
|
2247 |
"/ |
|
2248 |
self activityNotification:'saving ' , cls name , ' in repository ...'. |
|
2249 |
||
2250 |
logMsg := logMsg replChar:$" withString:'\"'. |
|
2251 |
||
2252 |
OperatingSystem isUNIXlike ifFalse:[ |
|
2253 |
"/ save the log message into another tempFile ... |
|
2254 |
logTmp := Filename newTemporaryIn:tempdir. |
|
2255 |
s := logTmp writeStream. |
|
2256 |
s nextPutAll:logMsg. |
|
2257 |
s close. |
|
2258 |
||
2259 |
cmd := 'commit -F "', logTmp baseName, '" ', checkoutName, ' >', '"' , cmdOut name , '"'. |
|
2260 |
] ifTrue:[ |
|
2261 |
"/ |
|
2262 |
"/ CVS up to V1.9.14 prints the 'new revision' to stderr, |
|
2263 |
"/ CVS V1.9.16 to stdout. |
|
2264 |
"/ |
|
2265 |
cmd := 'commit -m "', logMsg, '" ', checkoutName, ' >', '"', cmdOut name, '"' , ' 2>&1'. |
|
2266 |
]. |
|
2267 |
(self |
|
2268 |
executeCVSCommand:cmd |
|
2269 |
module:moduleDir |
|
2270 |
inDirectory:tempdir name |
|
2271 |
) ifFalse:[ |
|
2272 |
'CVSSourceCodeManager [error]: failed to execute: ' errorPrint. cmd errorPrintCR. |
|
2273 |
||
2274 |
(cmdOut exists and:[cmdOut fileSize > 0]) ifTrue:[ |
|
2275 |
whatHappened := cmdOut contentsOfEntireFile asString. |
|
2276 |
] ifFalse:[ |
|
2277 |
whatHappened := '<< no message >>' |
|
2278 |
]. |
|
2279 |
self warn:'The following problem was reported by cvs: |
|
2280 |
||
2281 |
' , whatHappened , ' |
|
2282 |
||
2283 |
The class has NOT been checked into the repository.'. |
|
2284 |
||
2285 |
'CVSSourceCodeManager [error]: cannot checkin modified class source' errorPrintCR. |
|
2286 |
logTmp notNil ifTrue:[logTmp remove]. |
|
2287 |
cmdOut remove. |
|
2288 |
tempdir recursiveRemove. |
|
2289 |
^ false. |
|
2290 |
]. |
|
2291 |
logTmp notNil ifTrue:[logTmp remove]. |
|
2292 |
(cmdOut exists and:[cmdOut fileSize > 0]) ifTrue:[ |
|
2293 |
whatHappened := cmdOut contentsOfEntireFile asString. |
|
2294 |
] ifFalse:[ |
|
2295 |
whatHappened := nil |
|
2296 |
]. |
|
2297 |
||
2298 |
tempdir recursiveRemove. |
|
2299 |
cmdOut remove. |
|
2300 |
||
2301 |
"/ |
|
2302 |
"/ fetch the new revision nr as found in the commit commands output |
|
2303 |
"/ |
|
2304 |
||
1447
2ac1cf09722b
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
2305 |
(whatHappened isEmptyOrNil) ifTrue:[ |
1362 | 2306 |
'CVSSourceCodeManager [error]: unexpected empty checkin command output' errorPrintCR. |
2307 |
] ifFalse:[ |
|
2308 |
whatHappened := whatHappened asCollectionOfLines asStringCollection. |
|
2309 |
idx := whatHappened indexOfLineStartingWith:'new revision:'. |
|
2310 |
idx == 0 ifTrue:[ |
|
2311 |
'CVSSourceCodeManager [error]: unexpected checkin command output (no new-revision info)' errorPrintCR. |
|
2312 |
] ifFalse:[ |
|
2313 |
l := whatHappened at:idx. |
|
2314 |
newRevision := (l copyFrom:14 to:(l indexOf:$; startingAt:14)-1) withoutSpaces. |
|
2315 |
] |
|
2316 |
]. |
|
2317 |
||
2318 |
"/ |
|
2319 |
"/ if there was no merge (i.e. the current version has been checked in unchanged): |
|
2320 |
"/ patch the classes revisionInfo (but keep binaryRevision unchanged) to the new revision |
|
2321 |
"/ this makes everyone here believe, that the incore version of the class is based upon |
|
2322 |
"/ the newly checked in version. |
|
2323 |
"/ (however, the binaryRevision must remain as it is - we will need it to fetch the sourceCode |
|
2324 |
"/ correctly for all unchanged methodss) |
|
2325 |
"/ |
|
2326 |
"/ if there was a merge (i.e. the repository now contains a merge of the current and some |
|
2327 |
"/ other version): |
|
2328 |
"/ patch the classes revisionInfo (again, keep the binaryRevision) to the old revision |
|
2329 |
"/ and add a 'm' (for merged). |
|
2330 |
"/ If we later checkin again, the new checkin will be again based on the current revision |
|
2331 |
"/ |
|
2332 |
newRevision notNil ifTrue:[ |
|
2333 |
didMerge ifFalse:[ |
|
2334 |
self activityNotification:'fetch new revision number of ', cls name. |
|
2335 |
||
2336 |
changeLog := self revisionLogOf:cls fromRevision:newRevision toRevision:newRevision. |
|
2337 |
(changeLog isNil or:[(changeLog at:#revisions) size ~~ 1]) ifTrue:[ |
|
2338 |
force ifTrue:[ |
|
2339 |
changeLog := self revisionLogOfContainer:classFileName directory:packageDir module:moduleDir. |
|
2340 |
]. |
|
2341 |
]. |
|
2342 |
(changeLog isNil or:[(changeLog at:#revisions) size ~~ 1]) ifTrue:[ |
|
2343 |
'CVSSourceCodeManager [error]: failed to update revisionString (no log)' errorPrintCR. |
|
2344 |
cls updateVersionMethodFor:'$' , 'Header' , '$'. "/ concatenated to avoid RCS expansion |
|
2345 |
] ifFalse:[ |
|
2346 |
entry := (changeLog at:#revisions) first. |
|
2347 |
newString := self revisionStringFromLog:changeLog entry:entry forClass:cls. |
|
2348 |
cls updateVersionMethodFor:newString. |
|
2349 |
cls revision ~= newRevision ifTrue:[ |
|
2350 |
'CVSSourceCodeManager [error]: failed to update revisionString' errorPrintCR |
|
2351 |
] |
|
2352 |
] |
|
2353 |
] ifTrue:[ |
|
2354 |
newString := self updatedRevisionStringOf:cls forRevision:nil with:cls revisionString. |
|
2355 |
cls updateVersionMethodFor:newString. |
|
2356 |
]. |
|
2357 |
]. |
|
2358 |
||
2359 |
Class addChangeRecordForClassCheckIn:cls. |
|
2360 |
self postCheckInClass:cls. |
|
2361 |
||
2362 |
(checkInRepaired and:[checkInNew not]) ifTrue:[ |
|
2363 |
self information:'Now the repository contains a merge between your and the other changes. |
|
2364 |
However, the class in your image does NOT contain the other changes. |
|
2365 |
This will lead to more conflict-resolving whenever you check this class in again later, |
|
2366 |
unless you load the newest (merged) version of the class from the repository. |
|
2367 |
||
2368 |
I recommend doing this as soon as possible via your browsers checkout function.' |
|
2369 |
]. |
|
2370 |
^ true |
|
2371 |
||
2372 |
" |
|
2373 |
SourceCodeManager checkinClass:Array logMessage:'testing only' |
|
2374 |
" |
|
2375 |
||
2376 |
"Created: / 11.9.1996 / 16:16:11 / cg" |
|
2377 |
"Modified: / 26.2.1998 / 17:34:16 / stefan" |
|
2378 |
"Modified: / 5.11.2001 / 14:35:38 / cg" |
|
130 | 2379 |
! |
2380 |
||
1362 | 2381 |
checkoutModule:aModule package:aPackage andDo:aBlock |
2382 |
"check out everything from a package into a temporary directory. |
|
2383 |
Then evaluate aBlock, passing the name of that temp-directory. |
|
2384 |
Afterwards, the tempDir is removed. |
|
2385 |
Return true, if OK, false if any error occurred." |
|
2386 |
||
2387 |
|cvsRoot packageDir tempdir cmdOut cmd dirName| |
|
2388 |
||
2389 |
cvsRoot := self getCVSROOTForModule:aModule. |
|
2390 |
cvsRoot isNil ifTrue:[^ false ]. |
|
2391 |
||
2392 |
aPackage notNil ifTrue:[ |
|
2393 |
dirName := aModule , '/' , aPackage. |
|
2394 |
] ifFalse:[ |
|
2395 |
dirName := aModule. |
|
2396 |
]. |
|
2397 |
||
2398 |
self activityNotification:'checking out everything in ' , dirName , ' ...'. |
|
2399 |
||
2400 |
tempdir := self createTempDirectory:nil forModule:nil. |
|
2401 |
tempdir isNil ifTrue:[ |
|
2402 |
('CVSSourceCodeManager [error]: no tempDir - cannot checkout') errorPrintCR. |
|
2403 |
^ false |
|
2404 |
]. |
|
2405 |
||
1393
28d04a5111c6
cvs V1.11.14 does not support the 'cvs -l' option any longer and breaks
Stefan Vogel <sv@exept.de>
parents:
1390
diff
changeset
|
2406 |
cmd := 'checkout ', dirName. |
1362 | 2407 |
OperatingSystem isUNIXlike ifTrue:[ |
2408 |
"/ can redirect output |
|
2409 |
cmdOut := Filename newTemporary. |
|
2410 |
cmdOut exists ifTrue:[ |
|
2411 |
cmdOut remove. |
|
2412 |
]. |
|
2413 |
cmd := cmd , ' > ', '"' , cmdOut name, '"' . |
|
2414 |
]. |
|
2415 |
||
2416 |
(self |
|
2417 |
executeCVSCommand:cmd |
|
2418 |
module:aModule |
|
2419 |
inDirectory:tempdir name |
|
2420 |
) ifFalse:[ |
|
2421 |
'CVSSourceCodeManager [error]: failed to execute: ' errorPrint. cmd errorPrintCR. |
|
2422 |
cmdOut notNil ifTrue:[cmdOut remove]. |
|
2423 |
tempdir recursiveRemove. |
|
2424 |
^ false |
|
2425 |
]. |
|
2426 |
||
2427 |
cmdOut notNil ifTrue:[ |
|
2428 |
"/ listOfFiles := cmdOut contents. |
|
2429 |
cmdOut remove |
|
2430 |
]. |
|
2431 |
||
2432 |
packageDir := (tempdir construct:dirName). |
|
2433 |
(packageDir isDirectory) ifFalse:[ |
|
2434 |
'CVSSourceCodeManager [error]: checkout failed (no dir)' errorPrintCR. |
|
2435 |
tempdir recursiveRemove. |
|
2436 |
^ false |
|
2437 |
]. |
|
2438 |
||
2439 |
"/ now, invoke the block ... |
|
2440 |
[ |
|
2441 |
aBlock value:packageDir |
|
2442 |
] ensure:[ |
|
2443 |
tempdir recursiveRemove. |
|
2444 |
]. |
|
2445 |
||
2446 |
^ true |
|
2447 |
||
2448 |
"Modified: / 28.4.1999 / 12:21:10 / cg" |
|
2449 |
! |
|
2450 |
||
1405 | 2451 |
streamForClass:cls fileName:fileName revision:revision directory:packageDir module:moduleDir cache:cacheItArg |
1362 | 2452 |
"extract a source file and return an open readStream on it, |
2453 |
or nil if the extract failed. If revision is nil or (#newest), take |
|
2454 |
the latest; otherwise, a specific revisions source is extracted. |
|
2455 |
The cls argument is currently ignored, but may be used in future versions, |
|
2456 |
to validate the correct container against the class. |
|
2457 |
To check out a file (i.e. not a classes file), leave it nil." |
|
2458 |
||
2459 |
|dir cachedSourceFilename cachedFile cmd fullName revisionArg stream |
|
2460 |
checkoutName checkoutNameLocal fullTempName fullCachedName tempdir cmdOut |
|
1405 | 2461 |
classFileName cvsRoot tempFile revMsg cacheIt| |
2462 |
||
2463 |
cacheIt := cacheItArg. |
|
1362 | 2464 |
|
2465 |
(DisabledModules notNil and:[DisabledModules includes:moduleDir]) ifTrue:[ |
|
2466 |
Transcript showCR:'cvs access for module ' , moduleDir , ' has been disabled (due to previous failure)'. |
|
2467 |
Transcript showCR:'reenable using the launchers source&debugger dialog'. |
|
2468 |
||
2469 |
^ nil |
|
2470 |
]. |
|
2471 |
||
2472 |
cvsRoot := self getCVSROOTForModule:moduleDir. |
|
2473 |
cvsRoot isNil ifTrue:[^ nil]. |
|
2474 |
||
2475 |
"/ if not already existing, create a cache directory |
|
2476 |
"/ where we deposit sources. |
|
2477 |
"/ this is used as a cache for further requests, since |
|
2478 |
"/ accessing the repository may be slow. |
|
2479 |
"/ (if cvs uses a remote connection via ppp, for example) |
|
2480 |
"/ |
|
2481 |
||
2482 |
revision ~~ #newest ifTrue:[ |
|
2483 |
(dir := self sourceCacheDirectory) isNil ifTrue:[ |
|
2484 |
'CVSSourceCodeManager [warning]: no source cache directory' errorPrintCR. |
|
2485 |
] |
|
2486 |
]. |
|
2487 |
||
2488 |
classFileName := fileName. |
|
2489 |
(classFileName endsWith:',v') ifTrue:[ |
|
2490 |
classFileName := classFileName copyWithoutLast:2. |
|
2491 |
]. |
|
2492 |
(classFileName endsWith:'.st') ifTrue:[ |
|
2493 |
cls notNil ifTrue:[ |
|
2494 |
classFileName := classFileName copyWithoutLast:3. |
|
2495 |
] |
|
2496 |
]. |
|
2497 |
fullName := moduleDir , '/' , packageDir , '/' , classFileName. |
|
2498 |
cls notNil ifTrue:[ |
|
2499 |
fullName := fullName , '.st'. |
|
2500 |
]. |
|
2501 |
||
2502 |
(revision isNil or:[revision == #newest]) ifTrue:[ |
|
2503 |
cachedSourceFilename := classFileName. |
|
2504 |
] ifFalse:[ |
|
2505 |
cachedSourceFilename := classFileName , '_' , revision. |
|
2506 |
]. |
|
2507 |
||
2508 |
dir notNil ifTrue:[ |
|
2509 |
cachedFile := dir construct:cachedSourceFilename. |
|
2510 |
cachedFile exists ifTrue:[ |
|
2511 |
"/ cachedFile fileSize < 10 ifTrue:[ |
|
2512 |
"/ ('CVSSourceCodeManager [warning]: existing: ', cachedFile name , ' seems corrupted.') errorPrintCR. |
|
2513 |
"/ cachedFile remove |
|
2514 |
"/ ] ifFalse:[ |
|
2515 |
"/ ('CVSSourceCodeManager [info]: found existing: ', cachedFile name) infoPrintCR. |
|
2516 |
^ cachedFile readStream |
|
2517 |
"/ ] |
|
2518 |
]. |
|
2519 |
]. |
|
2520 |
||
2521 |
"/ |
|
2522 |
"/ first, create a temporary work tree |
|
2523 |
"/ Do not make module and package directories, their existence cause cvs checkout to fail in server mode |
|
2524 |
"/ |
|
2525 |
tempdir := self createTempDirectory:nil forModule:nil. |
|
2526 |
tempdir isNil ifTrue:[ |
|
2527 |
('CVSSourceCodeManager [error]: no tempDir - cannot checkout ' , classFileName) errorPrintCR. |
|
2528 |
^ nil |
|
2529 |
]. |
|
2530 |
||
2531 |
"/ tempdir := Filename newTemporaryIn:nil. |
|
2532 |
"/ tempdir exists ifTrue:[ |
|
2533 |
"/ tempdir recursiveRemove. |
|
2534 |
"/ ]. |
|
2535 |
"/ tempdir makeDirectory. |
|
2536 |
"/ dir := tempdir construct:moduleDir. |
|
2537 |
"/ dir makeDirectory. |
|
2538 |
"/ dir := dir construct:packageDir. |
|
2539 |
"/ dir recursiveMakeDirectory. |
|
2540 |
"/ dir exists ifFalse:[ |
|
2541 |
"/ tempdir recursiveRemove. |
|
2542 |
"/ 'CVSMGR: cannot create temporary directory' infoPrintCR. |
|
2543 |
"/ ^ nil. |
|
2544 |
"/ ]. |
|
2545 |
||
2546 |
"/ |
|
2547 |
"/ check it out there |
|
2548 |
"/ |
|
2549 |
checkoutName := fullName. |
|
2550 |
||
2551 |
checkoutNameLocal := (moduleDir asFilename construct:packageDir) constructString:(fullName asFilename baseName). |
|
2552 |
||
2553 |
(revision isNil or:[revision == #newest]) ifTrue:[ |
|
2554 |
cachedSourceFilename := classFileName. |
|
2555 |
revisionArg := ''. |
|
2556 |
revMsg := ''. |
|
2557 |
] ifFalse:[ |
|
2558 |
cachedSourceFilename := classFileName , '_' , revision. |
|
2559 |
revisionArg := ' -r ' , revision. |
|
2560 |
revMsg := ' (' , revision , ')'. |
|
2561 |
]. |
|
2562 |
||
2563 |
self activityNotification:'checking out source ' , checkoutName , revMsg. |
|
2564 |
OperatingSystem isUNIXlike ifTrue:[ |
|
2565 |
"/ can redirect output |
|
2566 |
cmdOut := Filename newTemporary. |
|
2567 |
cmdOut exists ifTrue:[ |
|
2568 |
cmdOut remove. |
|
2569 |
]. |
|
1393
28d04a5111c6
cvs V1.11.14 does not support the 'cvs -l' option any longer and breaks
Stefan Vogel <sv@exept.de>
parents:
1390
diff
changeset
|
2570 |
cmd := 'checkout' , revisionArg , ' ', checkoutName , ' > ' , '"' , cmdOut name, '"' . |
1362 | 2571 |
] ifFalse:[ |
1393
28d04a5111c6
cvs V1.11.14 does not support the 'cvs -l' option any longer and breaks
Stefan Vogel <sv@exept.de>
parents:
1390
diff
changeset
|
2572 |
cmd := 'checkout' , revisionArg , ' ', checkoutName. |
1362 | 2573 |
]. |
2574 |
||
2575 |
(self |
|
2576 |
executeCVSCommand:cmd |
|
2577 |
module:moduleDir |
|
2578 |
inDirectory:tempdir name |
|
2579 |
) ifFalse:[ |
|
2580 |
'CVSSourceCodeManager [error]: failed to execute: ' errorPrint. cmd errorPrintCR. |
|
2581 |
cmdOut notNil ifTrue:[cmdOut remove]. |
|
2582 |
tempdir recursiveRemove. |
|
2583 |
('CVSSourceCodeManager [error]: cannot checkout ' , checkoutName) errorPrintCR. |
|
1477
bea2ad3479eb
no longer automatically disable a CVS module !
Claus Gittinger <cg@exept.de>
parents:
1465
diff
changeset
|
2584 |
|
bea2ad3479eb
no longer automatically disable a CVS module !
Claus Gittinger <cg@exept.de>
parents:
1465
diff
changeset
|
2585 |
false ifTrue:[ |
1362 | 2586 |
"/ see if there is CVS access at all ... |
2587 |
(self checkForExistingModule:moduleDir) ifFalse:[ |
|
2588 |
"/ disable |
|
2589 |
DisabledModules isNil ifTrue:[ |
|
2590 |
DisabledModules := Set new. |
|
2591 |
]. |
|
2592 |
DisabledModules add:moduleDir. |
|
2593 |
('CVSSourceCodeManager [warning]: disabled repository access for module ' , moduleDir) errorPrintCR. |
|
2594 |
]. |
|
1477
bea2ad3479eb
no longer automatically disable a CVS module !
Claus Gittinger <cg@exept.de>
parents:
1465
diff
changeset
|
2595 |
]. |
1362 | 2596 |
^ nil. |
2597 |
]. |
|
2598 |
||
2599 |
cmdOut notNil ifTrue:[cmdOut remove]. |
|
2600 |
fullTempName := tempdir construct:checkoutNameLocal. |
|
1405 | 2601 |
CacheDirectoryName isNil ifTrue:[ |
2602 |
cacheIt := false |
|
2603 |
] ifFalse:[ |
|
2604 |
fullCachedName := CacheDirectoryName asFilename constructString:cachedSourceFilename. |
|
2605 |
]. |
|
1362 | 2606 |
fullTempName exists ifFalse:[ |
2607 |
('CVSSourceCodeManager [error]: failed to checkout ', fullTempName pathName, ' (file does not exist after cvs co)') errorPrintCR. |
|
2608 |
tempdir recursiveRemove. |
|
2609 |
^ nil |
|
2610 |
]. |
|
2611 |
||
2612 |
(cacheIt |
|
2613 |
and:[cachedFile notNil |
|
2614 |
and:[fullTempName exists]]) |
|
2615 |
ifTrue:[ |
|
2616 |
(OperatingSystem errorSignal catch:[ |
|
2617 |
fullTempName moveTo:fullCachedName |
|
2618 |
]) ifTrue:[ |
|
2619 |
('CVSSourceCodeManager [error]: failed to rename ', fullTempName pathName, ' to ', cachedSourceFilename) errorPrintCR. |
|
2620 |
tempdir recursiveRemove. |
|
2621 |
^ nil |
|
2622 |
]. |
|
2623 |
fullCachedName asFilename exists ifTrue:[ |
|
2624 |
stream := fullCachedName asFilename readStream. |
|
2625 |
]. |
|
2626 |
] ifFalse:[ |
|
2627 |
OperatingSystem isUNIXlike ifFalse:[ |
|
2628 |
"/ cannot remove files which are still open ... |
|
2629 |
"/ sigh - need a delete-on-close flag in FileStream. |
|
2630 |
"/ |
|
2631 |
tempFile := Filename newTemporary. |
|
2632 |
fullTempName copyTo:tempFile. |
|
2633 |
stream := tempFile readStream. |
|
2634 |
stream notNil ifTrue:[ |
|
2635 |
stream removeOnClose:true. |
|
2636 |
]. |
|
2637 |
] ifTrue:[ |
|
2638 |
stream := fullTempName readStream. |
|
2639 |
] |
|
2640 |
]. |
|
2641 |
||
2642 |
self releaseAndRemove:tempdir module:moduleDir outputTo:nil. |
|
2643 |
^ stream |
|
2644 |
||
2645 |
"Created: / 4.11.1995 / 19:46:20 / cg" |
|
2646 |
"Modified: / 20.8.1997 / 16:37:11 / stefan" |
|
2647 |
"Modified: / 23.8.2001 / 12:28:59 / cg" |
|
2648 |
! ! |
|
2649 |
||
2650 |
!CVSSourceCodeManager class methodsFor:'source code administration'! |
|
2651 |
||
2652 |
checkForExistingContainerInModule:moduleDir package:packageDir container:fileName |
|
2653 |
"check for a container to exist" |
|
2654 |
||
2655 |
|fullName ret cvsRoot cmd tempDir| |
|
2656 |
||
2657 |
||
2658 |
fullName := moduleDir , '/' , packageDir , '/' , fileName. |
|
2659 |
||
2660 |
RemoteCVS ifFalse:[ |
|
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
2661 |
cvsRoot := self getCVSROOTForModule:moduleDir. |
1362 | 2662 |
cvsRoot asFilename exists ifTrue:[ |
2663 |
"/ |
|
2664 |
"/ with local CVS - simply check if that file exists |
|
2665 |
"/ |
|
2666 |
(fullName endsWith:',v') ifFalse:[ |
|
2667 |
fullName := fullName , ',v'. |
|
2668 |
]. |
|
2669 |
^ (cvsRoot , '/' , fullName) asFilename exists. |
|
2670 |
]. |
|
2671 |
]. |
|
2672 |
||
2673 |
tempDir := self createTempDirectory:nil forModule:nil. |
|
2674 |
||
2675 |
"With remote CVS, do a no-op rtag command, which doesn't |
|
2676 |
need a working directory, but reports missing files" |
|
2677 |
||
2678 |
(fullName endsWith:',v') ifTrue:[ |
|
2679 |
fullName := fullName copyWithoutLast:2. |
|
2680 |
]. |
|
2681 |
||
2682 |
cmd := '-n rtag -l -F dummy '. |
|
1390
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
2683 |
[ |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
2684 |
|errorStream| |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
2685 |
errorStream := '' writeStream. |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
2686 |
|
1362 | 2687 |
ret := self |
2688 |
executeCVSCommand:cmd , fullName |
|
2689 |
module:moduleDir |
|
2690 |
"/ cg; cannot do it in current dir, in case it contains a CVS subDirectory, |
|
2691 |
"/ with a different CVSRoot in its CVS/Root file ... |
|
2692 |
"/ cvs would complain then. |
|
2693 |
inDirectory:(tempDir pathName) |
|
1390
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
2694 |
log:false |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
2695 |
errorTo:errorStream. |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
2696 |
|
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
2697 |
"cannot check for exit status starting at cvs 1.11.5, because an exit status 0 |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
2698 |
is returned even if the file does not exist" |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
2699 |
|
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
2700 |
"But: if there is any output, the command failed and the container does not exist" |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
2701 |
ret := errorStream size == 0. |
1362 | 2702 |
] ensure:[ |
2703 |
tempDir recursiveRemove. |
|
2704 |
]. |
|
2705 |
^ ret |
|
2706 |
||
2707 |
" |
|
2708 |
CVSSourceCodeManager |
|
2709 |
checkForExistingContainerInModule:'stx' |
|
2710 |
package:'libbasic' |
|
2711 |
container:'Integer.st' |
|
2712 |
||
2713 |
CVSSourceCodeManager |
|
2714 |
checkForExistingContainerInModule:'stx' |
|
2715 |
package:'libtool' |
|
2716 |
container:'AboutBox.st' |
|
2717 |
||
2718 |
CVSSourceCodeManager |
|
2719 |
checkForExistingContainerInModule:'stx' |
|
2720 |
package:'libtool' |
|
2721 |
container:'AboutBox.st,v' |
|
2722 |
||
2723 |
CVSSourceCodeManager |
|
2724 |
checkForExistingContainerInModule:'stx' |
|
2725 |
package:'libtool' |
|
2726 |
container:'FooBar.st' |
|
2727 |
||
2728 |
CVSSourceCodeManager |
|
2729 |
checkForExistingContainerInModule:'DPU' |
|
2730 |
package:'test' |
|
2731 |
container:'marks' |
|
2732 |
" |
|
2733 |
||
2734 |
"Created: / 9.12.1995 / 19:13:37 / cg" |
|
2735 |
"Modified: / 1.3.1999 / 19:32:55 / cg" |
|
2736 |
"Modified: / 23.7.1999 / 17:36:58 / stefan" |
|
2737 |
! |
|
2738 |
||
2739 |
checkForExistingModule:moduleDir |
|
2740 |
"check for a module to exist" |
|
2741 |
||
2742 |
|ret cvsRoot cmd tempDir| |
|
2743 |
||
2744 |
self activityNotification:'checking for existing module ' , moduleDir. |
|
2745 |
||
2746 |
cvsRoot := self getCVSROOTForModule:moduleDir. |
|
2747 |
cvsRoot isNil ifTrue:[^ false]. |
|
2748 |
||
2749 |
RemoteCVS ifFalse:[ |
|
2750 |
cvsRoot asFilename exists ifTrue:[ |
|
2751 |
"/ |
|
2752 |
"/ with local CVS - simply check if that directory exists |
|
2753 |
"/ |
|
2754 |
^ (cvsRoot , '/' , moduleDir) asFilename isDirectory. |
|
2755 |
] |
|
2756 |
]. |
|
2757 |
||
2758 |
tempDir := self createTempDirectory:nil forModule:nil. |
|
2759 |
||
2760 |
"With remote CVS, do a no-op rtag command, which doesn't |
|
2761 |
need a working directory, but reports missing files" |
|
2762 |
||
2763 |
cmd := '-n rtag -l dummy '. |
|
2764 |
[ |
|
2765 |
ret := self |
|
2766 |
executeCVSCommand:cmd , moduleDir |
|
2767 |
module:moduleDir |
|
2768 |
"/ cg; cannot do it in current dir, in case it contains a CVS subDirectory, |
|
2769 |
"/ with a different CVSRoot in its CVS/Root file ... |
|
2770 |
"/ cvs would complain then. |
|
2771 |
inDirectory:(tempDir pathName) |
|
2772 |
log:false. |
|
2773 |
] ensure:[ |
|
2774 |
tempDir recursiveRemove. |
|
2775 |
]. |
|
2776 |
^ ret |
|
2777 |
||
2778 |
" |
|
2779 |
CVSSourceCodeManager checkForExistingModule:'stx' |
|
2780 |
CVSSourceCodeManager checkForExistingModule:'DPU' |
|
2781 |
CVSSourceCodeManager checkForExistingModule:'cg' |
|
2782 |
CVSSourceCodeManager checkForExistingModule:'aeg' |
|
2783 |
CVSSourceCodeManager checkForExistingModule:'foo' |
|
2784 |
" |
|
2785 |
||
2786 |
"Created: / 9.12.1995 / 19:13:37 / cg" |
|
2787 |
"Modified: / 1.3.1999 / 19:32:59 / cg" |
|
2788 |
"Modified: / 23.7.1999 / 17:38:59 / stefan" |
|
2789 |
! |
|
2790 |
||
2791 |
checkForExistingModule:moduleDir package:packageDir |
|
2792 |
"check for a package to exist" |
|
2793 |
||
2794 |
|ret cvsRoot cmd tempDir fullName | |
|
2795 |
||
2796 |
self activityNotification:'checking for existing package ' , packageDir. |
|
2797 |
||
1365 | 2798 |
cvsRoot := self getCVSROOTForModule:moduleDir. |
2799 |
cvsRoot isNil ifTrue:[^ false]. |
|
2800 |
||
1362 | 2801 |
fullName := moduleDir , '/' , packageDir. |
2802 |
||
2803 |
RemoteCVS ifFalse:[ |
|
2804 |
cvsRoot asFilename exists ifTrue:[ |
|
2805 |
"/ |
|
2806 |
"/ with local CVS - simply check if that directory exists |
|
2807 |
"/ |
|
2808 |
^ (cvsRoot , '/' , fullName) asFilename isDirectory. |
|
2809 |
]. |
|
2810 |
]. |
|
2811 |
||
2812 |
tempDir := self createTempDirectory:nil forModule:nil. |
|
2813 |
||
2814 |
"With remote CVS, do a no-op rtag command, which doesn't |
|
2815 |
need a working directory, but reports missing files" |
|
2816 |
||
2817 |
cmd := '-n rtag -l -F dummy '. |
|
2818 |
[ |
|
2819 |
ret := self |
|
2820 |
executeCVSCommand:cmd, fullName |
|
2821 |
module:moduleDir |
|
2822 |
"/ cg; cannot do it in current dir, in case it contains a CVS subDirectory, |
|
2823 |
"/ with a different CVSRoot in its CVS/Root file ... |
|
2824 |
"/ cvs would complain then. |
|
2825 |
inDirectory:(tempDir pathName) |
|
2826 |
log:false. |
|
2827 |
||
2828 |
] ensure:[ |
|
2829 |
tempDir recursiveRemove. |
|
2830 |
]. |
|
2831 |
^ ret |
|
2832 |
||
2833 |
" |
|
2834 |
CVSSourceCodeManager checkForExistingModule:'stx' package:'libbasic' |
|
2835 |
CVSSourceCodeManager checkForExistingModule:'aeg' package:'libProgram' |
|
2836 |
CVSSourceCodeManager checkForExistingModule:'foo' package:'libbasic' |
|
2837 |
CVSSourceCodeManager checkForExistingModule:'foo' package:'bar' |
|
2838 |
CVSSourceCodeManager checkForExistingModule:'cg' package:'private' |
|
2839 |
" |
|
2840 |
||
2841 |
"Created: / 9.12.1995 / 19:13:37 / cg" |
|
2842 |
"Modified: / 1.3.1999 / 19:33:04 / cg" |
|
2843 |
"Modified: / 23.7.1999 / 17:39:21 / stefan" |
|
2844 |
! |
|
2845 |
||
2846 |
createContainerFor:aClass inModule:moduleDir package:packageDir container:fileName |
|
2847 |
"create a container - this does an initial checkin |
|
2848 |
(i.e. cvs add & cvs commit)" |
|
2849 |
||
2850 |
|fullName tempdir checkoutName cmdOut cmd tempFile idx aStream whatHappened l newRevision |
|
2851 |
changeLog entry newString startIdx endIdx checkInDir logTmp s| |
|
2852 |
||
2853 |
||
2854 |
cmdOut := Filename newTemporary. |
|
2855 |
cmdOut exists ifTrue:[ |
|
2856 |
cmdOut remove. |
|
2857 |
]. |
|
2858 |
||
2859 |
fullName := moduleDir , '/' , packageDir , '/' , fileName. |
|
2860 |
checkoutName := moduleDir , '/' , packageDir. |
|
2861 |
||
2862 |
"/ |
|
2863 |
"/ first, check out everything there - this creates the CVS helpfiles |
|
2864 |
"/ required later. |
|
2865 |
"/ |
|
2866 |
||
2867 |
self activityNotification:'checking for directory ' , checkoutName. |
|
2868 |
tempdir := self createLocalDirectory:packageDir inModule:moduleDir. |
|
2869 |
tempdir isNil ifTrue:[ |
|
2870 |
('CVSSourceCodeManager [error]: cannot checkout ' , checkoutName) errorPrintCR. |
|
2871 |
^ false. |
|
2872 |
]. |
|
2873 |
||
2874 |
"/ |
|
2875 |
"/ create the source there |
|
2876 |
"/ |
|
2877 |
tempFile := (tempdir construct:checkoutName) construct:fileName. |
|
2878 |
[ |
|
2879 |
aStream := tempFile writeStream. |
|
2880 |
] on:FileStream openErrorSignal do:[:ex| |
|
2881 |
('CVSSourceCodeManager [error]: temporary fileout failed -> ', tempFile name) errorPrintCR. |
|
2882 |
tempdir recursiveRemove. |
|
2883 |
^ false |
|
2884 |
]. |
|
2885 |
||
2886 |
Class fileOutErrorSignal handle:[:ex | |
|
2887 |
'CVSSourceCodeManager [error]: fileout failed' errorPrintCR. |
|
2888 |
aStream close. |
|
2889 |
tempdir recursiveRemove. |
|
2890 |
^ false |
|
2891 |
] do:[ |
|
2892 |
aClass fileOutOn:aStream withTimeStamp:false. |
|
2893 |
]. |
|
2894 |
aStream close. |
|
2895 |
||
2896 |
tempFile exists ifFalse:[ |
|
2897 |
'CVSSourceCodeManager [error]: temporary fileout failed' errorPrintCR. |
|
2898 |
tempdir recursiveRemove. |
|
2899 |
^ false |
|
2900 |
]. |
|
2901 |
||
2902 |
"/ |
|
2903 |
"/ and add it to the repository |
|
2904 |
"/ |
|
2905 |
self activityNotification:'adding ' , fileName. |
|
2906 |
||
2907 |
OperatingSystem isUNIXlike ifTrue:[ |
|
2908 |
checkInDir := tempdir constructString:checkoutName. |
|
2909 |
] ifFalse:[ |
|
2910 |
OperatingSystem isMSDOSlike ifTrue:[ |
|
2911 |
checkInDir := tempdir constructString:(checkoutName copyReplaceAll:$/ with:$\). |
|
2912 |
] ifFalse:[ |
|
2913 |
self error:'VMS case not yet implemented'. "/ add code for VMS ... |
|
2914 |
] |
|
2915 |
]. |
|
2916 |
cmd := 'add ' , fileName , ' > ', '"' , cmdOut name, '"'. |
|
2917 |
(self |
|
2918 |
executeCVSCommand:cmd |
|
2919 |
module:moduleDir |
|
2920 |
inDirectory:checkInDir |
|
2921 |
) ifFalse:[ |
|
2922 |
'CVSSourceCodeManager [error]: failed to execute: ' errorPrint. cmd errorPrintCR. |
|
2923 |
||
2924 |
cmdOut remove. |
|
2925 |
tempdir recursiveRemove. |
|
2926 |
('CVSSourceCodeManager [error]: cannot checkout ' , checkoutName) errorPrintCR. |
|
2927 |
^ false. |
|
2928 |
]. |
|
2929 |
cmdOut remove. |
|
2930 |
||
2931 |
"/ |
|
2932 |
"/ commit |
|
2933 |
"/ |
|
2934 |
self activityNotification:'committing ' , fileName. |
|
2935 |
||
2936 |
OperatingSystem isUNIXlike ifFalse:[ |
|
2937 |
"/ save the log message into another tempFile ... |
|
2938 |
logTmp := Filename newTemporaryIn:checkInDir. |
|
2939 |
s := logTmp writeStream. |
|
2940 |
s nextPutAll:'initial checkin'. |
|
2941 |
s close. |
|
2942 |
||
2943 |
cmd := 'commit -F "', logTmp baseName, '" ', fileName, ' > ', '"', cmdOut name, '"'. |
|
2944 |
] ifTrue:[ |
|
2945 |
"/ |
|
2946 |
"/ CVS up to V1.9.14 prints the 'new revision' to stderr, |
|
2947 |
"/ CVS V1.9.16 to stdout. |
|
2948 |
"/ |
|
2949 |
cmd := 'commit -m "initial checkin" ' , fileName , ' > ', '"' , cmdOut name, '"', ' 2>&1'. |
|
2950 |
]. |
|
2951 |
||
2952 |
(self |
|
2953 |
executeCVSCommand:cmd |
|
2954 |
module:moduleDir |
|
2955 |
inDirectory:checkInDir "tempdir name" |
|
2956 |
) ifFalse:[ |
|
2957 |
Verbose == true ifTrue:[ |
|
2958 |
'CVSMGR: failed to execute: ' infoPrint. cmd infoPrintCR. |
|
2959 |
]. |
|
2960 |
cmdOut fileSize > 0 ifTrue:[ |
|
2961 |
whatHappened := cmdOut contentsOfEntireFile asString. |
|
2962 |
] ifFalse:[ |
|
2963 |
whatHappened := '<< no message >>' |
|
2964 |
]. |
|
2965 |
self warn:'The following problem was reported by cvs: |
|
2966 |
||
2967 |
' , whatHappened , ' |
|
2968 |
||
2969 |
The class has NOT been checked into the repository.'. |
|
2970 |
||
2971 |
'CVSSourceCodeManager [error]: cannot checkin modified class source' errorPrintCR. |
|
2972 |
cmdOut remove. |
|
2973 |
tempdir recursiveRemove. |
|
2974 |
^ false. |
|
2975 |
]. |
|
2976 |
whatHappened := cmdOut contentsOfEntireFile asString. |
|
2977 |
cmdOut remove. |
|
2978 |
||
2979 |
"/ |
|
2980 |
"/ release it towards cvs |
|
2981 |
"/ |
|
2982 |
self releaseAndRemove:tempdir module:moduleDir outputTo:nil. |
|
2983 |
||
2984 |
"/ |
|
2985 |
"/ good - its in the CVS repository; now, we need the updated RCS header |
|
2986 |
"/ |
|
1447
2ac1cf09722b
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
2987 |
(whatHappened isEmptyOrNil) ifTrue:[ |
1362 | 2988 |
'CVSSourceCodeManager [warning]: unexpected empty commit command output' errorPrintCR. |
2989 |
"/ TODO: scan the file for $Header ... |
|
2990 |
"/ and extract the revision manually |
|
2991 |
||
2992 |
] ifFalse:[ |
|
2993 |
whatHappened := whatHappened asCollectionOfLines asStringCollection. |
|
2994 |
idx := whatHappened indexOfLineStartingWith:'initial revision:'. |
|
2995 |
idx ~~ 0 ifTrue:[ |
|
2996 |
startIdx := 18 |
|
2997 |
] ifFalse:[ |
|
2998 |
idx := whatHappened indexOfLineStartingWith:'new revision:'. |
|
2999 |
idx ~~ 0 ifTrue:[ |
|
3000 |
'CVSSourceCodeManager [warning]: container existed before' errorPrintCR. |
|
3001 |
startIdx := 14. |
|
3002 |
] ifFalse:[ |
|
3003 |
'CVSSourceCodeManager [warning]: unexpected commit command output (no new-revision info)' errorPrintCR. |
|
3004 |
] |
|
3005 |
]. |
|
3006 |
idx ~~ 0 ifTrue:[ |
|
3007 |
l := whatHappened at:idx. |
|
3008 |
endIdx := (l indexOf:$; startingAt:startIdx) - 1. |
|
3009 |
endIdx < 0 ifTrue:[ |
|
3010 |
endIdx := l size |
|
3011 |
]. |
|
3012 |
newRevision := (l copyFrom:startIdx to:endIdx) withoutSpaces. |
|
3013 |
(Number fromString:newRevision onError:nil) isNil ifTrue:[ |
|
3014 |
newRevision := '1.1' |
|
3015 |
] |
|
3016 |
] |
|
3017 |
]. |
|
3018 |
||
3019 |
Transcript showCR:'created new sourceContainer for ' , aClass name , '.'. |
|
3020 |
||
3021 |
"/ |
|
3022 |
"/ patch the classes revisionInfo (but keep binaryRevision unchanged) |
|
3023 |
"/ this makes everyone here believe, that the incore version of the class is based upon |
|
3024 |
"/ the newly checked in version. |
|
3025 |
"/ (however, the binaryRevision must remain as it is - we will need it to fetch the sourceCode |
|
3026 |
"/ correctly for all unchanged methodss) |
|
3027 |
"/ |
|
3028 |
||
3029 |
newRevision notNil ifTrue:[ |
|
3030 |
changeLog := self |
|
3031 |
revisionLogOf:aClass |
|
3032 |
fromRevision:newRevision |
|
3033 |
toRevision:newRevision |
|
3034 |
fileName:fileName |
|
3035 |
directory:packageDir |
|
3036 |
module:moduleDir. |
|
3037 |
||
3038 |
(changeLog isNil or:[(changeLog at:#revisions) size ~~ 1]) ifTrue:[ |
|
3039 |
'CVSSourceCodeManager [error]: failed to update revisionString (no log)' errorPrintCR |
|
3040 |
] ifFalse:[ |
|
3041 |
entry := (changeLog at:#revisions) first. |
|
3042 |
newString := self revisionStringFromLog:changeLog entry:entry forClass:aClass. |
|
3043 |
aClass updateVersionMethodFor:newString. |
|
3044 |
('CVSSourceCodeManager [info]: updated revisionString to:',newString) infoPrintCR |
|
3045 |
] |
|
3046 |
]. |
|
3047 |
||
3048 |
tempdir recursiveRemove. |
|
3049 |
||
3050 |
Class addChangeRecordForClassCheckIn:aClass. |
|
3051 |
self postCheckInClass:aClass. |
|
3052 |
^ true |
|
3053 |
||
3054 |
"Created: / 9.12.1995 / 19:13:37 / cg" |
|
3055 |
"Modified: / 23.7.1999 / 19:47:59 / stefan" |
|
3056 |
"Modified: / 5.11.2001 / 14:22:56 / cg" |
|
3057 |
! |
|
3058 |
||
3059 |
createContainerForText:someText inModule:moduleDir package:packageDir container:fileName |
|
3060 |
"create a container - this does an initial checkin |
|
3061 |
(i.e. cvs add & cvs commit)" |
|
3062 |
||
3063 |
|fullName tempdir checkoutName cmdOut cmd tempFile idx aStream whatHappened l newRevision |
|
3064 |
startIdx endIdx checkInDir logTmp s| |
|
3065 |
||
3066 |
cmdOut := Filename newTemporary. |
|
3067 |
cmdOut exists ifTrue:[ |
|
3068 |
cmdOut remove. |
|
3069 |
]. |
|
3070 |
||
3071 |
fullName := moduleDir , '/' , packageDir , '/' , fileName. |
|
3072 |
checkoutName := moduleDir , '/' , packageDir. |
|
3073 |
||
3074 |
"/ |
|
3075 |
"/ first, check out everything there - this creates the CVS helpfiles |
|
3076 |
"/ required later. |
|
3077 |
"/ |
|
3078 |
||
3079 |
self activityNotification:'checking for directory ' , checkoutName. |
|
3080 |
tempdir := self createLocalDirectory:packageDir inModule:moduleDir. |
|
3081 |
tempdir isNil ifTrue:[ |
|
3082 |
('CVSSourceCodeManager [error]: cannot checkout ' , checkoutName) errorPrintCR. |
|
3083 |
^ false. |
|
3084 |
]. |
|
3085 |
||
3086 |
[ |
|
3087 |
"/ |
|
3088 |
"/ create the source there |
|
3089 |
"/ |
|
3090 |
tempFile := (tempdir construct:checkoutName) construct:fileName. |
|
3091 |
[ |
|
3092 |
aStream := tempFile writeStream. |
|
3093 |
] on:FileStream openErrorSignal do:[:ex| |
|
3094 |
('CVSSourceCodeManager [error]: temporary fileout failed -> ', tempFile name) errorPrintCR. |
|
3095 |
^ false |
|
3096 |
]. |
|
3097 |
||
3098 |
aStream nextPutAll:someText. |
|
3099 |
aStream close. |
|
3100 |
||
3101 |
tempFile exists ifFalse:[ |
|
3102 |
'CVSSourceCodeManager [error]: temporary fileout failed' errorPrintCR. |
|
3103 |
^ false |
|
3104 |
]. |
|
3105 |
||
3106 |
"/ |
|
3107 |
"/ and add it to the repository |
|
3108 |
"/ |
|
3109 |
self activityNotification:'adding ' , fileName. |
|
3110 |
||
3111 |
OperatingSystem isUNIXlike ifTrue:[ |
|
3112 |
checkInDir := tempdir constructString:checkoutName. |
|
3113 |
] ifFalse:[ |
|
3114 |
OperatingSystem isMSDOSlike ifTrue:[ |
|
3115 |
checkInDir := tempdir constructString:(checkoutName copyReplaceAll:$/ with:$\). |
|
3116 |
] ifFalse:[ |
|
3117 |
self error:'VMS case not yet implemented'. "/ add code for VMS ... |
|
3118 |
] |
|
3119 |
]. |
|
3120 |
cmd := 'add ' , fileName , ' > ', '"' , cmdOut name, '"'. |
|
3121 |
(self |
|
3122 |
executeCVSCommand:cmd |
|
3123 |
module:moduleDir |
|
3124 |
inDirectory:checkInDir |
|
3125 |
) ifFalse:[ |
|
3126 |
'CVSSourceCodeManager [error]: failed to execute: ' errorPrint. cmd errorPrintCR. |
|
3127 |
||
3128 |
cmdOut remove. |
|
3129 |
('CVSSourceCodeManager [error]: cannot checkout ' , checkoutName) errorPrintCR. |
|
3130 |
^ false. |
|
3131 |
]. |
|
3132 |
cmdOut remove. |
|
3133 |
||
3134 |
"/ |
|
3135 |
"/ commit |
|
3136 |
"/ |
|
3137 |
self activityNotification:'committing ' , fileName. |
|
3138 |
||
3139 |
OperatingSystem isUNIXlike ifFalse:[ |
|
3140 |
"/ save the log message into another tempFile ... |
|
3141 |
logTmp := Filename newTemporaryIn:checkInDir. |
|
3142 |
s := logTmp writeStream. |
|
3143 |
s nextPutAll:'initial checkin'. |
|
3144 |
s close. |
|
3145 |
||
3146 |
cmd := 'commit -F "', logTmp baseName, '" ', fileName, ' >', '"', cmdOut name, '"'. |
|
3147 |
] ifTrue:[ |
|
3148 |
"/ |
|
3149 |
"/ CVS up to V1.9.14 prints the 'new revision' to stderr, |
|
3150 |
"/ CVS V1.9.16 to stdout. |
|
3151 |
"/ |
|
3152 |
cmd := 'commit -m "initial checkin" ' , fileName , ' > ', '"' , cmdOut name, '"', ' 2>&1'. |
|
3153 |
]. |
|
3154 |
||
3155 |
(self |
|
3156 |
executeCVSCommand:cmd |
|
3157 |
module:moduleDir |
|
3158 |
inDirectory:checkInDir "tempdir name" |
|
3159 |
) ifFalse:[ |
|
3160 |
Verbose == true ifTrue:[ |
|
3161 |
'CVSMGR: failed to execute: ' infoPrint. cmd infoPrintCR. |
|
3162 |
]. |
|
3163 |
cmdOut fileSize > 0 ifTrue:[ |
|
3164 |
whatHappened := cmdOut contentsOfEntireFile asString. |
|
3165 |
] ifFalse:[ |
|
3166 |
whatHappened := '<< no message >>' |
|
3167 |
]. |
|
3168 |
self warn:'The following problem was reported by cvs: |
|
3169 |
||
3170 |
' , whatHappened , ' |
|
3171 |
||
3172 |
The class has NOT been checked into the repository.'. |
|
3173 |
||
3174 |
'CVSSourceCodeManager [error]: cannot checkin modified class source' errorPrintCR. |
|
3175 |
cmdOut remove. |
|
3176 |
^ false. |
|
3177 |
]. |
|
3178 |
whatHappened := cmdOut contentsOfEntireFile asString. |
|
3179 |
cmdOut remove. |
|
3180 |
||
3181 |
"/ |
|
3182 |
"/ release it towards cvs |
|
3183 |
"/ |
|
3184 |
self releaseAndRemove:tempdir module:moduleDir outputTo:nil. |
|
3185 |
||
3186 |
"/ |
|
3187 |
"/ good - its in the CVS repository; now, we need the updated RCS header |
|
3188 |
"/ |
|
1447
2ac1cf09722b
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
3189 |
(whatHappened isEmptyOrNil) ifTrue:[ |
1362 | 3190 |
'CVSSourceCodeManager [warning]: unexpected empty commit command output' errorPrintCR. |
3191 |
"/ TODO: scan the file for $Header ... |
|
3192 |
"/ and extract the revision manually |
|
3193 |
||
3194 |
] ifFalse:[ |
|
3195 |
whatHappened := whatHappened asCollectionOfLines asStringCollection. |
|
3196 |
idx := whatHappened indexOfLineStartingWith:'initial revision:'. |
|
3197 |
idx ~~ 0 ifTrue:[ |
|
3198 |
startIdx := 18 |
|
3199 |
] ifFalse:[ |
|
3200 |
idx := whatHappened indexOfLineStartingWith:'new revision:'. |
|
3201 |
idx ~~ 0 ifTrue:[ |
|
3202 |
'CVSSourceCodeManager [warning]: container existed before' errorPrintCR. |
|
3203 |
startIdx := 14. |
|
3204 |
] ifFalse:[ |
|
3205 |
'CVSSourceCodeManager [warning]: unexpected commit command output (no new-revision info)' errorPrintCR. |
|
3206 |
] |
|
3207 |
]. |
|
3208 |
idx ~~ 0 ifTrue:[ |
|
3209 |
l := whatHappened at:idx. |
|
3210 |
endIdx := (l indexOf:$; startingAt:startIdx) - 1. |
|
3211 |
endIdx < 0 ifTrue:[ |
|
3212 |
endIdx := l size |
|
3213 |
]. |
|
3214 |
newRevision := (l copyFrom:startIdx to:endIdx) withoutSpaces. |
|
3215 |
(Number fromString:newRevision onError:nil) isNil ifTrue:[ |
|
3216 |
newRevision := '1.1' |
|
3217 |
] |
|
3218 |
] |
|
3219 |
]. |
|
3220 |
||
3221 |
Transcript showCR:'created new sourceContainer for ' , fileName , '.'. |
|
3222 |
] ensure:[ |
|
3223 |
tempdir recursiveRemove. |
|
3224 |
]. |
|
3225 |
^ true |
|
3226 |
! |
|
3227 |
||
3228 |
createModule:moduleName |
|
3229 |
"create a module directory" |
|
3230 |
||
3231 |
|tempdir moduleDir cmdOut cmd| |
|
3232 |
||
3233 |
"/ |
|
3234 |
"/ first, create a temporary work tree |
|
3235 |
"/ |
|
3236 |
tempdir := self createTempDirectory:nil forModule:moduleName. |
|
3237 |
tempdir isNil ifTrue:[ |
|
3238 |
('CVSSourceCodeManager [error]: no tempDir - cannot create moduleDirectory') errorPrintCR. |
|
3239 |
^ false |
|
3240 |
]. |
|
3241 |
||
3242 |
cmdOut := Filename newTemporary. |
|
3243 |
cmdOut exists ifTrue:[ |
|
3244 |
cmdOut remove. |
|
3245 |
]. |
|
3246 |
||
3247 |
"/ |
|
3248 |
"/ create the module directory |
|
3249 |
"/ |
|
3250 |
moduleDir := tempdir construct:moduleName. |
|
3251 |
moduleDir exists ifFalse:[ |
|
3252 |
'CVSSourceCodeManager [error]: failed to create: ' errorPrint. moduleDir name errorPrintCR. |
|
3253 |
tempdir recursiveRemove. |
|
3254 |
^ false. |
|
3255 |
]. |
|
3256 |
||
3257 |
"/ |
|
3258 |
"/ then import it into CVS |
|
3259 |
"/ |
|
3260 |
||
3261 |
cmd := 'import -m "created from browser" ' , moduleName , ' initialV initialR > ' , cmdOut name. |
|
3262 |
(self |
|
3263 |
executeCVSCommand:cmd |
|
3264 |
module:moduleName |
|
3265 |
inDirectory:tempdir name |
|
3266 |
) ifFalse:[ |
|
3267 |
'CVSSourceCodeManager [error]: failed to execute: ' errorPrint. cmd errorPrintCR. |
|
3268 |
||
3269 |
cmdOut remove. |
|
3270 |
tempdir recursiveRemove. |
|
3271 |
^ false. |
|
3272 |
]. |
|
3273 |
||
3274 |
'CVSSourceCodeManager [info]: created new module: ' infoPrint. moduleName infoPrintCR. |
|
3275 |
tempdir recursiveRemove. |
|
3276 |
cmdOut remove. |
|
3277 |
^ true |
|
3278 |
||
3279 |
"Created: / 9.12.1995 / 19:53:51 / cg" |
|
3280 |
"Modified: / 7.1.1998 / 14:18:57 / stefan" |
|
3281 |
"Modified: / 6.6.1998 / 16:15:34 / cg" |
|
3282 |
! |
|
3283 |
||
3284 |
createModule:moduleDirName package:packageDirName |
|
3285 |
"create a package directory" |
|
3286 |
||
3287 |
|tempdir cmdOut cmd packageDir moduleDir relativePath idx parentPackage| |
|
3288 |
||
3289 |
"/ any parent package required ? |
|
3290 |
idx := packageDirName lastIndexOf:$/. |
|
3291 |
idx ~~ 0 ifTrue:[ |
|
3292 |
parentPackage := packageDirName copyTo:idx-1. |
|
3293 |
(self checkForExistingModule:moduleDirName package:parentPackage) ifFalse:[ |
|
3294 |
(self createModule:moduleDirName package:parentPackage) ifFalse:[ |
|
3295 |
^ false. |
|
3296 |
]. |
|
3297 |
]. |
|
3298 |
]. |
|
3299 |
||
3300 |
(moduleDirName asFilename components includes:'core') ifTrue:[ |
|
3301 |
('CVSSourceCodeManager [error]: cvs does not allow for a module to be named ''core'' - cannot create moduleDirectory') errorPrintCR. |
|
3302 |
^ false |
|
3303 |
]. |
|
3304 |
||
3305 |
"/ |
|
3306 |
"/ first, create a temporary work tree |
|
3307 |
"/ |
|
3308 |
tempdir := self createTempDirectory:packageDirName forModule:moduleDirName. |
|
3309 |
tempdir isNil ifTrue:[ |
|
3310 |
('CVSSourceCodeManager [error]: no tempDir - cannot create moduleDirectory') errorPrintCR. |
|
3311 |
^ false |
|
3312 |
]. |
|
3313 |
||
3314 |
cmdOut := Filename newTemporary. |
|
3315 |
cmdOut exists ifTrue:[ |
|
3316 |
cmdOut remove. |
|
3317 |
]. |
|
3318 |
||
3319 |
moduleDir := tempdir construct:moduleDirName. |
|
3320 |
moduleDir isDirectory ifFalse:[ |
|
3321 |
'CVSSourceCodeManager [error]: command failed: ' errorPrint. cmd errorPrintCR. |
|
3322 |
||
3323 |
tempdir recursiveRemove. |
|
3324 |
^ false. |
|
3325 |
]. |
|
3326 |
||
3327 |
"/ |
|
3328 |
"/ create the package directory there |
|
3329 |
"/ |
|
3330 |
packageDir := moduleDir construct:packageDirName. |
|
3331 |
OperatingSystem errorSignal catch:[ |
|
3332 |
packageDir recursiveMakeDirectory. |
|
3333 |
]. |
|
3334 |
packageDir isDirectory ifFalse:[ |
|
3335 |
tempdir recursiveRemove. |
|
3336 |
('CVSSourceCodeManager [error]: cannot create new directory: ' , packageDir pathName) errorPrintCR. |
|
3337 |
^ false. |
|
3338 |
]. |
|
3339 |
||
3340 |
"/ |
|
3341 |
"/ then import it into CVS |
|
3342 |
"/ |
|
3343 |
||
3344 |
relativePath := moduleDirName asFilename constructString:packageDirName. |
|
3345 |
cmd := 'import -m "created from browser" . initialV initialR > ' , cmdOut name. |
|
3346 |
(self |
|
3347 |
executeCVSCommand:cmd |
|
3348 |
module:moduleDirName |
|
3349 |
inDirectory:tempdir name |
|
3350 |
) ifFalse:[ |
|
3351 |
'CVSSourceCodeManager [error]: failed to execute: ' errorPrint. cmd errorPrintCR. |
|
3352 |
'CVSSourceCodeManager [error]: output from cvs:' errorPrintCR. |
|
3353 |
(cmdOut contentsOfEntireFile) errorPrint. |
|
3354 |
||
3355 |
cmdOut remove. |
|
3356 |
tempdir recursiveRemove. |
|
3357 |
^ false. |
|
3358 |
]. |
|
3359 |
||
3360 |
tempdir recursiveRemove. |
|
3361 |
cmdOut remove. |
|
3362 |
^ true |
|
3363 |
||
3364 |
" |
|
3365 |
self createModule:'stefan' package:'dummy1' |
|
3366 |
" |
|
3367 |
||
3368 |
"Created: / 9.12.1995 / 20:09:33 / cg" |
|
3369 |
"Modified: / 23.7.1999 / 18:40:49 / stefan" |
|
3370 |
"Modified: / 18.1.2000 / 20:14:01 / cg" |
|
3371 |
! |
|
3372 |
||
1459
83c50df5be7f
Setting/deleting symbolic names
Stefan Vogel <sv@exept.de>
parents:
1457
diff
changeset
|
3373 |
deleteSymbolicName:symbolicName path:pathInRepository |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3374 |
"remove symbolicName from classFileName" |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3375 |
|
1459
83c50df5be7f
Setting/deleting symbolic names
Stefan Vogel <sv@exept.de>
parents:
1457
diff
changeset
|
3376 |
self setSymbolicName:symbolicName revision:0 overWrite:false path:pathInRepository |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3377 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3378 |
" |
1459
83c50df5be7f
Setting/deleting symbolic names
Stefan Vogel <sv@exept.de>
parents:
1457
diff
changeset
|
3379 |
self deleteSymbolicName:'stable' path:'stx/libbasic/Array.st' |
83c50df5be7f
Setting/deleting symbolic names
Stefan Vogel <sv@exept.de>
parents:
1457
diff
changeset
|
3380 |
self deleteSymbolicName:'testBLAbla' path:'stx/libbasic/Array.st' |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3381 |
" |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3382 |
! |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3383 |
|
1362 | 3384 |
getExistingContainersInModule:aModule package:aPackage |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3385 |
"return a list of existing containers." |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3386 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3387 |
^ self listDirectories:aModule, '/', aPackage |
1362 | 3388 |
|
3389 |
" |
|
3390 |
CVSSourceCodeManager getExistingContainersInModule:'stx' package:'libhtml' |
|
3391 |
CVSSourceCodeManager getExistingContainersInModule:'cg' package:'java' |
|
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3392 |
CVSSourceCodeManager getExistingContainersInModule:'exept' package:'osi' |
1362 | 3393 |
" |
3394 |
! |
|
3395 |
||
3396 |
getExistingModules |
|
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3397 |
"return a list of existing modules" |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3398 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3399 |
^ self listDirectories:nil. |
1362 | 3400 |
|
3401 |
" |
|
3402 |
CVSSourceCodeManager getExistingModules |
|
3403 |
" |
|
3404 |
! |
|
3405 |
||
3406 |
getExistingPackagesInModule:aModule |
|
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3407 |
"return a list of existing packages." |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3408 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3409 |
^ self listDirectories:aModule. |
1362 | 3410 |
|
3411 |
" |
|
3412 |
CVSSourceCodeManager getExistingPackagesInModule:'stx' |
|
3413 |
CVSSourceCodeManager getExistingPackagesInModule:'cg' |
|
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3414 |
CVSSourceCodeManager getExistingPackagesInModule:'exept' |
1362 | 3415 |
" |
3416 |
||
3417 |
"Created: / 20.5.1998 / 19:28:43 / cg" |
|
3418 |
"Modified: / 20.5.1998 / 22:07:13 / cg" |
|
3419 |
! |
|
3420 |
||
3421 |
initialRevisionStringFor:aClass inModule:moduleDir package:packageDir container:fileName |
|
3422 |
"return a string usable as initial revision string" |
|
3423 |
||
3424 |
|cvsRoot| |
|
3425 |
||
3426 |
cvsRoot := self getCVSROOTForModule:moduleDir. |
|
3427 |
cvsRoot := self repositoryTopDirectory:cvsRoot. |
|
3428 |
^ self |
|
3429 |
initialRCSRevisionStringFor:aClass |
|
3430 |
in:(cvsRoot , '/' , moduleDir , '/' , packageDir) |
|
3431 |
container:fileName |
|
3432 |
||
3433 |
"Modified: / 19.9.1997 / 06:34:10 / cg" |
|
3434 |
"Modified: / 16.1.1998 / 17:34:13 / stefan" |
|
3435 |
! |
|
3436 |
||
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3437 |
listDirectories:cvsPath |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3438 |
"return a list of all directories in cvsPath. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3439 |
cvsPath is the path relative to the cvs root" |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3440 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3441 |
|cvsRoot directories inStream line| |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3442 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3443 |
cvsRoot := self getCVSROOTForModule:nil. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3444 |
cvsRoot isNil ifTrue:[^ #()]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3445 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3446 |
self activityNotification:'getting list of directories...'. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3447 |
directories := Set new. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3448 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3449 |
[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3450 |
inStream := self |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3451 |
executeCVSCommand:('rls -l ' , (cvsPath ? '')) |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3452 |
module:nil |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3453 |
inDirectory:nil |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3454 |
log:false |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3455 |
pipe:true. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3456 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3457 |
inStream isNil ifTrue:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3458 |
self warn:'This operation is not possible with this remoteCVS server'. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3459 |
^ #(). |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3460 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3461 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3462 |
[line := inStream nextLine. line notNil] whileTrue:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3463 |
|idx| |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3464 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3465 |
"/ 'd--- 2005-06-02 17:21:20 +0200 Eigene Dateien' |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3466 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3467 |
(line startsWith:$d) ifTrue:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3468 |
idx := 0. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3469 |
4 timesRepeat:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3470 |
idx := line indexOf:Character space startingAt:idx+1. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3471 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3472 |
directories add:(line copyFrom:idx+1) withoutSeparators |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3473 |
] |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3474 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3475 |
] ensure:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3476 |
inStream notNil ifTrue:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3477 |
inStream close. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3478 |
] |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3479 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3480 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3481 |
^ directories asArray sort |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3482 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3483 |
" |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3484 |
CVSSourceCodeManager listDirectories:nil |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3485 |
CVSSourceCodeManager listDirectories:'stx' |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3486 |
CVSSourceCodeManager listDirectories:'stx/libbasic' |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3487 |
" |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3488 |
! |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3489 |
|
1362 | 3490 |
newestRevisionInFile:classFileName directory:packageDir module:moduleDir |
3491 |
"return the newest revision found in a container. |
|
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3492 |
Return nil on failure." |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3493 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3494 |
|tempDir fullName modulePath inStream line s| |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3495 |
|
1464
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3496 |
self use_rlog ifFalse:[ |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3497 |
"/ Uses 'cvs status' - rlog seems not to work |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3498 |
|
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3499 |
|info| |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3500 |
|
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3501 |
info := self |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3502 |
statusOf:nil |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3503 |
fileName:classFileName |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3504 |
directory:packageDir |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3505 |
module:moduleDir. |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3506 |
|
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3507 |
info isNil ifTrue:[^ nil]. |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3508 |
^ info at:#newestRevision ifAbsent:nil |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3509 |
]. |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3510 |
|
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3511 |
modulePath := moduleDir , '/' , packageDir. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3512 |
fullName := modulePath , '/' , classFileName. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3513 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3514 |
[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3515 |
self activityNotification:'Fetching revision info for ', fullName. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3516 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3517 |
inStream := self |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3518 |
executeCVSCommand:('rlog -h -N ' , fullName) |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3519 |
module:moduleDir |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3520 |
inDirectory:tempDir |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3521 |
log:true |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3522 |
pipe:true. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3523 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3524 |
inStream isNil ifTrue:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3525 |
('CVSSourceCodeManager [error]: cannot open pipe to cvs log ', fullName) errorPrintCR. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3526 |
^ nil |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3527 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3528 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3529 |
"/ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3530 |
"/ read the commands pipe output and extract the container info |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3531 |
"/ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3532 |
[inStream atEnd] whileFalse:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3533 |
line:= inStream nextLine. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3534 |
line notNil ifTrue:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3535 |
line := line withoutSeparators. |
1464
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3536 |
line notEmpty ifTrue:[ |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3537 |
Transcript showCR:line. |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3538 |
s := line restAfter:'head:' withoutSeparators:true. |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3539 |
s notNil ifTrue:[ |i| |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3540 |
i := s indexOfSeparator. |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3541 |
i ~~ 0 ifTrue:[ |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3542 |
s := s copyTo:i-1 |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3543 |
]. |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3544 |
^ s |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3545 |
]. |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3546 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3547 |
] |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3548 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3549 |
('CVSSourceCodeManager [warning]: no revision for ', fullName) errorPrintCR. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3550 |
] ensure:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3551 |
inStream notNil ifTrue:[inStream close]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3552 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3553 |
^ nil |
1362 | 3554 |
|
3555 |
" |
|
3556 |
SourceCodeManager newestRevisionInFile:'Array.st' directory:'libbasic' module:'stx' |
|
3557 |
" |
|
3558 |
! |
|
3559 |
||
3560 |
removeContainerFor:aClass inModule:moduleDir package:packageDir container:fileName |
|
3561 |
"remove a container" |
|
3562 |
||
3563 |
(self removeContainerInModule:moduleDir package:packageDir container:fileName) ifFalse:[ |
|
3564 |
^ false |
|
3565 |
]. |
|
3566 |
||
3567 |
"/ |
|
3568 |
"/ patch the classes revisionInfo (but keep binaryRevision unchanged) |
|
3569 |
"/ this makes everyone here believe, that the incore version of the class is based upon |
|
3570 |
"/ some container-less class. |
|
3571 |
"/ (however, the binaryRevision must remain as it is - we will need it to fetch the sourceCode |
|
3572 |
"/ correctly for all unchanged methodss) |
|
3573 |
"/ |
|
3574 |
||
3575 |
aClass updateVersionMethodFor:'no longer in repository'. |
|
3576 |
Class addChangeRecordForClassContainerRemove:aClass. |
|
3577 |
^ true |
|
3578 |
! |
|
3579 |
||
3580 |
removeContainerInModule:moduleDir package:packageDir container:fileName |
|
3581 |
"remove a container" |
|
3582 |
||
3583 |
|fullName tempdir checkoutName cmdOut cmd tempFile whatHappened| |
|
3584 |
||
3585 |
fullName := moduleDir , '/' , packageDir , '/' , fileName. |
|
3586 |
checkoutName := moduleDir , '/' , packageDir. |
|
3587 |
||
3588 |
(tempdir := self createLocalDirectory:packageDir inModule:moduleDir with:fileName) isNil ifTrue:[ |
|
3589 |
'CVSSourceCodeManager [error]: failed to checkout: ' errorPrint. checkoutName errorPrintCR. |
|
3590 |
tempdir recursiveRemove. |
|
3591 |
('CVSSourceCodeManager [error]: cannot checkout ' , checkoutName) errorPrintCR. |
|
3592 |
^ false. |
|
3593 |
]. |
|
3594 |
||
3595 |
"/ |
|
3596 |
"/ and remove it to the repository |
|
3597 |
"/ |
|
3598 |
self activityNotification:'removing ' , fileName. |
|
3599 |
||
3600 |
"/ |
|
3601 |
"/ check presence of source there |
|
3602 |
"/ |
|
3603 |
tempFile := (tempdir construct:checkoutName) construct:fileName. |
|
3604 |
tempFile exists ifFalse:[ |
|
3605 |
'CVSSourceCodeManager [error]: temporary fileout failed' errorPrintCR. |
|
3606 |
tempdir recursiveRemove. |
|
3607 |
^ false |
|
3608 |
]. |
|
3609 |
||
3610 |
tempFile exists ifTrue:[ |
|
3611 |
tempFile remove. |
|
3612 |
]. |
|
3613 |
||
3614 |
cmdOut := Filename newTemporary. |
|
3615 |
cmdOut exists ifTrue:[ |
|
3616 |
cmdOut remove. |
|
3617 |
]. |
|
3618 |
||
3619 |
cmd := 'remove ' , fileName , ' > ' , cmdOut name. |
|
3620 |
(self |
|
3621 |
executeCVSCommand:cmd |
|
3622 |
module:moduleDir |
|
3623 |
inDirectory:(tempdir constructString:checkoutName) |
|
3624 |
) ifFalse:[ |
|
3625 |
'CVSSourceCodeManager [error]: failed to execute: ' errorPrint. cmd errorPrintCR. |
|
3626 |
||
3627 |
cmdOut remove. |
|
3628 |
tempdir recursiveRemove. |
|
3629 |
('CVSSourceCodeManager [error]: cannot remove ' , checkoutName) errorPrintCR. |
|
3630 |
^ false. |
|
3631 |
]. |
|
3632 |
cmdOut remove. |
|
3633 |
||
3634 |
"/ |
|
3635 |
"/ commit |
|
3636 |
"/ |
|
3637 |
self activityNotification:'committing removal of ' , fileName. |
|
3638 |
||
3639 |
cmd := 'commit -m "removed container" -l ' , fileName , ' 2> ' , cmdOut name. |
|
3640 |
(self |
|
3641 |
executeCVSCommand:cmd |
|
3642 |
module:moduleDir |
|
3643 |
inDirectory:(tempdir constructString:checkoutName) |
|
3644 |
) ifFalse:[ |
|
3645 |
'CVSSourceCodeManager [error]: failed to execute: ' errorPrint. cmd errorPrintCR. |
|
3646 |
||
3647 |
cmdOut fileSize > 0 ifTrue:[ |
|
3648 |
whatHappened := cmdOut contentsOfEntireFile asString. |
|
3649 |
] ifFalse:[ |
|
3650 |
whatHappened := '<< no message >>' |
|
3651 |
]. |
|
3652 |
self warn:'The following problem was reported by cvs: |
|
3653 |
||
3654 |
' , whatHappened , ' |
|
3655 |
||
3656 |
The container has NOT been removed into the repository.'. |
|
3657 |
||
3658 |
'CVSSourceCodeManager [error]: cannot remove container' errorPrintCR. |
|
3659 |
cmdOut remove. |
|
3660 |
tempdir recursiveRemove. |
|
3661 |
^ false. |
|
3662 |
]. |
|
3663 |
cmdOut remove. |
|
3664 |
||
3665 |
"/ |
|
3666 |
"/ release the temporary tree towards cvs |
|
3667 |
"/ |
|
3668 |
self releaseAndRemove:tempdir module:moduleDir outputTo:nil. |
|
3669 |
||
3670 |
tempdir recursiveRemove. |
|
3671 |
^ true |
|
3672 |
||
3673 |
" |
|
3674 |
CVSSourceCodeManager removeContainerInModule:'stx' package:'private' container:'WorldPO.st' |
|
3675 |
" |
|
3676 |
||
3677 |
"Modified: / 26.2.1998 / 17:33:57 / stefan" |
|
3678 |
"Modified: / 18.1.2000 / 21:02:30 / cg" |
|
3679 |
! |
|
3680 |
||
3681 |
reportHistoryLogSince:timeGoal filterSTSources:filter filterUser:userFilter filterRepository:filterRep filterModules:filterModules inTo:aBlock |
|
3682 |
"process a full historyLog, evaluate aBlock for each entry, passing |
|
3683 |
the logs info in a dictionary. |
|
3684 |
This walks over all possible repositories. |
|
3685 |
filterRep may be a collection of repository names |
|
3686 |
(i.e. 'stc', 'exept', 'phx' etc.) to only report changes made to one |
|
3687 |
of those repositories. |
|
3688 |
filterUser, if non-nil, will filter only changes made by that user." |
|
3689 |
||
3690 |
|inStream line words recordType fileName user date time rev pkgDir module idx |
|
3691 |
clsName cls clsRev roots info tempDir endReached| |
|
3692 |
||
3693 |
CVSRoot isNil ifTrue:[ |
|
3694 |
'CVSSourceCodeManager [info]: CVSROOT not set' infoPrintCR. |
|
3695 |
^ nil |
|
3696 |
]. |
|
3697 |
||
1481 | 3698 |
filterRep notEmptyOrNil ifTrue:[ |
3699 |
roots := filterRep. |
|
1362 | 3700 |
] ifFalse:[ |
1481 | 3701 |
roots := Set withAll:(CVSModuleRoots values). |
3702 |
roots add:CVSRoot. |
|
1362 | 3703 |
]. |
3704 |
||
3705 |
"/ must do it in a tempDir, to avoid cvs validating the -D arg |
|
3706 |
"/ against any info found in CVS/Root |
|
3707 |
||
3708 |
tempDir := self createTempDirectory:nil forModule:nil. |
|
3709 |
tempDir isNil ifTrue:[ |
|
3710 |
('CVSSourceCodeManager [error]: no tempDir - cannot extract log') errorPrintCR. |
|
3711 |
^ nil. |
|
3712 |
]. |
|
3713 |
||
1481 | 3714 |
roots do:[:eachCvsRoot | |
1362 | 3715 |
|root host cmd| |
3716 |
||
1481 | 3717 |
cmd := 'cvs -d ' , eachCvsRoot. |
3718 |
||
3719 |
cmd := cmd , ' history -x ARM -a'. |
|
1447
2ac1cf09722b
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
3720 |
(timeGoal notEmptyOrNil) ifTrue:[ |
1362 | 3721 |
cmd := cmd , ' -D "' , timeGoal , '"'. |
3722 |
]. |
|
3723 |
userFilter notNil ifTrue:[ |
|
3724 |
userFilter isString ifTrue:[ |
|
3725 |
cmd := cmd , ' -u "' , userFilter , '"'. |
|
3726 |
] ifFalse:[ |
|
3727 |
userFilter do:[:user | |
|
3728 |
cmd := cmd , ' -u "' , user , '"'. |
|
3729 |
]. |
|
3730 |
]. |
|
3731 |
]. |
|
3732 |
||
1481 | 3733 |
"/ The -m and -x options do not work together in cvs history |
1362 | 3734 |
"/ |
3735 |
"/ filterModules notNil ifTrue:[ |
|
3736 |
"/ filterModules do:[:aModule | |
|
3737 |
"/ cmd := cmd , ' -m "' , aModule , '"'. |
|
3738 |
"/ ]. |
|
3739 |
"/ ]. |
|
3740 |
||
3741 |
Transcript showCR:cmd. |
|
3742 |
||
3743 |
inStream := PipeStream readingFrom:cmd inDirectory:tempDir. |
|
3744 |
inStream isNil ifTrue:[ |
|
3745 |
('CVSSourceCodeManager [error]: cannot open pipe to ''cvs history''') errorPrintCR. |
|
3746 |
] ifFalse:[ |
|
3747 |
inStream class streamErrorSignal handle:[:ex | |
|
3748 |
('CVSSourceCodeManager [error]: pipe read error (''cvs history'')') errorPrintCR. |
|
3749 |
ex return. |
|
3750 |
] do:[ |
|
3751 |
"/ |
|
3752 |
"/ read the commands pipe output and reformat the lines |
|
3753 |
"/ |
|
3754 |
endReached := false. |
|
3755 |
[endReached] whileFalse:[ |
|
3756 |
inStream readWait. |
|
3757 |
line := inStream nextLine. |
|
3758 |
(endReached := line isNil) ifFalse:[ |
|
3759 |
||
3760 |
"/ cvs history line is of the following format: |
|
3761 |
"/ [Ma] date time +xxx user rev name module/package .... |
|
3762 |
words := line asCollectionOfWords. |
|
1481 | 3763 |
words size < 8 ifTrue:[ |
1362 | 3764 |
"/ something like 'No records selected' ... |
1481 | 3765 |
] ifFalse:[ |
3766 |
"a valid history line" |
|
1362 | 3767 |
recordType := words at:1. |
3768 |
fileName := words at:7. |
|
3769 |
user := words at:5. |
|
3770 |
||
3771 |
(filter not |
|
3772 |
or:[fileName endsWith:'.st']) ifTrue:[ |
|
3773 |
(userFilter isNil |
|
1481 | 3774 |
or:[userFilter includes:user]) ifTrue:[ |
1362 | 3775 |
|
3776 |
date := words at:2. |
|
3777 |
time := words at:3. |
|
3778 |
rev := words at:6. |
|
3779 |
pkgDir := words at:8. |
|
3780 |
||
1481 | 3781 |
module := pkgDir. |
1362 | 3782 |
(module startsWith:'./') ifTrue:[ |
3783 |
module := module copyFrom:3. |
|
3784 |
]. |
|
3785 |
idx := module indexOf:$/. |
|
3786 |
idx ~~ 0 ifTrue:[ |
|
1481 | 3787 |
module := module copyTo:idx-1. |
1362 | 3788 |
]. |
3789 |
||
3790 |
(filterModules isNil |
|
1481 | 3791 |
or:[filterModules includes:module]) ifTrue:[ |
1362 | 3792 |
recordType = 'M' ifTrue:[ |
3793 |
recordType := ' ' |
|
3794 |
] ifFalse:[ |
|
3795 |
recordType = 'A' ifTrue:[ |
|
3796 |
recordType := '+' |
|
3797 |
] ifFalse:[ |
|
1481 | 3798 |
recordType = 'R' ifTrue:[ |
1362 | 3799 |
recordType := '-' |
3800 |
] |
|
3801 |
] |
|
3802 |
]. |
|
3803 |
||
3804 |
info := Dictionary new. |
|
3805 |
info at:#cvsRecordType put:recordType. |
|
3806 |
info at:#date put:date. |
|
3807 |
info at:#time put:time. |
|
3808 |
info at:#user put:user. |
|
3809 |
info at:#fileName put:fileName. |
|
3810 |
info at:#revision put:rev. |
|
3811 |
info at:#directory put:pkgDir. |
|
3812 |
info at:#className put:(Smalltalk classNameForFile:fileName). |
|
1481 | 3813 |
info at:#cvsRoot put:eachCvsRoot. |
3814 |
||
1362 | 3815 |
"/ |
3816 |
"/ for your convenience: |
|
3817 |
"/ check what the actual version is in the image |
|
3818 |
"/ |
|
3819 |
clsName := Smalltalk classNameForFile:fileName. |
|
3820 |
clsName notNil ifTrue:[ |
|
3821 |
cls := Smalltalk classNamed:clsName. |
|
3822 |
(cls notNil and:[(clsRev := cls revision) notNil]) ifTrue:[ |
|
3823 |
info at:#classesRevision put:clsRev. |
|
3824 |
]. |
|
3825 |
]. |
|
3826 |
aBlock value:info |
|
3827 |
] |
|
3828 |
] |
|
3829 |
] |
|
3830 |
] |
|
3831 |
] |
|
3832 |
]. |
|
3833 |
]. |
|
3834 |
inStream close. |
|
3835 |
] |
|
3836 |
]. |
|
3837 |
||
3838 |
tempDir recursiveRemove. |
|
3839 |
||
3840 |
"Created: / 17.1.2001 / 13:11:20 / cg" |
|
3841 |
"Modified: / 17.1.2001 / 13:41:22 / cg" |
|
3842 |
! |
|
3843 |
||
3844 |
reportHistoryLogSince:timeGoal filterSTSources:filter filterUser:userFilter filterRepository:filterRep inTo:aBlock |
|
3845 |
"process a full historyLog, evaluate aBlock for each entry, passing |
|
3846 |
the logs info in a dictionary. |
|
3847 |
This walks over all possible repositories. |
|
3848 |
filterRep may be a collection of repository names |
|
3849 |
(i.e. 'stc', 'exept', 'phx' etc.) to only report changes made to one |
|
3850 |
of those repositories. |
|
3851 |
filterUser, if non-nil, will filter only changes made by that user." |
|
3852 |
||
3853 |
^self |
|
3854 |
reportHistoryLogSince:timeGoal |
|
3855 |
filterSTSources:filter |
|
3856 |
filterUser:userFilter |
|
3857 |
filterRepository:filterRep |
|
3858 |
filterModules:nil |
|
3859 |
inTo:aBlock |
|
3860 |
||
3861 |
"Modified: / 17.1.2001 / 13:12:15 / cg" |
|
3862 |
! |
|
3863 |
||
3864 |
revisionInfoFromString:aString |
|
3865 |
"{ Pragma: +optSpace }" |
|
3866 |
||
3867 |
"return a dictionary filled with revision info. |
|
3868 |
This extracts the relevant info from aString." |
|
3869 |
||
3870 |
^ self revisionInfoFromRCSString:aString |
|
3871 |
||
3872 |
" |
|
3873 |
self revisionInfoFromString:(Array version) |
|
3874 |
" |
|
3875 |
||
3876 |
"Modified: 29.1.1997 / 19:00:35 / cg" |
|
3877 |
! |
|
3878 |
||
1451 | 3879 |
revisionLogOf:clsOrNil fromRevision:firstRev toRevision:lastRef fileName:classFileName directory:packageDir module:moduleDir |
3880 |
^ self |
|
3881 |
revisionLogOf:clsOrNil |
|
3882 |
fromRevision:firstRev |
|
3883 |
toRevision:lastRef |
|
3884 |
numberOfRevisions:nil |
|
3885 |
fileName:classFileName |
|
3886 |
directory:packageDir |
|
3887 |
module:moduleDir |
|
3888 |
! |
|
3889 |
||
3890 |
revisionLogOf:clsOrNil fromRevision:firstRev toRevision:lastRef numberOfRevisions:numRevisions fileName:classFileName directory:packageDir module:moduleDir |
|
1362 | 3891 |
"return info about the repository container and |
3892 |
(part of) the revisionlog as a collection of revision entries. |
|
3893 |
Return nil on failure. |
|
3894 |
||
1451 | 3895 |
If numRevisions is notNil, it limits the number of revision records returned - |
3896 |
only numRevions of the newest revision infos will be collected. |
|
3897 |
||
1362 | 3898 |
The returned information is a structure (IdentityDictionary) |
3899 |
filled with: |
|
3900 |
#container -> the RCS/CVS container file name |
|
3901 |
#cvsRoot -> the CVS root (repository) |
|
3902 |
#filename -> the actual source file name |
|
3903 |
#newestRevision -> the revisionString of the newest revision |
|
3904 |
#numberOfRevisions -> the number of revisions in the container (nil for all) |
|
3905 |
#revisions -> collection of per-revision info (see below) |
|
3906 |
||
1451 | 3907 |
firstRev / lastRef specify from which revisions a logEntry is wanted: |
3908 |
-If firstRev is nil, the first revision is the initial revision |
|
1362 | 3909 |
otherwise, the log starts with that revision. |
1451 | 3910 |
-If lastRef is nil, the last revision is the newest revision |
1362 | 3911 |
otherwise, the log ends with that revision. |
3912 |
||
3913 |
-If both are nil, all logEntries are extracted. |
|
3914 |
-If both are 0 (not nil), no logEntries are extracted (i.e. only the header). |
|
3915 |
||
3916 |
per revision info consists of one record per revision: |
|
3917 |
||
3918 |
#revision -> the revision string |
|
3919 |
#author -> who checked that revision into the repository |
|
3920 |
#date -> when was it checked in |
|
3921 |
#state -> the RCS state |
|
3922 |
#numberOfChangedLines -> the number of changed line w.r.t the previous |
|
1451 | 3923 |
#logMessage -> the checkIn log message |
1362 | 3924 |
|
3925 |
revisions are ordered newest first |
|
3926 |
(i.e. the last entry is for the initial revision; the first for the most recent one) |
|
3927 |
" |
|
3928 |
||
1464
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3929 |
|tempDir fullName modulePath inStream inHeaderInfo atEnd line idx |
1451 | 3930 |
info record revisionRecords s headerOnly msg| |
1362 | 3931 |
|
1464
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3932 |
self use_rlog ifFalse:[ |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3933 |
tempDir := self createTempDirectory:nil forModule:nil. |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3934 |
tempDir isNil ifTrue:[ |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3935 |
('CVSSourceCodeManager [error]: no tempDir - cannot extract log') errorPrintCR. |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3936 |
^ nil. |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3937 |
]. |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3938 |
]. |
1362 | 3939 |
|
3940 |
[ |
|
1464
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3941 |
|cmd revArg| |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3942 |
|
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3943 |
modulePath := moduleDir , '/' , packageDir. |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3944 |
fullName := modulePath , '/' , classFileName. |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3945 |
|
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3946 |
self use_rlog ifFalse:[ |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3947 |
self createEntryFor:fullName |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3948 |
module:moduleDir |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3949 |
in:(tempDir construct:modulePath) |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3950 |
revision:'1.1' |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3951 |
date:'dummy' |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3952 |
special:'' |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3953 |
overwrite:false. |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3954 |
]. |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3955 |
|
1362 | 3956 |
revArg := ''. |
3957 |
headerOnly := false. |
|
1451 | 3958 |
(firstRev notNil or:[lastRef notNil]) ifTrue:[ |
3959 |
(firstRev == 0 and:[lastRef == 0]) ifTrue:[ |
|
1362 | 3960 |
revArg := '-h'. |
3961 |
headerOnly := true. |
|
3962 |
] ifFalse:[ |
|
3963 |
revArg := '-r'. |
|
1451 | 3964 |
firstRev notNil ifTrue:[ |
3965 |
revArg := revArg , firstRev |
|
1362 | 3966 |
]. |
3967 |
revArg := revArg , ':'. |
|
1451 | 3968 |
lastRef notNil ifTrue:[ |
3969 |
revArg := revArg , lastRef |
|
1362 | 3970 |
]. |
3971 |
] |
|
3972 |
]. |
|
3973 |
||
3974 |
headerOnly ifTrue:[ |
|
3975 |
msg := 'fetching revision info ' |
|
3976 |
] ifFalse:[ |
|
3977 |
msg := 'reading revision log ' |
|
3978 |
]. |
|
3979 |
clsOrNil isNil ifTrue:[ |
|
3980 |
msg := msg , 'in ' , fullName. |
|
3981 |
] ifFalse:[ |
|
3982 |
msg := msg , 'of ', clsOrNil name. |
|
3983 |
]. |
|
3984 |
self activityNotification:msg. |
|
3985 |
||
1464
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3986 |
self use_rlog ifTrue:[ |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3987 |
cmd := ('rlog ' , revArg , ' ' , fullName). |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3988 |
] ifFalse:[ |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3989 |
cmd := ('log ' , revArg , ' ' , fullName). |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3990 |
]. |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
3991 |
|
1362 | 3992 |
inStream := self |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3993 |
executeCVSCommand:('rlog ' , revArg , ' ' , fullName) |
1362 | 3994 |
module:moduleDir |
3995 |
inDirectory:tempDir |
|
3996 |
log:true |
|
3997 |
pipe:true. |
|
3998 |
||
3999 |
inStream isNil ifTrue:[ |
|
4000 |
('CVSSourceCodeManager [error]: cannot open pipe to cvs log ', fullName) errorPrintCR. |
|
4001 |
^ nil |
|
4002 |
]. |
|
4003 |
||
4004 |
"/ |
|
4005 |
"/ read the commands pipe output and extract the container info |
|
4006 |
"/ |
|
4007 |
info := IdentityDictionary new. |
|
4008 |
inHeaderInfo := true. |
|
4009 |
[inHeaderInfo and:[inStream atEnd not]] whileTrue:[ |
|
4010 |
line:= inStream nextLine. |
|
4011 |
line notNil ifTrue:[ |
|
4012 |
|gotIt| |
|
4013 |
||
4014 |
gotIt := false. |
|
4015 |
#('RCS file:' #container |
|
4016 |
'Working file:' #filename |
|
4017 |
'head:' #newestRevision |
|
4018 |
'total revisions:' #numberOfRevisions |
|
4019 |
) pairWiseDo:[:word :key | |
|
4020 |
gotIt ifFalse:[ |
|
4021 |
s := line restAfter:word withoutSeparators:true. |
|
4022 |
s notNil ifTrue:[info at:key put:s. gotIt := true]. |
|
4023 |
] |
|
4024 |
]. |
|
4025 |
gotIt ifFalse:[ |
|
1451 | 4026 |
(line startsWith:'symbolic names:') ifTrue:[ |
4027 |
|tags tokens| |
|
4028 |
||
4029 |
tags := Dictionary new. |
|
4030 |
line:= inStream nextLine. |
|
4031 |
[line notNil |
|
4032 |
and:[(line startsWith:Character space) or:[line startsWith:Character tab]]] whileTrue:[ |
|
4033 |
tokens := line asCollectionOfSubstringsSeparatedBy:$:. |
|
4034 |
tags at:(tokens first withoutSeparators) put:(tokens second withoutSeparators). |
|
4035 |
line:= inStream nextLine. |
|
4036 |
]. |
|
4037 |
info at:#symbolicNames put:tags. |
|
4038 |
]. |
|
1362 | 4039 |
(line startsWith:'description:') ifTrue:[inHeaderInfo := false]. |
4040 |
] |
|
4041 |
] |
|
4042 |
]. |
|
4043 |
inStream nextLine. "/ skip separating line after description. |
|
4044 |
||
4045 |
info isEmpty ifTrue:[ |
|
4046 |
('CVSSourceCodeManager [warning]: no log for ', fullName) errorPrintCR. |
|
4047 |
^ nil |
|
4048 |
]. |
|
4049 |
||
4050 |
"/ strip selected revisions from the total-revisions entry |
|
4051 |
s := info at:#numberOfRevisions. |
|
4052 |
(idx := s indexOf:$;) ~~ 0 ifTrue:[ |
|
4053 |
info at:#numberOfRevisions put:(Integer readFrom:(s copyTo:idx - 1)) |
|
4054 |
] ifFalse:[ |
|
4055 |
info at:#numberOfRevisions put:(Integer readFrom:s onError:[1]) |
|
4056 |
]. |
|
4057 |
headerOnly ifFalse:[ |
|
4058 |
"/ |
|
4059 |
"/ continue to read the commands pipe output |
|
4060 |
"/ and extract revision info records |
|
4061 |
"/ |
|
4062 |
revisionRecords := OrderedCollection new:(info at:#numberOfRevisions). |
|
4063 |
info at:#revisions put:revisionRecords. |
|
4064 |
||
4065 |
atEnd := false. |
|
4066 |
[atEnd or:[inStream atEnd]] whileFalse:[ |
|
4067 |
record := self readRevisionLogEntryFromStream:inStream. |
|
4068 |
record isNil ifTrue:[ |
|
4069 |
atEnd := true. |
|
4070 |
] ifFalse:[ |
|
4071 |
revisionRecords add:record. |
|
1451 | 4072 |
]. |
4073 |
(numRevisions notNil and:[revisionRecords size >= numRevisions]) ifTrue:[ |
|
4074 |
atEnd := true |
|
1362 | 4075 |
] |
4076 |
]. |
|
4077 |
]. |
|
4078 |
] ensure:[ |
|
4079 |
inStream notNil ifTrue:[inStream close]. |
|
1464
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4080 |
|
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4081 |
tempDir notNil ifTrue:[ |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4082 |
OperatingSystem accessDeniedErrorSignal handle:[:ex | |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4083 |
('CVSSourceCodeManager [warning]: could not remove tempDir ', tempDir pathName) infoPrintCR. |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4084 |
] do:[ |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4085 |
tempDir recursiveRemove |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4086 |
]. |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4087 |
]. |
1362 | 4088 |
]. |
4089 |
^ info |
|
4090 |
||
4091 |
" |
|
4092 |
SourceCodeManager revisionLogOf:Array |
|
4093 |
SourceCodeManager revisionLogOf:Array fromRevision:'1.40' toRevision:'1.43' |
|
4094 |
SourceCodeManager revisionLogOf:Array fromRevision:'1.40' toRevision:nil |
|
4095 |
SourceCodeManager revisionLogOf:Array fromRevision:nil toRevision:'1.3' |
|
4096 |
SourceCodeManager revisionLogOf:Array fromRevision:nil toRevision:nil |
|
4097 |
SourceCodeManager revisionLogOf:Array fromRevision:0 toRevision:0 |
|
4098 |
" |
|
4099 |
||
4100 |
"Created: / 16.11.1995 / 13:25:30 / cg" |
|
4101 |
"Modified: / 29.1.1997 / 16:51:30 / stefan" |
|
4102 |
"Modified: / 27.8.1998 / 12:40:59 / cg" |
|
4103 |
! |
|
4104 |
||
4105 |
revisionLogOf:clsOrNil numberOfRevisions:numRevisions fileName:classFileName directory:packageDir module:moduleDir |
|
1451 | 4106 |
^ self |
4107 |
revisionLogOf:clsOrNil |
|
4108 |
fromRevision:nil |
|
4109 |
toRevision:nil |
|
4110 |
numberOfRevisions:numRevisions |
|
4111 |
fileName:classFileName |
|
4112 |
directory:packageDir |
|
4113 |
module:moduleDir |
|
1362 | 4114 |
! |
4115 |
||
1459
83c50df5be7f
Setting/deleting symbolic names
Stefan Vogel <sv@exept.de>
parents:
1457
diff
changeset
|
4116 |
setSymbolicName:symbolicName revision:rev overWrite:overWriteBool path:pathInRepository |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4117 |
"set a symbolicName for revision rev. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4118 |
If rev is nil, set it for the head (most recent) revision. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4119 |
If rev is 0, delete the symbolic name. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4120 |
If overWriteBool is true, the symbolicName will be changed, even if it has already been set. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4121 |
If overWriteBool is false, an error will be raised if symbolicName has already been set. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4122 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4123 |
If filename is nil, the symbolicName for a whole package is set" |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4124 |
|
1459
83c50df5be7f
Setting/deleting symbolic names
Stefan Vogel <sv@exept.de>
parents:
1457
diff
changeset
|
4125 |
|inStream argumentString result errorStream outStream moduleDir| |
83c50df5be7f
Setting/deleting symbolic names
Stefan Vogel <sv@exept.de>
parents:
1457
diff
changeset
|
4126 |
|
83c50df5be7f
Setting/deleting symbolic names
Stefan Vogel <sv@exept.de>
parents:
1457
diff
changeset
|
4127 |
moduleDir := (pathInRepository asCollectionOfSubstringsSeparatedByAny:'/\') first. |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4128 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4129 |
rev = 0 ifTrue:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4130 |
argumentString := ' -d '. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4131 |
] ifFalse:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4132 |
argumentString := ' -r ', (rev ? 'HEAD'). |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4133 |
overWriteBool ifTrue:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4134 |
argumentString := argumentString, ' -F' |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4135 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4136 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4137 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4138 |
[ |
1459
83c50df5be7f
Setting/deleting symbolic names
Stefan Vogel <sv@exept.de>
parents:
1457
diff
changeset
|
4139 |
self activityNotification:'setting symbolic name ', pathInRepository. |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4140 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4141 |
errorStream := '' writeStream. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4142 |
outStream := '' writeStream. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4143 |
|
1459
83c50df5be7f
Setting/deleting symbolic names
Stefan Vogel <sv@exept.de>
parents:
1457
diff
changeset
|
4144 |
result := self executeCVSCommand:('rtag ' , argumentString, ' ', symbolicName, ' ', pathInRepository) |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4145 |
module:moduleDir |
1459
83c50df5be7f
Setting/deleting symbolic names
Stefan Vogel <sv@exept.de>
parents:
1457
diff
changeset
|
4146 |
inDirectory:nil |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4147 |
log:true |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4148 |
outputTo:outStream |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4149 |
errorTo:errorStream. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4150 |
(result not or:[errorStream size ~~ 0]) ifTrue:[ |
1459
83c50df5be7f
Setting/deleting symbolic names
Stefan Vogel <sv@exept.de>
parents:
1457
diff
changeset
|
4151 |
SourceCodeManagerError raiseWith:errorStream contents errorString:' cvs tag failed: ', pathInRepository. |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4152 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4153 |
(outStream contents asStringCollection contains:[:eachLine| eachLine startsWithAnyOf:'WE']) ifTrue:[ |
1459
83c50df5be7f
Setting/deleting symbolic names
Stefan Vogel <sv@exept.de>
parents:
1457
diff
changeset
|
4154 |
SourceCodeManagerError raiseWith:outStream contents errorString:' cvs tag could not be set: ', pathInRepository. |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4155 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4156 |
] ensure:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4157 |
inStream notNil ifTrue:[inStream close]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4158 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4159 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4160 |
" |
1459
83c50df5be7f
Setting/deleting symbolic names
Stefan Vogel <sv@exept.de>
parents:
1457
diff
changeset
|
4161 |
self setSymbolicName:'stable' revision:nil overWrite:false path:'stx/libbasic/Array.st' |
83c50df5be7f
Setting/deleting symbolic names
Stefan Vogel <sv@exept.de>
parents:
1457
diff
changeset
|
4162 |
self setSymbolicName:'stable' revision:nil overWrite:true path:'stx/libbasic/Array.st' |
83c50df5be7f
Setting/deleting symbolic names
Stefan Vogel <sv@exept.de>
parents:
1457
diff
changeset
|
4163 |
self setSymbolicName:'stable' revision:nil overWrite:true path:'stx/libbasic/Array.st' |
83c50df5be7f
Setting/deleting symbolic names
Stefan Vogel <sv@exept.de>
parents:
1457
diff
changeset
|
4164 |
self setSymbolicName:'stable' revision:'1.1' overWrite:true path:'stx/libbasic/Array.st' |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4165 |
" |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4166 |
! |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4167 |
|
1362 | 4168 |
statusOf:clsOrNil fileName:classFileName directory:packageDir module:moduleDir |
4169 |
"return info about the status repository container. |
|
4170 |
Return nil on failure. |
|
4171 |
||
4172 |
The returned information is a structure (IdentityDictionary) |
|
4173 |
filled with: |
|
4174 |
#newestRevision -> the revisionString of the newest revision |
|
4175 |
||
4176 |
This is much faster than revisionLog info (especially, if there are many revisions), |
|
4177 |
and all we need is a classes newest version number. |
|
4178 |
" |
|
4179 |
||
4180 |
|tempDir fullName modulePath inStream line |
|
4181 |
info s msg| |
|
4182 |
||
4183 |
modulePath := moduleDir , '/' , packageDir. |
|
4184 |
fullName := modulePath , '/' , classFileName. |
|
4185 |
tempDir := self createTempDirectory:nil forModule:nil. |
|
4186 |
tempDir isNil ifTrue:[ |
|
4187 |
('CVSSourceCodeManager [error]: no tempDir - cannot extract log') errorPrintCR. |
|
4188 |
^ nil. |
|
4189 |
]. |
|
4190 |
||
4191 |
[ |
|
4192 |
self createEntryFor:fullName |
|
4193 |
module:moduleDir |
|
4194 |
in:(tempDir construct:modulePath) |
|
4195 |
revision:'1.1' |
|
4196 |
date:'dummy' |
|
4197 |
special:'' |
|
4198 |
overwrite:false. |
|
4199 |
||
4200 |
msg := 'fetching status info of '. |
|
4201 |
clsOrNil isNil ifTrue:[ |
|
4202 |
msg := msg , fullName. |
|
4203 |
] ifFalse:[ |
|
4204 |
msg := msg , clsOrNil name. |
|
4205 |
]. |
|
4206 |
self activityNotification:msg. |
|
4207 |
||
4208 |
inStream := self |
|
4209 |
executeCVSCommand:('status ' , fullName) |
|
4210 |
module:moduleDir |
|
4211 |
inDirectory:tempDir |
|
4212 |
log:true |
|
4213 |
pipe:true. |
|
4214 |
||
4215 |
inStream isNil ifTrue:[ |
|
4216 |
('CVSSourceCodeManager [error]: cannot open pipe to cvs log ', fullName) errorPrintCR. |
|
4217 |
^ nil |
|
4218 |
]. |
|
4219 |
||
4220 |
"/ |
|
4221 |
"/ read the commands pipe output and extract the container info |
|
4222 |
"/ |
|
4223 |
info := IdentityDictionary new. |
|
4224 |
[inStream atEnd] whileFalse:[ |
|
4225 |
line:= inStream nextLine. |
|
4226 |
line notNil ifTrue:[ |
|
4227 |
line := line withoutSeparators. |
|
4228 |
]. |
|
4229 |
line size > 0 ifTrue:[ |
|
4230 |
|gotIt i| |
|
4231 |
||
4232 |
gotIt := false. |
|
4233 |
#( |
|
4234 |
'Repository revision:' #newestRevision |
|
4235 |
) pairWiseDo:[:word :key | |
|
4236 |
gotIt ifFalse:[ |
|
4237 |
s := line restAfter:word withoutSeparators:true. |
|
4238 |
s notNil ifTrue:[ |
|
4239 |
i := s indexOfSeparator. |
|
4240 |
i ~~ 0 ifTrue:[ |
|
4241 |
s := s copyTo:i-1 |
|
4242 |
]. |
|
4243 |
info at:key put:s. |
|
4244 |
gotIt := true. |
|
4245 |
]. |
|
4246 |
] |
|
4247 |
]. |
|
4248 |
] |
|
4249 |
]. |
|
4250 |
info isEmpty ifTrue:[ |
|
4251 |
('CVSSourceCodeManager [warning]: no status for ', fullName) errorPrintCR. |
|
4252 |
^ nil |
|
4253 |
]. |
|
4254 |
] ensure:[ |
|
4255 |
inStream notNil ifTrue:[inStream close]. |
|
4256 |
tempDir recursiveRemove |
|
4257 |
]. |
|
4258 |
^ info |
|
4259 |
||
4260 |
" |
|
4261 |
SourceCodeManager statusOf:Array |
|
4262 |
SourceCodeManager statusOf:Array fileName:'Array.st' directory:'libbasic' module:'stx' |
|
4263 |
SourceCodeManager statusOf:Filename fileName:'Filename.st' directory:'libbasic' module:'stx' |
|
4264 |
SourceCodeManager statusOf:NewSystemBrowser fileName:'NewSystemBrowser.st' directory:'libtool' module:'stx' |
|
4265 |
" |
|
4266 |
! ! |
|
4267 |
||
4268 |
!CVSSourceCodeManager class methodsFor:'documentation'! |
|
4269 |
||
4270 |
version |
|
1481 | 4271 |
^ '$Header: /cvs/stx/stx/libbasic3/CVSSourceCodeManager.st,v 1.302 2006-03-31 10:17:13 stefan Exp $' |
1362 | 4272 |
! ! |
1170 | 4273 |
|
130 | 4274 |
CVSSourceCodeManager initialize! |