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