author | Claus Gittinger <cg@exept.de> |
Wed, 06 Dec 2017 12:32:54 +0100 | |
changeset 4289 | 6c076e9881d9 |
parent 4280 | f4fb6e5cd1fb |
child 4292 | edbabb3f6941 |
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 |
"{ Package: 'stx:libbasic3' }" |
|
13 |
||
3711 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
1362 | 16 |
AbstractSourceCodeManager subclass:#CVSSourceCodeManager |
2929
7eaac7d0dab5
added: #exeptsPublicSTXRepositoryModuleRoot
Claus Gittinger <cg@exept.de>
parents:
2928
diff
changeset
|
17 |
instanceVariableNames:'' |
4273 | 18 |
classVariableNames:'AuthorMap CMD_checkout CVSBranchPerPackage CVSCommandSemaphore |
19 |
CVSCommandTimeout CVSCommitOptions CVSExecutable CVSModuleRoots |
|
20 |
CVSRoot CVSTempDir CVSUpdateOptions DisabledModules RecentTags |
|
4055 | 21 |
RecentlyCheckedModulesAndPackages RemoteCVS' |
2929
7eaac7d0dab5
added: #exeptsPublicSTXRepositoryModuleRoot
Claus Gittinger <cg@exept.de>
parents:
2928
diff
changeset
|
22 |
poolDictionaries:'' |
7eaac7d0dab5
added: #exeptsPublicSTXRepositoryModuleRoot
Claus Gittinger <cg@exept.de>
parents:
2928
diff
changeset
|
23 |
category:'System-SourceCodeManagement' |
1362 | 24 |
! |
25 |
||
4144 | 26 |
VersionInfo subclass:#CVSVersionInfo |
4157 | 27 |
instanceVariableNames:'repositoryPathName timeZone changedLinesInfo' |
4144 | 28 |
classVariableNames:'' |
29 |
poolDictionaries:'' |
|
30 |
privateIn:CVSSourceCodeManager |
|
31 |
! |
|
32 |
||
1362 | 33 |
!CVSSourceCodeManager class methodsFor:'documentation'! |
34 |
||
35 |
copyright |
|
130 | 36 |
" |
37 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
807
f84a9377278e
Fix .stxCvsDummy / import stuff.
Stefan Vogel <sv@exept.de>
parents:
806
diff
changeset
|
38 |
All Rights Reserved |
130 | 39 |
|
40 |
This software is furnished under a license and may be used |
|
41 |
only in accordance with the terms of that license and with the |
|
42 |
inclusion of the above copyright notice. This software may not |
|
43 |
be provided or otherwise made available to, or used by, any |
|
44 |
other person. No title to or ownership of the software is |
|
45 |
hereby transferred. |
|
46 |
" |
|
1362 | 47 |
! |
48 |
||
49 |
documentation |
|
50 |
" |
|
51 |
SourceCodeManager which accesses the sourcecode through cvs. |
|
52 |
It requires the shell environment variable CVSROOT to be set |
|
53 |
to the top of the repository tree. (or alternatively, the CVSRoot |
|
54 |
variable being set by a private.rc file). |
|
4227 | 55 |
Under that top, for each module (especially the stx module itself), |
1362 | 56 |
a subdirectory containing that modules directories must exist. |
57 |
||
4227 | 58 |
If not specified otherwise, the module defaults to 'stx'. |
1362 | 59 |
If a class has its home in another module, it has to be compiled |
60 |
with a corresponding entry in the package string (see below). |
|
61 |
Within a module, classes are organized in classlibraries, and the corresponding |
|
62 |
source code is found in various subdirectories of CVSROOT. The directories |
|
63 |
name can also be provided by the package string - if not, it defaults to the |
|
64 |
libraries name. |
|
65 |
The package string controls all this, and is REQUIRED in order for the sourceCodeManager |
|
66 |
to be able to retrieve a classes source. |
|
67 |
The package strings format is: |
|
68 |
'...any infotext....(sourceCodeInfo)' |
|
69 |
the sourceCOdeInfo consists of multiple entries, separated by colons. |
|
70 |
The following formats are allowed: |
|
71 |
(libraryName) - module defaults to 'stx'; directory to the name of the library |
|
72 |
(foo/bar/x) - module defaults to 'stx'; dir is 'foo/bar/x'; library name defaults to x |
|
73 |
(module:directory:libname) - specifies all components |
|
74 |
The first formats are intermediate, for backward compatibility. We urge everyone |
|
75 |
to use the last format (by changing the Make.proto files and add a -P flag to |
|
76 |
the stc compiler flags (see libbasic/Make.proto as an example). |
|
77 |
||
78 |
Notice, that the sourceCodeManager is (currently) only consulted, if no |
|
79 |
source subdirectory exists, or no source file is found there. If it does exist, |
|
80 |
that one is supposed to contain an up-to-date version of the classes source |
|
81 |
(this is temporary - in the future the probe order will be reversed, trying |
|
82 |
the source repository first). |
|
83 |
The source directory is required for systems which do NO source code control. |
|
84 |
||
85 |
Setup: |
|
86 |
- make certain, that the commands 'cvs' and 'co' are available on your system. |
|
87 |
- add setup for the CVSROOT environment variable to your .bashrc / .login / .profile |
|
88 |
- Make certain that either no local source directory exists, or it is empty or it contains |
|
89 |
only source code for files NOT found in the repository (this will not be required in future versions). |
|
90 |
||
91 |
Caveat: |
|
3581 | 92 |
currently, the rcs container is accessed directly, since cvs mangles the file's ident-string and |
1362 | 93 |
thus does not correctly recreate the original file (all source is offset by some characters w.r.t. the |
94 |
compiled file). |
|
1736 | 95 |
Therefore, server-mode CVS is not supported. |
96 |
||
97 |
Comment: |
|
98 |
The code here is a copy-paste mess; it definitely needs some cleanup... |
|
1362 | 99 |
|
100 |
[class variables:] |
|
101 |
CVSTempDir <String | nil> where a directory tree is |
|
102 |
generated temporarily for checkin/checkout |
|
1407 | 103 |
(default is nil -> systems tmp-dir) |
1362 | 104 |
|
105 |
CVSRoot <String> the CVS root. Imported from the |
|
106 |
CVSROOT shell variable. |
|
107 |
||
108 |
RemoteCVS <Boolean> if true, remote CVS access is used |
|
109 |
(i.e. via a socket to a CVS server). |
|
110 |
if false, disk access is used; |
|
3948 | 111 |
files in CVSRoot must be accessible. |
1362 | 112 |
|
113 |
CVSWorkDirectory not yet supported/implemented. |
|
114 |
PLANNED: name of a directory hierarchy, |
|
115 |
which is kept in sync with the current |
|
116 |
version. |
|
117 |
||
118 |
CVSBinDir where the CVS commands are found |
|
119 |
||
120 |
CVSModuleRoots <Directory> per-module roots. |
|
121 |
If empty, or no entry is found for a |
|
122 |
module is found, CVSRoot is used. |
|
123 |
Otherwise, specifies a per-module CVSRoot. |
|
124 |
(allows multiple CVS hierarchies) |
|
125 |
||
126 |
[author:] |
|
127 |
Claus Gittinger |
|
128 |
||
129 |
[see also:] |
|
130 |
( cvs manual page :man: cvs ) |
|
131 |
( Coding style used in Smalltalk/X classes :html: programming/codingStyle.html ) |
|
132 |
" |
|
133 |
! |
|
134 |
||
135 |
examples |
|
136 |
" |
|
137 |
Default setup: |
|
138 |
This setup accesses all sources from a single repository: /files/CVS. |
|
139 |
Actually, this is the setup as used within eXept for development. |
|
140 |
||
141 |
CVSSourceCodeManager initializeForRepository:'/files/CVS'. |
|
142 |
||
143 |
||
144 |
Dual repository setup: |
|
145 |
This accesses all ST/X standard classes' source from the /files/CVS |
|
146 |
repository, while your private classes are created in and accessed from |
|
147 |
'/files/myCVS'. |
|
148 |
This setup is useful, if you need revision management on the |
|
149 |
ST/X standard classes as well as for your own classes. |
|
150 |
In order to do this, you should (manually) check in all ST/X classes |
|
151 |
into a private repository WHILE preserving the original revision numbers. |
|
152 |
A shell-procedure similar to: |
|
153 |
||
154 |
for i in lib*/*.st |
|
155 |
do |
|
156 |
id=`ident $i` |
|
157 |
set $id |
|
158 |
rev=$3 |
|
159 |
ci -r$rev <CVSDIR>/$i $i |
|
160 |
done |
|
161 |
||
162 |
should acomplish this. |
|
163 |
Now, that you have all ST/X files in your own repository (and with the |
|
164 |
original revision numbers), access is possible by defining CVSROOT |
|
165 |
as above. However, in order to have your own files being stored in |
|
166 |
another repository, you have to give a per-module repository. |
|
167 |
||
168 |
This defines the default repository (for your containers): |
|
169 |
||
170 |
CVSSourceCodeManager initializeForRepository:'/files/myCVS'. |
|
171 |
||
172 |
and this specifies a repository for all standard ST/X classes (in the stx module): |
|
173 |
||
174 |
CVSSourceCodeManager repositoryName:'/files/CVS' forModule:'stx' |
|
175 |
||
176 |
Dual repository setup for eXept customers with a full licence |
|
177 |
(these can access our in-house master repository, for convenient software update |
|
178 |
and uploading): |
|
179 |
All class sourcees under the 'stx' module (i.e. packageID is 'stx:*') can be accessed |
|
180 |
from the eXept cvs server (i.e. CVSROOT for them is :pserver:userName@exept.de:/files/CVS/stc). |
|
181 |
All local classes should be maintained in and accessed from a local cvs repository |
|
182 |
such as '/files/myCVS'. |
|
183 |
||
184 |
Then, tell the CVSSourceCodeManager about this; |
|
185 |
first the default repository: |
|
186 |
||
187 |
CVSSourceCodeManager initializeForRepository:'/files/myCVS'. |
|
188 |
||
189 |
and the repository for all standard ST/X classes (in the stx module): |
|
190 |
||
191 |
CVSSourceCodeManager repositoryName:':pserver:userName@exept.de:/files/CVS' forModule:'stx' |
|
192 |
" |
|
193 |
! ! |
|
194 |
||
195 |
!CVSSourceCodeManager class methodsFor:'initialization'! |
|
196 |
||
3411 | 197 |
addExeptsPrivateRepositoryToModuleRoots |
198 |
CVSModuleRoots at:'stx' put:(self exeptsPrivateSTXRepositoryModuleRoot). |
|
199 |
CVSModuleRoots at:'exept' put:(self exeptsPrivateSTXRepositoryModuleRoot). |
|
200 |
! |
|
201 |
||
2928
34adae678b19
added: #addExeptsPublicRepositoryToModuleRoots
Claus Gittinger <cg@exept.de>
parents:
2927
diff
changeset
|
202 |
addExeptsPublicRepositoryToModuleRoots |
2929
7eaac7d0dab5
added: #exeptsPublicSTXRepositoryModuleRoot
Claus Gittinger <cg@exept.de>
parents:
2928
diff
changeset
|
203 |
CVSModuleRoots at:'stx' put:(self exeptsPublicSTXRepositoryModuleRoot) |
7eaac7d0dab5
added: #exeptsPublicSTXRepositoryModuleRoot
Claus Gittinger <cg@exept.de>
parents:
2928
diff
changeset
|
204 |
! |
7eaac7d0dab5
added: #exeptsPublicSTXRepositoryModuleRoot
Claus Gittinger <cg@exept.de>
parents:
2928
diff
changeset
|
205 |
|
3411 | 206 |
exeptsPrivateSTXRepositoryModuleRoot |
4048 | 207 |
"the actual stx repository as used within exept. |
208 |
Only valid within exept" |
|
4227 | 209 |
|
3411 | 210 |
^ ':pserver:',(OperatingSystem getLoginName),'@cvs.bh.exept.de:/cvs/stx'. |
211 |
! |
|
212 |
||
2929
7eaac7d0dab5
added: #exeptsPublicSTXRepositoryModuleRoot
Claus Gittinger <cg@exept.de>
parents:
2928
diff
changeset
|
213 |
exeptsPublicSTXRepositoryModuleRoot |
4048 | 214 |
"the public repository, which is a read-only copy of the exept-internal repository. |
4227 | 215 |
Updated every night." |
216 |
||
2929
7eaac7d0dab5
added: #exeptsPublicSTXRepositoryModuleRoot
Claus Gittinger <cg@exept.de>
parents:
2928
diff
changeset
|
217 |
^ ':pserver:cvs@cvs.smalltalk-x.de:/cvs/stx'. |
2928
34adae678b19
added: #addExeptsPublicRepositoryToModuleRoots
Claus Gittinger <cg@exept.de>
parents:
2927
diff
changeset
|
218 |
! |
34adae678b19
added: #addExeptsPublicRepositoryToModuleRoots
Claus Gittinger <cg@exept.de>
parents:
2927
diff
changeset
|
219 |
|
1362 | 220 |
forgetDisabledModules |
221 |
DisabledModules := nil. |
|
222 |
! |
|
223 |
||
224 |
initCommands |
|
225 |
CMD_checkout := 'cvs -n checkout %1'. |
|
1874
30d39369c9bc
changes for compare-project functionality
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
226 |
|
30d39369c9bc
changes for compare-project functionality
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
227 |
"Modified: / 13-10-2006 / 00:44:13 / cg" |
1362 | 228 |
! |
229 |
||
230 |
initialize |
|
231 |
"check if $CVSROOT (the shell variable) or CVSRoot (the smalltalk global) |
|
232 |
is set, check if cvs commands can be executed and install myself as the |
|
233 |
SourceCodeManager if this works out ok" |
|
234 |
||
4047 | 235 |
| s f top | |
236 |
||
237 |
CVSCommandSemaphore isNil ifTrue:[ |
|
238 |
CVSCommandSemaphore := (Semaphore new:10) name:'Concurrent CVS Commands'. "/ at most 10 cvs activities concurrently |
|
239 |
]. |
|
240 |
CVSCommitOptions isNil ifTrue:[ |
|
241 |
CVSCommitOptions := ''. |
|
242 |
CVSUpdateOptions := ''. |
|
243 |
]. |
|
244 |
RemoteCVS isNil ifTrue:[ |
|
245 |
RemoteCVS := true. |
|
246 |
]. |
|
1362 | 247 |
DisabledModules := nil. |
1481 | 248 |
CVSModuleRoots isNil ifTrue:[ |
249 |
CVSModuleRoots := Dictionary new. |
|
250 |
]. |
|
3411 | 251 |
"/ self possiblyAddExeptsPrivateRepositoryToModuleRoots. |
1481 | 252 |
|
1362 | 253 |
"/ |
254 |
"/ if CVSROOT is non-empty and both cvs and co are available |
|
255 |
"/ as commands, assume this system uses a cvs source code management. |
|
256 |
"/ |
|
2098 | 257 |
CVSRoot isNil ifTrue:[ |
1407 | 258 |
CVSRoot := OperatingSystem getEnvironment:'CVSROOT'. |
1929 | 259 |
CVSRoot isNil ifTrue:[ |
1407 | 260 |
"disabled since $CVSROOT is not set" |
261 |
^ self |
|
262 |
]. |
|
1362 | 263 |
]. |
264 |
||
265 |
UseWorkTree := false. |
|
266 |
||
267 |
"/ |
|
268 |
"/ check if there is an stx directory there |
|
269 |
"/ |
|
4227 | 270 |
((f := CVSRoot asFilename) isDirectory |
1362 | 271 |
and:[(top := f construct:'stx') isDirectory |
272 |
and:[top isReadable]]) ifTrue:[ |
|
273 |
RemoteCVS := false |
|
274 |
]. |
|
275 |
||
2726 | 276 |
DefaultManager isNil ifTrue:[ |
4227 | 277 |
DefaultManager := self. |
2726 | 278 |
]. |
1362 | 279 |
|
280 |
('CVSSourceCodeManager [info]: repository CVSROOT is ''' , CVSRoot , '''.') infoPrintCR. |
|
1808
d3e667543b00
use CVSExecutable instead of CVSBindir
Claus Gittinger <cg@exept.de>
parents:
1803
diff
changeset
|
281 |
RemoteCVS ifFalse:[ |
d3e667543b00
use CVSExecutable instead of CVSBindir
Claus Gittinger <cg@exept.de>
parents:
1803
diff
changeset
|
282 |
'CVSSourceCodeManager [info]: using faster local CVS mode' infoPrintCR. |
1362 | 283 |
^ self |
284 |
]. |
|
285 |
||
286 |
"/ |
|
287 |
"/ optionally set the WorkTreeDirectoryName from $STX_WORKTREE; |
|
288 |
"/ if non-nil, a working tree is kept there |
|
289 |
"/ and updated/commited files are not removed. |
|
4227 | 290 |
"/ If you use a regular (make-) tree, |
1362 | 291 |
"/ set WorkTreeDirectoryName (or the environment variable) to that. |
292 |
"/ |
|
293 |
"/ this is not yet finished. |
|
294 |
"/ |
|
295 |
s := OperatingSystem getEnvironment:'STX_WORKTREE'. |
|
296 |
s notNil ifTrue:[ |
|
297 |
WorkTreeDirectoryName := s. |
|
298 |
UseWorkTree := true. |
|
299 |
] |
|
300 |
||
301 |
" |
|
302 |
AbstractSourceCodeManager initialize |
|
303 |
CVSSourceCodeManager initialize |
|
304 |
" |
|
305 |
||
306 |
" |
|
307 |
CVSRoot := '/files/CVS'. |
|
308 |
AbstractSourceCodeManager initialize. |
|
309 |
CVSSourceCodeManager initialize. |
|
310 |
" |
|
311 |
||
2104 | 312 |
" |
313 |
CVSRoot := ':pserver:cg@cvs.bh.exept.de:/cvs/stx'. |
|
314 |
AbstractSourceCodeManager initialize. |
|
315 |
CVSSourceCodeManager initialize. |
|
316 |
SourceCodeManager := CVSSourceCodeManager. |
|
317 |
" |
|
318 |
||
1808
d3e667543b00
use CVSExecutable instead of CVSBindir
Claus Gittinger <cg@exept.de>
parents:
1803
diff
changeset
|
319 |
"Created: / 04-11-1995 / 19:14:38 / cg" |
d3e667543b00
use CVSExecutable instead of CVSBindir
Claus Gittinger <cg@exept.de>
parents:
1803
diff
changeset
|
320 |
"Modified: / 19-12-1995 / 14:25:46 / stefan" |
2814 | 321 |
"Modified: / 20-03-2012 / 19:06:35 / cg" |
1362 | 322 |
! |
323 |
||
324 |
initializeForRepository:aDirectoryName |
|
325 |
"set the global CVSROOT directory (i.e. the repositories name). |
|
4227 | 326 |
And reinitialize. |
1362 | 327 |
Can be used from the launcher to change/configure the repository." |
328 |
||
329 |
self repositoryName:aDirectoryName. |
|
330 |
AbstractSourceCodeManager initialize. |
|
4182 | 331 |
self initialize. |
1362 | 332 |
|
333 |
" |
|
334 |
CVSSourceCodeManager initializeForRepository:'/files/CVS' |
|
335 |
CVSSourceCodeManager initializeForRepository:'ibm:/files/CVS' |
|
336 |
" |
|
337 |
||
338 |
"Created: / 13.8.1997 / 17:20:57 / cg" |
|
339 |
"Modified: / 25.9.1997 / 12:28:05 / stefan" |
|
340 |
"Modified: / 2.11.1997 / 17:08:27 / cg" |
|
3411 | 341 |
! |
342 |
||
343 |
possiblyAddExeptsPrivateRepositoryToModuleRoots |
|
344 |
"/ for exept's convenience: if this is a host in our domain, |
|
345 |
"/ add the exept repository. |
|
346 |
||
4182 | 347 |
((OperatingSystem getDomainName endsWith:'exept.de') or:[ |
348 |
OperatingSystem getNetworkAddresses contains:[:eachSocketAddress| eachSocketAddress hostAddress startsWith: #[172 23 1]]] |
|
349 |
) ifTrue:[ |
|
350 |
self addExeptsPrivateRepositoryToModuleRoots. |
|
3411 | 351 |
]. |
1362 | 352 |
! ! |
353 |
||
354 |
!CVSSourceCodeManager class methodsFor:'accessing'! |
|
355 |
||
4273 | 356 |
CVSBranchPerPackage |
357 |
^ CVSBranchPerPackage |
|
358 |
||
359 |
"Created: / 04-12-2017 / 17:30:34 / cg" |
|
360 |
! |
|
361 |
||
2011
940166eac0f5
+CVSUpdateOptions and CVSCommitOptions to allow for additional flags,
Claus Gittinger <cg@exept.de>
parents:
2010
diff
changeset
|
362 |
CVSCommitOptions |
940166eac0f5
+CVSUpdateOptions and CVSCommitOptions to allow for additional flags,
Claus Gittinger <cg@exept.de>
parents:
2010
diff
changeset
|
363 |
^ CVSCommitOptions ? '' |
940166eac0f5
+CVSUpdateOptions and CVSCommitOptions to allow for additional flags,
Claus Gittinger <cg@exept.de>
parents:
2010
diff
changeset
|
364 |
! |
940166eac0f5
+CVSUpdateOptions and CVSCommitOptions to allow for additional flags,
Claus Gittinger <cg@exept.de>
parents:
2010
diff
changeset
|
365 |
|
940166eac0f5
+CVSUpdateOptions and CVSCommitOptions to allow for additional flags,
Claus Gittinger <cg@exept.de>
parents:
2010
diff
changeset
|
366 |
CVSCommitOptions:aString |
940166eac0f5
+CVSUpdateOptions and CVSCommitOptions to allow for additional flags,
Claus Gittinger <cg@exept.de>
parents:
2010
diff
changeset
|
367 |
CVSCommitOptions := aString. |
940166eac0f5
+CVSUpdateOptions and CVSCommitOptions to allow for additional flags,
Claus Gittinger <cg@exept.de>
parents:
2010
diff
changeset
|
368 |
! |
940166eac0f5
+CVSUpdateOptions and CVSCommitOptions to allow for additional flags,
Claus Gittinger <cg@exept.de>
parents:
2010
diff
changeset
|
369 |
|
940166eac0f5
+CVSUpdateOptions and CVSCommitOptions to allow for additional flags,
Claus Gittinger <cg@exept.de>
parents:
2010
diff
changeset
|
370 |
CVSUpdateOptions |
940166eac0f5
+CVSUpdateOptions and CVSCommitOptions to allow for additional flags,
Claus Gittinger <cg@exept.de>
parents:
2010
diff
changeset
|
371 |
^ CVSUpdateOptions ? '' |
940166eac0f5
+CVSUpdateOptions and CVSCommitOptions to allow for additional flags,
Claus Gittinger <cg@exept.de>
parents:
2010
diff
changeset
|
372 |
! |
940166eac0f5
+CVSUpdateOptions and CVSCommitOptions to allow for additional flags,
Claus Gittinger <cg@exept.de>
parents:
2010
diff
changeset
|
373 |
|
940166eac0f5
+CVSUpdateOptions and CVSCommitOptions to allow for additional flags,
Claus Gittinger <cg@exept.de>
parents:
2010
diff
changeset
|
374 |
CVSUpdateOptions:aString |
940166eac0f5
+CVSUpdateOptions and CVSCommitOptions to allow for additional flags,
Claus Gittinger <cg@exept.de>
parents:
2010
diff
changeset
|
375 |
CVSUpdateOptions := aString. |
940166eac0f5
+CVSUpdateOptions and CVSCommitOptions to allow for additional flags,
Claus Gittinger <cg@exept.de>
parents:
2010
diff
changeset
|
376 |
! |
940166eac0f5
+CVSUpdateOptions and CVSCommitOptions to allow for additional flags,
Claus Gittinger <cg@exept.de>
parents:
2010
diff
changeset
|
377 |
|
1809 | 378 |
cvsBinDirectory:ignoredString |
379 |
"ignored - for backward compatibility (to read old settings files)" |
|
380 |
||
381 |
"Created: / 21-09-2006 / 17:26:43 / cg" |
|
382 |
! |
|
383 |
||
2697
64b38153013c
cvsCommandTimeout can be set in settings dialog
Claus Gittinger <cg@exept.de>
parents:
2696
diff
changeset
|
384 |
cvsCommandTimeout |
64b38153013c
cvsCommandTimeout can be set in settings dialog
Claus Gittinger <cg@exept.de>
parents:
2696
diff
changeset
|
385 |
^ CVSCommandTimeout ? ("360" 120 seconds) |
64b38153013c
cvsCommandTimeout can be set in settings dialog
Claus Gittinger <cg@exept.de>
parents:
2696
diff
changeset
|
386 |
|
64b38153013c
cvsCommandTimeout can be set in settings dialog
Claus Gittinger <cg@exept.de>
parents:
2696
diff
changeset
|
387 |
"Modified (comment): / 08-01-2012 / 19:02:44 / cg" |
64b38153013c
cvsCommandTimeout can be set in settings dialog
Claus Gittinger <cg@exept.de>
parents:
2696
diff
changeset
|
388 |
! |
64b38153013c
cvsCommandTimeout can be set in settings dialog
Claus Gittinger <cg@exept.de>
parents:
2696
diff
changeset
|
389 |
|
64b38153013c
cvsCommandTimeout can be set in settings dialog
Claus Gittinger <cg@exept.de>
parents:
2696
diff
changeset
|
390 |
cvsCommandTimeout:aTimeDuration |
64b38153013c
cvsCommandTimeout can be set in settings dialog
Claus Gittinger <cg@exept.de>
parents:
2696
diff
changeset
|
391 |
CVSCommandTimeout := aTimeDuration asTimeDuration. |
64b38153013c
cvsCommandTimeout can be set in settings dialog
Claus Gittinger <cg@exept.de>
parents:
2696
diff
changeset
|
392 |
|
64b38153013c
cvsCommandTimeout can be set in settings dialog
Claus Gittinger <cg@exept.de>
parents:
2696
diff
changeset
|
393 |
"Created: / 08-01-2012 / 19:36:01 / cg" |
64b38153013c
cvsCommandTimeout can be set in settings dialog
Claus Gittinger <cg@exept.de>
parents:
2696
diff
changeset
|
394 |
! |
64b38153013c
cvsCommandTimeout can be set in settings dialog
Claus Gittinger <cg@exept.de>
parents:
2696
diff
changeset
|
395 |
|
1808
d3e667543b00
use CVSExecutable instead of CVSBindir
Claus Gittinger <cg@exept.de>
parents:
1803
diff
changeset
|
396 |
cvsExecutable |
d3e667543b00
use CVSExecutable instead of CVSBindir
Claus Gittinger <cg@exept.de>
parents:
1803
diff
changeset
|
397 |
"return the name of the cvs executable." |
d3e667543b00
use CVSExecutable instead of CVSBindir
Claus Gittinger <cg@exept.de>
parents:
1803
diff
changeset
|
398 |
|
1990
69b3fcc2f7f6
#cvsExecutable answers the default cvs command
Stefan Vogel <sv@exept.de>
parents:
1989
diff
changeset
|
399 |
^ CVSExecutable ? 'cvs' |
1808
d3e667543b00
use CVSExecutable instead of CVSBindir
Claus Gittinger <cg@exept.de>
parents:
1803
diff
changeset
|
400 |
|
d3e667543b00
use CVSExecutable instead of CVSBindir
Claus Gittinger <cg@exept.de>
parents:
1803
diff
changeset
|
401 |
"Created: / 21-09-2006 / 15:31:12 / cg" |
1362 | 402 |
! |
403 |
||
1808
d3e667543b00
use CVSExecutable instead of CVSBindir
Claus Gittinger <cg@exept.de>
parents:
1803
diff
changeset
|
404 |
cvsExecutable:aString |
d3e667543b00
use CVSExecutable instead of CVSBindir
Claus Gittinger <cg@exept.de>
parents:
1803
diff
changeset
|
405 |
"set the name of the cvs executable." |
1362 | 406 |
|
1829 | 407 |
aString isEmptyOrNil ifTrue:[ |
1808
d3e667543b00
use CVSExecutable instead of CVSBindir
Claus Gittinger <cg@exept.de>
parents:
1803
diff
changeset
|
408 |
CVSExecutable := nil |
4227 | 409 |
] ifFalse:[ |
1808
d3e667543b00
use CVSExecutable instead of CVSBindir
Claus Gittinger <cg@exept.de>
parents:
1803
diff
changeset
|
410 |
CVSExecutable := aString. |
1362 | 411 |
]. |
1808
d3e667543b00
use CVSExecutable instead of CVSBindir
Claus Gittinger <cg@exept.de>
parents:
1803
diff
changeset
|
412 |
|
d3e667543b00
use CVSExecutable instead of CVSBindir
Claus Gittinger <cg@exept.de>
parents:
1803
diff
changeset
|
413 |
"Created: / 21-09-2006 / 15:31:59 / cg" |
d3e667543b00
use CVSExecutable instead of CVSBindir
Claus Gittinger <cg@exept.de>
parents:
1803
diff
changeset
|
414 |
"Modified: / 21-09-2006 / 16:41:33 / cg" |
1362 | 415 |
! |
416 |
||
1407 | 417 |
cvsTmpDirectory |
418 |
"return the name of the tmp repository. |
|
2721 | 419 |
That's the directory, where temporary files are created for checkin/checkout. |
3274 | 420 |
If nil, a directory under the system's default tempDirectory is used." |
421 |
||
422 |
|d| |
|
423 |
||
424 |
CVSTempDir notNil ifTrue:[^ CVSTempDir]. |
|
425 |
d := Filename tempDirectory / 'stx_cvs'. |
|
426 |
d exists ifFalse:[ |
|
427 |
d recursiveMakeDirectory. |
|
428 |
]. |
|
429 |
^ d pathName |
|
1407 | 430 |
|
431 |
" |
|
432 |
CVSTempDir := nil |
|
433 |
" |
|
2721 | 434 |
|
2921 | 435 |
"Modified (comment): / 24-09-2012 / 11:09:38 / cg" |
1407 | 436 |
! |
437 |
||
438 |
cvsTmpDirectory:aPathNameString |
|
439 |
"set the name of the tmp repository. |
|
2721 | 440 |
That's the directory, where temporary files are created for checkin/checkout. |
2921 | 441 |
If nil, the system's default tempDirectory is used." |
1407 | 442 |
|
443 |
CVSTempDir := aPathNameString |
|
2721 | 444 |
|
2921 | 445 |
"Modified (comment): / 24-09-2012 / 11:09:34 / cg" |
1407 | 446 |
! |
447 |
||
1481 | 448 |
knownModules |
449 |
"return the modules, we currently know" |
|
450 |
||
2686 | 451 |
CVSModuleRoots isEmptyOrNil ifTrue:[^ #() ]. |
452 |
^ CVSModuleRoots keys |
|
453 |
||
454 |
"Modified: / 26-12-2011 / 00:49:03 / cg" |
|
1481 | 455 |
! |
456 |
||
1482 | 457 |
knownRepositories |
458 |
"return the modules, we currently know" |
|
459 |
||
460 |
^ CVSModuleRoots values copyWith:CVSRoot |
|
461 |
! |
|
462 |
||
3292 | 463 |
recentTag |
464 |
"a place to remember recently set tags (to share between File and SystemBrowser)" |
|
465 |
||
3848 | 466 |
^ RecentTags isEmptyOrNil ifTrue:[nil] ifFalse:[RecentTags first]. |
3620 | 467 |
|
468 |
" |
|
469 |
self recentTag |
|
470 |
" |
|
3292 | 471 |
! |
472 |
||
473 |
recentTag:aString |
|
474 |
"a place to remember recently set tags (to share between File and SystemBrowser)" |
|
475 |
||
4102 | 476 |
aString isEmpty ifTrue:[ |
477 |
^ self. |
|
478 |
]. |
|
3620 | 479 |
RecentTags isNil ifTrue:[ |
480 |
RecentTags := OrderedCollection new. |
|
481 |
]. |
|
482 |
RecentTags remove:aString ifAbsent:[]. |
|
483 |
RecentTags addFirst:aString. |
|
484 |
RecentTags size > 10 ifTrue:[ RecentTags removeLast]. |
|
485 |
! |
|
486 |
||
487 |
recentTags |
|
488 |
"a place to remember recently set tags (to share between File and SystemBrowser)" |
|
489 |
||
490 |
^ RecentTags |
|
3292 | 491 |
! |
492 |
||
2568 | 493 |
repositoryForPackage:packageId |
494 |
"superclass AbstractSourceCodeManager class says that I am responsible to implement this method" |
|
495 |
||
496 |
^self getCVSROOTForModule: ( packageId upTo:$:) |
|
497 |
||
498 |
"Modified: / 10-10-2011 / 19:38:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
499 |
! |
|
500 |
||
1730 | 501 |
repositoryInfoPerModule |
502 |
"return the dictionary, which associates CVSRoots to module names. |
|
503 |
If no entry is contained in this dictionary for some module, |
|
504 |
the default cvsRoot (CVSRoot) will be used." |
|
505 |
||
506 |
^ CVSModuleRoots ? #() |
|
507 |
! |
|
508 |
||
509 |
repositoryInfoPerModule:aDictionary |
|
510 |
"set the dictionary, which associates CVSRoots to module names. |
|
511 |
If no entry is contained in this dictionary for some module, |
|
512 |
the default cvsRoot (CVSRoot) will be used." |
|
513 |
||
514 |
CVSModuleRoots := aDictionary |
|
1526 | 515 |
! |
516 |
||
1362 | 517 |
repositoryName |
518 |
"return the name of the global repository. |
|
519 |
This is used, if no per-module repository is defined." |
|
520 |
||
521 |
^ CVSRoot |
|
522 |
||
523 |
"Created: 14.9.1996 / 13:22:05 / cg" |
|
524 |
"Modified: 19.9.1997 / 06:12:02 / cg" |
|
525 |
! |
|
526 |
||
527 |
repositoryName:aDirectoryName |
|
528 |
"set the name of the repository; |
|
2648 | 529 |
that's the name of the global CVSROOT directory, which is used |
1362 | 530 |
if no specific repository was defined for a module. |
531 |
Can be used from an rc-script, to override the CVSROOT shell |
|
532 |
variable setting." |
|
533 |
||
534 |
DisabledModules := nil. |
|
535 |
CVSRoot := aDirectoryName. |
|
536 |
||
2648 | 537 |
"Created: / 14-09-1996 / 13:22:24 / cg" |
538 |
"Modified: / 19-09-1997 / 06:10:31 / cg" |
|
539 |
"Modified (comment): / 21-12-2011 / 14:54:15 / cg" |
|
1362 | 540 |
! |
541 |
||
542 |
repositoryName:aRepositoryName forModule:aModuleName |
|
543 |
"set the CVSROOT directory which provides the sources for all |
|
544 |
classes in a particular module. |
|
545 |
This can be used from an rc-script, to specify a repository |
|
546 |
for a particular module. |
|
547 |
If left unspecified, the global (i.e. fallBack) repository is used." |
|
548 |
||
549 |
DisabledModules := nil. |
|
550 |
CVSModuleRoots at:aModuleName put:aRepositoryName |
|
551 |
||
552 |
"Modified: 19.9.1997 / 06:09:40 / cg" |
|
553 |
! |
|
554 |
||
555 |
repositoryNameForModule:aModuleName |
|
556 |
"return the CVSROOT directory which provides the sources for all |
|
557 |
classes in a particular module. |
|
558 |
Nil is returned for unspecified moduleRoots; in this case, |
|
559 |
the global (i.e. fallBack) repository will be used for source access." |
|
560 |
||
561 |
^ CVSModuleRoots at:aModuleName ifAbsent:nil. |
|
562 |
||
563 |
"Modified: 19.9.1997 / 06:09:40 / cg" |
|
564 |
"Created: 19.9.1997 / 06:13:06 / cg" |
|
565 |
! |
|
566 |
||
2593 | 567 |
repositoryNameForPackage:packageId |
568 |
"superclass AbstractSourceCodeManager class says that I am responsible to implement this method" |
|
569 |
||
2671 | 570 |
^ self getCVSROOTForModule:(packageId upTo:$: ) |
571 |
||
572 |
"Created: / 10-10-2011 / 19:44:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
573 |
"Modified (format): / 21-12-2011 / 23:03:29 / cg" |
|
2593 | 574 |
! |
575 |
||
1362 | 576 |
repositoryNamesPerModule |
2079 | 577 |
<resource: #obsolete> |
1362 | 578 |
"return the dictionary, which associates CVSRoots to module names. |
579 |
If no entry is contained in this dictionary for some module, |
|
580 |
the default cvsRoot (CVSRoot) will be used." |
|
581 |
||
1730 | 582 |
self obsoleteMethodWarning:'use repositoryInfoPerModule'. |
1481 | 583 |
^ CVSModuleRoots |
1362 | 584 |
! |
585 |
||
586 |
repositoryNamesPerModule:aDictionary |
|
2079 | 587 |
<resource: #obsolete> |
1362 | 588 |
"set the dictionary, which associates CVSRoots to module names. |
589 |
If no entry is contained in this dictionary for some module, |
|
590 |
the default cvsRoot (CVSRoot) will be used." |
|
591 |
||
1730 | 592 |
self obsoleteMethodWarning:'use repositoryInfoPerModule:'. |
1362 | 593 |
CVSModuleRoots := aDictionary |
2568 | 594 |
! ! |
595 |
||
596 |
!CVSSourceCodeManager class methodsFor:'basic administration'! |
|
597 |
||
598 |
createContainerFor:aClass inModule:moduleName directory:dirName container:fileName |
|
599 |
"create a new container & check into it an initial version of aClass" |
|
600 |
||
601 |
^ self shouldImplement |
|
1362 | 602 |
! ! |
603 |
||
1861
ee2942e14d27
New. #changeCVSRoot:inDirectoryTree:
Stefan Vogel <sv@exept.de>
parents:
1859
diff
changeset
|
604 |
!CVSSourceCodeManager class methodsFor:'misc operations'! |
ee2942e14d27
New. #changeCVSRoot:inDirectoryTree:
Stefan Vogel <sv@exept.de>
parents:
1859
diff
changeset
|
605 |
|
3324 | 606 |
authorMappingFor:authorName |
607 |
"allows for author names to be mapped on the fly |
|
608 |
when retrieving a revisionLog or other statistics. |
|
609 |
Useful when a login name is changed, and you still want to |
|
610 |
create reasonable logs" |
|
611 |
||
612 |
AuthorMap isNil ifTrue:[ ^ authorName ]. |
|
613 |
^ AuthorMap at:authorName ifAbsent:[ authorName ]. |
|
614 |
||
615 |
" |
|
616 |
AuthorMap := Dictionary new |
|
617 |
at:'claus' put:'cg'; |
|
618 |
yourself. |
|
619 |
" |
|
620 |
! |
|
621 |
||
1861
ee2942e14d27
New. #changeCVSRoot:inDirectoryTree:
Stefan Vogel <sv@exept.de>
parents:
1859
diff
changeset
|
622 |
changeCVSRoot:newRootString inDirectoryTree:aDirectoryFilename |
2104 | 623 |
"WARNING: read and understand before executing !! |
624 |
Change the CVS root to newRootString (something like:':pserver:user@cvs.bh.exept.de:/cvs/stx'). |
|
2136
a927ffd1c82a
changed: #changeCVSRoot:inDirectoryTree:
Claus Gittinger <cg@exept.de>
parents:
2127
diff
changeset
|
625 |
This is done by rewriting all files named CVS/Root below the given path. |
1861
ee2942e14d27
New. #changeCVSRoot:inDirectoryTree:
Stefan Vogel <sv@exept.de>
parents:
1859
diff
changeset
|
626 |
aDirectoryFilename is recursively descended" |
ee2942e14d27
New. #changeCVSRoot:inDirectoryTree:
Stefan Vogel <sv@exept.de>
parents:
1859
diff
changeset
|
627 |
|
ee2942e14d27
New. #changeCVSRoot:inDirectoryTree:
Stefan Vogel <sv@exept.de>
parents:
1859
diff
changeset
|
628 |
aDirectoryFilename asFilename allDirectoriesDo:[:eachDirectoryName| |
ee2942e14d27
New. #changeCVSRoot:inDirectoryTree:
Stefan Vogel <sv@exept.de>
parents:
1859
diff
changeset
|
629 |
eachDirectoryName baseName = 'CVS' ifTrue:[ |
2136
a927ffd1c82a
changed: #changeCVSRoot:inDirectoryTree:
Claus Gittinger <cg@exept.de>
parents:
2127
diff
changeset
|
630 |
self activityNotification:eachDirectoryName pathName. |
1861
ee2942e14d27
New. #changeCVSRoot:inDirectoryTree:
Stefan Vogel <sv@exept.de>
parents:
1859
diff
changeset
|
631 |
(eachDirectoryName construct:'Root') writeStream |
ee2942e14d27
New. #changeCVSRoot:inDirectoryTree:
Stefan Vogel <sv@exept.de>
parents:
1859
diff
changeset
|
632 |
nextPutLine:newRootString; |
ee2942e14d27
New. #changeCVSRoot:inDirectoryTree:
Stefan Vogel <sv@exept.de>
parents:
1859
diff
changeset
|
633 |
close. |
ee2942e14d27
New. #changeCVSRoot:inDirectoryTree:
Stefan Vogel <sv@exept.de>
parents:
1859
diff
changeset
|
634 |
]. |
ee2942e14d27
New. #changeCVSRoot:inDirectoryTree:
Stefan Vogel <sv@exept.de>
parents:
1859
diff
changeset
|
635 |
]. |
2136
a927ffd1c82a
changed: #changeCVSRoot:inDirectoryTree:
Claus Gittinger <cg@exept.de>
parents:
2127
diff
changeset
|
636 |
self activityNotification:nil. |
1861
ee2942e14d27
New. #changeCVSRoot:inDirectoryTree:
Stefan Vogel <sv@exept.de>
parents:
1859
diff
changeset
|
637 |
|
1962 | 638 |
"OperatingSystem getLoginName |
639 |
self |
|
1963 | 640 |
changeCVSRoot:':pserver:',OperatingSystem getLoginName,'@cvs.bh.exept.de:/cvs/stx' |
641 |
inDirectoryTree:'../../../stx' |
|
1962 | 642 |
|
643 |
self |
|
1963 | 644 |
changeCVSRoot:':pserver:',OperatingSystem getLoginName,'@cvs.bh.exept.de:/cvs/stx' |
645 |
inDirectoryTree:'..\..\..\exept' |
|
646 |
||
647 |
self |
|
648 |
changeCVSRoot:':pserver:',OperatingSystem getLoginName,'@cvs.bh.exept.de:/cvs/stx' |
|
649 |
inDirectoryTree:'..\..\..\cg' |
|
1861
ee2942e14d27
New. #changeCVSRoot:inDirectoryTree:
Stefan Vogel <sv@exept.de>
parents:
1859
diff
changeset
|
650 |
" |
ee2942e14d27
New. #changeCVSRoot:inDirectoryTree:
Stefan Vogel <sv@exept.de>
parents:
1859
diff
changeset
|
651 |
! ! |
ee2942e14d27
New. #changeCVSRoot:inDirectoryTree:
Stefan Vogel <sv@exept.de>
parents:
1859
diff
changeset
|
652 |
|
1362 | 653 |
!CVSSourceCodeManager class methodsFor:'private'! |
654 |
||
655 |
checkOut:relativeFilename module:moduleDir in:tempdir |
|
656 |
"checkout realtiveFilename in tempdir" |
|
657 |
||
658 |
|cmd| |
|
659 |
||
660 |
cmd := 'checkout -l ' , relativeFilename. |
|
661 |
^ self |
|
662 |
executeCVSCommand:cmd |
|
663 |
module:moduleDir |
|
664 |
inDirectory:tempdir name |
|
665 |
log:false |
|
666 |
||
667 |
||
668 |
" |
|
3580 | 669 |
self checkOut:'libbasic/Integer.st' module:'stx' in:'/tmp' asFilename |
1362 | 670 |
" |
671 |
||
672 |
"Created: / 18.1.2000 / 20:30:01 / cg" |
|
673 |
"Modified: / 18.1.2000 / 20:35:06 / cg" |
|
674 |
! |
|
675 |
||
676 |
checkinTroubleDialog:title message:message log:log abortable:abortable option:optionTitle |
|
677 |
"trouble checking in - open a dialog" |
|
678 |
||
679 |
^ self |
|
680 |
checkinTroubleDialog:title |
|
681 |
message:message |
|
682 |
log:log |
|
683 |
abortable:abortable |
|
684 |
option:optionTitle |
|
685 |
option2:nil |
|
686 |
||
687 |
"Created: 10.12.1995 / 17:34:33 / cg" |
|
688 |
"Modified: 12.9.1996 / 02:39:06 / cg" |
|
689 |
! |
|
690 |
||
691 |
checkinTroubleDialog:title message:message log:log abortable:abortable option:optionTitle option2:optionTitle2 |
|
692 |
^self |
|
693 |
checkinTroubleDialog:title |
|
694 |
message:message |
|
695 |
log:log |
|
696 |
abortable:abortable |
|
697 |
option:optionTitle |
|
698 |
option2:optionTitle2 |
|
699 |
option3:nil |
|
700 |
! |
|
701 |
||
702 |
checkinTroubleDialog:title message:message log:log abortable:abortable option:optionTitle option2:optionTitle2 option3:optionTitle3 |
|
703 |
"trouble checking in - open a dialog" |
|
704 |
||
705 |
|l box list listView optionPressed option2Pressed option3Pressed| |
|
706 |
||
707 |
l := log collect:[:line | line withTabsExpanded]. |
|
708 |
list := SelectionInList with:l. |
|
709 |
||
710 |
box := Dialog new. |
|
711 |
box label:(title). |
|
712 |
||
713 |
(box addTextLabel:message) borderWidth:0. |
|
714 |
||
715 |
listView := SelectionInListView on:list. |
|
716 |
listView disable. |
|
717 |
listView height:200. |
|
718 |
box addComponent:(HVScrollableView forView:listView miniScrollerH:true) tabable:false. |
|
719 |
box addVerticalSpace. |
|
720 |
||
721 |
abortable ifTrue:[ |
|
722 |
box addAbortButton |
|
723 |
]. |
|
724 |
optionTitle notNil ifTrue:[ |
|
725 |
box addOkButton:(Button label:optionTitle action:[optionPressed := true. box hide]). |
|
726 |
]. |
|
727 |
optionTitle2 notNil ifTrue:[ |
|
728 |
box addOkButton:(Button label:optionTitle2 action:[option2Pressed := true. box hide]). |
|
729 |
]. |
|
730 |
optionTitle3 notNil ifTrue:[ |
|
731 |
box addOkButton:(Button label:optionTitle3 action:[option3Pressed := true. box hide]). |
|
732 |
]. |
|
733 |
box addOkButton. |
|
734 |
||
735 |
box extent:(box preferredExtent). |
|
736 |
box minExtent:box extent. |
|
737 |
box maxExtent:box extent. |
|
738 |
||
739 |
box open. |
|
740 |
||
741 |
box destroy. |
|
742 |
optionPressed == true ifTrue:[^ #option]. |
|
743 |
option2Pressed == true ifTrue:[^ #option2]. |
|
744 |
option3Pressed == true ifTrue:[^ #option3]. |
|
745 |
^ box accepted |
|
746 |
||
747 |
"Created: 9.9.1996 / 19:12:45 / cg" |
|
748 |
"Modified: 12.9.1996 / 02:39:10 / cg" |
|
749 |
! |
|
750 |
||
751 |
createEntryFor:pathInRepository module:aModule in:aDirectory revision:rev date:date special:special overwrite:overwrite |
|
752 |
"create an CVS/Repository and CVS/Entries entry for filename. |
|
753 |
If the path does not exist, it will be created |
|
3277 | 754 |
If overwrite is true, an existing entry will be overwritten. |
1362 | 755 |
" |
756 |
||
3358 | 757 |
|filename cvsRoot cvsDir name entries firstPart entriesInStream path| |
1362 | 758 |
|
759 |
filename := pathInRepository asFilename. |
|
760 |
cvsDir := (aDirectory asFilename construct:'CVS') recursiveMakeDirectory. |
|
761 |
entries := cvsDir construct:'Entries'. |
|
762 |
name := filename baseName. |
|
763 |
firstPart := '/', name, '/'. |
|
764 |
||
3358 | 765 |
entriesInStream := entries readStreamOrNil. |
766 |
entriesInStream isNil ifTrue:[ |
|
1362 | 767 |
"/ |
768 |
"/ no Repository yet, create one |
|
769 |
"/ |
|
3754 | 770 |
|root| |
1362 | 771 |
|
772 |
cvsRoot := self getCVSROOTForModule:aModule. |
|
3277 | 773 |
cvsRoot isNil ifTrue:[ self error:'missing/invalid CVSROOT setting' ]. |
3263 | 774 |
cvsRoot := cvsRoot withoutPrefix:':local:'. |
775 |
||
1496 | 776 |
root := self repositoryTopDirectoryFromCVSRoot:cvsRoot. |
777 |
||
1362 | 778 |
"/ create Repository |
779 |
"/ (notice, contents must be a Unix filename ... |
|
780 |
||
3358 | 781 |
entriesInStream := (cvsDir construct:'Repository') writeStream. |
1362 | 782 |
path := Filename components:filename directory name. |
783 |
path := path asStringWith:$/. |
|
3358 | 784 |
entriesInStream nextPutLine:(root, '/', path). |
785 |
entriesInStream syncData; close. |
|
1362 | 786 |
|
787 |
"/ make new Entries file. |
|
3358 | 788 |
entriesInStream := entries writeStream. |
1362 | 789 |
] ifFalse:[ |
790 |
|newName newStream line| |
|
791 |
||
792 |
newName := Filename newTemporaryIn:cvsDir. |
|
793 |
newStream := newName writeStream. |
|
3358 | 794 |
[(line := entriesInStream nextLine) notNil] whileTrue:[ |
1362 | 795 |
(line findString:firstPart) ~= 1 ifTrue:[ |
796 |
"/ we have found an entry for ourself. |
|
797 |
"/ If we do not want to overwrite it, clean up everything and return. |
|
798 |
overwrite ifFalse:[ |
|
799 |
newName remove. |
|
800 |
newStream close. |
|
3358 | 801 |
entriesInStream close. |
1362 | 802 |
^ self |
803 |
]. |
|
804 |
newStream nextPutLine:line |
|
805 |
]. |
|
806 |
]. |
|
807 |
newName renameTo:entries. |
|
3358 | 808 |
entriesInStream close. |
809 |
entriesInStream := newStream. |
|
1362 | 810 |
]. |
3358 | 811 |
entriesInStream nextPutLine:firstPart, rev, '/', date, '/', special, '/'. |
812 |
entriesInStream syncData; close. |
|
1362 | 813 |
|
814 |
" |
|
815 |
self createEntryFor:'foo/xxx/yyy' in:'foo/xxx' revision:'1.22' date:'dummy' special:'' |
|
816 |
self createEntryFor:'foo/xxx/yyy' in:'foo/xxx' revision:'3.44' date:'new dummy' special:'special' |
|
817 |
" |
|
818 |
||
1496 | 819 |
"Created: / 19-09-1997 / 06:21:02 / cg" |
820 |
"Modified: / 07-01-1998 / 14:15:35 / stefan" |
|
821 |
"Modified: / 21-06-2006 / 12:13:30 / cg" |
|
1362 | 822 |
! |
823 |
||
824 |
createLocalDirectory:packageDir inModule:moduleDir |
|
825 |
"create a local working directory for module/package. |
|
826 |
To speed up things, we checkout the file '.cvsignore', to create |
|
827 |
the whole tree. If the file is not present, we will create it as empty file. |
|
828 |
Return the name of a temporary directory containing the package" |
|
829 |
||
830 |
^ self |
|
831 |
createLocalDirectory:packageDir |
|
832 |
inModule:moduleDir |
|
833 |
with:'.cvsignore' |
|
3820 | 834 |
andDefaultContents: |
835 |
'makefile |
|
836 |
*.STH |
|
837 |
*.@@@ |
|
838 |
ntLibInit.c |
|
839 |
*.res |
|
840 |
*.RES |
|
841 |
*.sc |
|
842 |
*.c |
|
843 |
objbc |
|
844 |
objvc |
|
845 |
objmingw |
|
846 |
'. |
|
1362 | 847 |
|
848 |
" |
|
849 |
self createLocalDirectory:'libbasic' inModule:'stx' |
|
850 |
" |
|
851 |
||
852 |
"Created: / 23.7.1999 / 19:14:28 / stefan" |
|
853 |
"Modified: / 26.7.1999 / 17:43:35 / stefan" |
|
854 |
"Modified: / 18.1.2000 / 20:56:19 / cg" |
|
855 |
! |
|
856 |
||
857 |
createLocalDirectory:packageDir inModule:moduleDir with:fileToCheckout |
|
858 |
"create a local working directory for module/package, and checkout the |
|
859 |
given file there. |
|
860 |
Return the name of a temporary directory containing the package, or nil" |
|
861 |
||
3821 | 862 |
^ self |
3820 | 863 |
createLocalDirectory:packageDir |
864 |
inModule:moduleDir |
|
865 |
with:fileToCheckout |
|
866 |
andDefaultContents:nil |
|
867 |
||
868 |
" |
|
869 |
self createLocalDirectory:'libbasic' inModule:'stx' |
|
870 |
" |
|
871 |
||
872 |
"Modified: / 26-07-1999 / 17:43:35 / stefan" |
|
873 |
"Created: / 18-01-2000 / 20:55:52 / cg" |
|
874 |
"Modified: / 16-07-2013 / 19:49:26 / cg" |
|
875 |
! |
|
876 |
||
877 |
createLocalDirectory:packageDir inModule:moduleDir with:fileToCheckout andDefaultContents:defaultContents |
|
878 |
"create a local working directory for module/package, and checkout the |
|
879 |
given file there. |
|
880 |
Return the name of a temporary directory containing the package, or nil" |
|
881 |
||
3321 | 882 |
|path absolutePath tempdir unixPath| |
1362 | 883 |
|
884 |
path := (moduleDir asFilename construct:packageDir) construct:fileToCheckout. |
|
885 |
||
886 |
tempdir := self createTempDirectory:nil forModule:nil. |
|
2127 | 887 |
tempdir isNil ifTrue:[ |
888 |
('no tempDir - cannot checkout') errorPrintCR. |
|
889 |
^ nil |
|
890 |
]. |
|
1362 | 891 |
|
892 |
[ |
|
893 |
OperatingSystem isUNIXlike ifTrue:[ |
|
894 |
unixPath := path name. |
|
895 |
] ifFalse:[ |
|
896 |
OperatingSystem isVMSlike ifTrue:[ |
|
897 |
self error:'VMS case not yet implemented' |
|
898 |
]. |
|
3592 | 899 |
unixPath := path name asUnixFilenameString |
1362 | 900 |
]. |
901 |
||
902 |
(self checkOut:unixPath module:moduleDir in:tempdir) ifFalse:[ |
|
903 |
"dummy file does not exist, so create it" |
|
904 |
||
905 |
absolutePath := tempdir construct:path. |
|
906 |
absolutePath directory recursiveMakeDirectory. |
|
3820 | 907 |
|
1362 | 908 |
"now create the file" |
3820 | 909 |
absolutePath writingFileDo:[:s | |
910 |
defaultContents notNil ifTrue:[ |
|
3949 | 911 |
s nextPutAll:defaultContents. |
3820 | 912 |
]. |
1362 | 913 |
]. |
914 |
||
915 |
"now create the dummy file in the repository" |
|
916 |
(self import:moduleDir in:tempdir) ifFalse:[ |
|
917 |
('CVSSourceCodeManager [error]: cannot import dummy') errorPrintCR. |
|
918 |
]. |
|
919 |
||
920 |
"remove the path, so that checkout works" |
|
921 |
(tempdir construct:moduleDir) recursiveRemove. |
|
922 |
||
923 |
"checkout the dummy, the intermediate directories will be created" |
|
924 |
(self checkOut:unixPath module:moduleDir in:tempdir) ifFalse:[ |
|
925 |
('CVSSourceCodeManager [warning]: import failed (to create working dir)') errorPrintCR. |
|
926 |
"/false ifTrue:[ |
|
927 |
"/ "/ manually create it |
|
928 |
"/ |
|
929 |
"/ (tempdir construct:unixPath) directory recursiveMakeDirectory. |
|
930 |
"/ workingDir := tempdir. |
|
931 |
"/ unixPath asFilename directory components do:[:each | |
|
932 |
"/ self executeCVSCommand:('add ' , each) module:moduleDir inDirectory:workingDir. |
|
933 |
"/ workingDir := workingDir construct:each. |
|
934 |
"/ ]. |
|
935 |
"/ (absolutePath writeStream close) isNil ifTrue:[ |
|
936 |
"/ ('CVSSourceCodeManager [error]: cannot create dummy') errorPrintCR. |
|
937 |
"/ tempdir recursiveRemove. |
|
938 |
"/ ^ nil. |
|
939 |
"/ ]. |
|
940 |
"/ self executeCVSCommand:('add ' , fileToCheckout) module:moduleDir inDirectory:workingDir. |
|
941 |
"/ self executeCVSCommand:('commit ' , fileToCheckout) module:moduleDir inDirectory:workingDir. |
|
942 |
"/ |
|
943 |
"/ ^ tempdir |
|
944 |
"/]. |
|
945 |
tempdir recursiveRemove. |
|
946 |
^ nil. |
|
947 |
]. |
|
948 |
]. |
|
1406 | 949 |
] ifCurtailed:[ |
1362 | 950 |
tempdir recursiveRemove. |
951 |
]. |
|
952 |
||
953 |
^ tempdir. |
|
954 |
||
955 |
" |
|
956 |
self createLocalDirectory:'libbasic' inModule:'stx' |
|
957 |
" |
|
958 |
||
1778
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
959 |
"Modified: / 26-07-1999 / 17:43:35 / stefan" |
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
960 |
"Created: / 18-01-2000 / 20:55:52 / cg" |
3352 | 961 |
"Modified: / 16-07-2013 / 19:49:26 / cg" |
1362 | 962 |
! |
963 |
||
964 |
createTempDirectory:packageDir forModule:moduleDir |
|
965 |
"create a temp directory for checking out" |
|
966 |
||
3267 | 967 |
^ self createTempDirectory:packageDir forModule:moduleDir in:(self cvsTmpDirectory) |
1362 | 968 |
! |
969 |
||
2311 | 970 |
cvsTimeString:timestamp |
1388
6fae02877da5
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
1387
diff
changeset
|
971 |
"convert a Timestamp to a string suitable for the CVS/Entries file: |
1362 | 972 |
|
973 |
123456789012345678901234 |
|
974 |
Tue Dec 19 20:56:26 1995 |
|
975 |
" |
|
976 |
||
2311 | 977 |
^ timestamp printStringFormat:'%(ShortDayName) %(ShortMonthName) %(day) %h:%m:%s %(year)' language:#en. |
1362 | 978 |
|
979 |
" |
|
2311 | 980 |
CVSSourceCodeManager cvsTimeString:(UtcTimestamp now) |
1362 | 981 |
" |
982 |
! |
|
983 |
||
984 |
executeCVSCommand:cvsCommand module:moduleName inDirectory:dir |
|
985 |
"execute command and prepend cvs command name and global options. |
|
986 |
if dir ~= nil, execute command in that directory. |
|
987 |
This also leads to a log-entry to be added to cvs's logfile." |
|
988 |
||
989 |
^ self |
|
990 |
executeCVSCommand:cvsCommand |
|
991 |
module:moduleName |
|
992 |
inDirectory:dir |
|
993 |
log:true |
|
994 |
||
995 |
"Modified: / 20.5.1998 / 16:07:28 / cg" |
|
996 |
! |
|
997 |
||
998 |
executeCVSCommand:cvsCommand module:moduleName inDirectory:dir log:doLog |
|
999 |
"execute command and prepend cvs command name and global options. |
|
1000 |
if dir ~= nil, execute command in that directory. |
|
4064 | 1001 |
The doLog argument, if false suppresses a logEntry to be added |
1362 | 1002 |
in the cvs log file (used when reading / extracting history)" |
1003 |
||
1004 |
^ self |
|
4064 | 1005 |
executeCVSCommand:cvsCommand module:moduleName inDirectory:dir log:doLog |
1362 | 1006 |
pipe:false |
1007 |
! |
|
1008 |
||
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1009 |
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
|
1010 |
^ self |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1011 |
executeCVSCommand:cvsCommand |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1012 |
module:moduleName |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1013 |
inDirectory:dirArg |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1014 |
log:doLog |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1015 |
outputTo:nil |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1016 |
errorTo:errorStream |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1017 |
! |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1018 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1019 |
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
|
1020 |
"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
|
1021 |
execute command in the dirArg directory. |
4064 | 1022 |
The doLog argument, if false suppresses a logEntry to be added |
1390
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
1023 |
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
|
1024 |
|
4064 | 1025 |
^ self |
1026 |
executeCVSCommand:cvsCommand |
|
1027 |
module:moduleName |
|
1028 |
inDirectory:dirArg |
|
1029 |
log:doLog |
|
1030 |
pipe:false |
|
2776
34e2fea3d517
duplicate code (ouch) refactored
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
1031 |
orElseOutputTo:outStream errorTo:errorStream |
1390
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
1032 |
|
1502 | 1033 |
"Modified: / 23-04-1996 / 15:24:00 / stefan" |
1034 |
"Created: / 20-05-1998 / 16:06:34 / cg" |
|
2598
197192cec3c7
On Windows, set CVS_RSH to plink if CVS_RSH is not set and plink is executable
vrany
parents:
2593
diff
changeset
|
1035 |
"Modified: / 13-10-2011 / 17:07:07 / jv" |
2776
34e2fea3d517
duplicate code (ouch) refactored
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
1036 |
"Modified: / 28-02-2012 / 17:31:34 / cg" |
1390
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
1037 |
! |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
1038 |
|
4064 | 1039 |
executeCVSCommand:cvsCommand module:moduleName inDirectory:dirArg log:doLog pipe:doPipe |
1362 | 1040 |
"execute command and prepend cvs command name and global options. |
1041 |
execute command in the dirArg directory. |
|
4064 | 1042 |
The doLog argument, if false suppresses a logEntry to be added |
1362 | 1043 |
in the cvs log file (used when reading / extracting history)" |
4064 | 1044 |
|
1045 |
^ self |
|
1046 |
executeCVSCommand:cvsCommand |
|
1047 |
module:moduleName |
|
1048 |
inDirectory:dirArg |
|
1049 |
log:doLog |
|
1050 |
pipe:doPipe |
|
2776
34e2fea3d517
duplicate code (ouch) refactored
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
1051 |
orElseOutputTo:nil errorTo:nil |
34e2fea3d517
duplicate code (ouch) refactored
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
1052 |
|
34e2fea3d517
duplicate code (ouch) refactored
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
1053 |
"Modified: / 23-04-1996 / 15:24:00 / stefan" |
34e2fea3d517
duplicate code (ouch) refactored
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
1054 |
"Created: / 20-05-1998 / 16:06:34 / cg" |
34e2fea3d517
duplicate code (ouch) refactored
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
1055 |
"Modified: / 10-10-2011 / 14:47:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
34e2fea3d517
duplicate code (ouch) refactored
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
1056 |
"Modified (format): / 13-10-2011 / 17:06:28 / jv" |
34e2fea3d517
duplicate code (ouch) refactored
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
1057 |
"Modified: / 28-02-2012 / 17:31:06 / cg" |
34e2fea3d517
duplicate code (ouch) refactored
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
1058 |
! |
34e2fea3d517
duplicate code (ouch) refactored
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
1059 |
|
34e2fea3d517
duplicate code (ouch) refactored
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
1060 |
executeCVSCommand:cvsCommand module:moduleName inDirectory:dirArg log:doLog pipe:doPipe orElseOutputTo:outStreamOrNil errorTo:errorStreamOrNil |
34e2fea3d517
duplicate code (ouch) refactored
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
1061 |
"execute command and prepend cvs command name and global options. |
3321 | 1062 |
execute command in the dirArg directory (or the current directory if dirArg is nil). |
4064 | 1063 |
The doLog argument, if false suppresses a logEntry to be added |
2776
34e2fea3d517
duplicate code (ouch) refactored
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
1064 |
in the cvs log file (used when reading / extracting history)" |
4064 | 1065 |
|
4181 | 1066 |
|command cvsRoot rslt ok pathOfDir errorString osProcess| |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1067 |
|
2506 | 1068 |
dirArg notNil ifTrue:[ |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1069 |
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
|
1070 |
]. |
2776
34e2fea3d517
duplicate code (ouch) refactored
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
1071 |
|
1362 | 1072 |
cvsRoot := self getCVSROOTForModule:moduleName. |
3263 | 1073 |
cvsRoot := cvsRoot withoutPrefix:':local:'. |
1074 |
||
1990
69b3fcc2f7f6
#cvsExecutable answers the default cvs command
Stefan Vogel <sv@exept.de>
parents:
1989
diff
changeset
|
1075 |
command := self cvsExecutable. |
1362 | 1076 |
(command includes:Character space) ifTrue:[ |
2506 | 1077 |
command := '"' , command , '"' |
1362 | 1078 |
]. |
1079 |
doLog ifFalse:[ |
|
2506 | 1080 |
"/ cvs 1.11.14 fails with -l option |
1081 |
"/ command := command , ' -l'. |
|
1362 | 1082 |
]. |
2598
197192cec3c7
On Windows, set CVS_RSH to plink if CVS_RSH is not set and plink is executable
vrany
parents:
2593
diff
changeset
|
1083 |
|
197192cec3c7
On Windows, set CVS_RSH to plink if CVS_RSH is not set and plink is executable
vrany
parents:
2593
diff
changeset
|
1084 |
"JV@2011-10-13: Try to be foolproof and set CVS_RSH on Windows" |
197192cec3c7
On Windows, set CVS_RSH to plink if CVS_RSH is not set and plink is executable
vrany
parents:
2593
diff
changeset
|
1085 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
197192cec3c7
On Windows, set CVS_RSH to plink if CVS_RSH is not set and plink is executable
vrany
parents:
2593
diff
changeset
|
1086 |
(OperatingSystem getEnvironment:'CVS_RSH') isNil ifTrue:[ |
197192cec3c7
On Windows, set CVS_RSH to plink if CVS_RSH is not set and plink is executable
vrany
parents:
2593
diff
changeset
|
1087 |
(OperatingSystem canExecuteCommand: 'plink') ifTrue:[ |
197192cec3c7
On Windows, set CVS_RSH to plink if CVS_RSH is not set and plink is executable
vrany
parents:
2593
diff
changeset
|
1088 |
OperatingSystem setEnvironment: 'CVS_RSH' to: 'plink' |
197192cec3c7
On Windows, set CVS_RSH to plink if CVS_RSH is not set and plink is executable
vrany
parents:
2593
diff
changeset
|
1089 |
] |
197192cec3c7
On Windows, set CVS_RSH to plink if CVS_RSH is not set and plink is executable
vrany
parents:
2593
diff
changeset
|
1090 |
]. |
197192cec3c7
On Windows, set CVS_RSH to plink if CVS_RSH is not set and plink is executable
vrany
parents:
2593
diff
changeset
|
1091 |
]. |
197192cec3c7
On Windows, set CVS_RSH to plink if CVS_RSH is not set and plink is executable
vrany
parents:
2593
diff
changeset
|
1092 |
|
2506 | 1093 |
command := command , ' -d "' , cvsRoot , '" ' , cvsCommand. |
3580 | 1094 |
|
1362 | 1095 |
Verbose == true ifTrue:[ |
2776
34e2fea3d517
duplicate code (ouch) refactored
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
1096 |
('CVSSourceCodeManager [info]: executing: ' , command , ' [in ' , (pathOfDir ? '.') , ']') infoPrintCR. |
1362 | 1097 |
]. |
2776
34e2fea3d517
duplicate code (ouch) refactored
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
1098 |
|
1362 | 1099 |
doPipe ifTrue:[ |
4064 | 1100 |
rslt := PipeStream |
2506 | 1101 |
readingFrom:command |
1102 |
errorDisposition:#inline |
|
1103 |
inDirectory:pathOfDir. |
|
1362 | 1104 |
ok := rslt notNil. |
1105 |
] ifFalse:[ |
|
4181 | 1106 |
osProcess := OSProcess new |
1107 |
command:command; |
|
1108 |
outStream:outStreamOrNil; |
|
4280 | 1109 |
errorStream:errorStreamOrNil; |
4181 | 1110 |
directory:pathOfDir. |
1111 |
||
1362 | 1112 |
Processor isDispatching ifFalse:[ |
3333 | 1113 |
"/ special hack to allow source code access during the initialization |
1114 |
"/ phase (when threading is not yet enabled in the ProcessorScheduler) |
|
1115 |
"/ execute the command in this thread, as opposed to the code below. |
|
4181 | 1116 |
ok := rslt := osProcess execute. |
1362 | 1117 |
] ifTrue:[ |
4181 | 1118 |
CVSCommandSemaphore critical:[ |
1119 |
|errOut done| |
|
1120 |
||
1121 |
errOut := WriteStream on:''. |
|
1122 |
osProcess errorStream:errOut. |
|
1123 |
ok := osProcess startProcess. |
|
1124 |
||
1125 |
[ |
|
1126 |
done := true. |
|
1127 |
(osProcess waitUntilFinishedWithTimeout:self cvsCommandTimeout) isNil ifTrue:[ |
|
1128 |
(Dialog confirm:('CVS command timeout (%1) for:\\%2\\Hint: you can change this timeout in the launcher''s settings dialog.\Proceed?' withCRs |
|
1129 |
bindWith:self cvsCommandTimeout with:command)) |
|
1130 |
ifTrue:[ |
|
1131 |
done := false |
|
2695 | 1132 |
] ifFalse:[ |
4181 | 1133 |
('CVSSourceCodeManager [info]: command timeout: ' , command) errorPrintCR. |
1134 |
osProcess terminate. |
|
1135 |
ok := false. |
|
1136 |
errorString := 'CVS command timeout'. |
|
1137 |
]. |
|
1138 |
] ifFalse:[ |
|
1139 |
ok := rslt := osProcess finishedWithSuccess. |
|
1140 |
ok ifFalse:[ |
|
1141 |
errorString := errOut contents. |
|
1142 |
]. |
|
1143 |
] |
|
1144 |
] doUntil:[done]. |
|
1145 |
]. |
|
1362 | 1146 |
]. |
1147 |
]. |
|
1148 |
ok ifFalse:[ |
|
1149 |
('CVSSourceCodeManager [info]: command failed: ' , command) errorPrintCR. |
|
3390 | 1150 |
SourceCodeManagerError isHandled ifTrue:[ |
2792
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
1151 |
SourceCodeManagerError raiseRequestErrorString:(errorString ? 'CVS Error'). |
1832
e47ad13133b8
error reporting (in checkModule) was uninformative when login was required
Claus Gittinger <cg@exept.de>
parents:
1829
diff
changeset
|
1152 |
]. |
1362 | 1153 |
]. |
1154 |
^ rslt |
|
1155 |
||
1508 | 1156 |
"Modified: / 23-04-1996 / 15:24:00 / stefan" |
2568 | 1157 |
"Modified: / 10-10-2011 / 14:47:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2598
197192cec3c7
On Windows, set CVS_RSH to plink if CVS_RSH is not set and plink is executable
vrany
parents:
2593
diff
changeset
|
1158 |
"Modified (format): / 13-10-2011 / 17:06:28 / jv" |
2776
34e2fea3d517
duplicate code (ouch) refactored
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
1159 |
"Created: / 28-02-2012 / 17:30:34 / cg" |
4280 | 1160 |
"Modified: / 06-12-2017 / 03:22:53 / cg" |
1362 | 1161 |
! |
1162 |
||
2938 | 1163 |
fetchRevisionsFromRLogStream:inStream searchForKeyword:searchFor |
1164 |
"helper for revisionsInModule*" |
|
1165 |
||
1166 |
|info line s revisionUsed fileName| |
|
1167 |
||
1168 |
info := OrderedCollection new. |
|
1169 |
||
1170 |
[inStream atEnd] whileFalse:[ |
|
1171 |
line:= inStream nextLine. |
|
1172 |
line notNil ifTrue:[ |
|
1173 |
line := line withoutSeparators. |
|
1174 |
line notEmpty ifTrue:[ |
|
4227 | 1175 |
s := line restAfter:'RCS file:' withoutSeparators:true. |
1176 |
s notNil ifTrue:[ |
|
2938 | 1177 |
(UnixFilename named:s) directory baseName = 'Attic' ifTrue:[ |
1178 |
"/ file has been removed in the repository |
|
1179 |
revisionUsed := #deleted |
|
1180 |
]. |
|
1181 |
fileName := (UnixFilename named:s) baseName. |
|
1182 |
(fileName endsWith:',v') ifTrue:[ |
|
3231
b3cce588c936
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
3112
diff
changeset
|
1183 |
fileName := fileName copyButLast:2. |
2938 | 1184 |
] ifFalse:[ |
1185 |
self halt:'oops - should not happen'. |
|
1186 |
]. |
|
1187 |
]. |
|
1188 |
s := line restAfter:searchFor withoutSeparators:true. |
|
1189 |
s notNil ifTrue:[ |i| |
|
1190 |
i := s indexOfSeparator. |
|
1191 |
i ~~ 0 ifTrue:[ |
|
1192 |
s := s copyTo:i-1 |
|
1193 |
]. |
|
1194 |
revisionUsed := revisionUsed ? s. "/ deleted-info comes from the Attic-component in the path |
|
1195 |
info add:(fileName -> revisionUsed). |
|
1196 |
fileName := revisionUsed := nil. |
|
4227 | 1197 |
]. |
1198 |
]. |
|
2938 | 1199 |
] |
1200 |
]. |
|
1201 |
^ info |
|
1202 |
! |
|
1203 |
||
1204 |
fetchRevisionsFromRLogStream:inStream searchForKeyword:searchFor ignoreDeleted:ignoreDeleted |
|
1205 |
"helper for revisionsInModule*" |
|
1206 |
||
1207 |
|info line s revisionUsed fileName| |
|
1208 |
||
1209 |
info := OrderedCollection new. |
|
1210 |
||
1211 |
[inStream atEnd] whileFalse:[ |
|
1212 |
line:= inStream nextLine. |
|
1213 |
line notNil ifTrue:[ |
|
1214 |
line := line withoutSeparators. |
|
1215 |
line notEmpty ifTrue:[ |
|
4227 | 1216 |
s := line restAfter:'RCS file:' withoutSeparators:true. |
1217 |
s notNil ifTrue:[ |
|
2938 | 1218 |
(UnixFilename named:s) directory baseName = 'Attic' ifTrue:[ |
1219 |
"/ file has been removed in the repository |
|
1220 |
revisionUsed := #deleted |
|
1221 |
]. |
|
1222 |
fileName := (UnixFilename named:s) baseName. |
|
1223 |
(fileName endsWith:',v') ifTrue:[ |
|
3231
b3cce588c936
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
3112
diff
changeset
|
1224 |
fileName := fileName copyButLast:2. |
2938 | 1225 |
] ifFalse:[ |
1226 |
self halt:'oops - should not happen'. |
|
1227 |
]. |
|
1228 |
]. |
|
1229 |
s := line restAfter:searchFor withoutSeparators:true. |
|
1230 |
s notNil ifTrue:[ |i| |
|
1231 |
i := s indexOfSeparator. |
|
1232 |
i ~~ 0 ifTrue:[ |
|
1233 |
s := s copyTo:i-1 |
|
1234 |
]. |
|
1235 |
revisionUsed := revisionUsed ? s. "/ deleted-info comes from the Attic-component in the path |
|
1236 |
(revisionUsed ~~ #deleted or:[ ignoreDeleted not ]) ifTrue:[ |
|
1237 |
info add:(fileName -> revisionUsed). |
|
1238 |
]. |
|
1239 |
fileName := revisionUsed := nil. |
|
4227 | 1240 |
]. |
1241 |
]. |
|
2938 | 1242 |
] |
1243 |
]. |
|
1244 |
^ info |
|
1245 |
! |
|
1246 |
||
1362 | 1247 |
getCVSROOTForModule:aModuleName |
1248 |
"internal: used when accessing a source repository. |
|
1249 |
Return the CVSROOT which provides the sources for a particular module. |
|
1250 |
If no specific root was defined for that module, return the value of |
|
1251 |
the global (fallBack) CVSRoot. |
|
1252 |
Nil is returned if no repository is available." |
|
1253 |
||
1254 |
CVSModuleRoots isNil ifTrue:[^ CVSRoot]. |
|
1255 |
aModuleName isNil ifTrue:[^ CVSRoot]. |
|
1481 | 1256 |
^ CVSModuleRoots at:aModuleName ifAbsent:CVSRoot. |
1362 | 1257 |
|
1258 |
"Created: / 19.9.1997 / 06:18:07 / cg" |
|
1259 |
"Modified: / 20.5.1998 / 16:30:12 / cg" |
|
1260 |
! |
|
1261 |
||
1262 |
getCVSROOTsPerModule |
|
1263 |
"return a dictionary, which associates CVSRoots to modules" |
|
1264 |
||
1265 |
^ CVSModuleRoots ? #() |
|
1266 |
! |
|
1267 |
||
1268 |
import:moduleDir in:tempdir |
|
1269 |
"import the existing tree in tempdir as repository" |
|
1270 |
||
1271 |
|cmd| |
|
1272 |
||
3574 | 1273 |
cmd := 'import -m "checkin from stx browser" ', moduleDir, ' initialV initialR'. |
1362 | 1274 |
^ self |
1275 |
executeCVSCommand:cmd |
|
1276 |
module:moduleDir |
|
3574 | 1277 |
inDirectory:(tempdir / moduleDir) name |
1362 | 1278 |
log:false |
1279 |
||
1280 |
||
1281 |
" |
|
1282 |
|f d| |
|
1283 |
f := 'stefan/dummy/fasel'. |
|
1284 |
d := '/tmp/tt' asFilename construct:f. |
|
1285 |
d directory recursiveMakeDirectory. |
|
1286 |
d writeStream close. |
|
1287 |
self import:'stefan' in:'/tmp/tt/stefan' asFilename |
|
1288 |
" |
|
1289 |
||
1290 |
"Created: / 23.7.1999 / 19:19:34 / stefan" |
|
1291 |
"Modified: / 26.7.1999 / 17:46:29 / stefan" |
|
1292 |
"Modified: / 18.1.2000 / 20:21:32 / cg" |
|
1293 |
! |
|
1294 |
||
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1295 |
readRevisionLogEntryFromStream:inStream |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1296 |
"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
|
1297 |
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
|
1298 |
|
4157 | 1299 |
The returned information is a CVSVersionInfo object (used to be an IdentityDictionary) |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1300 |
filled with: |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1301 |
#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
|
1302 |
#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
|
1303 |
#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
|
1304 |
#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
|
1305 |
#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
|
1306 |
#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
|
1307 |
" |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1308 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1309 |
|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
|
1310 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1311 |
atEnd := false. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1312 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1313 |
revLine1 := inStream nextLine. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1314 |
[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
|
1315 |
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
|
1316 |
revLine1 := nil |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1317 |
] ifFalse:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1318 |
revLine1 := inStream nextLine. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1319 |
] |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1320 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1321 |
revLine2 := inStream nextLine. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1322 |
(revLine1 notNil and:[revLine2 notNil]) ifTrue:[ |
4157 | 1323 |
record := CVSVersionInfo "IdentityDictionary" new. |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1324 |
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
|
1325 |
"/ decompose date/author/state etc. |
4256 | 1326 |
revLine2 asCollectionOfSubCollectionsSeparatedBy:$; do:[:info | |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1327 |
|subEntry| |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1328 |
subEntry := info withoutSeparators. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1329 |
#('date:' #date |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1330 |
'author:' #author |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1331 |
'state:' #state |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1332 |
'lines:' #numberOfChangedLines |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1333 |
) pairWiseDo:[:word :key | |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1334 |
s := subEntry restAfter:word withoutSeparators:true. |
3324 | 1335 |
s notNil ifTrue:[ |
3330 | 1336 |
key == #'author' ifTrue:[ s := self authorMappingFor:s ]. |
3324 | 1337 |
record at:key put:s. |
1338 |
]. |
|
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1339 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1340 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1341 |
|
4157 | 1342 |
"first revision does not have a 'lines:' entry" |
1343 |
(record at:#numberOfChangedLines ifAbsent:[nil]) isNil ifTrue:[ |
|
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1344 |
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
|
1345 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1346 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1347 |
s := nil. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1348 |
line := inStream nextLine. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1349 |
[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
|
1350 |
(line startsWith:'==========') ifTrue:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1351 |
atEnd := true. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1352 |
] ifFalse:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1353 |
(line withoutSpaces = '.') ifTrue:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1354 |
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
|
1355 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1356 |
s isNil ifTrue:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1357 |
s := line |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1358 |
] ifFalse:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1359 |
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
|
1360 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1361 |
line := inStream nextLine. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1362 |
] |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1363 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1364 |
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
|
1365 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1366 |
^record. |
4256 | 1367 |
|
1368 |
"Modified: / 20-09-2017 / 20:16:45 / stefan" |
|
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1369 |
! |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
1370 |
|
1362 | 1371 |
releaseAndRemove:tempdir module:moduleDir outputTo:outputFilename |
1372 |
"cleanup; release tree towards cvs and remove the temporary tree" |
|
1373 |
||
1374 |
|cmd redirect| |
|
1375 |
||
1376 |
outputFilename isNil ifTrue:[ |
|
1377 |
OperatingSystem isMSDOSlike ifTrue:[ |
|
1378 |
redirect := 'NUL' |
|
1379 |
] ifFalse:[ |
|
1380 |
redirect := '/dev/null' |
|
1381 |
] |
|
1382 |
] ifFalse:[ |
|
1383 |
redirect := outputFilename name |
|
1384 |
]. |
|
1385 |
||
1386 |
"/ |
|
1387 |
"/ release it towards cvs |
|
1388 |
"/ |
|
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
|
1389 |
cmd := 'release > ' , redirect. |
1362 | 1390 |
(self |
1391 |
executeCVSCommand:cmd |
|
1392 |
module:moduleDir |
|
1393 |
inDirectory:tempdir name |
|
1394 |
log:false |
|
1395 |
) ifFalse:[ |
|
1396 |
"/ 'CVSMGR: failed to release: ' errorPrint. cmd errorPrintNL. |
|
1397 |
]. |
|
1398 |
||
1399 |
tempdir recursiveRemove. |
|
1400 |
||
1401 |
"Modified: / 23.4.1996 / 14:29:49 / stefan" |
|
1402 |
"Created: / 19.9.1997 / 06:28:02 / cg" |
|
1403 |
"Modified: / 20.5.1998 / 16:44:07 / cg" |
|
1404 |
"Modified: / 3.9.1999 / 14:51:29 / ps" |
|
1405 |
! |
|
1406 |
||
1496 | 1407 |
repositoryTopDirectoryFromCVSRoot |
1362 | 1408 |
"return the top of the repository. This handles remote CVS connections |
1409 |
as well" |
|
1410 |
||
1411 |
CVSRoot isNil ifTrue:[^ nil]. |
|
1496 | 1412 |
^ self repositoryTopDirectoryFromCVSRoot:CVSRoot. |
1362 | 1413 |
|
1414 |
" |
|
1415 |
CVSSourceCodeManager repositoryTopDirectory |
|
1416 |
" |
|
1417 |
||
1496 | 1418 |
"Modified: / 16-01-1998 / 17:33:31 / stefan" |
1419 |
"Created: / 21-06-2006 / 12:06:18 / cg" |
|
1362 | 1420 |
! |
1421 |
||
1496 | 1422 |
repositoryTopDirectoryFromCVSRoot:aString |
1362 | 1423 |
"return the top of the repository (without remote prefix)" |
1424 |
||
1425 |
|idx| |
|
1426 |
||
1427 |
idx := aString indexOf:$/. |
|
1428 |
idx <= 1 ifTrue:[ |
|
1429 |
^ aString. |
|
1430 |
]. |
|
1431 |
^ aString copyFrom:idx. |
|
1432 |
||
1433 |
" |
|
1496 | 1434 |
CVSSourceCodeManager repositoryTopDirectoryFromCVSRoot:':pserver:stefan@ibm.exept.de:/archiv/cvs' |
1435 |
CVSSourceCodeManager repositoryTopDirectoryFromCVSRoot:'exept:/files/CVS' |
|
1436 |
CVSSourceCodeManager repositoryTopDirectoryFromCVSRoot:'/archiv/cvs' |
|
1362 | 1437 |
" |
1438 |
||
1496 | 1439 |
"Modified: / 16-01-1998 / 17:32:03 / stefan" |
1440 |
"Created: / 21-06-2006 / 12:05:53 / cg" |
|
1362 | 1441 |
! |
1442 |
||
1443 |
revisionStringFromLog:log entry:entry forClass:aClass |
|
1444 |
"given a log entry, extract a revision string" |
|
1445 |
||
1446 |
|oldRev idx special| |
|
1447 |
||
1448 |
oldRev := aClass revisionString. |
|
1449 |
special := ''. |
|
1450 |
||
1451 |
oldRev notNil ifTrue:[ |
|
1452 |
idx := oldRev lastIndexOf:$[. |
|
1453 |
idx ~~ 0 ifTrue:[ |
|
1454 |
idx := oldRev indexOf:$[ startingAt:idx+1. |
|
1455 |
idx ~~ 0 ifTrue:[ |
|
1456 |
special := ' ' , (oldRev copyFrom:idx). |
|
1457 |
] |
|
1458 |
]. |
|
1459 |
]. |
|
1460 |
||
1461 |
^ '$Header: ' , (log at:#container) , |
|
1462 |
' ' , (entry at:#revision) , |
|
1463 |
' ' , (entry at:#date) , |
|
1464 |
' ' , (entry at:#author) , |
|
1465 |
' ' , (entry at:#state) , |
|
1466 |
' $' , |
|
1467 |
special |
|
1468 |
||
1469 |
"Created: 16.9.1996 / 20:24:14 / cg" |
|
1470 |
"Modified: 3.3.1997 / 22:31:51 / cg" |
|
1471 |
! |
|
1472 |
||
3649 | 1473 |
updatedRevisionStringOf:aClass forRevision:newRevision andUser:userName with:originalVersionString |
1474 |
"update a revision string: take the original versionString, |
|
1475 |
and return a new version string with changed revisionNr, dateAndTime and author. |
|
1476 |
Used to synthetically generate a new version method without a need to consult the |
|
1477 |
cvs for an revision string after an update (which is slow, when done remote)" |
|
1478 |
||
1479 |
|idx leftPart rightPart vsnString newVsn dateAndTimePart newDateAndTimePart prevUser| |
|
1480 |
||
1481 |
originalVersionString isEmptyOrNil ifTrue:[^ nil]. |
|
1482 |
||
1483 |
"/ search for ,v |
|
1484 |
idx := originalVersionString indexOfSubCollection:'.st,v'. |
|
1485 |
idx == 0 ifTrue:[^ nil]. |
|
1486 |
||
1487 |
leftPart := originalVersionString copyTo:(idx - 1 + 5). |
|
1488 |
rightPart := (originalVersionString copyFrom:(idx + 5)) withoutSpaces. |
|
1489 |
idx := rightPart indexOfSeparator. |
|
1490 |
||
1491 |
vsnString := rightPart copyTo:idx - 1. |
|
1492 |
rightPart := rightPart copyFrom:idx + 1. |
|
1493 |
||
1494 |
newRevision isNil ifTrue:[ |
|
1495 |
(vsnString endsWith:'m') ifTrue:[ |
|
4094 | 1496 |
"/ already a modified class |
3649 | 1497 |
"/ ('already modified: ' , vsnString) printNL. |
1498 |
^ nil |
|
1499 |
]. |
|
1500 |
newVsn := vsnString , 'm' |
|
1501 |
] ifFalse:[ |
|
1502 |
newVsn := newRevision |
|
1503 |
]. |
|
1504 |
||
1505 |
idx := rightPart indexOfSeparator. |
|
1506 |
idx := rightPart indexOfSeparatorStartingAt:idx+1. |
|
1507 |
dateAndTimePart := rightPart copyTo:idx-1. |
|
1508 |
rightPart := rightPart copyFrom:idx+1. |
|
1509 |
idx := rightPart indexOfSeparator. |
|
1510 |
prevUser := rightPart copyTo:idx-1. |
|
1511 |
rightPart := rightPart copyFrom:idx+1. |
|
1512 |
||
4233 | 1513 |
"/ originalVersionString (Do not mind the additional space between $ and Header:. This is to prevent keyword substitution.) |
1514 |
"/ '$ Header: /cvs/stx/stx/goodies/refactoryBrowser/lint/RBLiteralArrayContainsCommaRule.st,v 1.4 2013/01/24 10:14:27 vrany Exp $' |
|
3649 | 1515 |
"/ leftPart: |
1516 |
"/ '$Header: /cvs/stx/stx/goodies/refactoryBrowser/lint/RBLiteralArrayContainsCommaRule.st,v' |
|
1517 |
"/ dateAndTimePart: |
|
1518 |
"/ '2013/01/24 10:14:27' |
|
1519 |
"/ rightPart: |
|
1520 |
"/ 'Exp $' |
|
4094 | 1521 |
newDateAndTimePart := Timestamp now printStringFormat:'%(year)-%(month)-%(day) %H:%m:%s'. |
1522 |
^ leftPart , ' ' , newVsn , ' ' , newDateAndTimePart , ' ' , userName , ' ' , rightPart |
|
4233 | 1523 |
|
1524 |
"Modified (comment): / 13-04-2017 / 19:29:22 / mawalch" |
|
3649 | 1525 |
! |
1526 |
||
1362 | 1527 |
updatedRevisionStringOf:aClass forRevision:newRevision with:originalVersionString |
3649 | 1528 |
"update a revision string: take the original versionString, |
1529 |
and return a new version string with changed revisionNr." |
|
1362 | 1530 |
|
1531 |
|idx leftPart rightPart vsnString newVsn| |
|
1532 |
||
1912 | 1533 |
originalVersionString isEmptyOrNil ifTrue:[^ nil]. |
1534 |
||
1362 | 1535 |
"/ search for ,v |
1536 |
idx := originalVersionString indexOfSubCollection:'.st,v'. |
|
1537 |
idx == 0 ifTrue:[^ nil]. |
|
1538 |
||
1539 |
leftPart := originalVersionString copyTo:(idx - 1 + 5). |
|
1540 |
rightPart := (originalVersionString copyFrom:(idx + 5)) withoutSpaces. |
|
1541 |
idx := rightPart indexOfSeparator. |
|
1484 | 1542 |
"/ idx == 0 ifTrue:[^ nil]. |
1362 | 1543 |
|
1544 |
vsnString := rightPart copyTo:idx - 1. |
|
1545 |
rightPart := rightPart copyFrom:idx + 1. |
|
1546 |
||
1547 |
newRevision isNil ifTrue:[ |
|
1548 |
(vsnString endsWith:'m') ifTrue:[ |
|
4094 | 1549 |
"/ already a modified class |
1362 | 1550 |
"/ ('already modified: ' , vsnString) printNL. |
1551 |
^ nil |
|
1552 |
]. |
|
1553 |
newVsn := vsnString , 'm' |
|
1554 |
] ifFalse:[ |
|
1555 |
newVsn := newRevision |
|
1556 |
]. |
|
1557 |
||
1558 |
^ leftPart , ' ' , newVsn , ' ' , rightPart |
|
1559 |
||
1912 | 1560 |
"Created: / 07-12-1995 / 20:23:38 / cg" |
1561 |
"Modified: / 20-11-2006 / 22:22:09 / cg" |
|
1464
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
1562 |
! |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
1563 |
|
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
1564 |
use_rlog |
1502 | 1565 |
^ true "/ OperatingSystem isMSWINDOWSlike not |
1566 |
||
1567 |
"Modified: / 04-07-2006 / 18:05:43 / cg" |
|
1362 | 1568 |
! ! |
1569 |
||
1730 | 1570 |
!CVSSourceCodeManager class methodsFor:'queries'! |
1571 |
||
2449 | 1572 |
isResponsibleForPackage:aString |
1573 |
||
1574 |
"JV@2011-07-09: The real check is too slow. Cache needed here" |
|
3321 | 1575 |
^ true. |
2449 | 1576 |
|
1577 |
"/ id := aString asPackageId. |
|
1578 |
"/ ^self checkForExistingModule: id module directory: id directory. |
|
1579 |
||
1580 |
"Created: / 09-07-2011 / 14:32:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1581 |
! |
|
1582 |
||
1730 | 1583 |
managerTypeName |
1584 |
^ 'CVS' |
|
1585 |
||
1586 |
"Created: / 16-08-2006 / 11:05:56 / cg" |
|
2141
09a1d1033c9d
added nameOfVersionMethodInClasses
Claus Gittinger <cg@exept.de>
parents:
2136
diff
changeset
|
1587 |
! |
09a1d1033c9d
added nameOfVersionMethodInClasses
Claus Gittinger <cg@exept.de>
parents:
2136
diff
changeset
|
1588 |
|
2196
a55cfe0bd6e4
added: #nameOfVersionMethodForExtensions
Claus Gittinger <cg@exept.de>
parents:
2188
diff
changeset
|
1589 |
nameOfVersionMethodForExtensions |
a55cfe0bd6e4
added: #nameOfVersionMethodForExtensions
Claus Gittinger <cg@exept.de>
parents:
2188
diff
changeset
|
1590 |
^ #'extensionsVersion_CVS' |
a55cfe0bd6e4
added: #nameOfVersionMethodForExtensions
Claus Gittinger <cg@exept.de>
parents:
2188
diff
changeset
|
1591 |
! |
a55cfe0bd6e4
added: #nameOfVersionMethodForExtensions
Claus Gittinger <cg@exept.de>
parents:
2188
diff
changeset
|
1592 |
|
2141
09a1d1033c9d
added nameOfVersionMethodInClasses
Claus Gittinger <cg@exept.de>
parents:
2136
diff
changeset
|
1593 |
nameOfVersionMethodInClasses |
09a1d1033c9d
added nameOfVersionMethodInClasses
Claus Gittinger <cg@exept.de>
parents:
2136
diff
changeset
|
1594 |
^ #'version_CVS' |
2348 | 1595 |
! |
1596 |
||
1597 |
settingsApplicationClass |
|
2351
89f497bc9155
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2348
diff
changeset
|
1598 |
"link to my settings application (needed for the settings dialog" |
89f497bc9155
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2348
diff
changeset
|
1599 |
|
2348 | 1600 |
^ CVSSourceCodeManagementSettingsAppl |
1601 |
||
1602 |
"Created: / 19-04-2011 / 12:43:29 / cg" |
|
2351
89f497bc9155
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
2348
diff
changeset
|
1603 |
"Modified: / 19-04-2011 / 13:52:42 / cg" |
3659 | 1604 |
! |
1605 |
||
1606 |
versionInfoClass |
|
1607 |
||
1608 |
^ CVSVersionInfo |
|
1730 | 1609 |
! ! |
1610 |
||
1891 | 1611 |
!CVSSourceCodeManager class methodsFor:'saving'! |
1612 |
||
1613 |
savePreferencesOn:aStream |
|
2363 | 1614 |
aStream nextPutLine:'CVSSourceCodeManager notNil ifTrue:['. |
1615 |
self repositoryInfoPerModule notEmptyOrNil ifTrue:[ |
|
1616 |
aStream nextPutLine:' CVSSourceCodeManager repositoryInfoPerModule:' , self repositoryInfoPerModule storeString , '.'. |
|
1617 |
]. |
|
1990
69b3fcc2f7f6
#cvsExecutable answers the default cvs command
Stefan Vogel <sv@exept.de>
parents:
1989
diff
changeset
|
1618 |
CVSExecutable notNil ifTrue:[ |
69b3fcc2f7f6
#cvsExecutable answers the default cvs command
Stefan Vogel <sv@exept.de>
parents:
1989
diff
changeset
|
1619 |
aStream nextPutLine:' CVSSourceCodeManager cvsExecutable:' , CVSExecutable storeString , '.'. |
1891 | 1620 |
]. |
1621 |
(Smalltalk at:#SourceCodeManager) == self ifTrue:[ |
|
1899 | 1622 |
aStream nextPutLine:' Smalltalk at:#SourceCodeManager put: CVSSourceCodeManager.'. |
1623 |
aStream nextPutLine:' CVSSourceCodeManager initializeForRepository:' , self repositoryName storeString , '.'. |
|
2671 | 1624 |
] ifFalse:[ |
1625 |
aStream nextPutLine:' CVSSourceCodeManager repositoryName:' , self repositoryName storeString , '.'. |
|
1891 | 1626 |
]. |
2363 | 1627 |
aStream nextPutLine:'].'. |
1891 | 1628 |
|
1629 |
"Created: / 09-11-2006 / 15:09:25 / cg" |
|
2671 | 1630 |
"Modified: / 22-12-2011 / 00:47:28 / cg" |
1891 | 1631 |
! ! |
1632 |
||
1362 | 1633 |
!CVSSourceCodeManager class methodsFor:'source code access'! |
1634 |
||
4280 | 1635 |
checkin:containerFilename text:someText directory:packageDir module:moduleDir logMessage:logMessage force:force onBranch:branchNameOrNil |
1362 | 1636 |
"enter some (source) code (which is someText) |
1637 |
into the source repository. If the force argument is true, no merge is done; |
|
1638 |
instead, the code is checked in as given (Dangerous). |
|
1639 |
Return true if ok, false if not." |
|
1640 |
||
4075 | 1641 |
|tempdir cmd checkoutName logMsg revision logTmp |
1642 |
cmdOut whatHappened idx changeLog changesAsLogged l |
|
1362 | 1643 |
newRevision msg answer didMerge |
4075 | 1644 |
modulePath time |
1645 |
editor checkInRepaired didAccept emphasizedText repairedText out |
|
4280 | 1646 |
emSep comment branchTag| |
1647 |
||
1648 |
branchNameOrNil notNil ifTrue:[ |
|
1649 |
branchTag := (self branchTagPrefix,branchNameOrNil). |
|
1650 |
revision := self utilities |
|
1651 |
revisionForSymbolicName:branchTag |
|
1652 |
class:nil |
|
1653 |
fileName:containerFilename |
|
1654 |
directory:packageDir |
|
1655 |
module:moduleDir |
|
1656 |
manager:self. |
|
1657 |
] ifFalse:[ |
|
1658 |
revision := self newestRevisionInFile:containerFilename directory:packageDir module:moduleDir. |
|
1659 |
]. |
|
1660 |
||
1362 | 1661 |
logMsg := logMessage. |
1447
2ac1cf09722b
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
1662 |
(logMsg isEmptyOrNil) ifTrue:[ |
1362 | 1663 |
logMsg := 'checkin from browser'. |
1664 |
]. |
|
1665 |
||
4055 | 1666 |
packageDir isEmptyOrNil ifTrue:[ |
1667 |
modulePath := moduleDir |
|
4075 | 1668 |
] ifFalse:[ |
1669 |
modulePath := moduleDir , '/' , packageDir. |
|
1670 |
]. |
|
1362 | 1671 |
checkoutName := modulePath , '/' , containerFilename. |
1672 |
||
1673 |
revision isNil ifTrue:[ |
|
1674 |
"/ a new file ... |
|
4280 | 1675 |
^ self createContainerForText:someText inModule:moduleDir package:packageDir container:containerFilename |
1362 | 1676 |
]. |
1677 |
||
3264 | 1678 |
[ |
1679 |
cmdOut := Filename newTemporary. |
|
1680 |
cmdOut exists ifTrue:[ |
|
1362 | 1681 |
cmdOut remove. |
1682 |
]. |
|
3264 | 1683 |
|
1684 |
"/ |
|
1685 |
"/ in CVS, we have to checkout the file first, in order |
|
1686 |
"/ to get up-to-date CVS entries, and also to be able to merge in |
|
1687 |
"/ other users changes. |
|
1688 |
"/ |
|
1689 |
||
1690 |
"/ |
|
1691 |
"/ first, create a temporary work tree |
|
1362 | 1692 |
"/ |
3264 | 1693 |
tempdir := self createTempDirectory:nil forModule:nil. |
1694 |
tempdir isNil ifTrue:[ |
|
1695 |
('no tempDir - cannot checkin ' , containerFilename) errorPrintCR. |
|
1696 |
^ false |
|
1697 |
]. |
|
1698 |
||
1699 |
"/ |
|
1700 |
"/ next, create CVS/Entries and CVS/Repository with version information of current version |
|
1701 |
"/ |
|
1702 |
||
1703 |
"/ correct our current time, so that converting it will give us UTC |
|
1704 |
time := Timestamp now asUtcTimestamp subtractSeconds:1. |
|
1705 |
||
4075 | 1706 |
self createEntryFor:checkoutName |
3264 | 1707 |
module:moduleDir |
4075 | 1708 |
in:(tempdir construct:modulePath) |
3264 | 1709 |
revision:revision |
1710 |
date:(self cvsTimeString:time) |
|
1711 |
special:'' |
|
1712 |
overwrite:true. |
|
1713 |
||
1714 |
"/ |
|
1715 |
"/ copy-over our current version |
|
1362 | 1716 |
"/ |
3264 | 1717 |
Error handle:[:ex| |
1718 |
'CVSSourceCodeManager [error]: cannot copy-over filedOut class source' errorPrintCR. |
|
1719 |
^ false. |
|
1720 |
] do:[ |
|
3858 | 1721 |
|s| |
1722 |
||
3264 | 1723 |
s := (tempdir construct:checkoutName) writeStream. |
1724 |
s nextPutAll:someText. |
|
1725 |
s close. |
|
1362 | 1726 |
]. |
3264 | 1727 |
|
1728 |
"/ |
|
1729 |
"/ synchronize i.e. merge in any changes |
|
1362 | 1730 |
"/ |
3870 | 1731 |
self activityNotification:'CVS: Merging ' , containerFilename , ' with repository version...'. |
3264 | 1732 |
|
4280 | 1733 |
branchTag notNil ifTrue:[ |
1734 |
cmd := 'update ', CVSUpdateOptions, ' -r ', branchTag, ' ' , containerFilename, ' >', '"' , cmdOut name , '"'. |
|
1735 |
] ifFalse:[ |
|
1736 |
cmd := 'update ', CVSUpdateOptions, ' ', containerFilename, ' >', '"' , cmdOut name , '"'. |
|
1737 |
]. |
|
4075 | 1738 |
(self |
1739 |
executeCVSCommand:cmd |
|
3264 | 1740 |
module:moduleDir |
1741 |
inDirectory:((tempdir construct:moduleDir) constructString:packageDir) |
|
1742 |
) ifFalse:[ |
|
1743 |
force ifFalse:[ |
|
1744 |
'CVSSourceCodeManager [error]: cannot merge current source with repository version' errorPrintCR. |
|
1745 |
^ false. |
|
1746 |
]. |
|
1747 |
] ifTrue:[ |
|
1748 |
"/ |
|
1749 |
"/ check what happened - the contents of the cmdOut file may be: |
|
1750 |
"/ empty -> nothing changed |
|
1751 |
"/ M xxx -> merged-in changes from other users |
|
4075 | 1752 |
"/ C xxx -> a conflict occurred and the differences have been merged into the source |
3264 | 1753 |
"/ needs special action |
1754 |
"/ |
|
1755 |
(cmdOut exists and:[cmdOut fileSize > 0]) ifTrue:[ |
|
3583 | 1756 |
whatHappened := cmdOut contentsAsString. |
3264 | 1757 |
]. |
1362 | 1758 |
]. |
3264 | 1759 |
|
1760 |
(whatHappened isEmptyOrNil) ifTrue:[ |
|
1761 |
"/ |
|
1762 |
"/ no change |
|
1763 |
"/ |
|
1764 |
"/ Transcript showCR:'no change in ' , containerFilename , ' (repository unchanged)'. |
|
1765 |
force ifFalse:[ |
|
1766 |
self information:'nothing changed in ' , containerFilename , ' (repository unchanged)'. |
|
1767 |
]. |
|
1768 |
^ true |
|
1769 |
]. |
|
1770 |
||
1771 |
Verbose == true ifTrue:[ |
|
1772 |
('CVSMGR: result is: ' , whatHappened) infoPrintCR. |
|
1362 | 1773 |
]. |
3264 | 1774 |
|
1775 |
force ifFalse:[ |
|
1776 |
revision isNil ifTrue:[ |
|
1777 |
changeLog := self revisionLogOfContainer:containerFilename directory:packageDir module:moduleDir. |
|
1778 |
] ifFalse:[ |
|
1779 |
changeLog := self revisionLogOfContainer:containerFilename module:moduleDir directory:packageDir fromRevision:(self revisionAfter:revision) toRevision:nil. |
|
1780 |
]. |
|
1781 |
changeLog notNil ifTrue:[ |
|
3858 | 1782 |
|s| |
1783 |
||
1784 |
s := CharacterWriteStream new. |
|
3264 | 1785 |
self writeRevisionLogMessagesFrom:changeLog withHeader:false to:s. |
1786 |
changesAsLogged := s contents. |
|
1787 |
] ifFalse:[ |
|
1788 |
"/ mhmh - that should not happen |
|
1789 |
changesAsLogged := ''. |
|
1790 |
]. |
|
1362 | 1791 |
]. |
3264 | 1792 |
|
1793 |
didMerge := false. |
|
1794 |
||
1362 | 1795 |
"/ |
3264 | 1796 |
"/ cvs above rel10 returns a multiline info ... |
1797 |
"/ we have to extract the one line which states what happened. |
|
1362 | 1798 |
"/ |
3264 | 1799 |
whatHappened := whatHappened asCollectionOfLines asStringCollection. |
1800 |
whatHappened := whatHappened select:[:line | |
|
1801 |
(line startsWith:'RCS file') not |
|
1802 |
and:[(line startsWith:'retrieving') not |
|
1803 |
and:[(line startsWith:'Merging') not |
|
1804 |
and:[line size > 0]]] |
|
1805 |
]. |
|
1806 |
whatHappened := whatHappened asString. |
|
1807 |
||
1808 |
(force or:[whatHappened startsWith:'M ']) ifTrue:[ |
|
1362 | 1809 |
"/ |
3264 | 1810 |
"/ merged in changes |
1362 | 1811 |
"/ |
4075 | 1812 |
(force |
1813 |
or:[changeLog isNil |
|
3264 | 1814 |
or:[(changeLog at:#revisions ifAbsent:[#()]) isEmpty]]) ifTrue:[ |
1815 |
"/ |
|
1816 |
"/ pretty good - nothing has changed in the meanwhile |
|
1817 |
"/ |
|
4113 | 1818 |
Transcript showCR:'CVSSourceCodeManager [info]: checking in ' , containerFilename , ' ...' |
3264 | 1819 |
] ifFalse:[ |
1820 |
| mySource mergedSource | |
|
1821 |
||
1822 |
"/ |
|
1823 |
"/ someone else has changed things in the meanwhile, but there is no conflict |
|
1824 |
"/ and version have been merged. |
|
1825 |
"/ |
|
1826 |
didMerge := true. |
|
1827 |
changesAsLogged := changesAsLogged asCollectionOfLines. |
|
1828 |
||
3858 | 1829 |
mySource := someText. |
3264 | 1830 |
mergedSource := (tempdir construct:checkoutName) readStream contents asString. |
1831 |
||
1832 |
mySource = mergedSource ifTrue:[ |
|
1833 |
msg := 'The source of ' , containerFilename , ' has been changed in the meanwhile as listed below. |
|
1362 | 1834 |
|
4075 | 1835 |
I have merged your version with the newest repository version, |
1362 | 1836 |
and found no differences between the result and your current version |
1837 |
(i.e. your version seemed up-to-date).'. |
|
1838 |
||
3264 | 1839 |
self checkinTroubleDialog:'Merging versions' |
4075 | 1840 |
message:msg |
3264 | 1841 |
log:changesAsLogged |
4075 | 1842 |
abortable:false |
3264 | 1843 |
option:nil. |
1844 |
didMerge := false. |
|
1845 |
] ifFalse:[ |
|
1846 |
msg := 'The source of ' , containerFilename , ' has been changed in the meanwhile as listed below. |
|
1362 | 1847 |
|
1848 |
If you continue, your new changes (based upon rev. ' , revision printString , ') will be MERGED |
|
1849 |
into the newest revision. This will combine the other version with your changes |
|
4075 | 1850 |
into a new common revision which may be different from both. |
1851 |
Although this is a nice feature, it may fail to create the expected result in certain situations. |
|
1362 | 1852 |
|
1853 |
You should carefully check the result - by comparing the current version with the |
|
1854 |
most recent version in the repository. If that does not contain an acceptable version, |
|
4075 | 1855 |
change methods as required and check in again. |
1362 | 1856 |
Be aware, that after that, the actual repository version is different from your current classes, |
1857 |
and you should update your class from the repository. |
|
1858 |
||
1859 |
Continue ?'. |
|
1860 |
||
3264 | 1861 |
answer := self checkinTroubleDialog:'Merging versions' |
4075 | 1862 |
message:msg |
3264 | 1863 |
log:changesAsLogged |
1864 |
abortable:true |
|
1865 |
option:'Stop - see first'. |
|
1866 |
answer ~~ true ifTrue:[ |
|
1867 |
answer == #option ifTrue:[ |
|
1868 |
DiffCodeView |
|
1869 |
openOn:mySource |
|
1870 |
label:'current version' |
|
1871 |
and:mergedSource |
|
1872 |
label:'merged version'. |
|
4075 | 1873 |
|
3264 | 1874 |
]. |
1875 |
Transcript showCR:'checkin aborted - (no merge; repository unchanged)'. |
|
1876 |
^ false. |
|
1362 | 1877 |
]. |
1878 |
]. |
|
1879 |
||
1880 |
"/ changesAsLogged := (changesAsLogged asStringCollection collect:[:line | line withTabsExpanded]) asString. |
|
1881 |
"/ msg := 'The source of ' , containerFilename , ' has been changed in the meanwhile as follows: |
|
1882 |
"/' , changesAsLogged , ' |
|
1883 |
"/ |
|
1884 |
"/If you continue, your new changes (based upon rev. ' , revision , ') will be MERGED |
|
1885 |
"/into the newest revision. This will combine the other version with your changes |
|
4075 | 1886 |
"/into a new common revision which is different from both. |
1887 |
"/Although convenient, it may fail to create the expected result in certain situations. |
|
1362 | 1888 |
"/ |
1889 |
"/You should carefully check the result - by comparing the current version with the |
|
1890 |
"/most recent version in the repository. If that does not contain an acceptable version, |
|
1891 |
"/change methods as required and check in again. Be aware, that the actual repository version |
|
1892 |
"/is different from your current classes. |
|
1893 |
"/ |
|
1894 |
"/Continue ?'. |
|
1895 |
"/ (self confirm:msg) ifFalse:[ |
|
1896 |
"/ Transcript showCR:'checkin aborted - (no merge; repository unchanged)'. |
|
1897 |
"/ ^ false. |
|
1898 |
"/ ]. |
|
4113 | 1899 |
Transcript showCR:'CVSSourceCodeManager [info]: checking in ' , containerFilename , ' (merged other changes) ...' |
3264 | 1900 |
] |
1901 |
] ifFalse:[ |
|
1902 |
(whatHappened startsWith:'C ') ifTrue:[ |
|
1903 |
"/ |
|
1904 |
"/ conflict; someone else checked in something in the meanwhile, |
|
1905 |
"/ and there is a conflict between this version and the checked in version. |
|
1906 |
"/ |
|
1907 |
||
1908 |
changesAsLogged := changesAsLogged asCollectionOfLines. |
|
1909 |
||
1910 |
msg := 'The source of ' , containerFilename , ' has been changed in the meanwhile as listed below. |
|
1362 | 1911 |
|
1912 |
Your new changes (based upon rev. ' , revision printString , ') CONFLICT with those changes. |
|
1913 |
||
1914 |
You should fix things by comparing your class with the most recent repository version |
|
1915 |
and change your methods avoiding conflicts. The checkin again. |
|
1916 |
'. |
|
1917 |
||
3264 | 1918 |
answer := self checkinTroubleDialog:'Version conflict' |
4075 | 1919 |
message:msg |
3264 | 1920 |
log:changesAsLogged |
1921 |
abortable:false |
|
1922 |
option:'show conflicts' |
|
1923 |
option2:'resolve conflicts'. |
|
1924 |
||
1925 |
answer == #option ifTrue:[ |
|
1926 |
"/ |
|
1927 |
"/ show conflicts in a 3-way DiffTextView ... |
|
1928 |
"/ |
|
1929 |
Diff3TextView |
|
4075 | 1930 |
openOnMergedText:(tempdir construct:checkoutName) readStream contents |
1931 |
label:'your version (checkin attempt)' |
|
1932 |
label:'original (base version)' |
|
1933 |
label:'newest repository version'. |
|
3264 | 1934 |
]. |
1935 |
||
1936 |
checkInRepaired := false. |
|
1937 |
answer == #option2 ifTrue:[ |
|
1938 |
"/ |
|
1939 |
"/ allow checkin of repair version |
|
1940 |
"/ this is error prone ... |
|
1941 |
"/ |
|
1942 |
"/ |
|
1943 |
"/ show merged version in an editor ... |
|
1944 |
"/ ... accept will check it in. |
|
1945 |
"/ |
|
1946 |
emphasizedText := (tempdir construct:checkoutName) readStream contents. |
|
1947 |
emSep := (Array with:(#color->Color black) |
|
1948 |
with:(#backgroundColor->Color green)). |
|
4075 | 1949 |
emphasizedText := Diff3TextView |
1950 |
emphasizeMergedDiff3Text:emphasizedText |
|
3264 | 1951 |
emphasize1:(Array with:(#color->Color white) |
1952 |
with:(#backgroundColor->Color blue)) |
|
1953 |
emphasize2:(Array with:(#color->Color white) |
|
1954 |
with:(#backgroundColor->Color red)) |
|
1955 |
emphasizeSep:emSep. |
|
1956 |
||
4075 | 1957 |
comment := |
1362 | 1958 |
'"/ *************************************************************** |
1959 |
"/ This text contains your current versions code (blue) |
|
1960 |
"/ merged with the conflicting code as found in the repository (red) which resulted |
|
1961 |
"/ from some other checkin. |
|
1962 |
"/ Each such conflict is surrounded by green text (like this paragraph). |
|
4075 | 1963 |
"/ |
1362 | 1964 |
"/ Please have a look at ALL the conflicts and fix things as appropriate. |
1965 |
"/ Delete the green lines as a confirmation - I will not checkin the changed text, |
|
1966 |
"/ unless no more green parts are present. This includes this comment at the top. |
|
1967 |
"/ *************************************************************** |
|
1968 |
'. |
|
3264 | 1969 |
comment := (Text string:comment emphasis:emSep) asStringCollection. |
1970 |
emphasizedText := comment , emphasizedText. |
|
1971 |
||
1972 |
didAccept := false. checkInRepaired := true. |
|
1973 |
[didAccept not and:[checkInRepaired]] whileTrue:[ |
|
4075 | 1974 |
editor := RCSConflictEditTextView |
3264 | 1975 |
setupWith:emphasizedText |
4075 | 1976 |
title:'Resolve conflicts in ' , containerFilename , ', then accept & close to checkin'. |
3264 | 1977 |
|
1978 |
editor acceptAction:[:dummy | |
|
1979 |
repairedText := editor list. |
|
1980 |
didAccept := true. |
|
1981 |
]. |
|
1982 |
didAccept := false. |
|
1983 |
editor topView openModal. |
|
1984 |
||
1985 |
didAccept ifFalse:[ |
|
1986 |
(Dialog confirm:'You did not accept the new text. Edit again ?') |
|
1987 |
ifFalse:[ |
|
1988 |
checkInRepaired := false. |
|
1989 |
] |
|
1990 |
] ifTrue:[ |
|
1991 |
"/ check if all green-stuff (separators) have been removed |
|
3685 | 1992 |
(repairedText findFirst:[:line | line notEmptyOrNil and:[(line emphasisAt:1) = emSep]]) ~~ 0 ifTrue:[ |
3264 | 1993 |
self warn:'You have to look at ALL conflicts, and remove ALL green lines as a confirmation !!'. |
1994 |
didAccept := false. |
|
1995 |
] |
|
1996 |
]. |
|
1997 |
||
1362 | 1998 |
]. |
3264 | 1999 |
|
2000 |
checkInRepaired ifTrue:[ |
|
2001 |
[ |
|
2002 |
out := (tempdir construct:checkoutName) writeStream. |
|
2003 |
out nextPutAll:(repairedText asString string). |
|
2004 |
didAccept := true. |
|
2005 |
out close. |
|
2006 |
] on:FileStream openErrorSignal do:[:ex| |
|
2007 |
self warn:'could not write file ' , (tempdir constructString:checkoutName). |
|
1362 | 2008 |
checkInRepaired := false. |
3264 | 2009 |
]. |
2010 |
] |
|
1362 | 2011 |
]. |
2012 |
||
2013 |
checkInRepaired ifTrue:[ |
|
4113 | 2014 |
Transcript showCR:'CVSSourceCodeManager [info]: checking in ' , containerFilename , ' (manually repaired version) ...' |
3264 | 2015 |
] ifFalse:[ |
2016 |
'CVSSourceCodeManager [warning]: cannot (for now) checkin; conflicts found' infoPrintCR. |
|
2017 |
Transcript showCR:'checkin of ' , containerFilename , ' aborted (conflicting changes; repository unchanged)'. |
|
2018 |
^ false. |
|
1362 | 2019 |
] |
2020 |
] ifFalse:[ |
|
3264 | 2021 |
(whatHappened startsWith:'U ') ifTrue:[ |
2022 |
"/ |
|
2023 |
"/ nothing changed here, but the repository already contains |
|
2024 |
"/ a newer version. |
|
2025 |
"/ |
|
2026 |
||
2027 |
self information:'nothing changed in your ''' , containerFilename , '''; |
|
1362 | 2028 |
but repository already contains a newer version (repository unchanged).'. |
3264 | 2029 |
^ true. |
2030 |
] ifFalse:[ |
|
2031 |
"/ |
|
2032 |
"/ unexpected |
|
2033 |
"/ |
|
2034 |
self warn:'unexpected message from CVS: |
|
1362 | 2035 |
' , whatHappened , ' |
2036 |
||
2037 |
No checkin performed.'. |
|
3264 | 2038 |
Transcript showCR:'*** cannot checkin ' , containerFilename , ' (unexpected CVS response; repository unchanged)'. |
2039 |
^ false. |
|
2040 |
] |
|
1362 | 2041 |
] |
3264 | 2042 |
]. |
2043 |
||
2044 |
||
2045 |
"/ |
|
2046 |
"/ now check it in again |
|
1362 | 2047 |
"/ |
3870 | 2048 |
self activityNotification:'CVS: Saving ' , containerFilename , ' in repository...'. |
3264 | 2049 |
|
2050 |
logMsg := logMsg replChar:$" withString:'\"'. |
|
2051 |
||
2052 |
OperatingSystem isUNIXlike ifFalse:[ |
|
2053 |
"/ save the log message into another tempFile ... |
|
3858 | 2054 |
|s| |
2055 |
||
3264 | 2056 |
logTmp := Filename newTemporaryIn:tempdir. |
2057 |
s := logTmp writeStream. |
|
2058 |
s nextPutAll:logMsg. |
|
2059 |
s close. |
|
2060 |
||
2061 |
cmd := 'commit -F "%1" %2 %3 > "%4"' |
|
2062 |
bindWith:logTmp baseName |
|
2063 |
with:CVSCommitOptions |
|
2064 |
with:checkoutName |
|
2065 |
with:cmdOut name. |
|
2066 |
] ifTrue:[ |
|
2067 |
"/ |
|
2068 |
"/ CVS up to V1.9.14 prints the 'new revision' to stderr, |
|
2069 |
"/ CVS V1.9.16 to stdout. |
|
2070 |
"/ |
|
2071 |
cmd := 'commit -m "%1" %2 %3 > "%4" 2>&1' |
|
2072 |
bindWith:logMsg |
|
2073 |
with:CVSCommitOptions |
|
2074 |
with:checkoutName |
|
2075 |
with:cmdOut name |
|
1362 | 2076 |
]. |
3264 | 2077 |
|
4075 | 2078 |
(self |
2079 |
executeCVSCommand:cmd |
|
3264 | 2080 |
module:moduleDir |
2081 |
inDirectory:tempdir name |
|
2082 |
) ifFalse:[ |
|
2083 |
(cmdOut exists and:[cmdOut fileSize > 0]) ifTrue:[ |
|
2084 |
whatHappened := cmdOut contentsOfEntireFile asString. |
|
2085 |
] ifFalse:[ |
|
2086 |
whatHappened := '<< no message >>' |
|
2087 |
]. |
|
2088 |
self warn:'The following problem was reported by cvs: |
|
1362 | 2089 |
|
2090 |
' , whatHappened , ' |
|
2091 |
||
2092 |
The class has NOT been checked into the repository.'. |
|
2093 |
||
3264 | 2094 |
('CVSSourceCodeManager [error]: cvs: ' , whatHappened) errorPrintCR. |
2095 |
'CVSSourceCodeManager [error]: cannot checkin modified class source' errorPrintCR. |
|
2096 |
logTmp notNil ifTrue:[logTmp remove]. |
|
2097 |
^ false. |
|
2098 |
]. |
|
1362 | 2099 |
logTmp notNil ifTrue:[logTmp remove]. |
3264 | 2100 |
(cmdOut exists and:[cmdOut fileSize > 0]) ifTrue:[ |
2101 |
whatHappened := cmdOut contentsOfEntireFile asString. |
|
2102 |
] ifFalse:[ |
|
2103 |
whatHappened := nil |
|
2104 |
]. |
|
2105 |
||
2106 |
"/ |
|
2107 |
"/ fetch the new revision nr as found in the commit commands output |
|
2108 |
"/ |
|
2109 |
||
2110 |
(whatHappened isEmptyOrNil) ifTrue:[ |
|
2111 |
'CVSSourceCodeManager [warning]: unexpected empty checkin command output' errorPrintCR. |
|
1362 | 2112 |
] ifFalse:[ |
3264 | 2113 |
whatHappened := whatHappened asCollectionOfLines asStringCollection. |
2114 |
idx := whatHappened indexOfLineStartingWith:'new revision:'. |
|
2115 |
idx == 0 ifTrue:[ |
|
2116 |
'CVSSourceCodeManager [error]: unexpected checkin command output (no new-revision info)' errorPrintCR. |
|
2117 |
] ifFalse:[ |
|
2118 |
l := whatHappened at:idx. |
|
2119 |
newRevision := (l copyFrom:14 to:(l indexOf:$; startingAt:14)-1) withoutSpaces. |
|
2120 |
] |
|
2121 |
]. |
|
2122 |
] ensure:[ |
|
2123 |
cmdOut notNil ifTrue:[ cmdOut remove ]. |
|
2124 |
tempdir notNil ifTrue:[ tempdir recursiveRemove ] |
|
1362 | 2125 |
]. |
2126 |
^ true |
|
1664
5fa005755e5f
renamed *package* to *directory* to avoid confusion.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
2127 |
|
4280 | 2128 |
"Created: / 05-12-2017 / 23:28:31 / cg" |
2129 |
"Modified: / 06-12-2017 / 03:19:59 / cg" |
|
1362 | 2130 |
! |
2131 |
||
2132 |
checkinClass:cls fileName:classFileName directory:packageDir module:moduleDir source:sourceFileName logMessage:logMessage force:forceArg |
|
4232 | 2133 |
^ self checkinClass:cls fileName:classFileName directory:packageDir module:moduleDir source:sourceFileName logMessage:logMessage force:forceArg asBranch:nil |
2134 |
||
2135 |
"Created: / 11-09-1996 / 16:16:11 / cg" |
|
2136 |
"Modified: / 31-07-2013 / 18:07:53 / cg" |
|
2137 |
"Modified: / 29-03-2017 / 18:21:23 / stefan" |
|
2138 |
! |
|
2139 |
||
2140 |
checkinClass:cls fileName:classFileName directory:packageDir module:moduleDir source:sourceFileName logMessage:logMessage force:forceArg asBranch:branchTag |
|
1362 | 2141 |
"enter a classes source code (which has been already filed out into sourceFileName) |
2142 |
into the source repository. If the force argument is true, no merge is done; |
|
2143 |
instead, the code is checked in as given (Dangerous). |
|
4232 | 2144 |
Return true if ok, false if not. |
2145 |
||
2146 |
If branchTag is notNil, the class is checked in on the branch if it already exists, or a branch for this tag is created. |
|
2147 |
(branch support does not work yet!!)" |
|
2148 |
||
2149 |
|tempdir cmd checkoutName logMsg classRevision newestRevision cmdOut whatHappened s entry idx changeLog changesAsLogged l |
|
1362 | 2150 |
newRevision newString binRevision className msg answer didMerge |
4075 | 2151 |
modulePath time |
2152 |
editor checkInRepaired checkInNew didAccept emphasizedText repairedText out |
|
4232 | 2153 |
emSep force conflictResolvedManually revisionOption| |
1362 | 2154 |
|
2155 |
force := forceArg. |
|
2156 |
||
2157 |
className := cls name. |
|
2158 |
cls isPrivate ifTrue:[ |
|
1778
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2159 |
self reportError:'refuse to check in private classes.'. |
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2160 |
^ false. |
1362 | 2161 |
]. |
4232 | 2162 |
classRevision := cls revisionOfManager:self. |
2163 |
(classRevision notNil and:[classRevision endsWith:$m]) ifTrue:[ |
|
1362 | 2164 |
"/ this class has already been checked in with a merge, |
2165 |
"/ but not reloaded from the repository. |
|
2166 |
"/ must use the original revision string. |
|
4232 | 2167 |
classRevision := classRevision copyButLast:1. |
1362 | 2168 |
]. |
4232 | 2169 |
binRevision := cls binaryRevision. |
2170 |
(binRevision notNil and:[classRevision ~= binRevision]) ifTrue:[ |
|
2171 |
Transcript showCR:('CVSSourceCodeManager [info]: class ' , className , ' is based upon ' , binRevision , ' but has revision ' , (classRevision ? '?')) |
|
1362 | 2172 |
]. |
2173 |
||
4232 | 2174 |
classRevision isNil ifTrue:[ |
2175 |
"there is no version method. Get the version from the repository" |
|
2176 |
classRevision := newestRevision := self newestRevisionOf:cls. |
|
2177 |
classRevision isNil ifTrue:[ |
|
1362 | 2178 |
force ifTrue:[ |
4232 | 2179 |
classRevision := newestRevision := self newestRevisionInFile:classFileName directory:packageDir module:moduleDir. |
2180 |
]. |
|
2181 |
classRevision isNil ifTrue:[ |
|
2182 |
classRevision := '1.0' "/ initial checkin |
|
2183 |
]. |
|
1502 | 2184 |
] ifFalse:[ |
4232 | 2185 |
classRevision == #deleted ifTrue:[ |
2186 |
classRevision := '0' "/ to force cvs-adding, which resurrects the file from the Attic |
|
1502 | 2187 |
]. |
2188 |
]. |
|
1362 | 2189 |
]. |
2190 |
||
1373
65473183582d
Check for unicode in cvs log message (cvs cannot handle this)
Stefan Vogel <sv@exept.de>
parents:
1365
diff
changeset
|
2191 |
logMessage isNil ifTrue:[ |
65473183582d
Check for unicode in cvs log message (cvs cannot handle this)
Stefan Vogel <sv@exept.de>
parents:
1365
diff
changeset
|
2192 |
logMsg := ''. |
65473183582d
Check for unicode in cvs log message (cvs cannot handle this)
Stefan Vogel <sv@exept.de>
parents:
1365
diff
changeset
|
2193 |
] ifFalse:[ |
65473183582d
Check for unicode in cvs log message (cvs cannot handle this)
Stefan Vogel <sv@exept.de>
parents:
1365
diff
changeset
|
2194 |
logMsg := logMessage asSingleByteStringIfPossible. |
2982 | 2195 |
logMsg isWideString ifTrue:[ |
1778
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2196 |
self reportError:'cvs cannot handle unicode in logMessage'. |
1373
65473183582d
Check for unicode in cvs log message (cvs cannot handle this)
Stefan Vogel <sv@exept.de>
parents:
1365
diff
changeset
|
2197 |
^ false. |
4075 | 2198 |
]. |
1362 | 2199 |
]. |
2200 |
||
2201 |
cmdOut := Filename newTemporary. |
|
2202 |
cmdOut exists ifTrue:[ |
|
2203 |
cmdOut remove. |
|
2204 |
]. |
|
2205 |
||
2206 |
"/ |
|
2207 |
"/ in CVS, we have to checkout the file first, in order |
|
2208 |
"/ to get up-to-date CVS entries, and also to be able to merge in |
|
2209 |
"/ other users changes. |
|
2210 |
"/ |
|
2211 |
||
2212 |
"/ |
|
2213 |
"/ first, create a temporary work tree |
|
2214 |
"/ |
|
2215 |
tempdir := self createTempDirectory:nil forModule:nil. |
|
2127 | 2216 |
tempdir isNil ifTrue:[ |
2217 |
('no tempDir - cannot checkin ' , className) errorPrintCR. |
|
2218 |
^ false |
|
2219 |
]. |
|
4232 | 2220 |
[ "ensure protected block" |
1362 | 2221 |
"/ |
4232 | 2222 |
"/ next, create CVS/Entries and CVS/Repository with revision information of current revision |
4229 | 2223 |
"/ |
2224 |
packageDir isEmptyOrNil ifTrue:[ |
|
2225 |
modulePath := moduleDir |
|
2226 |
] ifFalse:[ |
|
2227 |
modulePath := moduleDir , '/' , packageDir. |
|
2228 |
]. |
|
2229 |
checkoutName := modulePath , '/' , classFileName. |
|
2230 |
||
2231 |
"/ |
|
2232 |
"/ correct our current time, so that converting it will give us UTC |
|
2233 |
"/ |
|
2234 |
time := UtcTimestamp now subtractSeconds:1. |
|
2235 |
||
2236 |
self createEntryFor:checkoutName |
|
2237 |
module:moduleDir |
|
2238 |
in:(tempdir construct:modulePath) |
|
4232 | 2239 |
revision:classRevision |
4229 | 2240 |
date:(self cvsTimeString:time) |
2241 |
special:'' |
|
2242 |
overwrite:true. |
|
2243 |
||
2244 |
"/ |
|
2245 |
"/ copy-over our current version |
|
2246 |
"/ |
|
2247 |
Error handle:[:ex| |
|
2248 |
self reportError:'cannot copy-over filedOut class source'. |
|
2249 |
^ false. |
|
2250 |
] do:[ |
|
2251 |
sourceFileName asFilename copyTo:(tempdir construct:checkoutName). |
|
2252 |
]. |
|
2253 |
||
2254 |
"/ |
|
2255 |
"/ synchronize i.e. merge in any changes |
|
2256 |
"/ |
|
2257 |
self activityNotification:'CVS: Merging ' , cls name , ' with repository version...'. |
|
2258 |
||
2259 |
revisionOption := ''. |
|
2260 |
branchTag notEmptyOrNil ifTrue:[ |
|
2261 |
revisionOption := '-r ', branchTag. |
|
2262 |
] ifFalse:[ |
|
4232 | 2263 |
(classRevision occurrencesOf:$.) > 2 ifTrue:[ |
4229 | 2264 |
"must be a branch, compare with branch revision" |
4232 | 2265 |
revisionOption := '-r ', classRevision copyUpToLast:$.. |
4229 | 2266 |
]. |
2267 |
]. |
|
2268 |
||
2269 |
cmd := 'update %1 %4 %2 >"%3"' |
|
4232 | 2270 |
bindWith:CVSUpdateOptions |
2271 |
with:classFileName |
|
2272 |
with:cmdOut name |
|
2273 |
with:revisionOption. |
|
4229 | 2274 |
|
2275 |
(self |
|
2276 |
executeCVSCommand:cmd |
|
2277 |
module:moduleDir |
|
2278 |
inDirectory:((tempdir construct:moduleDir) constructString:packageDir) |
|
2279 |
) ifFalse:[ |
|
2280 |
force ifFalse:[ |
|
2281 |
(self checkForExistingContainer:classFileName inModule:moduleDir directory:packageDir) ifFalse:[ |
|
2282 |
"/ no container |
|
2283 |
"/ someone fiddled around with repository ? |
|
2284 |
(cls binaryRevision notNil) ifTrue:[ |
|
2285 |
(Dialog confirm:('Someone seems to have removed the source container for ',cls name,'\\Force new checkin ?') withCRs) |
|
2286 |
ifTrue:[ |
|
2287 |
cls setBinaryRevision:nil. |
|
2288 |
^ self checkinClass:cls fileName:classFileName directory:packageDir module:moduleDir source:sourceFileName logMessage:logMsg force:force asBranch:branchTag. |
|
2289 |
]. |
|
2290 |
]. |
|
2291 |
(Dialog confirm:('There seems to be no source container for "%1"\(Either the source container was removed,\or your per-module repository setting is wrong,\or the CVS server is unreachable).\\Proceed?' bindWith:cls name allBold) withCRs) |
|
2292 |
ifFalse:[ |
|
2293 |
^ false |
|
2294 |
]. |
|
2295 |
]. |
|
2296 |
||
2297 |
"/ is the version correct ? |
|
2298 |
newestRevision isNil ifTrue:[ |
|
2299 |
newestRevision := self newestRevisionOf:cls. |
|
2300 |
newestRevision isNil ifTrue:[ |
|
2301 |
(Dialog confirm:('The source container for ',cls name allBold,' seems corrupted. Proceed?' withCRs)) ifFalse:[ |
|
2302 |
^ false |
|
2303 |
]. |
|
2304 |
^ self |
|
2305 |
checkinClass:cls fileName:classFileName directory:packageDir module:moduleDir |
|
2306 |
source:sourceFileName logMessage:logMessage force:true. |
|
2307 |
]. |
|
2308 |
]. |
|
2309 |
"/ revision > newestRevision ifTrue:[ |
|
2310 |
"/ true "/ (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) |
|
2311 |
"/ ifTrue:[ |
|
2312 |
"/ "/ newVersionString := self updatedRevisionStringOf:cls forRevision:newestRevision with:cls revisionString. |
|
2313 |
"/ "/ self updateVersionMethodOf:cls for:newVersionString. |
|
2314 |
"/ ^ self checkinClass:cls fileName:classFileName directory:packageDir module:moduleDir source:sourceFileName logMessage:logMsg force:force. |
|
2315 |
"/ ]. |
|
2316 |
"/ ]. |
|
2317 |
"/ |
|
2318 |
"/ self reportError:('cannot merge current source with repository version (failed to execute: ',cmd,')'). |
|
2319 |
"/ ^ false. |
|
2320 |
"/ if we arrive here, proceed as if merged |
|
2321 |
whatHappened := 'M initial' |
|
2322 |
]. |
|
2323 |
] ifTrue:[ |
|
2324 |
"/ |
|
2325 |
"/ check what happened - the contents of the cmdOut file may be: |
|
2326 |
"/ empty -> nothing changed |
|
2327 |
"/ M xxx -> merged-in changes from other users |
|
2328 |
"/ C xxx -> a conflict occurred and the differences have been merged into the source |
|
2329 |
"/ needs special action |
|
2330 |
"/ |
|
2331 |
(cmdOut exists and:[cmdOut fileSize > 0]) ifTrue:[ |
|
2332 |
whatHappened := cmdOut contentsAsString. |
|
2333 |
] ifFalse:[ |
|
2334 |
self breakPoint:#cg. |
|
2335 |
]. |
|
2336 |
]. |
|
2337 |
||
2338 |
(whatHappened isEmptyOrNil) ifTrue:[ |
|
2339 |
"/ |
|
2340 |
"/ no change |
|
2341 |
"/ |
|
2342 |
Transcript showCR:'no change in ' , className , ' (repository unchanged)'. |
|
2343 |
||
2344 |
force ifFalse:[ |
|
2345 |
"/ (ChangeSet current includesChangeForClass:cls) ifTrue:[ |
|
2346 |
"/ (self confirm:('Nothing changed in %1 (repository unchanged).\\Remove entries from changeSet ?' bindWith:className) withCRs) ifTrue:[ |
|
2347 |
"/ ChangeSet current condenseChangesForClass:cls. |
|
2348 |
"/ ]. |
|
2349 |
"/ ] ifFalse:[ |
|
2350 |
"/ self information:('Nothing changed in %1 (repository unchanged)' bindWith:className). |
|
2351 |
"/ ]. |
|
2352 |
self postCheckInClass:cls. |
|
2353 |
] ifTrue:[ |
|
2354 |
changeLog := self revisionLogOfContainer:classFileName directory:packageDir module:moduleDir. |
|
2355 |
(changeLog isNil or:[(changeLog at:#revisions) size ~~ 1]) ifTrue:[ |
|
2356 |
'CVSSourceCodeManager [error]: failed to update revisionString (no log)' errorPrintCR. |
|
2357 |
self updateVersionMethodOf:cls for:'$' , 'Header' , '$'. "/ concatenated to avoid RCS expansion |
|
2358 |
] ifFalse:[ |
|
2359 |
entry := (changeLog at:#revisions) first. |
|
2360 |
newString := self revisionStringFromLog:changeLog entry:entry forClass:cls. |
|
2361 |
newString isEmptyOrNil ifTrue:[ |
|
4232 | 2362 |
'CVSSourceCodeManager [error]: missing revisionString' errorPrintCR |
4229 | 2363 |
] ifFalse:[ |
2364 |
self updateVersionMethodOf:cls for:newString. |
|
2365 |
cls revision ~= newRevision ifTrue:[ |
|
2366 |
'CVSSourceCodeManager [error]: failed to update revisionString' errorPrintCR |
|
2367 |
] ifFalse:[ |
|
2368 |
('CVSSourceCodeManager [info]: updated revisionString to:',newString) infoPrintCR |
|
2369 |
] |
|
2370 |
] |
|
2371 |
] |
|
2372 |
]. |
|
2373 |
^ true |
|
2374 |
]. |
|
4232 | 2375 |
|
4229 | 2376 |
Verbose == true ifTrue:[ |
2377 |
('CVSMGR: result is: ' , whatHappened) infoPrintCR. |
|
2378 |
]. |
|
2379 |
||
2380 |
force ifFalse:[ |
|
4232 | 2381 |
|nextRevision| |
2382 |
||
2383 |
classRevision notNil ifTrue:[ |
|
2384 |
nextRevision := self revisionAfter:classRevision. |
|
4229 | 2385 |
]. |
4232 | 2386 |
changeLog := self revisionLogOf:cls fromRevision:nextRevision toRevision:nil. |
4229 | 2387 |
changeLog notNil ifTrue:[ |
2388 |
s := CharacterWriteStream on:''. |
|
2389 |
self writeRevisionLogMessagesFrom:changeLog withHeader:false to:s. |
|
2390 |
changesAsLogged := s contents. |
|
2391 |
] ifFalse:[ |
|
2392 |
"/ mhmh - that should not happen |
|
2393 |
changesAsLogged := ''. |
|
2394 |
]. |
|
2395 |
]. |
|
2396 |
||
2397 |
didMerge := false. |
|
2398 |
conflictResolvedManually := checkInRepaired := checkInNew := false. |
|
2399 |
||
2400 |
"/ |
|
2401 |
"/ cvs above rel10 returns a multiline info ... |
|
2402 |
"/ we have to extract the one line which states what happened. |
|
2403 |
"/ |
|
4232 | 2404 |
whatHappened := whatHappened asCollectionOfLines reject:[:line | |
2405 |
line isEmpty |
|
2406 |
or:[(line startsWith:'RCS file') |
|
2407 |
or:[(line startsWith:'retrieving') |
|
2408 |
or:[(line startsWith:'Merging')]]] |
|
4229 | 2409 |
]. |
2410 |
whatHappened := whatHappened asString. |
|
2411 |
||
2412 |
(force or:[(whatHappened startsWith:'M ') or:[whatHappened startsWith:'A ']]) ifTrue:[ |
|
2413 |
"/ |
|
2414 |
"/ merged in changes / resurrected |
|
2415 |
"/ |
|
2416 |
(force |
|
4232 | 2417 |
or:[changeLog isNil |
2418 |
or:[(changeLog at:#revisions ifAbsent:nil) isEmptyOrNil]]) ifTrue:[ |
|
4229 | 2419 |
"/ |
2420 |
"/ pretty good - nothing has changed in the meanwhile |
|
2421 |
"/ |
|
2422 |
Transcript showCR:('CVSSourceCodeManager [info]: checking in %1 (%2)...' bindWith:className with:modulePath). |
|
2423 |
] ifFalse:[ |
|
2424 |
|mySource mergedSource | |
|
2425 |
||
2426 |
"/ |
|
2427 |
"/ someone else has changed things in the meanwhile, but there is no conflict |
|
2428 |
"/ and version have been merged. |
|
2429 |
"/ |
|
2430 |
didMerge := true. |
|
2431 |
changesAsLogged := changesAsLogged asCollectionOfLines. |
|
2432 |
||
2433 |
s := CharacterWriteStream new. |
|
4232 | 2434 |
self fileOutSourceCodeOf:cls on:s. |
2435 |
mySource := s contents. |
|
2436 |
mergedSource := (tempdir construct:checkoutName) readStream contentsAsString. |
|
4229 | 2437 |
|
2438 |
mySource = mergedSource ifTrue:[ |
|
2439 |
msg := 'The source of ' , className , ' has been changed in the meanwhile as listed below. |
|
2440 |
||
2441 |
I have merged your version with the newest repository version, |
|
2442 |
and found no differences between the result and your current version |
|
2443 |
(i.e. your version seemed up-to-date).'. |
|
2444 |
||
2445 |
self checkinTroubleDialog:'Merging versions' |
|
2446 |
message:msg |
|
2447 |
log:changesAsLogged |
|
2448 |
abortable:false |
|
2449 |
option:nil. |
|
2450 |
didMerge := false. |
|
2451 |
] ifFalse:[ |
|
2452 |
msg := 'The source of ' , className , ' has been changed in the meanwhile as listed below. |
|
2453 |
||
4232 | 2454 |
If you continue, your new changes (based upon rev. ' , classRevision printString , ') will be MERGED |
4229 | 2455 |
into the newest revision. This will combine the other version with your changes |
2456 |
into a new common revision which may be different from both. |
|
2457 |
Although this is a nice feature, it may fail to create the expected result in certain situations. |
|
2458 |
||
2459 |
You should carefully check the result - by comparing the current version with the |
|
2460 |
most recent version in the repository. If that does not contain an acceptable version, |
|
2461 |
change methods as required and check in again. |
|
2462 |
Be aware, that after that, the actual repository version is different from your current classes, |
|
2463 |
and you should update your class from the repository. |
|
2464 |
||
2465 |
Continue ?'. |
|
2466 |
||
2467 |
answer := self checkinTroubleDialog:'Merging versions' |
|
2468 |
message:msg |
|
2469 |
log:changesAsLogged |
|
2470 |
abortable:true |
|
2471 |
option:'Stop - see first' |
|
2472 |
option2:'Do NOT Merge - Force my Code'. |
|
2473 |
||
2474 |
answer == #option2 ifTrue:[ |
|
2475 |
(Dialog confirm:'Are you certain that you want to suppress a merge and force your code to be checked in ?') |
|
2476 |
ifTrue:[ |
|
2477 |
s := (tempdir construct:checkoutName) writeStream. |
|
2478 |
self fileOutSourceCodeOf: cls on:s. |
|
2479 |
s close. |
|
2480 |
answer := true. |
|
2481 |
] |
|
2482 |
]. |
|
2483 |
||
2484 |
answer ~~ true ifTrue:[ |
|
2485 |
answer == #option ifTrue:[ |
|
2486 |
DiffCodeView |
|
2487 |
openOn:mySource |
|
2488 |
label:'current version' |
|
2489 |
and:mergedSource |
|
2490 |
label:'merged version'. |
|
2491 |
||
2492 |
]. |
|
2493 |
self reportError:'checkin aborted - (no merge; repository unchanged)'. |
|
2494 |
^ false. |
|
2495 |
]. |
|
2496 |
]. |
|
2497 |
||
2498 |
"/ changesAsLogged := (changesAsLogged asStringCollection collect:[:line | line withTabsExpanded]) asString. |
|
2499 |
"/ msg := 'The source of ' , className , ' has been changed in the meanwhile as follows: |
|
2500 |
"/' , changesAsLogged , ' |
|
2501 |
"/ |
|
2502 |
"/If you continue, your new changes (based upon rev. ' , revision , ') will be MERGED |
|
2503 |
"/into the newest revision. This will combine the other version with your changes |
|
2504 |
"/into a new common revision which is different from both. |
|
2505 |
"/Although convenient, it may fail to create the expected result in certain situations. |
|
2506 |
"/ |
|
2507 |
"/You should carefully check the result - by comparing the current version with the |
|
2508 |
"/most recent version in the repository. If that does not contain an acceptable version, |
|
2509 |
"/change methods as required and check in again. Be aware, that the actual repository version |
|
2510 |
"/is different from your current classes. |
|
2511 |
"/ |
|
2512 |
"/Continue ?'. |
|
2513 |
"/ (self confirm:msg) ifFalse:[ |
|
2514 |
"/ Transcript showCR:'checkin aborted - (no merge; repository unchanged)'. |
|
2515 |
"/ ^ false. |
|
2516 |
"/ ]. |
|
2517 |
Transcript showCR:('CVSSourceCodeManager [info]: checking in %1 (%2) (merge)...' bindWith:className with:modulePath). |
|
2518 |
] |
|
2519 |
] ifFalse:[ |
|
2520 |
(whatHappened startsWith:'C ') ifTrue:[ |
|
2521 |
"/ |
|
2522 |
"/ conflict; someone else checked in something in the meanwhile, |
|
2523 |
"/ and there is a conflict between this version and the checked in version. |
|
2524 |
"/ |
|
2525 |
||
2526 |
changesAsLogged := changesAsLogged asCollectionOfLines. |
|
2527 |
||
2528 |
msg := 'The source of ' , className , ' has been changed in the meanwhile as listed below. |
|
2529 |
||
4232 | 2530 |
Your new changes (based upon rev. ' , classRevision printString , ') CONFLICT with those changes. |
4229 | 2531 |
|
2532 |
You should fix things by comparing your class with the most recent repository version |
|
2533 |
and change your methods avoiding conflicts. Then checkin again. |
|
2534 |
'. |
|
2535 |
||
2536 |
answer := self checkinTroubleDialog:'Version conflict' |
|
2537 |
message:msg |
|
2538 |
log:changesAsLogged |
|
2539 |
abortable:false |
|
2540 |
option:'Show conflicts' |
|
2541 |
option2:'Resolve conflicts' |
|
2542 |
option3:'Do NOT Merge - Force my Code'. |
|
2543 |
||
2544 |
answer == #option ifTrue:[ |
|
2545 |
"/ |
|
2546 |
"/ show conflicts in a 3-way DiffTextView ... |
|
2547 |
"/ |
|
2548 |
Diff3TextView |
|
2549 |
openOnMergedText:(tempdir construct:checkoutName) readStream contents |
|
2550 |
label:'your version (checkin attempt)' |
|
2551 |
label:'original (base version)' |
|
2552 |
label:'newest repository version'. |
|
2553 |
]. |
|
2554 |
||
2555 |
answer == #option2 ifTrue:[ |
|
4232 | 2556 |
|diffComment| |
2557 |
||
4229 | 2558 |
"/ |
2559 |
"/ allow checkin of repair version |
|
2560 |
"/ this is error prone ... |
|
2561 |
"/ |
|
2562 |
"/ |
|
2563 |
"/ show merged version in an editor ... |
|
2564 |
"/ ... accept will check it in. |
|
2565 |
"/ |
|
2566 |
emphasizedText := (tempdir construct:checkoutName) readStream contents. |
|
2567 |
emSep := (Array with:(#color->Color black) |
|
2568 |
with:(#backgroundColor->Color green)). |
|
2569 |
emphasizedText := Diff3TextView |
|
2570 |
emphasizeMergedDiff3Text:emphasizedText |
|
2571 |
emphasize1:(Array with:(#color->Color white) |
|
2572 |
with:(#backgroundColor->Color blue)) |
|
2573 |
emphasize2:(Array with:(#color->Color white) |
|
2574 |
with:(#backgroundColor->Color red)) |
|
2575 |
emphasizeSep:emSep. |
|
2576 |
||
4232 | 2577 |
diffComment := |
4229 | 2578 |
'"/ *************************************************************** |
2579 |
"/ This text contains your current versions code (blue) |
|
2580 |
"/ merged with the conflicting code as found in the repository (red) which resulted |
|
2581 |
"/ from some other checkin. |
|
2582 |
"/ Each such conflict is surrounded by green text (like this paragraph). |
|
2583 |
"/ |
|
2584 |
"/ Please have a look at ALL the conflicts and fix things as appropriate. |
|
2585 |
"/ Delete the green lines as a confirmation - I will not checkin the changed text, |
|
2586 |
"/ unless no more green parts are present. This includes this comment at the top. |
|
2587 |
"/ *************************************************************** |
|
2588 |
'. |
|
4232 | 2589 |
diffComment := (Text string:diffComment emphasis:emSep) asStringCollection. |
2590 |
emphasizedText := diffComment , emphasizedText. |
|
4229 | 2591 |
|
2592 |
didAccept := false. checkInRepaired := true. |
|
2593 |
[didAccept not and:[checkInRepaired]] whileTrue:[ |
|
2594 |
editor := RCSConflictEditTextView |
|
2595 |
setupWith:emphasizedText |
|
2596 |
title:'Resolve conflicts in ' , className , ', then accept & close to checkin'. |
|
2597 |
||
2598 |
editor acceptAction:[:dummy | |
|
2599 |
repairedText := editor list. |
|
2600 |
didAccept := true. |
|
2601 |
]. |
|
2602 |
didAccept := false. |
|
2603 |
editor topView openModal. |
|
2604 |
||
2605 |
didAccept ifFalse:[ |
|
2606 |
(Dialog confirm:'You did not accept the new text. Edit again ?') |
|
2607 |
ifFalse:[ |
|
2608 |
checkInRepaired := false. |
|
2609 |
] |
|
2610 |
] ifTrue:[ |
|
2611 |
"/ check if all green-stuff (separators) have been removed |
|
2612 |
(repairedText findFirst:[:line | line notEmptyOrNil and:[(line emphasisAt:1) = emSep]]) ~~ 0 ifTrue:[ |
|
2613 |
self warn:'You have to look at ALL conflicts, and remove ALL green lines as a confirmation !!'. |
|
2614 |
didAccept := false. |
|
2615 |
] |
|
2616 |
]. |
|
2617 |
||
2618 |
]. |
|
2619 |
||
2620 |
checkInRepaired ifTrue:[ |
|
2621 |
[ |
|
2622 |
out := (tempdir construct:checkoutName) writeStream. |
|
2623 |
out nextPutAll:(repairedText asString string). |
|
2624 |
didAccept := true. |
|
2625 |
out close. |
|
2626 |
] on:FileStream openErrorSignal do:[:ex| |
|
2627 |
self warn:'could not write file ' , (tempdir constructString:checkoutName). |
|
2628 |
checkInRepaired := false. |
|
2629 |
]. |
|
2630 |
] |
|
2631 |
]. |
|
2632 |
||
2633 |
answer == #option3 ifTrue:[ |
|
2634 |
"/ |
|
2635 |
"/ force checkin of new version |
|
2636 |
"/ |
|
2637 |
"/ |
|
2638 |
"/ show merged version in an editor ... |
|
2639 |
"/ ... accept will check it in. |
|
2640 |
"/ |
|
2641 |
[ |
|
2642 |
out := (tempdir construct:checkoutName) writeStream. |
|
2643 |
self fileOutSourceCodeOf: cls on:out. |
|
2644 |
out close. |
|
2645 |
didAccept := true. |
|
2646 |
checkInNew := checkInRepaired := true. |
|
2647 |
] on:FileStream openErrorSignal do:[:ex| |
|
2648 |
self warn:'could not write file ' , (tempdir constructString:checkoutName). |
|
2649 |
]. |
|
2650 |
]. |
|
2651 |
||
2652 |
checkInRepaired ifTrue:[ |
|
2653 |
checkInNew ifTrue:[ |
|
2654 |
Transcript showCR:('CVSSourceCodeManager [info]: checking in %1 (%2) (force)...' bindWith:className with:modulePath). |
|
2655 |
] ifFalse:[ |
|
2656 |
conflictResolvedManually := true. "/ checkInRepaired and:[checkInNew not]. |
|
2657 |
Transcript showCR:('CVSSourceCodeManager [info]: checking in %1 (%2) (manually repaired)...' bindWith:className with:modulePath). |
|
2658 |
]. |
|
2659 |
] ifFalse:[ |
|
2660 |
Transcript showCR:'checkin of ' , className , ' aborted (conflicting changes; repository unchanged)'. |
|
2661 |
self reportError:'checkin of ' , className , ' aborted (conflicting changes; repository unchanged)'. |
|
2662 |
^ false. |
|
2663 |
]. |
|
2664 |
] ifFalse:[ |
|
2665 |
((whatHappened startsWith:'U ') |
|
4232 | 2666 |
or:[whatHappened startsWith:'P ']) ifTrue:[ |
4229 | 2667 |
"/ |
2668 |
"/ nothing changed here, but the repository already contains |
|
2669 |
"/ a newer version. |
|
2670 |
"/ |
|
2671 |
||
2672 |
self information:'nothing changed in your ''' , className , '''; |
|
2673 |
but repository already contains a newer version (repository unchanged).'. |
|
2674 |
^ true. |
|
2675 |
] ifFalse:[ |
|
2676 |
"/ |
|
2677 |
"/ unexpected |
|
2678 |
"/ |
|
2679 |
self warn:'unexpected message from CVS: |
|
2680 |
' , whatHappened , ' |
|
2681 |
||
2682 |
No checkin performed.'. |
|
2683 |
self reportError:'*** cannot checkin ' , className , ' (unexpected CVS response; repository unchanged)'. |
|
2684 |
^ false. |
|
2685 |
] |
|
2686 |
] |
|
2687 |
]. |
|
2688 |
||
2689 |
||
2690 |
"/ |
|
2691 |
"/ now check it in again |
|
2692 |
"/ |
|
2693 |
self activityNotification:'CVS: Saving ' , cls name , ' in repository...'. |
|
2694 |
||
4232 | 2695 |
logMsg := logMsg replChar:$" withString:'\"'. |
4229 | 2696 |
|
2697 |
OperatingSystem isUNIXlike ifFalse:[ |
|
2698 |
"/ save the log message into another tempFile ... |
|
4232 | 2699 |
s := FileStream newTemporaryIn:tempdir. |
4229 | 2700 |
s nextPutAll:logMsg. |
2701 |
s close. |
|
2702 |
||
4232 | 2703 |
cmd := 'commit -F "', s fileName baseName, '" ', checkoutName, ' >', '"' , cmdOut name , '"'. |
4229 | 2704 |
] ifTrue:[ |
2705 |
"/ |
|
2706 |
"/ CVS up to V1.9.14 prints the 'new revision' to stderr, |
|
2707 |
"/ CVS V1.9.16 to stdout. |
|
2708 |
"/ |
|
2709 |
cmd := 'commit -m "', logMsg, '" ', checkoutName, ' >', '"', cmdOut name, '"' , ' 2>&1'. |
|
2710 |
]. |
|
2711 |
(self |
|
2712 |
executeCVSCommand:cmd |
|
2713 |
module:moduleDir |
|
2714 |
inDirectory:tempdir name |
|
2715 |
) ifFalse:[ |
|
2716 |
(cmdOut exists and:[cmdOut fileSize > 0]) ifTrue:[ |
|
4232 | 2717 |
whatHappened := cmdOut contentsAsString. |
4229 | 2718 |
] ifFalse:[ |
2719 |
whatHappened := '<< no message >>' |
|
2720 |
]. |
|
2721 |
self warn:'The following problem was reported by cvs: |
|
2722 |
||
2723 |
' , whatHappened , ' |
|
2724 |
||
2725 |
The class has NOT been checked into the repository.'. |
|
2726 |
||
2727 |
self reportError:'cannot checkin modified class source'. |
|
2728 |
^ false. |
|
2729 |
]. |
|
2730 |
(cmdOut exists and:[cmdOut fileSize > 0]) ifTrue:[ |
|
4232 | 2731 |
whatHappened := cmdOut contentsAsString. |
4229 | 2732 |
] ifFalse:[ |
2733 |
whatHappened := nil |
|
2734 |
]. |
|
2735 |
] ensure:[ |
|
2736 |
OsError handle:[:ex | |
|
2737 |
Dialog warn:('Warning: some problem encountered when trying to remove a temporary workfile:\\%1\\The checkin was successful, though.\Please remove those temporary files later.' withCRs |
|
2738 |
bindWith:ex description). |
|
2739 |
ex proceed. |
|
2740 |
] do:[ |
|
2741 |
tempdir notNil ifTrue:[ tempdir recursiveRemove ]. |
|
2742 |
cmdOut notNil ifTrue:[ cmdOut remove ]. |
|
2743 |
]. |
|
2744 |
]. |
|
2745 |
||
2746 |
"/ |
|
2747 |
"/ fetch the new revision nr as found in the commit commands output |
|
2748 |
"/ |
|
2749 |
(whatHappened isEmptyOrNil) ifTrue:[ |
|
2750 |
'CVSSourceCodeManager [warning]: unexpected empty checkin command output' errorPrintCR. |
|
2751 |
] ifFalse:[ |
|
4232 | 2752 |
whatHappened := whatHappened asCollectionOfLines. |
4229 | 2753 |
idx := whatHappened indexOfLineStartingWith:'new revision:'. |
2754 |
idx == 0 ifTrue:[ |
|
2755 |
'CVSSourceCodeManager [error]: unexpected checkin command output (no new-revision info)' errorPrintCR. |
|
2756 |
] ifFalse:[ |
|
2757 |
l := whatHappened at:idx. |
|
2758 |
newRevision := (l copyFrom:14 to:(l indexOf:$; startingAt:14)-1) withoutSpaces. |
|
2759 |
] |
|
2760 |
]. |
|
2761 |
||
2762 |
"/ |
|
2763 |
"/ if there was no merge (i.e. the current version has been checked in unchanged): |
|
2764 |
"/ patch the classes revisionInfo (but keep binaryRevision unchanged) to the new revision |
|
2765 |
"/ this makes everyone here believe, that the incore version of the class is based upon |
|
2766 |
"/ the newly checked in version. |
|
2767 |
"/ (however, the binaryRevision must remain as it is - we will need it to fetch the sourceCode |
|
2768 |
"/ correctly for all unchanged methodss) |
|
2769 |
"/ |
|
2770 |
"/ if there was a merge (i.e. the repository now contains a merge of the current and some |
|
2771 |
"/ other version): |
|
2772 |
"/ patch the classes revisionInfo (again, keep the binaryRevision) to the old revision |
|
2773 |
"/ and add a 'm' (for merged). |
|
2774 |
"/ If we later checkin again, the new checkin will be again based on the current revision |
|
2775 |
"/ |
|
2776 |
newRevision notNil ifTrue:[ |
|
2777 |
(didMerge or:[conflictResolvedManually]) ifFalse:[ |
|
2778 |
"/ new code: |
|
2779 |
cls revisionString notEmptyOrNil ifTrue:[ |
|
2780 |
newRevision isNil ifTrue:[ |
|
2781 |
'CVSSourceCodeManager [error]: got no valid revisionString (class checked in, but no valid revision returned)' errorPrintCR |
|
2782 |
] ifFalse:[ |
|
2783 |
newString := self updatedRevisionStringOf:cls forRevision:newRevision andUser:OperatingSystem getLoginName with:cls revisionString. |
|
2784 |
newString isNil ifTrue:[ |
|
2785 |
'CVSSourceCodeManager [error]: failed to update revisionString (class checked in, but no revision method)' errorPrintCR |
|
2786 |
] ifFalse:[ |
|
2787 |
self updateVersionMethodOf:cls for:newString. |
|
2788 |
cls revision ~= newRevision ifTrue:[ |
|
2789 |
'CVSSourceCodeManager [error]: failed to update revisionString' errorPrintCR |
|
2790 |
]. |
|
2791 |
]. |
|
2792 |
]. |
|
2793 |
self activityNotification:'Done.'. |
|
2794 |
] ifFalse:[ |
|
2795 |
self activityNotification:'CVS: Fetch new revision number of ', cls name. |
|
2796 |
||
2797 |
changeLog := self revisionLogOf:cls fromRevision:newRevision toRevision:newRevision. |
|
2798 |
(changeLog isNil or:[(changeLog at:#revisions) size ~~ 1]) ifTrue:[ |
|
2799 |
force ifTrue:[ |
|
2800 |
changeLog := self revisionLogOfContainer:classFileName directory:packageDir module:moduleDir. |
|
2801 |
]. |
|
2802 |
]. |
|
2803 |
(changeLog isNil or:[(changeLog at:#revisions) size ~~ 1]) ifTrue:[ |
|
2804 |
'CVSSourceCodeManager [error]: failed to update revisionString (no log)' errorPrintCR. |
|
2805 |
self updateVersionMethodOf:cls for:'$' , 'Header' , '$'. "/ concatenated to avoid RCS expansion |
|
2806 |
] ifFalse:[ |
|
2807 |
entry := (changeLog at:#revisions) first. |
|
2808 |
newString := self revisionStringFromLog:changeLog entry:entry forClass:cls. |
|
2809 |
self updateVersionMethodOf:cls for:newString. |
|
2810 |
cls revision ~= newRevision ifTrue:[ |
|
2811 |
'CVSSourceCodeManager [error]: failed to update revisionString' errorPrintCR |
|
2812 |
] |
|
2813 |
] |
|
2814 |
] |
|
2815 |
] ifTrue:[ |
|
2816 |
"/ If the conflict was resolved manually, do NOT update the revision method |
|
2817 |
"/ (to get a new conflict in the next check-in) |
|
2818 |
||
2819 |
"/ If there was a merge, update the revision method adding an 'm'" |
|
2820 |
didMerge ifTrue: [ |
|
2821 |
newString := self updatedRevisionStringOf:cls forRevision:nil with:cls revisionString. |
|
2822 |
newString notNil ifTrue:[ self updateVersionMethodOf:cls for:newString ]. |
|
2823 |
] |
|
2824 |
]. |
|
2825 |
]. |
|
2826 |
||
2827 |
Class addChangeRecordForClassCheckIn:cls. |
|
2828 |
self postCheckInClass:cls. |
|
2829 |
||
2830 |
conflictResolvedManually ifTrue:[ |
|
2831 |
(Dialog |
|
2832 |
confirm:'Now the repository contains a merge between your and the other changes. |
|
2833 |
However, the class in your image does NOT contain the other changes. |
|
2834 |
This will lead to more conflict-resolving whenever you check this class in again later, |
|
2835 |
unless you load the newest (merged) version of the class from the repository. |
|
2836 |
||
2837 |
I recommend doing this as soon as possible via your browser''s checkout function.' |
|
2838 |
title:'Code Merged' |
|
2839 |
yesLabel:'OK' noLabel:'Update (Load Merged Code)' |
|
2840 |
) ifFalse:[ |
|
2841 |
self utilities |
|
2842 |
checkoutClass:cls |
|
2843 |
askForRevision:false |
|
2844 |
askForMerge:false |
|
2845 |
askForConfirmation:false. |
|
2846 |
]. |
|
2847 |
]. |
|
2848 |
^ true |
|
2849 |
||
2850 |
" |
|
2851 |
SourceCodeManager checkinClass:Array logMessage:'testing only' |
|
2852 |
" |
|
2853 |
||
2854 |
"Created: / 13-03-2017 / 15:38:19 / stefan" |
|
4232 | 2855 |
"Modified: / 31-03-2017 / 15:42:32 / stefan" |
4229 | 2856 |
! |
2857 |
||
1664
5fa005755e5f
renamed *package* to *directory* to avoid confusion.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
2858 |
checkoutModule:aModule directory:aPackage andDo:aBlock |
1362 | 2859 |
"check out everything from a package into a temporary directory. |
2860 |
Then evaluate aBlock, passing the name of that temp-directory. |
|
2861 |
Afterwards, the tempDir is removed. |
|
2862 |
Return true, if OK, false if any error occurred." |
|
2863 |
||
1832
e47ad13133b8
error reporting (in checkModule) was uninformative when login was required
Claus Gittinger <cg@exept.de>
parents:
1829
diff
changeset
|
2864 |
|cvsRoot packageDir tempdir cmdOut cmd dirName rslt| |
1362 | 2865 |
|
2866 |
cvsRoot := self getCVSROOTForModule:aModule. |
|
2867 |
cvsRoot isNil ifTrue:[^ false ]. |
|
2868 |
||
2869 |
aPackage notNil ifTrue:[ |
|
2870 |
dirName := aModule , '/' , aPackage. |
|
2871 |
] ifFalse:[ |
|
2872 |
dirName := aModule. |
|
2873 |
]. |
|
2874 |
||
3870 | 2875 |
self activityNotification:'CVS: Checking out everything in ' , dirName , '...'. |
1362 | 2876 |
|
2877 |
tempdir := self createTempDirectory:nil forModule:nil. |
|
3265 | 2878 |
[ |
2879 |
cmd := 'checkout ', dirName. |
|
2880 |
OperatingSystem isUNIXlike ifTrue:[ |
|
2881 |
"/ can redirect output |
|
2882 |
cmdOut := Filename newTemporary. |
|
2883 |
cmdOut exists ifTrue:[ |
|
2884 |
cmdOut remove. |
|
2885 |
]. |
|
2886 |
cmd := cmd , ' > ', '"' , cmdOut name, '"' . |
|
1362 | 2887 |
]. |
3265 | 2888 |
|
2889 |
rslt := self |
|
2890 |
executeCVSCommand:cmd |
|
2891 |
module:aModule |
|
2892 |
inDirectory:tempdir name. |
|
2893 |
||
2894 |
packageDir := (tempdir construct:dirName). |
|
2895 |
(packageDir exists and:[packageDir isDirectory]) ifFalse:[ |
|
2896 |
self reportError:(rslt ifTrue:['checkout failed (no dir)'] ifFalse:['failed to execute: ',cmd]). |
|
2897 |
^ false |
|
2898 |
]. |
|
2899 |
||
2900 |
"/ now, invoke the block ... |
|
1362 | 2901 |
aBlock value:packageDir |
2902 |
] ensure:[ |
|
3265 | 2903 |
cmdOut notNil ifTrue:[ cmdOut remove ]. |
2904 |
tempdir notNil ifTrue:[ tempdir recursiveRemove ]. |
|
1362 | 2905 |
]. |
2906 |
^ true |
|
2907 |
||
1664
5fa005755e5f
renamed *package* to *directory* to avoid confusion.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
2908 |
"Created: / 23-08-2006 / 14:07:05 / cg" |
2792
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
2909 |
"Modified: / 06-03-2012 / 11:57:52 / cg" |
1362 | 2910 |
! |
2911 |
||
3866 | 2912 |
getSourceStreamFor:aClass revision:aRevisionStringOrNil |
2913 |
"extract a classes source code and return an open readStream on it. |
|
2914 |
A revision of nil selects the current (in image) revision. |
|
2915 |
The classes source code is extracted using the revision and the sourceCodeInfo, |
|
2916 |
which itself is extracted from the classes packageString." |
|
2917 |
||
2918 |
|cacheIt| |
|
2919 |
||
2920 |
"/ never cache symbolic versions |
|
2921 |
cacheIt := (aRevisionStringOrNil isNil or:[ aRevisionStringOrNil first isDigit ]). |
|
2922 |
^ self getSourceStreamFor:aClass revision:aRevisionStringOrNil cache:cacheIt |
|
2923 |
! |
|
2924 |
||
1405 | 2925 |
streamForClass:cls fileName:fileName revision:revision directory:packageDir module:moduleDir cache:cacheItArg |
1362 | 2926 |
"extract a source file and return an open readStream on it, |
2927 |
or nil if the extract failed. If revision is nil or (#newest), take |
|
2928 |
the latest; otherwise, a specific revisions source is extracted. |
|
2929 |
The cls argument is currently ignored, but may be used in future versions, |
|
2930 |
to validate the correct container against the class. |
|
2931 |
To check out a file (i.e. not a classes file), leave it nil." |
|
2932 |
||
1778
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2933 |
|cacheDir cacheSubDir cachedSourceFilename cachedFile cmd fullName revisionArg stream |
1362 | 2934 |
checkoutName checkoutNameLocal fullTempName fullCachedName tempdir cmdOut |
3580 | 2935 |
classFileName cvsRoot revMsg cacheIt zArg| |
1405 | 2936 |
|
2937 |
cacheIt := cacheItArg. |
|
1362 | 2938 |
|
2939 |
(DisabledModules notNil and:[DisabledModules includes:moduleDir]) ifTrue:[ |
|
2940 |
Transcript showCR:'cvs access for module ' , moduleDir , ' has been disabled (due to previous failure)'. |
|
2941 |
Transcript showCR:'reenable using the launchers source&debugger dialog'. |
|
2942 |
||
2943 |
^ nil |
|
2944 |
]. |
|
2945 |
||
2946 |
cvsRoot := self getCVSROOTForModule:moduleDir. |
|
2947 |
cvsRoot isNil ifTrue:[^ nil]. |
|
2948 |
||
2949 |
classFileName := fileName. |
|
1862 | 2950 |
classFileName isNil ifTrue:[classFileName := cls classBaseFilename]. |
2951 |
||
1362 | 2952 |
(classFileName endsWith:',v') ifTrue:[ |
3231
b3cce588c936
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
3112
diff
changeset
|
2953 |
classFileName := classFileName copyButLast:2. |
1362 | 2954 |
]. |
2955 |
(classFileName endsWith:'.st') ifTrue:[ |
|
2956 |
cls notNil ifTrue:[ |
|
3231
b3cce588c936
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
3112
diff
changeset
|
2957 |
classFileName := classFileName copyButLast:3. |
1362 | 2958 |
] |
2959 |
]. |
|
4055 | 2960 |
packageDir isEmptyOrNil ifTrue:[ |
2961 |
fullName := moduleDir , '/' , classFileName. |
|
2962 |
] ifFalse:[ |
|
2963 |
fullName := moduleDir , '/' , packageDir , '/' , classFileName. |
|
2964 |
]. |
|
1362 | 2965 |
cls notNil ifTrue:[ |
2966 |
fullName := fullName , '.st'. |
|
2967 |
]. |
|
2968 |
||
2969 |
(revision isNil or:[revision == #newest]) ifTrue:[ |
|
2970 |
cachedSourceFilename := classFileName. |
|
2971 |
] ifFalse:[ |
|
2972 |
cachedSourceFilename := classFileName , '_' , revision. |
|
2973 |
]. |
|
2974 |
||
2739
ec6ef52ebb5d
changed: #streamForClass:fileName:revision:directory:module:cache:
Claus Gittinger <cg@exept.de>
parents:
2738
diff
changeset
|
2975 |
"/ if not already existing, create a cache directory |
ec6ef52ebb5d
changed: #streamForClass:fileName:revision:directory:module:cache:
Claus Gittinger <cg@exept.de>
parents:
2738
diff
changeset
|
2976 |
"/ where we deposit sources. |
ec6ef52ebb5d
changed: #streamForClass:fileName:revision:directory:module:cache:
Claus Gittinger <cg@exept.de>
parents:
2738
diff
changeset
|
2977 |
"/ this is used as a cache for further requests, since |
ec6ef52ebb5d
changed: #streamForClass:fileName:revision:directory:module:cache:
Claus Gittinger <cg@exept.de>
parents:
2738
diff
changeset
|
2978 |
"/ accessing the repository may be slow. |
ec6ef52ebb5d
changed: #streamForClass:fileName:revision:directory:module:cache:
Claus Gittinger <cg@exept.de>
parents:
2738
diff
changeset
|
2979 |
"/ (if cvs uses a remote connection via ppp, for example) |
ec6ef52ebb5d
changed: #streamForClass:fileName:revision:directory:module:cache:
Claus Gittinger <cg@exept.de>
parents:
2738
diff
changeset
|
2980 |
|
ec6ef52ebb5d
changed: #streamForClass:fileName:revision:directory:module:cache:
Claus Gittinger <cg@exept.de>
parents:
2738
diff
changeset
|
2981 |
(cacheIt and:[revision ~~ #newest and:[revision notNil]]) ifTrue:[ |
ec6ef52ebb5d
changed: #streamForClass:fileName:revision:directory:module:cache:
Claus Gittinger <cg@exept.de>
parents:
2738
diff
changeset
|
2982 |
(cacheDir := self sourceCacheDirectory) isNil ifTrue:[ |
2740 | 2983 |
('CVSSourceCodeManager [warning]: no source cache directory for %1' bindWith:cachedSourceFilename) infoPrintCR. |
2739
ec6ef52ebb5d
changed: #streamForClass:fileName:revision:directory:module:cache:
Claus Gittinger <cg@exept.de>
parents:
2738
diff
changeset
|
2984 |
] |
ec6ef52ebb5d
changed: #streamForClass:fileName:revision:directory:module:cache:
Claus Gittinger <cg@exept.de>
parents:
2738
diff
changeset
|
2985 |
]. |
ec6ef52ebb5d
changed: #streamForClass:fileName:revision:directory:module:cache:
Claus Gittinger <cg@exept.de>
parents:
2738
diff
changeset
|
2986 |
|
1778
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2987 |
cacheDir notNil ifTrue:[ |
2230
356226c41514
changed: #streamForClass:fileName:revision:directory:module:cache:
Claus Gittinger <cg@exept.de>
parents:
2211
diff
changeset
|
2988 |
cacheSubDir := cacheDir / moduleDir / packageDir. |
356226c41514
changed: #streamForClass:fileName:revision:directory:module:cache:
Claus Gittinger <cg@exept.de>
parents:
2211
diff
changeset
|
2989 |
cachedFile := cacheSubDir / cachedSourceFilename. |
356226c41514
changed: #streamForClass:fileName:revision:directory:module:cache:
Claus Gittinger <cg@exept.de>
parents:
2211
diff
changeset
|
2990 |
cachedFile exists ifTrue:[ |
356226c41514
changed: #streamForClass:fileName:revision:directory:module:cache:
Claus Gittinger <cg@exept.de>
parents:
2211
diff
changeset
|
2991 |
^ cachedFile readStream |
1362 | 2992 |
]. |
2993 |
]. |
|
2994 |
||
2995 |
"/ |
|
2996 |
"/ first, create a temporary work tree |
|
2997 |
"/ Do not make module and package directories, their existence cause cvs checkout to fail in server mode |
|
2998 |
"/ |
|
2999 |
tempdir := self createTempDirectory:nil forModule:nil. |
|
2127 | 3000 |
tempdir isNil ifTrue:[ |
3001 |
('CVSSourceCodeManager [error]: no tempDir - cannot checkout ' , classFileName) errorPrintCR. |
|
3002 |
^ nil |
|
3003 |
]. |
|
3265 | 3004 |
[ |
1362 | 3005 |
"/ tempdir := Filename newTemporaryIn:nil. |
3006 |
"/ tempdir exists ifTrue:[ |
|
3007 |
"/ tempdir recursiveRemove. |
|
3008 |
"/ ]. |
|
3009 |
"/ tempdir makeDirectory. |
|
3010 |
"/ dir := tempdir construct:moduleDir. |
|
3011 |
"/ dir makeDirectory. |
|
3012 |
"/ dir := dir construct:packageDir. |
|
3013 |
"/ dir recursiveMakeDirectory. |
|
3014 |
"/ dir exists ifFalse:[ |
|
3015 |
"/ tempdir recursiveRemove. |
|
3016 |
"/ 'CVSMGR: cannot create temporary directory' infoPrintCR. |
|
3017 |
"/ ^ nil. |
|
3018 |
"/ ]. |
|
3019 |
||
3265 | 3020 |
"/ |
3021 |
"/ check it out there |
|
3022 |
"/ |
|
3023 |
checkoutName := fullName. |
|
3024 |
||
3025 |
checkoutNameLocal := (moduleDir asFilename construct:packageDir) constructString:(fullName asFilename baseName). |
|
3026 |
||
3027 |
(revision isNil or:[revision == #newest]) ifTrue:[ |
|
3028 |
cachedSourceFilename := classFileName. |
|
3029 |
revisionArg := ''. |
|
3030 |
revMsg := ''. |
|
3031 |
] ifFalse:[ |
|
3032 |
cachedSourceFilename := classFileName , '_' , revision. |
|
3033 |
revisionArg := ' -r ' , revision. |
|
3034 |
revMsg := ' (' , revision , ')'. |
|
1362 | 3035 |
]. |
3580 | 3036 |
zArg := ''. |
3037 |
"/ does not work, yet ?!!?!! |
|
3038 |
"/ (cvsRoot includesString:'pserver') ifTrue:[ |
|
3039 |
"/ zArg := ' -z 9'. |
|
3040 |
"/ ]. |
|
3265 | 3041 |
|
3870 | 3042 |
self activityNotification:'CVS: Checking out source ' , checkoutName , revMsg. |
3265 | 3043 |
OperatingSystem isUNIXlike ifTrue:[ |
3044 |
"/ can redirect output |
|
3375 | 3045 |
cmdOut := FileStream newTemporary |
3046 |
close; |
|
3047 |
fileName. |
|
3580 | 3048 |
cmd := 'checkout' , zArg, revisionArg , ' ', checkoutName , ' > ' , '"' , cmdOut name, '"' . |
3265 | 3049 |
] ifFalse:[ |
3580 | 3050 |
cmd := 'checkout' , zArg, revisionArg , ' ', checkoutName. |
3265 | 3051 |
]. |
3052 |
||
3053 |
(self |
|
3054 |
executeCVSCommand:cmd |
|
3055 |
module:moduleDir |
|
3375 | 3056 |
inDirectory:tempdir |
3265 | 3057 |
) ifFalse:[ |
3058 |
('CVSSourceCodeManager [error]: cannot checkout ' , checkoutName) errorPrintCR. |
|
1477
bea2ad3479eb
no longer automatically disable a CVS module !
Claus Gittinger <cg@exept.de>
parents:
1465
diff
changeset
|
3059 |
|
1778
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
3060 |
"/ "/ see if there is CVS access at all ... |
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
3061 |
"/ (self checkForExistingModule:moduleDir) ifFalse:[ |
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
3062 |
"/ "/ disable |
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
3063 |
"/ DisabledModules isNil ifTrue:[ |
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
3064 |
"/ DisabledModules := Set new. |
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
3065 |
"/ ]. |
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
3066 |
"/ DisabledModules add:moduleDir. |
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
3067 |
"/ ('CVSSourceCodeManager [warning]: disabled repository access for module ' , moduleDir) errorPrintCR. |
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
3068 |
"/ ]. |
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
3069 |
|
3265 | 3070 |
^ nil. |
3071 |
]. |
|
3072 |
||
3073 |
fullTempName := tempdir construct:checkoutNameLocal. |
|
3074 |
(cacheSubDir isNil) ifTrue:[ |
|
3075 |
cacheIt := false |
|
3076 |
] ifFalse:[ |
|
3077 |
cacheSubDir recursiveMakeDirectory. |
|
3078 |
fullCachedName := cacheSubDir constructString:cachedSourceFilename. |
|
3079 |
]. |
|
3080 |
fullTempName exists ifFalse:[ |
|
3081 |
('CVSSourceCodeManager [error]: failed to checkout ', fullTempName pathName, ' (file does not exist after cvs co)') errorPrintCR. |
|
1362 | 3082 |
^ nil |
3083 |
]. |
|
3265 | 3084 |
|
3085 |
(cacheIt |
|
3086 |
and:[cachedFile notNil |
|
3087 |
and:[fullTempName exists]]) |
|
3088 |
ifTrue:[ |
|
3089 |
(OsError catch:[ |
|
3090 |
fullTempName moveTo:fullCachedName. |
|
3870 | 3091 |
self activityNotification:'CVS: Cached as ',fullCachedName asFilename baseName. |
3265 | 3092 |
]) ifTrue:[ |
3870 | 3093 |
self activityNotification:'CVS: Not cached.'. |
3265 | 3094 |
('CVSSourceCodeManager [error]: failed to rename ', fullTempName pathName, ' to ', cachedSourceFilename) errorPrintCR. |
3095 |
^ nil |
|
3096 |
]. |
|
3097 |
fullCachedName asFilename exists ifTrue:[ |
|
3098 |
stream := fullCachedName asFilename readStream. |
|
3099 |
]. |
|
2511
6bd0081d93bb
changed: #streamForClass:fileName:revision:directory:module:cache:
Claus Gittinger <cg@exept.de>
parents:
2508
diff
changeset
|
3100 |
] ifFalse:[ |
3265 | 3101 |
fileName = 'extensions.st' ifTrue:[ |
3870 | 3102 |
self activityNotification:('CVS: "%1" not cached - please check your settings and/or version method in the "%2" projectDefinition.' |
3386 | 3103 |
bindWith:fileName |
3104 |
with:(moduleDir,':',packageDir)) |
|
3265 | 3105 |
] ifFalse:[ |
3870 | 3106 |
self activityNotification:('CVS: "%1" not cached - please check your settings and/or version method in the "%2" projectDefinition.' |
3386 | 3107 |
bindWith:fileName |
3108 |
with:(moduleDir,':',packageDir)) |
|
3265 | 3109 |
]. |
3375 | 3110 |
|
3111 |
OperatingSystem isUNIXlike ifTrue:[ |
|
3112 |
stream := fullTempName readStream. |
|
3113 |
] ifFalse:[ |
|
3265 | 3114 |
"/ cannot remove files which are still open ... |
3115 |
"/ sigh - need a delete-on-close flag in FileStream. |
|
3116 |
"/ |
|
3375 | 3117 |
stream := FileStream newTemporary. |
3118 |
fullTempName copyToStream:stream. |
|
3119 |
stream removeOnClose:true. |
|
3120 |
stream reset. |
|
3121 |
]. |
|
2511
6bd0081d93bb
changed: #streamForClass:fileName:revision:directory:module:cache:
Claus Gittinger <cg@exept.de>
parents:
2508
diff
changeset
|
3122 |
]. |
3265 | 3123 |
self releaseAndRemove:tempdir module:moduleDir outputTo:nil. |
3124 |
] ensure:[ |
|
3125 |
cmdOut notNil ifTrue:[cmdOut remove]. |
|
3274 | 3126 |
tempdir notNil ifTrue:[ |
3127 |
OsError handle:[:ex | |
|
3128 |
('CVSSourceCodeManager [warning]: could not remove temp directory ',tempdir pathName) infoPrintCR. |
|
3129 |
] do:[ |
|
3130 |
tempdir recursiveRemove |
|
3131 |
] |
|
3132 |
]. |
|
1362 | 3133 |
]. |
3134 |
^ stream |
|
3135 |
||
1778
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
3136 |
"Created: / 04-11-1995 / 19:46:20 / cg" |
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
3137 |
"Modified: / 20-08-1997 / 16:37:11 / stefan" |
2741
3914394ee4dd
changed: #streamForClass:fileName:revision:directory:module:cache:
Claus Gittinger <cg@exept.de>
parents:
2740
diff
changeset
|
3138 |
"Modified: / 20-01-2012 / 16:43:37 / cg" |
1362 | 3139 |
! ! |
3140 |
||
3141 |
!CVSSourceCodeManager class methodsFor:'source code administration'! |
|
3142 |
||
4220 | 3143 |
checkForExistingContainer:fileName inModule:moduleName directory:packageDirName |
3144 |
"check for a container to exist. Return a boolean result." |
|
1362 | 3145 |
|
3263 | 3146 |
|fullName ret ret2 cvsRoot cmd tempDir outputStream errorStream isLocalCVSRoot| |
3147 |
||
4220 | 3148 |
cvsRoot := self getCVSROOTForModule:moduleName. |
3263 | 3149 |
cvsRoot isNil ifTrue:[^ false]. |
3150 |
||
3151 |
(isLocalCVSRoot := (cvsRoot startsWith:':local:')) ifTrue:[ |
|
3152 |
cvsRoot := cvsRoot withoutPrefix:':local:'. |
|
3153 |
]. |
|
1362 | 3154 |
|
4220 | 3155 |
packageDirName isEmptyOrNil ifTrue:[ |
3156 |
fullName := moduleName , '/' , fileName. |
|
4055 | 3157 |
] ifFalse:[ |
4220 | 3158 |
fullName := moduleName , '/' , packageDirName , '/' , fileName. |
4055 | 3159 |
]. |
3160 |
||
3263 | 3161 |
(RemoteCVS not or:[isLocalCVSRoot]) ifTrue:[ |
1362 | 3162 |
cvsRoot asFilename exists ifTrue:[ |
3163 |
"/ |
|
3164 |
"/ with local CVS - simply check if that file exists |
|
3165 |
"/ |
|
3166 |
(fullName endsWith:',v') ifFalse:[ |
|
3167 |
fullName := fullName , ',v'. |
|
3168 |
]. |
|
3263 | 3169 |
^ (cvsRoot asFilename / fullName) exists. |
1362 | 3170 |
]. |
3263 | 3171 |
^ false |
1362 | 3172 |
]. |
3173 |
||
3174 |
tempDir := self createTempDirectory:nil forModule:nil. |
|
3175 |
||
3176 |
"With remote CVS, do a no-op rtag command, which doesn't |
|
3177 |
need a working directory, but reports missing files" |
|
3178 |
||
3179 |
(fullName endsWith:',v') ifTrue:[ |
|
3231
b3cce588c936
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
3112
diff
changeset
|
3180 |
fullName := fullName copyButLast:2. |
1362 | 3181 |
]. |
3182 |
||
1488
52af296c5910
rtag again - getting mad at CVS !!!!
Claus Gittinger <cg@exept.de>
parents:
1485
diff
changeset
|
3183 |
"/ 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
|
3184 |
"/ (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
|
3185 |
|
52af296c5910
rtag again - getting mad at CVS !!!!
Claus Gittinger <cg@exept.de>
parents:
1485
diff
changeset
|
3186 |
"/ cmd := '-n rtag -l -F dummy '. |
52af296c5910
rtag again - getting mad at CVS !!!!
Claus Gittinger <cg@exept.de>
parents:
1485
diff
changeset
|
3187 |
cmd := '-n rtag -F dummy '. |
1390
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
3188 |
[ |
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
3189 |
errorStream := '' writeStream. |
1502 | 3190 |
outputStream := '' writeStream. |
1390
5ca713ed160e
Fix for cvs 1.11.6 and following
Stefan Vogel <sv@exept.de>
parents:
1388
diff
changeset
|
3191 |
|
4184 | 3192 |
SourceCodeManagerError handle:[:ex | |
3193 |
^ false. |
|
3194 |
] do:[ |
|
3195 |
ret := self |
|
3196 |
executeCVSCommand:cmd , fullName |
|
4220 | 3197 |
module:moduleName |
4184 | 3198 |
"/ cg; cannot do it in current dir, in case it contains a CVS subDirectory, |
3199 |
"/ with a different CVSRoot in its CVS/Root file ... |
|
3200 |
"/ cvs would complain then. |
|
3201 |
inDirectory:(tempDir pathName) |
|
3202 |
log:false |
|
3203 |
outputTo:outputStream |
|
3204 |
errorTo:errorStream. |
|
3205 |
||
3206 |
"cannot check for exit status starting at cvs 1.11.5, because an exit status 0 |
|
3207 |
is returned even if the file does not exist" |
|
3208 |
||
3209 |
"But: if there is any output, the command failed and the container does not exist" |
|
3210 |
"/ cg: read comment above. |
|
3211 |
ret2 := errorStream size == 0. |
|
3212 |
ret2 ifFalse:[ |
|
3213 |
ret2 := (errorStream contents asCollectionOfLines |
|
4257 | 3214 |
reject:[:l | l isBlank or:[l includesString:'WARNING:']]) isEmpty. |
4184 | 3215 |
]. |
3216 |
] |
|
1362 | 3217 |
] ensure:[ |
3218 |
tempDir recursiveRemove. |
|
3219 |
]. |
|
1502 | 3220 |
^ ret2 |
1362 | 3221 |
|
3222 |
" |
|
3223 |
CVSSourceCodeManager |
|
1788 | 3224 |
checkForExistingContainer:'Integer.st' |
3225 |
inModule:'stx' |
|
3226 |
directory:'libbasic' |
|
1362 | 3227 |
|
3228 |
CVSSourceCodeManager |
|
1788 | 3229 |
checkForExistingContainer:'AboutBox.st' |
3230 |
inModule:'stx' |
|
3231 |
directory:'libtool' |
|
1362 | 3232 |
" |
3233 |
||
1788 | 3234 |
"Created: / 13-09-2006 / 18:20:36 / cg" |
4220 | 3235 |
"Modified (format): / 24-02-2017 / 11:32:37 / cg" |
4257 | 3236 |
"Modified: / 21-09-2017 / 11:00:40 / stefan" |
1362 | 3237 |
! |
3238 |
||
3239 |
checkForExistingModule:moduleDir |
|
3240 |
"check for a module to exist" |
|
3241 |
||
2479 | 3242 |
|ret cvsRoot cmd tempDir isLocalCVSRoot | |
3243 |
||
3244 |
RecentlyCheckedModulesAndPackages notNil ifTrue:[ |
|
3245 |
(RecentlyCheckedModulesAndPackages includes:moduleDir) ifTrue:[ |
|
3246 |
RecentlyCheckedModulesAndPackages remove:moduleDir. |
|
3247 |
RecentlyCheckedModulesAndPackages addFirst:moduleDir. |
|
3248 |
^ true. |
|
3249 |
]. |
|
3250 |
]. |
|
1362 | 3251 |
|
3870 | 3252 |
self activityNotification:'CVS: Checking for existing module ' , moduleDir. |
1362 | 3253 |
|
3254 |
cvsRoot := self getCVSROOTForModule:moduleDir. |
|
3255 |
cvsRoot isNil ifTrue:[^ false]. |
|
3256 |
||
2479 | 3257 |
(isLocalCVSRoot := (cvsRoot startsWith:':local:')) ifTrue:[ |
3260 | 3258 |
cvsRoot := cvsRoot withoutPrefix:':local:'. |
1362 | 3259 |
]. |
3260 |
||
2479 | 3261 |
((RemoteCVS not or:[isLocalCVSRoot]) |
3262 |
and:[ cvsRoot asFilename exists ]) ifTrue:[ |
|
3263 |
"/ |
|
3264 |
"/ with local CVS - simply check if that directory exists |
|
3265 |
"/ |
|
3266 |
ret := (cvsRoot , '/' , moduleDir) asFilename isDirectory. |
|
3267 |
] ifFalse:[ |
|
3268 |
tempDir := self createTempDirectory:nil forModule:nil. |
|
3269 |
||
3270 |
"With remote CVS, do a no-op rtag command, which doesn't |
|
3271 |
need a working directory, but reports missing files" |
|
3272 |
||
3273 |
cmd := '-n rtag -l dummy '. |
|
3274 |
[ |
|
3275 |
ret := self |
|
3276 |
executeCVSCommand:cmd , moduleDir |
|
3277 |
module:moduleDir |
|
3278 |
"/ cg; cannot do it in current dir, in case it contains a CVS subDirectory, |
|
3279 |
"/ with a different CVSRoot in its CVS/Root file ... |
|
3280 |
"/ cvs would complain then. |
|
3281 |
inDirectory:(tempDir pathName) |
|
3282 |
log:false. |
|
3283 |
] ensure:[ |
|
3284 |
tempDir recursiveRemove. |
|
3285 |
]. |
|
1362 | 3286 |
]. |
2479 | 3287 |
|
3288 |
RecentlyCheckedModulesAndPackages isNil ifTrue:[ |
|
3289 |
RecentlyCheckedModulesAndPackages := OrderedCollection new. |
|
3290 |
]. |
|
3291 |
RecentlyCheckedModulesAndPackages addFirst:moduleDir. |
|
3292 |
||
1362 | 3293 |
^ ret |
3294 |
||
3295 |
" |
|
3296 |
CVSSourceCodeManager checkForExistingModule:'stx' |
|
3297 |
CVSSourceCodeManager checkForExistingModule:'DPU' |
|
3298 |
CVSSourceCodeManager checkForExistingModule:'cg' |
|
3299 |
CVSSourceCodeManager checkForExistingModule:'aeg' |
|
3300 |
CVSSourceCodeManager checkForExistingModule:'foo' |
|
3301 |
" |
|
3302 |
||
1832
e47ad13133b8
error reporting (in checkModule) was uninformative when login was required
Claus Gittinger <cg@exept.de>
parents:
1829
diff
changeset
|
3303 |
"Created: / 09-12-1995 / 19:13:37 / cg" |
e47ad13133b8
error reporting (in checkModule) was uninformative when login was required
Claus Gittinger <cg@exept.de>
parents:
1829
diff
changeset
|
3304 |
"Modified: / 23-07-1999 / 17:38:59 / stefan" |
2479 | 3305 |
"Modified: / 19-08-2011 / 10:38:35 / cg" |
1362 | 3306 |
! |
3307 |
||
1664
5fa005755e5f
renamed *package* to *directory* to avoid confusion.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
3308 |
checkForExistingModule:moduleDir directory:directory |
1362 | 3309 |
"check for a package to exist" |
3310 |
||
2479 | 3311 |
|ret cvsRoot cmd tempDir fullName isLocalCVSRoot| |
3312 |
||
2506 | 3313 |
fullName := moduleDir , '/' , directory. |
3314 |
||
2479 | 3315 |
RecentlyCheckedModulesAndPackages notNil ifTrue:[ |
2506 | 3316 |
(RecentlyCheckedModulesAndPackages includes:fullName) ifTrue:[ |
3317 |
RecentlyCheckedModulesAndPackages remove:fullName. |
|
3318 |
RecentlyCheckedModulesAndPackages addFirst:fullName. |
|
2479 | 3319 |
^ true. |
3320 |
]. |
|
3321 |
]. |
|
1362 | 3322 |
|
3870 | 3323 |
self activityNotification:'CVS: Checking for existing package ' , directory. |
1362 | 3324 |
|
1365 | 3325 |
cvsRoot := self getCVSROOTForModule:moduleDir. |
3326 |
cvsRoot isNil ifTrue:[^ false]. |
|
3327 |
||
2479 | 3328 |
(isLocalCVSRoot := (cvsRoot startsWith:':local:')) ifTrue:[ |
3260 | 3329 |
cvsRoot := cvsRoot withoutPrefix:':local:'. |
2479 | 3330 |
]. |
3331 |
||
3332 |
((RemoteCVS not or:[isLocalCVSRoot]) |
|
3333 |
and:[ cvsRoot asFilename exists ]) ifTrue:[ |
|
3334 |
"/ |
|
3335 |
"/ with local CVS - simply check if that directory exists |
|
3336 |
"/ |
|
3337 |
ret := (cvsRoot , '/' , fullName) asFilename isDirectory. |
|
3338 |
] ifFalse:[ |
|
3339 |
||
3340 |
tempDir := self createTempDirectory:nil forModule:nil. |
|
3341 |
||
3342 |
"With remote CVS, do a no-op rtag command, which doesn't |
|
3343 |
need a working directory, but reports missing files" |
|
3344 |
||
3345 |
cmd := '-n rtag -l -F dummy '. |
|
3346 |
[ |
|
3347 |
ret := self |
|
3348 |
executeCVSCommand:cmd, fullName |
|
3349 |
module:moduleDir |
|
3350 |
"/ cg; cannot do it in current dir, in case it contains a CVS subDirectory, |
|
3351 |
"/ with a different CVSRoot in its CVS/Root file ... |
|
3352 |
"/ cvs would complain then. |
|
3353 |
inDirectory:(tempDir pathName) |
|
3354 |
log:false. |
|
3355 |
||
3356 |
] ensure:[ |
|
3357 |
tempDir recursiveRemove. |
|
1362 | 3358 |
]. |
3359 |
]. |
|
3360 |
||
2479 | 3361 |
RecentlyCheckedModulesAndPackages isNil ifTrue:[ |
3362 |
RecentlyCheckedModulesAndPackages := OrderedCollection new. |
|
1362 | 3363 |
]. |
2506 | 3364 |
RecentlyCheckedModulesAndPackages addFirst:fullName. |
2479 | 3365 |
|
1362 | 3366 |
^ ret |
3367 |
||
3368 |
" |
|
3369 |
CVSSourceCodeManager checkForExistingModule:'stx' package:'libbasic' |
|
3370 |
CVSSourceCodeManager checkForExistingModule:'aeg' package:'libProgram' |
|
3371 |
CVSSourceCodeManager checkForExistingModule:'foo' package:'libbasic' |
|
3372 |
CVSSourceCodeManager checkForExistingModule:'foo' package:'bar' |
|
3373 |
CVSSourceCodeManager checkForExistingModule:'cg' package:'private' |
|
3374 |
" |
|
3375 |
||
1664
5fa005755e5f
renamed *package* to *directory* to avoid confusion.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
3376 |
"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
|
3377 |
"Created: / 23-08-2006 / 14:03:03 / cg" |
1362 | 3378 |
! |
3379 |
||
4273 | 3380 |
createBranch:branchName forClasses:aCollectionOfClasses |
3381 |
"create a branch" |
|
3382 |
||
4280 | 3383 |
self setSymbolicName:(self branchTagPrefix,branchName) asBranch:true revision:nil overWrite:false classes:aCollectionOfClasses |
4273 | 3384 |
|
3385 |
"Created: / 04-12-2017 / 18:47:06 / cg" |
|
4280 | 3386 |
"Modified: / 05-12-2017 / 23:20:49 / cg" |
4273 | 3387 |
! |
3388 |
||
3389 |
createBranch:branchName pathes:aCollectionOfPathNames |
|
3390 |
"create a branch" |
|
3391 |
||
4280 | 3392 |
self setSymbolicName:(self branchTagPrefix,branchName) asBranch:true revision:nil overWrite:false pathes:aCollectionOfPathNames |
4273 | 3393 |
|
3394 |
"Created: / 04-12-2017 / 18:56:30 / cg" |
|
4280 | 3395 |
"Modified: / 05-12-2017 / 23:20:59 / cg" |
4273 | 3396 |
! |
3397 |
||
1362 | 3398 |
createContainerFor:aClass inModule:moduleDir package:packageDir container:fileName |
3399 |
"create a container - this does an initial checkin |
|
3400 |
(i.e. cvs add & cvs commit)" |
|
3401 |
||
3402 |
|fullName tempdir checkoutName cmdOut cmd tempFile idx aStream whatHappened l newRevision |
|
3403 |
changeLog entry newString startIdx endIdx checkInDir logTmp s| |
|
3404 |
||
3623 | 3405 |
aClass isPrivate ifTrue:[ |
3406 |
self reportError:'refuse to check in private classes.'. |
|
3407 |
^ false. |
|
3408 |
]. |
|
1362 | 3409 |
|
3410 |
cmdOut := Filename newTemporary. |
|
3411 |
cmdOut exists ifTrue:[ |
|
3412 |
cmdOut remove. |
|
3413 |
]. |
|
3414 |
||
4055 | 3415 |
packageDir isEmptyOrNil ifTrue:[ |
3416 |
fullName := moduleDir , '/' , fileName |
|
3417 |
] ifFalse:[ |
|
3418 |
fullName := moduleDir , '/' , packageDir , '/' , fileName. |
|
3419 |
]. |
|
1362 | 3420 |
checkoutName := moduleDir , '/' , packageDir. |
3421 |
||
3422 |
"/ |
|
3423 |
"/ first, check out everything there - this creates the CVS helpfiles |
|
3424 |
"/ required later. |
|
3425 |
"/ |
|
3426 |
||
3870 | 3427 |
self activityNotification:'CVS: Checking for directory ' , checkoutName. |
1362 | 3428 |
tempdir := self createLocalDirectory:packageDir inModule:moduleDir. |
3429 |
tempdir isNil ifTrue:[ |
|
3430 |
('CVSSourceCodeManager [error]: cannot checkout ' , checkoutName) errorPrintCR. |
|
3431 |
^ false. |
|
3432 |
]. |
|
3433 |
||
3434 |
"/ |
|
3435 |
"/ create the source there |
|
3436 |
"/ |
|
3437 |
tempFile := (tempdir construct:checkoutName) construct:fileName. |
|
3438 |
[ |
|
3439 |
aStream := tempFile writeStream. |
|
3440 |
] on:FileStream openErrorSignal do:[:ex| |
|
3441 |
('CVSSourceCodeManager [error]: temporary fileout failed -> ', tempFile name) errorPrintCR. |
|
3442 |
tempdir recursiveRemove. |
|
3443 |
^ false |
|
3444 |
]. |
|
3445 |
||
3446 |
Class fileOutErrorSignal handle:[:ex | |
|
3447 |
'CVSSourceCodeManager [error]: fileout failed' errorPrintCR. |
|
3448 |
aStream close. |
|
3449 |
tempdir recursiveRemove. |
|
3450 |
^ false |
|
3451 |
] do:[ |
|
2174 | 3452 |
self fileOutSourceCodeOf:aClass on:aStream |
1362 | 3453 |
]. |
3454 |
aStream close. |
|
3455 |
||
3456 |
tempFile exists ifFalse:[ |
|
3457 |
'CVSSourceCodeManager [error]: temporary fileout failed' errorPrintCR. |
|
3458 |
tempdir recursiveRemove. |
|
3459 |
^ false |
|
3460 |
]. |
|
3461 |
||
3462 |
"/ |
|
3463 |
"/ and add it to the repository |
|
3464 |
"/ |
|
3870 | 3465 |
self activityNotification:'CVS: Adding ' , fileName. |
1362 | 3466 |
|
3467 |
OperatingSystem isUNIXlike ifTrue:[ |
|
3468 |
checkInDir := tempdir constructString:checkoutName. |
|
3469 |
] ifFalse:[ |
|
3470 |
OperatingSystem isMSDOSlike ifTrue:[ |
|
3471 |
checkInDir := tempdir constructString:(checkoutName copyReplaceAll:$/ with:$\). |
|
3472 |
] ifFalse:[ |
|
3473 |
self error:'VMS case not yet implemented'. "/ add code for VMS ... |
|
3474 |
] |
|
3475 |
]. |
|
3476 |
cmd := 'add ' , fileName , ' > ', '"' , cmdOut name, '"'. |
|
3477 |
(self |
|
3478 |
executeCVSCommand:cmd |
|
3479 |
module:moduleDir |
|
3480 |
inDirectory:checkInDir |
|
3481 |
) ifFalse:[ |
|
3482 |
cmdOut remove. |
|
3483 |
tempdir recursiveRemove. |
|
3484 |
('CVSSourceCodeManager [error]: cannot checkout ' , checkoutName) errorPrintCR. |
|
3485 |
^ false. |
|
3486 |
]. |
|
3487 |
cmdOut remove. |
|
3488 |
||
3489 |
"/ |
|
3490 |
"/ commit |
|
3491 |
"/ |
|
3870 | 3492 |
self activityNotification:'CVS: Committing ' , fileName. |
1362 | 3493 |
|
3494 |
OperatingSystem isUNIXlike ifFalse:[ |
|
3495 |
"/ save the log message into another tempFile ... |
|
3496 |
logTmp := Filename newTemporaryIn:checkInDir. |
|
3497 |
s := logTmp writeStream. |
|
3498 |
s nextPutAll:'initial checkin'. |
|
3499 |
s close. |
|
3500 |
||
3501 |
cmd := 'commit -F "', logTmp baseName, '" ', fileName, ' > ', '"', cmdOut name, '"'. |
|
3502 |
] ifTrue:[ |
|
3503 |
"/ |
|
3504 |
"/ CVS up to V1.9.14 prints the 'new revision' to stderr, |
|
3505 |
"/ CVS V1.9.16 to stdout. |
|
3506 |
"/ |
|
3507 |
cmd := 'commit -m "initial checkin" ' , fileName , ' > ', '"' , cmdOut name, '"', ' 2>&1'. |
|
3508 |
]. |
|
3509 |
||
3510 |
(self |
|
3511 |
executeCVSCommand:cmd |
|
3512 |
module:moduleDir |
|
3513 |
inDirectory:checkInDir "tempdir name" |
|
3514 |
) ifFalse:[ |
|
3515 |
cmdOut fileSize > 0 ifTrue:[ |
|
3583 | 3516 |
whatHappened := cmdOut contentsAsString. |
1362 | 3517 |
] ifFalse:[ |
3518 |
whatHappened := '<< no message >>' |
|
3519 |
]. |
|
3520 |
self warn:'The following problem was reported by cvs: |
|
3521 |
||
3522 |
' , whatHappened , ' |
|
3523 |
||
3524 |
The class has NOT been checked into the repository.'. |
|
3525 |
||
3526 |
'CVSSourceCodeManager [error]: cannot checkin modified class source' errorPrintCR. |
|
3527 |
cmdOut remove. |
|
3528 |
tempdir recursiveRemove. |
|
3529 |
^ false. |
|
3530 |
]. |
|
3531 |
whatHappened := cmdOut contentsOfEntireFile asString. |
|
3532 |
cmdOut remove. |
|
3533 |
||
3534 |
"/ |
|
3535 |
"/ release it towards cvs |
|
3536 |
"/ |
|
3537 |
self releaseAndRemove:tempdir module:moduleDir outputTo:nil. |
|
3538 |
||
3539 |
"/ |
|
3540 |
"/ good - its in the CVS repository; now, we need the updated RCS header |
|
3541 |
"/ |
|
1447
2ac1cf09722b
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
3542 |
(whatHappened isEmptyOrNil) ifTrue:[ |
1362 | 3543 |
'CVSSourceCodeManager [warning]: unexpected empty commit command output' errorPrintCR. |
3544 |
"/ TODO: scan the file for $Header ... |
|
3545 |
"/ and extract the revision manually |
|
3546 |
||
3547 |
] ifFalse:[ |
|
3548 |
whatHappened := whatHappened asCollectionOfLines asStringCollection. |
|
3549 |
idx := whatHappened indexOfLineStartingWith:'initial revision:'. |
|
3550 |
idx ~~ 0 ifTrue:[ |
|
3551 |
startIdx := 18 |
|
3552 |
] ifFalse:[ |
|
3553 |
idx := whatHappened indexOfLineStartingWith:'new revision:'. |
|
3554 |
idx ~~ 0 ifTrue:[ |
|
3555 |
'CVSSourceCodeManager [warning]: container existed before' errorPrintCR. |
|
3556 |
startIdx := 14. |
|
3557 |
] ifFalse:[ |
|
3558 |
'CVSSourceCodeManager [warning]: unexpected commit command output (no new-revision info)' errorPrintCR. |
|
3559 |
] |
|
3560 |
]. |
|
3561 |
idx ~~ 0 ifTrue:[ |
|
3562 |
l := whatHappened at:idx. |
|
3563 |
endIdx := (l indexOf:$; startingAt:startIdx) - 1. |
|
3564 |
endIdx < 0 ifTrue:[ |
|
3565 |
endIdx := l size |
|
3566 |
]. |
|
3567 |
newRevision := (l copyFrom:startIdx to:endIdx) withoutSpaces. |
|
3568 |
(Number fromString:newRevision onError:nil) isNil ifTrue:[ |
|
3569 |
newRevision := '1.1' |
|
3570 |
] |
|
3571 |
] |
|
3572 |
]. |
|
3573 |
||
3574 |
Transcript showCR:'created new sourceContainer for ' , aClass name , '.'. |
|
3575 |
||
3576 |
"/ |
|
3577 |
"/ patch the classes revisionInfo (but keep binaryRevision unchanged) |
|
3578 |
"/ this makes everyone here believe, that the incore version of the class is based upon |
|
3579 |
"/ the newly checked in version. |
|
3580 |
"/ (however, the binaryRevision must remain as it is - we will need it to fetch the sourceCode |
|
3581 |
"/ correctly for all unchanged methodss) |
|
3582 |
"/ |
|
3583 |
||
3584 |
newRevision notNil ifTrue:[ |
|
3585 |
changeLog := self |
|
3586 |
revisionLogOf:aClass |
|
3587 |
fromRevision:newRevision |
|
3588 |
toRevision:newRevision |
|
3589 |
fileName:fileName |
|
3590 |
directory:packageDir |
|
3591 |
module:moduleDir. |
|
3592 |
||
3593 |
(changeLog isNil or:[(changeLog at:#revisions) size ~~ 1]) ifTrue:[ |
|
3594 |
'CVSSourceCodeManager [error]: failed to update revisionString (no log)' errorPrintCR |
|
3595 |
] ifFalse:[ |
|
3596 |
entry := (changeLog at:#revisions) first. |
|
3597 |
newString := self revisionStringFromLog:changeLog entry:entry forClass:aClass. |
|
2174 | 3598 |
self updateVersionMethodOf:aClass for:newString. |
1362 | 3599 |
('CVSSourceCodeManager [info]: updated revisionString to:',newString) infoPrintCR |
3600 |
] |
|
3601 |
]. |
|
3602 |
||
3603 |
tempdir recursiveRemove. |
|
3604 |
||
3605 |
Class addChangeRecordForClassCheckIn:aClass. |
|
3606 |
self postCheckInClass:aClass. |
|
3607 |
^ true |
|
3608 |
||
2296 | 3609 |
"Created: / 09-12-1995 / 19:13:37 / cg" |
3610 |
"Modified: / 23-07-1999 / 19:47:59 / stefan" |
|
3611 |
"Modified: / 12-11-2010 / 11:04:42 / cg" |
|
1362 | 3612 |
! |
3613 |
||
3614 |
createContainerForText:someText inModule:moduleDir package:packageDir container:fileName |
|
3615 |
"create a container - this does an initial checkin |
|
3616 |
(i.e. cvs add & cvs commit)" |
|
3617 |
||
3618 |
|fullName tempdir checkoutName cmdOut cmd tempFile idx aStream whatHappened l newRevision |
|
3619 |
startIdx endIdx checkInDir logTmp s| |
|
3620 |
||
3621 |
cmdOut := Filename newTemporary. |
|
3622 |
cmdOut exists ifTrue:[ |
|
3623 |
cmdOut remove. |
|
3624 |
]. |
|
3625 |
||
4055 | 3626 |
packageDir isEmptyOrNil ifTrue:[ |
3627 |
fullName := moduleDir , '/' , fileName |
|
3628 |
] ifFalse:[ |
|
3629 |
fullName := moduleDir , '/' , packageDir , '/' , fileName. |
|
3630 |
]. |
|
1362 | 3631 |
checkoutName := moduleDir , '/' , packageDir. |
3632 |
||
3633 |
"/ |
|
3634 |
"/ first, check out everything there - this creates the CVS helpfiles |
|
3635 |
"/ required later. |
|
3636 |
"/ |
|
3637 |
||
3870 | 3638 |
self activityNotification:'CVS: Checking for directory ' , checkoutName. |
1362 | 3639 |
tempdir := self createLocalDirectory:packageDir inModule:moduleDir. |
3640 |
tempdir isNil ifTrue:[ |
|
3641 |
('CVSSourceCodeManager [error]: cannot checkout ' , checkoutName) errorPrintCR. |
|
3642 |
^ false. |
|
3643 |
]. |
|
3644 |
||
3645 |
[ |
|
3646 |
"/ |
|
3647 |
"/ create the source there |
|
3648 |
"/ |
|
3649 |
tempFile := (tempdir construct:checkoutName) construct:fileName. |
|
3650 |
[ |
|
3651 |
aStream := tempFile writeStream. |
|
3652 |
] on:FileStream openErrorSignal do:[:ex| |
|
3653 |
('CVSSourceCodeManager [error]: temporary fileout failed -> ', tempFile name) errorPrintCR. |
|
3654 |
^ false |
|
3655 |
]. |
|
3656 |
||
3657 |
aStream nextPutAll:someText. |
|
3658 |
aStream close. |
|
3659 |
||
3660 |
tempFile exists ifFalse:[ |
|
3661 |
'CVSSourceCodeManager [error]: temporary fileout failed' errorPrintCR. |
|
3662 |
^ false |
|
3663 |
]. |
|
3664 |
||
3665 |
"/ |
|
3666 |
"/ and add it to the repository |
|
3667 |
"/ |
|
3870 | 3668 |
self activityNotification:'CVS: Adding ' , fileName. |
1362 | 3669 |
|
3670 |
OperatingSystem isUNIXlike ifTrue:[ |
|
3671 |
checkInDir := tempdir constructString:checkoutName. |
|
3672 |
] ifFalse:[ |
|
3673 |
OperatingSystem isMSDOSlike ifTrue:[ |
|
3674 |
checkInDir := tempdir constructString:(checkoutName copyReplaceAll:$/ with:$\). |
|
3675 |
] ifFalse:[ |
|
3676 |
self error:'VMS case not yet implemented'. "/ add code for VMS ... |
|
3677 |
] |
|
3678 |
]. |
|
3679 |
cmd := 'add ' , fileName , ' > ', '"' , cmdOut name, '"'. |
|
3680 |
(self |
|
3681 |
executeCVSCommand:cmd |
|
3682 |
module:moduleDir |
|
3683 |
inDirectory:checkInDir |
|
3684 |
) ifFalse:[ |
|
3685 |
cmdOut remove. |
|
3686 |
('CVSSourceCodeManager [error]: cannot checkout ' , checkoutName) errorPrintCR. |
|
3687 |
^ false. |
|
3688 |
]. |
|
3689 |
cmdOut remove. |
|
3690 |
||
3691 |
"/ |
|
3692 |
"/ commit |
|
3693 |
"/ |
|
3870 | 3694 |
self activityNotification:'CVS: Committing ' , fileName. |
1362 | 3695 |
|
3696 |
OperatingSystem isUNIXlike ifFalse:[ |
|
3697 |
"/ save the log message into another tempFile ... |
|
3698 |
logTmp := Filename newTemporaryIn:checkInDir. |
|
3699 |
s := logTmp writeStream. |
|
3700 |
s nextPutAll:'initial checkin'. |
|
3701 |
s close. |
|
3702 |
||
3703 |
cmd := 'commit -F "', logTmp baseName, '" ', fileName, ' >', '"', cmdOut name, '"'. |
|
3704 |
] ifTrue:[ |
|
3705 |
"/ |
|
3706 |
"/ CVS up to V1.9.14 prints the 'new revision' to stderr, |
|
3707 |
"/ CVS V1.9.16 to stdout. |
|
3708 |
"/ |
|
3709 |
cmd := 'commit -m "initial checkin" ' , fileName , ' > ', '"' , cmdOut name, '"', ' 2>&1'. |
|
3710 |
]. |
|
3711 |
||
3712 |
(self |
|
3713 |
executeCVSCommand:cmd |
|
3714 |
module:moduleDir |
|
3715 |
inDirectory:checkInDir "tempdir name" |
|
3716 |
) ifFalse:[ |
|
3717 |
cmdOut fileSize > 0 ifTrue:[ |
|
3583 | 3718 |
whatHappened := cmdOut contentsAsString. |
1362 | 3719 |
] ifFalse:[ |
3720 |
whatHappened := '<< no message >>' |
|
3721 |
]. |
|
3722 |
self warn:'The following problem was reported by cvs: |
|
3723 |
||
3724 |
' , whatHappened , ' |
|
3725 |
||
3726 |
The class has NOT been checked into the repository.'. |
|
3727 |
||
3728 |
'CVSSourceCodeManager [error]: cannot checkin modified class source' errorPrintCR. |
|
3729 |
cmdOut remove. |
|
3730 |
^ false. |
|
3731 |
]. |
|
3732 |
whatHappened := cmdOut contentsOfEntireFile asString. |
|
3733 |
cmdOut remove. |
|
3734 |
||
3735 |
"/ |
|
3736 |
"/ release it towards cvs |
|
3737 |
"/ |
|
3738 |
self releaseAndRemove:tempdir module:moduleDir outputTo:nil. |
|
3739 |
||
3740 |
"/ |
|
3741 |
"/ good - its in the CVS repository; now, we need the updated RCS header |
|
3742 |
"/ |
|
1447
2ac1cf09722b
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
3743 |
(whatHappened isEmptyOrNil) ifTrue:[ |
1362 | 3744 |
'CVSSourceCodeManager [warning]: unexpected empty commit command output' errorPrintCR. |
3745 |
"/ TODO: scan the file for $Header ... |
|
3746 |
"/ and extract the revision manually |
|
3747 |
||
3748 |
] ifFalse:[ |
|
3749 |
whatHappened := whatHappened asCollectionOfLines asStringCollection. |
|
3750 |
idx := whatHappened indexOfLineStartingWith:'initial revision:'. |
|
3751 |
idx ~~ 0 ifTrue:[ |
|
3752 |
startIdx := 18 |
|
3753 |
] ifFalse:[ |
|
3754 |
idx := whatHappened indexOfLineStartingWith:'new revision:'. |
|
3755 |
idx ~~ 0 ifTrue:[ |
|
3756 |
'CVSSourceCodeManager [warning]: container existed before' errorPrintCR. |
|
3757 |
startIdx := 14. |
|
3758 |
] ifFalse:[ |
|
3759 |
'CVSSourceCodeManager [warning]: unexpected commit command output (no new-revision info)' errorPrintCR. |
|
3760 |
] |
|
3761 |
]. |
|
3762 |
idx ~~ 0 ifTrue:[ |
|
3763 |
l := whatHappened at:idx. |
|
3764 |
endIdx := (l indexOf:$; startingAt:startIdx) - 1. |
|
3765 |
endIdx < 0 ifTrue:[ |
|
3766 |
endIdx := l size |
|
3767 |
]. |
|
3768 |
newRevision := (l copyFrom:startIdx to:endIdx) withoutSpaces. |
|
3769 |
(Number fromString:newRevision onError:nil) isNil ifTrue:[ |
|
3770 |
newRevision := '1.1' |
|
3771 |
] |
|
3772 |
] |
|
3773 |
]. |
|
3774 |
||
3775 |
Transcript showCR:'created new sourceContainer for ' , fileName , '.'. |
|
3776 |
] ensure:[ |
|
3777 |
tempdir recursiveRemove. |
|
3778 |
]. |
|
3779 |
^ true |
|
2296 | 3780 |
|
3781 |
"Modified: / 12-11-2010 / 11:04:55 / cg" |
|
1362 | 3782 |
! |
3783 |
||
3784 |
createModule:moduleName |
|
3785 |
"create a module directory" |
|
3786 |
||
3787 |
|tempdir moduleDir cmdOut cmd| |
|
3788 |
||
3789 |
"/ |
|
3790 |
"/ first, create a temporary work tree |
|
3791 |
"/ |
|
3792 |
tempdir := self createTempDirectory:nil forModule:moduleName. |
|
2127 | 3793 |
tempdir isNil ifTrue:[ |
3794 |
'CVSSourceCodeManager [error]: no tempDir - cannot create moduleDirectory' errorPrintCR. |
|
3795 |
^ false |
|
3796 |
]. |
|
1362 | 3797 |
|
3798 |
cmdOut := Filename newTemporary. |
|
3799 |
cmdOut exists ifTrue:[ |
|
3800 |
cmdOut remove. |
|
3801 |
]. |
|
3802 |
||
3803 |
"/ |
|
3804 |
"/ create the module directory |
|
3805 |
"/ |
|
3806 |
moduleDir := tempdir construct:moduleName. |
|
3807 |
moduleDir exists ifFalse:[ |
|
3808 |
'CVSSourceCodeManager [error]: failed to create: ' errorPrint. moduleDir name errorPrintCR. |
|
3809 |
tempdir recursiveRemove. |
|
3810 |
^ false. |
|
3811 |
]. |
|
3812 |
||
3813 |
"/ |
|
3814 |
"/ then import it into CVS |
|
3815 |
"/ |
|
3816 |
||
3817 |
cmd := 'import -m "created from browser" ' , moduleName , ' initialV initialR > ' , cmdOut name. |
|
3818 |
(self |
|
3819 |
executeCVSCommand:cmd |
|
3820 |
module:moduleName |
|
3821 |
inDirectory:tempdir name |
|
3822 |
) ifFalse:[ |
|
3823 |
cmdOut remove. |
|
3824 |
tempdir recursiveRemove. |
|
3825 |
^ false. |
|
3826 |
]. |
|
3827 |
||
3828 |
'CVSSourceCodeManager [info]: created new module: ' infoPrint. moduleName infoPrintCR. |
|
3829 |
tempdir recursiveRemove. |
|
3830 |
cmdOut remove. |
|
3831 |
^ true |
|
3832 |
||
1778
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
3833 |
"Created: / 09-12-1995 / 19:53:51 / cg" |
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
3834 |
"Modified: / 07-01-1998 / 14:18:57 / stefan" |
2296 | 3835 |
"Modified: / 12-11-2010 / 11:00:25 / cg" |
1362 | 3836 |
! |
3837 |
||
1664
5fa005755e5f
renamed *package* to *directory* to avoid confusion.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
3838 |
createModule:moduleDirName directory:packageDirName |
1362 | 3839 |
"create a package directory" |
3840 |
||
3841 |
|tempdir cmdOut cmd packageDir moduleDir relativePath idx parentPackage| |
|
3842 |
||
3843 |
"/ any parent package required ? |
|
3844 |
idx := packageDirName lastIndexOf:$/. |
|
3845 |
idx ~~ 0 ifTrue:[ |
|
3846 |
parentPackage := packageDirName copyTo:idx-1. |
|
1839 | 3847 |
(self checkForExistingModule:moduleDirName directory:parentPackage) ifFalse:[ |
3848 |
(self createModule:moduleDirName directory:parentPackage) ifFalse:[ |
|
1362 | 3849 |
^ false. |
3850 |
]. |
|
3851 |
]. |
|
3852 |
]. |
|
3853 |
||
3854 |
(moduleDirName asFilename components includes:'core') ifTrue:[ |
|
3855 |
('CVSSourceCodeManager [error]: cvs does not allow for a module to be named ''core'' - cannot create moduleDirectory') errorPrintCR. |
|
3856 |
^ false |
|
3857 |
]. |
|
3858 |
||
3859 |
"/ |
|
3860 |
"/ first, create a temporary work tree |
|
3861 |
"/ |
|
3862 |
tempdir := self createTempDirectory:packageDirName forModule:moduleDirName. |
|
3863 |
||
3864 |
cmdOut := Filename newTemporary. |
|
3865 |
cmdOut exists ifTrue:[ |
|
3866 |
cmdOut remove. |
|
3867 |
]. |
|
3868 |
||
3869 |
moduleDir := tempdir construct:moduleDirName. |
|
3870 |
moduleDir isDirectory ifFalse:[ |
|
3871 |
'CVSSourceCodeManager [error]: command failed: ' errorPrint. cmd errorPrintCR. |
|
3872 |
||
3873 |
tempdir recursiveRemove. |
|
3874 |
^ false. |
|
3875 |
]. |
|
3876 |
||
3877 |
"/ |
|
3878 |
"/ create the package directory there |
|
3879 |
"/ |
|
3880 |
packageDir := moduleDir construct:packageDirName. |
|
3235 | 3881 |
OsError catch:[ |
1362 | 3882 |
packageDir recursiveMakeDirectory. |
3883 |
]. |
|
3884 |
packageDir isDirectory ifFalse:[ |
|
3885 |
tempdir recursiveRemove. |
|
3886 |
('CVSSourceCodeManager [error]: cannot create new directory: ' , packageDir pathName) errorPrintCR. |
|
3887 |
^ false. |
|
3888 |
]. |
|
3889 |
||
3890 |
"/ |
|
3891 |
"/ then import it into CVS |
|
3892 |
"/ |
|
3893 |
||
3894 |
relativePath := moduleDirName asFilename constructString:packageDirName. |
|
3895 |
cmd := 'import -m "created from browser" . initialV initialR > ' , cmdOut name. |
|
3896 |
(self |
|
3897 |
executeCVSCommand:cmd |
|
3898 |
module:moduleDirName |
|
3899 |
inDirectory:tempdir name |
|
3900 |
) ifFalse:[ |
|
3901 |
'CVSSourceCodeManager [error]: output from cvs:' errorPrintCR. |
|
3583 | 3902 |
(cmdOut contentsAsString) errorPrint. |
1362 | 3903 |
|
3904 |
cmdOut remove. |
|
3905 |
tempdir recursiveRemove. |
|
3906 |
^ false. |
|
3907 |
]. |
|
3908 |
||
3909 |
tempdir recursiveRemove. |
|
3910 |
cmdOut remove. |
|
3911 |
^ true |
|
3912 |
||
3913 |
" |
|
3914 |
self createModule:'stefan' package:'dummy1' |
|
3915 |
" |
|
3916 |
||
1664
5fa005755e5f
renamed *package* to *directory* to avoid confusion.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
3917 |
"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
|
3918 |
"Created: / 23-08-2006 / 14:04:39 / cg" |
2296 | 3919 |
"Modified: / 12-11-2010 / 11:00:18 / cg" |
1362 | 3920 |
! |
3921 |
||
1459
83c50df5be7f
Setting/deleting symbolic names
Stefan Vogel <sv@exept.de>
parents:
1457
diff
changeset
|
3922 |
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
|
3923 |
"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
|
3924 |
|
1459
83c50df5be7f
Setting/deleting symbolic names
Stefan Vogel <sv@exept.de>
parents:
1457
diff
changeset
|
3925 |
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
|
3926 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3927 |
" |
1459
83c50df5be7f
Setting/deleting symbolic names
Stefan Vogel <sv@exept.de>
parents:
1457
diff
changeset
|
3928 |
self deleteSymbolicName:'stable' path:'stx/libbasic/Array.st' |
83c50df5be7f
Setting/deleting symbolic names
Stefan Vogel <sv@exept.de>
parents:
1457
diff
changeset
|
3929 |
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
|
3930 |
" |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3931 |
! |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3932 |
|
1664
5fa005755e5f
renamed *package* to *directory* to avoid confusion.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
3933 |
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
|
3934 |
"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
|
3935 |
|
2204 | 3936 |
^ self listNonDirectories:aModule, '/', aPackage |
1362 | 3937 |
|
3938 |
" |
|
3939 |
CVSSourceCodeManager getExistingContainersInModule:'stx' package:'libhtml' |
|
3940 |
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
|
3941 |
CVSSourceCodeManager getExistingContainersInModule:'exept' package:'osi' |
1362 | 3942 |
" |
1664
5fa005755e5f
renamed *package* to *directory* to avoid confusion.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
3943 |
|
5fa005755e5f
renamed *package* to *directory* to avoid confusion.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
3944 |
"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
|
3945 |
! |
5fa005755e5f
renamed *package* to *directory* to avoid confusion.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
3946 |
|
5fa005755e5f
renamed *package* to *directory* to avoid confusion.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
3947 |
getExistingDirectoriesInModule:aModule |
5fa005755e5f
renamed *package* to *directory* to avoid confusion.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
3948 |
"return a list of existing directories." |
5fa005755e5f
renamed *package* to *directory* to avoid confusion.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
3949 |
|
5fa005755e5f
renamed *package* to *directory* to avoid confusion.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
3950 |
^ self listDirectories:aModule. |
5fa005755e5f
renamed *package* to *directory* to avoid confusion.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
3951 |
|
5fa005755e5f
renamed *package* to *directory* to avoid confusion.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
3952 |
" |
5fa005755e5f
renamed *package* to *directory* to avoid confusion.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
3953 |
CVSSourceCodeManager getExistingDirectoriesInModule:'stx' |
5fa005755e5f
renamed *package* to *directory* to avoid confusion.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
3954 |
CVSSourceCodeManager getExistingDirectoriesInModule:'cg' |
5fa005755e5f
renamed *package* to *directory* to avoid confusion.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
3955 |
CVSSourceCodeManager getExistingDirectoriesInModule:'exept' |
5fa005755e5f
renamed *package* to *directory* to avoid confusion.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
3956 |
" |
5fa005755e5f
renamed *package* to *directory* to avoid confusion.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
3957 |
|
5fa005755e5f
renamed *package* to *directory* to avoid confusion.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
3958 |
"Created: / 23-08-2006 / 14:13:41 / cg" |
1362 | 3959 |
! |
3960 |
||
3961 |
getExistingModules |
|
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3962 |
"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
|
3963 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3964 |
^ self listDirectories:nil. |
1362 | 3965 |
|
3966 |
" |
|
3967 |
CVSSourceCodeManager getExistingModules |
|
3968 |
" |
|
3969 |
! |
|
3970 |
||
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3971 |
listDirectories:cvsPath |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3972 |
"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
|
3973 |
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
|
3974 |
|
2204 | 3975 |
|directories| |
3976 |
||
3870 | 3977 |
self activityNotification:'CVS: Fetching list of directories...'. |
2204 | 3978 |
|
3979 |
directories := Set new. |
|
3980 |
self listDirectoriesIn:cvsPath |
|
3981 |
into:[:fn | directories add:fn] |
|
3982 |
nonDirectoriesInto:[:fn | ]. |
|
3983 |
^ directories asArray sort |
|
3984 |
||
3985 |
" |
|
3986 |
CVSSourceCodeManager listDirectories:nil |
|
3987 |
CVSSourceCodeManager listDirectories:'stx' |
|
3988 |
CVSSourceCodeManager listDirectories:'stx/libbasic' |
|
3989 |
" |
|
3990 |
! |
|
3991 |
||
3992 |
listDirectoriesIn:cvsPath into:dirBlock nonDirectoriesInto:nonDirBlock |
|
3993 |
"enumerate all directories and non-directories in cvsPath. |
|
3994 |
cvsPath is the path relative to the cvs root" |
|
3995 |
||
3996 |
|cvsRoot inStream line| |
|
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3997 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
3998 |
cvsRoot := self getCVSROOTForModule:nil. |
2204 | 3999 |
cvsRoot isNil ifTrue:[^ self ]. |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4000 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4001 |
[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4002 |
inStream := self |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4003 |
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
|
4004 |
module:nil |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4005 |
inDirectory:nil |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4006 |
log:false |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4007 |
pipe:true. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4008 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4009 |
inStream isNil ifTrue:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4010 |
self warn:'This operation is not possible with this remoteCVS server'. |
2204 | 4011 |
^ self. |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4012 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4013 |
|
2204 | 4014 |
[ |
4015 |
line := inStream atEnd |
|
4016 |
ifTrue:[nil] |
|
4017 |
ifFalse:[ inStream nextLine ]. |
|
4018 |
line notNil |
|
4019 |
] whileTrue:[ |
|
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4020 |
|idx| |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4021 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4022 |
(line startsWith:$d) ifTrue:[ |
2204 | 4023 |
"/ 'd--- 2005-06-02 17:21:20 +0200 Eigene Dateien' |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4024 |
idx := 0. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4025 |
4 timesRepeat:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4026 |
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
|
4027 |
]. |
2204 | 4028 |
dirBlock value: (line copyFrom:idx+1) withoutSeparators |
4029 |
] ifFalse:[ |
|
4030 |
"/ '---- 2005-06-02 17:21:20 +0200 1.23 .cvsIgnore' |
|
4031 |
idx := 0. |
|
4032 |
5 timesRepeat:[ |
|
4033 |
idx := line indexOf:Character space startingAt:idx+1. |
|
4034 |
]. |
|
4035 |
nonDirBlock value: (line copyFrom:idx+1) withoutSeparators |
|
4036 |
]. |
|
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4037 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4038 |
] ensure:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4039 |
inStream notNil ifTrue:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4040 |
inStream close. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4041 |
] |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4042 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4043 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4044 |
" |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4045 |
CVSSourceCodeManager listDirectories:nil |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4046 |
CVSSourceCodeManager listDirectories:'stx' |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4047 |
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
|
4048 |
" |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4049 |
! |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4050 |
|
2204 | 4051 |
listNonDirectories:cvsPath |
4052 |
"return a list of all containers in cvsPath. |
|
4053 |
cvsPath is the path relative to the cvs root" |
|
4054 |
||
4055 |
|containers| |
|
4056 |
||
3870 | 4057 |
self activityNotification:'CVS: Fetching list of containers...'. |
2204 | 4058 |
|
4059 |
containers := Set new. |
|
4060 |
self listDirectoriesIn:cvsPath |
|
4061 |
into:[:fn | ] |
|
4062 |
nonDirectoriesInto:[:fn | containers add:fn]. |
|
4063 |
^ containers asArray sort |
|
4064 |
||
4065 |
" |
|
4066 |
CVSSourceCodeManager listNonDirectories:nil |
|
4067 |
CVSSourceCodeManager listNonDirectories:'stx' |
|
4068 |
CVSSourceCodeManager listNonDirectories:'stx/libbasic' |
|
4069 |
" |
|
4070 |
! |
|
4071 |
||
1362 | 4072 |
newestRevisionInFile:classFileName directory:packageDir module:moduleDir |
4073 |
"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
|
4074 |
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
|
4075 |
|
3264 | 4076 |
|fullName modulePath inStream line s| |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4077 |
|
3649 | 4078 |
false "self use_rlog" ifFalse:[ |
4079 |
"/ Uses 'cvs status' - rlog seems not to work and/or is slower |
|
1464
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4080 |
|
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4081 |
|info| |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4082 |
|
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4083 |
info := self |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4084 |
statusOf:nil |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4085 |
fileName:classFileName |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4086 |
directory:packageDir |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4087 |
module:moduleDir. |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4088 |
|
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4089 |
info isNil ifTrue:[^ nil]. |
3649 | 4090 |
^ info at:#newestRevision ifAbsent:nil |
1464
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4091 |
]. |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4092 |
|
4055 | 4093 |
packageDir isEmptyOrNil ifTrue:[ |
4094 |
modulePath := moduleDir |
|
4095 |
] ifFalse:[ |
|
4096 |
modulePath := moduleDir , '/' , packageDir. |
|
4097 |
]. |
|
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4098 |
fullName := modulePath , '/' , classFileName. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4099 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4100 |
[ |
3870 | 4101 |
self activityNotification:'CVS: Fetching revision info for ', fullName. |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4102 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4103 |
inStream := self |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4104 |
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
|
4105 |
module:moduleDir |
3264 | 4106 |
inDirectory:nil |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4107 |
log:true |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4108 |
pipe:true. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4109 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4110 |
inStream isNil ifTrue:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4111 |
('CVSSourceCodeManager [error]: cannot open pipe to cvs log ', fullName) errorPrintCR. |
2792
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4112 |
"/ will be raised unconditionally in the near future... |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4113 |
SourceCodeManagerError isHandled ifTrue:[ |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4114 |
SourceCodeManagerError raiseRequestErrorString:'cvs rlog failed'. |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4115 |
]. |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4116 |
^ nil |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4117 |
]. |
2792
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4118 |
inStream atEnd ifTrue:[ |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4119 |
"/ mhmh - that could be a cvs configuration problem... |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4120 |
"/ the following checks this and raises an appropriate error |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4121 |
self |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4122 |
executeCVSCommand:('status ' , fullName) |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4123 |
module:moduleDir |
3264 | 4124 |
inDirectory:nil |
2792
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4125 |
log:true |
4100 | 4126 |
outputTo:(WriteStream on:'') errorTo:(WriteStream on:''). |
2792
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4127 |
] ifFalse:[ |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4128 |
"/ |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4129 |
"/ read the commands pipe output and extract the container info |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4130 |
"/ |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4131 |
[inStream atEnd] whileFalse:[ |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4132 |
line:= inStream nextLine. |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4133 |
line notNil ifTrue:[ |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4134 |
line := line withoutSeparators. |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4135 |
line notEmpty ifTrue:[ |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4136 |
s := line restAfter:'RCS file:' withoutSeparators:true. |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4137 |
s notNil ifTrue:[ |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4138 |
(UnixFilename named:s) directory baseName = 'Attic' ifTrue:[ |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4139 |
"/ file has been removed in the repository |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4140 |
^ #deleted |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4141 |
]. |
1502 | 4142 |
]. |
2792
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4143 |
s := line restAfter:'head:' withoutSeparators:true. |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4144 |
s notNil ifTrue:[ |i| |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4145 |
i := s indexOfSeparator. |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4146 |
i ~~ 0 ifTrue:[ |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4147 |
s := s copyTo:i-1 |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4148 |
]. |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4149 |
^ s |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4150 |
]. |
1464
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4151 |
]. |
2792
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4152 |
] |
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4153 |
]. |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4154 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4155 |
('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
|
4156 |
] ensure:[ |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4157 |
inStream notNil ifTrue:[inStream close]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4158 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
4159 |
^ nil |
1362 | 4160 |
|
4161 |
" |
|
4162 |
SourceCodeManager newestRevisionInFile:'Array.st' directory:'libbasic' module:'stx' |
|
4163 |
" |
|
1502 | 4164 |
|
2792
25f99a06b4ff
comment/format in: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
4165 |
"Modified: / 06-03-2012 / 11:55:33 / cg" |
1362 | 4166 |
! |
4167 |
||
1858
a3038cf8dd3c
+newestRevisionsInModule:directory: to get bulk-information
Claus Gittinger <cg@exept.de>
parents:
1839
diff
changeset
|
4168 |
newestRevisionsInModule:module directory:packageDir |
a3038cf8dd3c
+newestRevisionsInModule:directory: to get bulk-information
Claus Gittinger <cg@exept.de>
parents:
1839
diff
changeset
|
4169 |
"return a list of filename-module associations for the containers in |
a3038cf8dd3c
+newestRevisionsInModule:directory: to get bulk-information
Claus Gittinger <cg@exept.de>
parents:
1839
diff
changeset
|
4170 |
a package directory. |
a3038cf8dd3c
+newestRevisionsInModule:directory: to get bulk-information
Claus Gittinger <cg@exept.de>
parents:
1839
diff
changeset
|
4171 |
Return nil on failure." |
a3038cf8dd3c
+newestRevisionsInModule:directory: to get bulk-information
Claus Gittinger <cg@exept.de>
parents:
1839
diff
changeset
|
4172 |
|
2188
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
4173 |
^ self revisionsInModule:module directory:packageDir fromDate:nil |
1858
a3038cf8dd3c
+newestRevisionsInModule:directory: to get bulk-information
Claus Gittinger <cg@exept.de>
parents:
1839
diff
changeset
|
4174 |
|
a3038cf8dd3c
+newestRevisionsInModule:directory: to get bulk-information
Claus Gittinger <cg@exept.de>
parents:
1839
diff
changeset
|
4175 |
" |
a3038cf8dd3c
+newestRevisionsInModule:directory: to get bulk-information
Claus Gittinger <cg@exept.de>
parents:
1839
diff
changeset
|
4176 |
SourceCodeManager |
2188
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
4177 |
newestRevisionsInModule:'bosch' directory:'dapasx' |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
4178 |
SourceCodeManager |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
4179 |
newestRevisionsInModule:'stx' directory:'goodies/net/ssl' |
1858
a3038cf8dd3c
+newestRevisionsInModule:directory: to get bulk-information
Claus Gittinger <cg@exept.de>
parents:
1839
diff
changeset
|
4180 |
" |
a3038cf8dd3c
+newestRevisionsInModule:directory: to get bulk-information
Claus Gittinger <cg@exept.de>
parents:
1839
diff
changeset
|
4181 |
|
a3038cf8dd3c
+newestRevisionsInModule:directory: to get bulk-information
Claus Gittinger <cg@exept.de>
parents:
1839
diff
changeset
|
4182 |
"Created: / 12-10-2006 / 10:12:59 / cg" |
a3038cf8dd3c
+newestRevisionsInModule:directory: to get bulk-information
Claus Gittinger <cg@exept.de>
parents:
1839
diff
changeset
|
4183 |
! |
a3038cf8dd3c
+newestRevisionsInModule:directory: to get bulk-information
Claus Gittinger <cg@exept.de>
parents:
1839
diff
changeset
|
4184 |
|
4273 | 4185 |
pathesForClasses:aCollectionOfClasses |
4186 |
"helper - collect the pathnames for a collection of classes" |
|
4187 |
||
4188 |
|paths alreadyWarned| |
|
4189 |
||
4190 |
alreadyWarned := 0. |
|
4191 |
||
4192 |
paths := aCollectionOfClasses |
|
4193 |
collect:[:cls | |
|
4194 |
|info path answer| |
|
4195 |
||
4196 |
cls isLoaded ifFalse:[ |
|
4197 |
Transcript showCR:('Cannot handle unloaded class: %1.' bindWith:cls name). |
|
4198 |
alreadyWarned == 0 ifTrue:[ |
|
4199 |
Dialog warn:('Cannot handle unloaded class: %1.' bindWith:cls name). |
|
4200 |
alreadyWarned := alreadyWarned + 1. |
|
4201 |
] ifFalse:[ |
|
4202 |
alreadyWarned == 1 ifTrue:[ |
|
4203 |
answer := Dialog confirmWithCancel:('Cannot handle unloaded class: %1.\\Suppress further warnings?' withCRs bindWith:cls name). |
|
4204 |
answer isNil ifTrue:[^ self]. |
|
4205 |
answer == true ifTrue:[ |
|
4206 |
alreadyWarned := alreadyWarned + 1. |
|
4207 |
]. |
|
4208 |
] |
|
4209 |
]. |
|
4210 |
nil |
|
4211 |
] ifTrue:[ |
|
4212 |
info := self sourceInfoOfClass:cls. |
|
4213 |
info isNil ifTrue:[ |
|
4214 |
Dialog warn:('No source info for: %1 (not in repository?)' bindWith:cls name). |
|
4215 |
nil |
|
4216 |
] ifFalse:[ |
|
4217 |
path := info at:#pathInRepository ifAbsent:nil. |
|
4218 |
path isNil ifTrue:[ |
|
4219 |
Dialog warn:('No source info for: %1 (not in repository?)' bindWith:cls name). |
|
4220 |
]. |
|
4221 |
path |
|
4222 |
]. |
|
4223 |
]. |
|
4224 |
] |
|
4225 |
thenSelect:[:path | path notNil]. |
|
4226 |
^ paths |
|
4227 |
||
4228 |
"Created: / 04-12-2017 / 18:48:30 / cg" |
|
4229 |
! |
|
4230 |
||
1788 | 4231 |
removeContainer:fileName inModule:moduleDir directory:packageDir |
1362 | 4232 |
"remove a container" |
4233 |
||
4234 |
|fullName tempdir checkoutName cmdOut cmd tempFile whatHappened| |
|
4235 |
||
4055 | 4236 |
packageDir isEmptyOrNil ifTrue:[ |
4237 |
fullName := moduleDir , '/' , fileName. |
|
4238 |
] ifFalse:[ |
|
4239 |
fullName := moduleDir , '/' , packageDir , '/' , fileName. |
|
4240 |
]. |
|
1362 | 4241 |
checkoutName := moduleDir , '/' , packageDir. |
4242 |
||
4243 |
(tempdir := self createLocalDirectory:packageDir inModule:moduleDir with:fileName) isNil ifTrue:[ |
|
4244 |
tempdir recursiveRemove. |
|
1778
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
4245 |
self reportError:('cannot checkout ',checkoutName,' (cannot create local directory)'). |
1362 | 4246 |
^ false. |
4247 |
]. |
|
4248 |
||
4249 |
"/ |
|
4250 |
"/ and remove it to the repository |
|
4251 |
"/ |
|
3870 | 4252 |
self activityNotification:'CVS: Removing ' , fileName. |
1362 | 4253 |
|
2480 | 4254 |
RecentlyCheckedModulesAndPackages := nil. "/ flush (could do better...) |
4255 |
||
1362 | 4256 |
"/ |
1788 | 4257 |
"/ check presence of file there |
1362 | 4258 |
"/ |
4259 |
tempFile := (tempdir construct:checkoutName) construct:fileName. |
|
4260 |
tempFile exists ifFalse:[ |
|
4261 |
tempdir recursiveRemove. |
|
1788 | 4262 |
"/ already removed |
1362 | 4263 |
^ false |
4264 |
]. |
|
4265 |
||
4266 |
tempFile exists ifTrue:[ |
|
4267 |
tempFile remove. |
|
4268 |
]. |
|
4269 |
||
4270 |
cmdOut := Filename newTemporary. |
|
4271 |
cmdOut exists ifTrue:[ |
|
4272 |
cmdOut remove. |
|
4273 |
]. |
|
4274 |
||
4275 |
cmd := 'remove ' , fileName , ' > ' , cmdOut name. |
|
4276 |
(self |
|
4277 |
executeCVSCommand:cmd |
|
4278 |
module:moduleDir |
|
4279 |
inDirectory:(tempdir constructString:checkoutName) |
|
4280 |
) ifFalse:[ |
|
4281 |
cmdOut remove. |
|
4282 |
tempdir recursiveRemove. |
|
1778
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
4283 |
self reportError:('cannot remove ',checkoutName). |
1362 | 4284 |
^ false. |
4285 |
]. |
|
4286 |
cmdOut remove. |
|
4287 |
||
4288 |
"/ |
|
4289 |
"/ commit |
|
4290 |
"/ |
|
3870 | 4291 |
self activityNotification:'CVS Committing removal of ' , fileName. |
1362 | 4292 |
|
4293 |
cmd := 'commit -m "removed container" -l ' , fileName , ' 2> ' , cmdOut name. |
|
4294 |
(self |
|
4295 |
executeCVSCommand:cmd |
|
4296 |
module:moduleDir |
|
4297 |
inDirectory:(tempdir constructString:checkoutName) |
|
4298 |
) ifFalse:[ |
|
4299 |
cmdOut fileSize > 0 ifTrue:[ |
|
3583 | 4300 |
whatHappened := cmdOut contentsAsString. |
1362 | 4301 |
] ifFalse:[ |
4302 |
whatHappened := '<< no message >>' |
|
4303 |
]. |
|
4304 |
self warn:'The following problem was reported by cvs: |
|
4305 |
||
4306 |
' , whatHappened , ' |
|
4307 |
||
4308 |
The container has NOT been removed into the repository.'. |
|
4309 |
||
4310 |
cmdOut remove. |
|
4311 |
tempdir recursiveRemove. |
|
1778
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
4312 |
self reportError:'cannot remove container'. |
1362 | 4313 |
^ false. |
4314 |
]. |
|
4315 |
cmdOut remove. |
|
4316 |
||
4317 |
"/ |
|
4318 |
"/ release the temporary tree towards cvs |
|
4319 |
"/ |
|
4320 |
self releaseAndRemove:tempdir module:moduleDir outputTo:nil. |
|
4321 |
||
4322 |
tempdir recursiveRemove. |
|
4323 |
^ true |
|
4324 |
||
4325 |
" |
|
1788 | 4326 |
SourceCodeManager checkForExistingContainer:'foo.st' inModule:'stx' directory:'private'. |
4327 |
||
4328 |
SourceCodeManager removeContainer:'foo.st' inModule:'stx' package:'private' |
|
1362 | 4329 |
" |
4330 |
||
1778
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
4331 |
"Modified: / 26-02-1998 / 17:33:57 / stefan" |
1788 | 4332 |
"Created: / 13-09-2006 / 18:31:55 / cg" |
2480 | 4333 |
"Modified (comment): / 19-08-2011 / 10:44:53 / cg" |
1788 | 4334 |
! |
4335 |
||
4336 |
removeContainer:fileName inModule:moduleDir package:packageDir |
|
4337 |
"remove a container" |
|
4338 |
||
1880 | 4339 |
<resource: #obsolete> |
1788 | 4340 |
self obsoleteMethodWarning. |
4341 |
^ self removeContainer:fileName inModule:moduleDir directory:packageDir |
|
4342 |
||
4343 |
"Modified: / 13-09-2006 / 18:32:25 / cg" |
|
4344 |
! |
|
4345 |
||
4346 |
removeContainerInModule:moduleDir package:packageDir container:fileName |
|
4347 |
"remove a container" |
|
4348 |
||
1880 | 4349 |
<resource: #obsolete> |
1788 | 4350 |
self obsoleteMethodWarning. |
4351 |
^ self removeContainer:fileName inModule:moduleDir directory:packageDir |
|
4352 |
||
4353 |
" |
|
4354 |
SourceCodeManager removeContainer:'foo.st' inModule:'stx' package:'private' |
|
4355 |
" |
|
4356 |
||
4357 |
"Modified: / 26-02-1998 / 17:33:57 / stefan" |
|
4358 |
"Modified: / 13-09-2006 / 18:31:52 / cg" |
|
1362 | 4359 |
! |
4360 |
||
2099
edfeaba9c51e
timeGoal can be a timestamp in reportHistory...
Claus Gittinger <cg@exept.de>
parents:
2098
diff
changeset
|
4361 |
reportHistoryLogSince:timeGoal |
edfeaba9c51e
timeGoal can be a timestamp in reportHistory...
Claus Gittinger <cg@exept.de>
parents:
2098
diff
changeset
|
4362 |
filterSTSources:filterSTSourcesBool |
edfeaba9c51e
timeGoal can be a timestamp in reportHistory...
Claus Gittinger <cg@exept.de>
parents:
2098
diff
changeset
|
4363 |
filterUser:userFilter |
edfeaba9c51e
timeGoal can be a timestamp in reportHistory...
Claus Gittinger <cg@exept.de>
parents:
2098
diff
changeset
|
4364 |
filterRepository:filterRep |
edfeaba9c51e
timeGoal can be a timestamp in reportHistory...
Claus Gittinger <cg@exept.de>
parents:
2098
diff
changeset
|
4365 |
filterModules:filterModules |
edfeaba9c51e
timeGoal can be a timestamp in reportHistory...
Claus Gittinger <cg@exept.de>
parents:
2098
diff
changeset
|
4366 |
inTo:aBlock |
edfeaba9c51e
timeGoal can be a timestamp in reportHistory...
Claus Gittinger <cg@exept.de>
parents:
2098
diff
changeset
|
4367 |
|
1362 | 4368 |
"process a full historyLog, evaluate aBlock for each entry, passing |
4369 |
the logs info in a dictionary. |
|
4370 |
This walks over all possible repositories. |
|
4371 |
filterRep may be a collection of repository names |
|
3928 | 4372 |
(i.e. 'stx', 'exept', 'phx' etc.) to only report changes made to one |
1362 | 4373 |
of those repositories. |
4374 |
filterUser, if non-nil, will filter only changes made by that user." |
|
4375 |
||
4376 |
|inStream line words recordType fileName user date time rev pkgDir module idx |
|
4377 |
clsName cls clsRev roots info tempDir endReached| |
|
4378 |
||
4379 |
CVSRoot isNil ifTrue:[ |
|
4380 |
'CVSSourceCodeManager [info]: CVSROOT not set' infoPrintCR. |
|
4381 |
^ nil |
|
4382 |
]. |
|
4383 |
||
1481 | 4384 |
filterRep notEmptyOrNil ifTrue:[ |
4385 |
roots := filterRep. |
|
1362 | 4386 |
] ifFalse:[ |
1481 | 4387 |
roots := Set withAll:(CVSModuleRoots values). |
4388 |
roots add:CVSRoot. |
|
1362 | 4389 |
]. |
4390 |
||
4391 |
"/ must do it in a tempDir, to avoid cvs validating the -D arg |
|
4392 |
"/ against any info found in CVS/Root |
|
4393 |
||
4394 |
tempDir := self createTempDirectory:nil forModule:nil. |
|
2127 | 4395 |
tempDir isNil ifTrue:[ |
4396 |
('CVSSourceCodeManager [error]: no tempDir - cannot extract log') errorPrintCR. |
|
4397 |
^ nil. |
|
4398 |
]. |
|
1362 | 4399 |
|
1481 | 4400 |
roots do:[:eachCvsRoot | |
1362 | 4401 |
|root host cmd| |
4402 |
||
1481 | 4403 |
cmd := 'cvs -d ' , eachCvsRoot. |
4404 |
||
3928 | 4405 |
cmd := cmd , ' history -x ARMT -a'. |
1447
2ac1cf09722b
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
4406 |
(timeGoal notEmptyOrNil) ifTrue:[ |
2099
edfeaba9c51e
timeGoal can be a timestamp in reportHistory...
Claus Gittinger <cg@exept.de>
parents:
2098
diff
changeset
|
4407 |
cmd := cmd , ' -D "' , timeGoal printString , '"'. |
1362 | 4408 |
]. |
4409 |
userFilter notNil ifTrue:[ |
|
4410 |
userFilter isString ifTrue:[ |
|
4411 |
cmd := cmd , ' -u "' , userFilter , '"'. |
|
4412 |
] ifFalse:[ |
|
4413 |
userFilter do:[:user | |
|
4414 |
cmd := cmd , ' -u "' , user , '"'. |
|
4415 |
]. |
|
4416 |
]. |
|
4417 |
]. |
|
4418 |
||
1481 | 4419 |
"/ The -m and -x options do not work together in cvs history |
1362 | 4420 |
"/ |
4421 |
"/ filterModules notNil ifTrue:[ |
|
4422 |
"/ filterModules do:[:aModule | |
|
4423 |
"/ cmd := cmd , ' -m "' , aModule , '"'. |
|
4424 |
"/ ]. |
|
4425 |
"/ ]. |
|
4426 |
||
4427 |
Transcript showCR:cmd. |
|
4428 |
||
4429 |
inStream := PipeStream readingFrom:cmd inDirectory:tempDir. |
|
4430 |
inStream isNil ifTrue:[ |
|
4431 |
('CVSSourceCodeManager [error]: cannot open pipe to ''cvs history''') errorPrintCR. |
|
4432 |
] ifFalse:[ |
|
4433 |
inStream class streamErrorSignal handle:[:ex | |
|
4434 |
('CVSSourceCodeManager [error]: pipe read error (''cvs history'')') errorPrintCR. |
|
4435 |
ex return. |
|
4436 |
] do:[ |
|
4437 |
"/ |
|
4438 |
"/ read the commands pipe output and reformat the lines |
|
4439 |
"/ |
|
4440 |
endReached := false. |
|
4441 |
[endReached] whileFalse:[ |
|
4442 |
inStream readWait. |
|
4443 |
line := inStream nextLine. |
|
4444 |
(endReached := line isNil) ifFalse:[ |
|
4445 |
||
4446 |
"/ cvs history line is of the following format: |
|
4447 |
"/ [Ma] date time +xxx user rev name module/package .... |
|
4448 |
words := line asCollectionOfWords. |
|
3928 | 4449 |
words size < 7 ifTrue:[ |
1362 | 4450 |
"/ something like 'No records selected' ... |
1481 | 4451 |
] ifFalse:[ |
4452 |
"a valid history line" |
|
1362 | 4453 |
recordType := words at:1. |
4454 |
user := words at:5. |
|
4455 |
||
3928 | 4456 |
recordType = 'T' ifTrue:[ |
4457 |
rev := words at:7. "something like [expecco_2_8_0:HEAD]" |
|
4458 |
module := fileName := words at:6. |
|
4459 |
fileName := fileName copyAfterLast:$/. |
|
4460 |
] ifFalse:[ |
|
4461 |
rev := words at:6. |
|
4462 |
fileName := words at:7. |
|
4463 |
pkgDir := words at:8. |
|
4464 |
module := pkgDir. |
|
4465 |
]. |
|
2099
edfeaba9c51e
timeGoal can be a timestamp in reportHistory...
Claus Gittinger <cg@exept.de>
parents:
2098
diff
changeset
|
4466 |
(filterSTSourcesBool not or:[fileName endsWith:'.st']) ifTrue:[ |
edfeaba9c51e
timeGoal can be a timestamp in reportHistory...
Claus Gittinger <cg@exept.de>
parents:
2098
diff
changeset
|
4467 |
(userFilter isNil or:[userFilter includes:user]) ifTrue:[ |
1362 | 4468 |
date := words at:2. |
4469 |
time := words at:3. |
|
3928 | 4470 |
|
1362 | 4471 |
(module startsWith:'./') ifTrue:[ |
4472 |
module := module copyFrom:3. |
|
4473 |
]. |
|
4474 |
idx := module indexOf:$/. |
|
4475 |
idx ~~ 0 ifTrue:[ |
|
1481 | 4476 |
module := module copyTo:idx-1. |
1362 | 4477 |
]. |
4478 |
||
4479 |
(filterModules isNil |
|
1481 | 4480 |
or:[filterModules includes:module]) ifTrue:[ |
1362 | 4481 |
recordType = 'M' ifTrue:[ |
4482 |
recordType := ' ' |
|
4483 |
] ifFalse:[ |
|
4484 |
recordType = 'A' ifTrue:[ |
|
4485 |
recordType := '+' |
|
4486 |
] ifFalse:[ |
|
1481 | 4487 |
recordType = 'R' ifTrue:[ |
1362 | 4488 |
recordType := '-' |
4489 |
] |
|
4490 |
] |
|
4491 |
]. |
|
4492 |
||
4493 |
info := Dictionary new. |
|
4494 |
info at:#cvsRecordType put:recordType. |
|
4495 |
info at:#date put:date. |
|
4496 |
info at:#time put:time. |
|
4497 |
info at:#user put:user. |
|
4498 |
info at:#fileName put:fileName. |
|
4499 |
info at:#revision put:rev. |
|
4500 |
info at:#directory put:pkgDir. |
|
4501 |
info at:#className put:(Smalltalk classNameForFile:fileName). |
|
1481 | 4502 |
info at:#cvsRoot put:eachCvsRoot. |
4503 |
||
1362 | 4504 |
"/ |
4505 |
"/ for your convenience: |
|
4506 |
"/ check what the actual version is in the image |
|
4507 |
"/ |
|
4508 |
clsName := Smalltalk classNameForFile:fileName. |
|
4509 |
clsName notNil ifTrue:[ |
|
4510 |
cls := Smalltalk classNamed:clsName. |
|
4511 |
(cls notNil and:[(clsRev := cls revision) notNil]) ifTrue:[ |
|
4512 |
info at:#classesRevision put:clsRev. |
|
4513 |
]. |
|
4514 |
]. |
|
4515 |
aBlock value:info |
|
4516 |
] |
|
4517 |
] |
|
4518 |
] |
|
4519 |
] |
|
4520 |
] |
|
4521 |
]. |
|
4522 |
]. |
|
4523 |
inStream close. |
|
4524 |
] |
|
4525 |
]. |
|
4526 |
||
4527 |
tempDir recursiveRemove. |
|
4528 |
||
1778
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
4529 |
"Created: / 17-01-2001 / 13:11:20 / cg" |
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
4530 |
"Modified: / 29-08-2006 / 13:17:50 / cg" |
1362 | 4531 |
! |
4532 |
||
4533 |
reportHistoryLogSince:timeGoal filterSTSources:filter filterUser:userFilter filterRepository:filterRep inTo:aBlock |
|
4534 |
"process a full historyLog, evaluate aBlock for each entry, passing |
|
4535 |
the logs info in a dictionary. |
|
4536 |
This walks over all possible repositories. |
|
4537 |
filterRep may be a collection of repository names |
|
4538 |
(i.e. 'stc', 'exept', 'phx' etc.) to only report changes made to one |
|
4539 |
of those repositories. |
|
4540 |
filterUser, if non-nil, will filter only changes made by that user." |
|
4541 |
||
4542 |
^self |
|
4543 |
reportHistoryLogSince:timeGoal |
|
4544 |
filterSTSources:filter |
|
4545 |
filterUser:userFilter |
|
4546 |
filterRepository:filterRep |
|
4547 |
filterModules:nil |
|
4548 |
inTo:aBlock |
|
4549 |
||
4550 |
"Modified: / 17.1.2001 / 13:12:15 / cg" |
|
4551 |
! |
|
4552 |
||
4553 |
revisionInfoFromString:aString |
|
4554 |
"{ Pragma: +optSpace }" |
|
4555 |
||
4556 |
"return a dictionary filled with revision info. |
|
4557 |
This extracts the relevant info from aString." |
|
4558 |
||
2398
a6671fa24ee5
added: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2363
diff
changeset
|
4559 |
^ self revisionInfoFromString:aString inClass:nil |
1362 | 4560 |
|
4561 |
" |
|
2203
5e9d516ef6d8
comment/format in: #revisionInfoFromString:
Claus Gittinger <cg@exept.de>
parents:
2196
diff
changeset
|
4562 |
self revisionInfoFromString:(Array version_CVS) |
5e9d516ef6d8
comment/format in: #revisionInfoFromString:
Claus Gittinger <cg@exept.de>
parents:
2196
diff
changeset
|
4563 |
self revisionInfoFromString:(stx_libbasic2 extensionsVersion_CVS) |
1362 | 4564 |
" |
4565 |
||
2398
a6671fa24ee5
added: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2363
diff
changeset
|
4566 |
"Modified: / 01-07-2011 / 13:54:02 / cg" |
a6671fa24ee5
added: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2363
diff
changeset
|
4567 |
! |
a6671fa24ee5
added: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2363
diff
changeset
|
4568 |
|
a6671fa24ee5
added: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2363
diff
changeset
|
4569 |
revisionInfoFromString:aString inClass:aClass |
a6671fa24ee5
added: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2363
diff
changeset
|
4570 |
"{ Pragma: +optSpace }" |
a6671fa24ee5
added: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2363
diff
changeset
|
4571 |
|
a6671fa24ee5
added: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2363
diff
changeset
|
4572 |
"return a dictionary filled with revision info. |
a6671fa24ee5
added: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2363
diff
changeset
|
4573 |
This extracts the relevant info from aString." |
a6671fa24ee5
added: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2363
diff
changeset
|
4574 |
|
2482 | 4575 |
|fixedString autoFixHolder| |
4576 |
||
4577 |
autoFixHolder := UserPreferences current showBadRevisionStringDialogs not asValue. |
|
2481
c0fa5e3e5b92
changed: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
4578 |
|
3811 | 4579 |
Dialog |
4580 |
modifyingBoxWith:[:box | |
|
4581 |
box addCheckBoxAtBottom:'Do not show this dialog again (always fix & proceed)' on:autoFixHolder. |
|
4582 |
] do:[ |
|
4583 |
"/ info: in some older ST/X releases, there have been bugs in the header string rewriting code, |
|
4584 |
"/ which lead to invalid CVS strings being checked into our repository. |
|
4585 |
"/ The following repairs such corrupted revision strings 'on the fly'. |
|
4586 |
"/ The repair code will be removed at some time in the future... |
|
4587 |
||
4588 |
"/ temporary fix Felix' bad string translation: |
|
4239 | 4589 |
(aString startsWith:'§Header:') ifTrue:[ |
4590 |
(aString endsWith:'Exp §') ifTrue:[ |
|
3811 | 4591 |
fixedString := '$' , (aString copyFrom:3 to:(aString size - 2)) , '$'. |
4592 |
||
4593 |
aClass isNil ifTrue:[ |
|
4594 |
autoFixHolder value ifFalse:[ |
|
4239 | 4595 |
Dialog information:'Attention: the CVS version string is corrupted (§-bug). Please fix it manually'. |
3811 | 4596 |
] |
4597 |
] ifFalse:[ |
|
4598 |
(autoFixHolder value |
|
4239 | 4599 |
or:[ Dialog confirm:('Attention: the CVS version string is corrupted in "%1" (§-bug). Fix it?' withCRs bindWith:aClass name) ] |
3811 | 4600 |
) ifTrue:[ |
4601 |
self updateVersionMethodOf:aClass for:fixedString. |
|
4602 |
]. |
|
2481
c0fa5e3e5b92
changed: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
4603 |
]. |
2398
a6671fa24ee5
added: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2363
diff
changeset
|
4604 |
]. |
a6671fa24ee5
added: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2363
diff
changeset
|
4605 |
]. |
3811 | 4606 |
|
4239 | 4607 |
"/ temporary fix Jan's bad Umlaut-removal (which results in Felix's bad § being removed): |
3811 | 4608 |
(aString startsWith:'Header: ') ifTrue:[ |
4609 |
(aString endsWith:'Exp ') ifTrue:[ |
|
4610 |
fixedString := '$' , aString , '$'. |
|
4611 |
||
4612 |
aClass isNil ifTrue:[ |
|
4613 |
autoFixHolder value ifFalse:[ |
|
4614 |
Dialog information:'Attention: the CVS version string is corrupted (Umlaut remover-bug). Please fix it manually'. |
|
4615 |
] |
|
4616 |
] ifFalse:[ |
|
4617 |
(autoFixHolder value |
|
4618 |
or:[ Dialog confirm:('Attention: the CVS version string is corrupted in "%1" (Umlaut remover-bug). Fix it?' withCRs bindWith:aClass name) ] |
|
4619 |
) ifTrue:[ |
|
4620 |
self updateVersionMethodOf:aClass for:fixedString. |
|
4621 |
]. |
|
2481
c0fa5e3e5b92
changed: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
4622 |
]. |
2398
a6671fa24ee5
added: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2363
diff
changeset
|
4623 |
]. |
a6671fa24ee5
added: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2363
diff
changeset
|
4624 |
]. |
3811 | 4625 |
|
4626 |
"/ temporary fix translated (-sign) and not restored strings: |
|
4627 |
(aString startsWith:'Header: ') ifTrue:[ |
|
4628 |
(aString endsWith:'Exp ') ifTrue:[ |
|
4629 |
fixedString := '$' , (aString copyFrom:2 to:(aString size - 1)) , '$'. |
|
4630 |
||
4631 |
aClass isNil ifTrue:[ |
|
4632 |
autoFixHolder value ifFalse:[ |
|
4633 |
Dialog information:'Attention: the CVS version string is corrupted (Escaper-bug). Please fix it manually'. |
|
4634 |
] |
|
4635 |
] ifFalse:[ |
|
4636 |
(autoFixHolder value |
|
4637 |
or:[ Dialog confirm:('Attention: the CVS version string is corrupted in "%1" (Escaper-bug).\\Fix it?' withCRs bindWith:aClass name) ] |
|
4638 |
) ifTrue:[ |
|
4639 |
self updateVersionMethodOf:aClass for:fixedString. |
|
4640 |
]. |
|
2481
c0fa5e3e5b92
changed: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
4641 |
]. |
2401
4c632b026c89
changed: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2398
diff
changeset
|
4642 |
]. |
4c632b026c89
changed: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2398
diff
changeset
|
4643 |
]. |
3811 | 4644 |
UserPreferences current showBadRevisionStringDialogs:autoFixHolder value not. |
2401
4c632b026c89
changed: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2398
diff
changeset
|
4645 |
]. |
4c632b026c89
changed: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2398
diff
changeset
|
4646 |
|
2545
c98f48b1f15c
changed: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
4647 |
^ CVSVersionInfo fromRCSString:(fixedString ? aString) |
2398
a6671fa24ee5
added: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2363
diff
changeset
|
4648 |
|
a6671fa24ee5
added: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2363
diff
changeset
|
4649 |
" |
a6671fa24ee5
added: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2363
diff
changeset
|
4650 |
self revisionInfoFromString:(Array version_CVS) |
a6671fa24ee5
added: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2363
diff
changeset
|
4651 |
self revisionInfoFromString:(stx_libbasic2 extensionsVersion_CVS) |
a6671fa24ee5
added: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2363
diff
changeset
|
4652 |
" |
a6671fa24ee5
added: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2363
diff
changeset
|
4653 |
|
a6671fa24ee5
added: #revisionInfoFromString:inClass:
Claus Gittinger <cg@exept.de>
parents:
2363
diff
changeset
|
4654 |
"Created: / 01-07-2011 / 13:51:41 / cg" |
2776
34e2fea3d517
duplicate code (ouch) refactored
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4655 |
"Modified: / 28-02-2012 / 10:40:48 / cg" |
1362 | 4656 |
! |
4657 |
||
4227 | 4658 |
revisionLogOf:clsOrNil |
4659 |
fromRevision:firstRevOrNil toRevision:lastRevOrNil numberOfRevisions:numRevisionsOrNil |
|
3605 | 4660 |
fileName:classFileName directory:packageDir module:moduleDir |
4661 |
||
1362 | 4662 |
"return info about the repository container and |
4663 |
(part of) the revisionlog as a collection of revision entries. |
|
4664 |
Return nil on failure. |
|
4665 |
||
2211
3d6f4b6bc4ee
comment/format in: #revisionLogOf:fromRevision:toRevision:numberOfRevisions:fileName:directory:module:
Claus Gittinger <cg@exept.de>
parents:
2206
diff
changeset
|
4666 |
If numRevisionsOrNil is notNil, it limits the number of revision records returned - |
1451 | 4667 |
only numRevions of the newest revision infos will be collected. |
4668 |
||
1362 | 4669 |
The returned information is a structure (IdentityDictionary) |
4670 |
filled with: |
|
4227 | 4671 |
#container -> the CVS container file name |
4672 |
#cvsRoot -> the CVS root (repository) |
|
1362 | 4673 |
#filename -> the actual source file name |
4674 |
#newestRevision -> the revisionString of the newest revision |
|
4675 |
#numberOfRevisions -> the number of revisions in the container (nil for all) |
|
4676 |
#revisions -> collection of per-revision info (see below) |
|
4677 |
||
2211
3d6f4b6bc4ee
comment/format in: #revisionLogOf:fromRevision:toRevision:numberOfRevisions:fileName:directory:module:
Claus Gittinger <cg@exept.de>
parents:
2206
diff
changeset
|
4678 |
firstRevOrNil / lastRevOrNil specify from which revisions a logEntry is wanted: |
3d6f4b6bc4ee
comment/format in: #revisionLogOf:fromRevision:toRevision:numberOfRevisions:fileName:directory:module:
Claus Gittinger <cg@exept.de>
parents:
2206
diff
changeset
|
4679 |
-If firstRevOrNil is nil, the first revision is the initial revision |
1362 | 4680 |
otherwise, the log starts with that revision. |
2211
3d6f4b6bc4ee
comment/format in: #revisionLogOf:fromRevision:toRevision:numberOfRevisions:fileName:directory:module:
Claus Gittinger <cg@exept.de>
parents:
2206
diff
changeset
|
4681 |
-If lastRevOrNil is nil, the last revision is the newest revision |
1362 | 4682 |
otherwise, the log ends with that revision. |
4683 |
||
4684 |
-If both are nil, all logEntries are extracted. |
|
4685 |
-If both are 0 (not nil), no logEntries are extracted (i.e. only the header). |
|
4686 |
||
4687 |
per revision info consists of one record per revision: |
|
4688 |
||
4689 |
#revision -> the revision string |
|
4690 |
#author -> who checked that revision into the repository |
|
4691 |
#date -> when was it checked in |
|
4692 |
#state -> the RCS state |
|
4157 | 4693 |
#numberOfChangedLines -> the number of changed lines w.r.t the previous (as string with +n -n) |
1451 | 4694 |
#logMessage -> the checkIn log message |
1362 | 4695 |
|
4227 | 4696 |
revisions are ordered newest first |
1362 | 4697 |
(i.e. the last entry is for the initial revision; the first for the most recent one) |
1989 | 4698 |
Attention: if state = 'dead' that revision is no longer valid. |
1362 | 4699 |
" |
4700 |
||
1464
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4701 |
|tempDir fullName modulePath inStream inHeaderInfo atEnd line idx |
2822 | 4702 |
info record revisionRecords s headerOnly msg selectedRevisions| |
1362 | 4703 |
|
1464
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4704 |
self use_rlog ifFalse:[ |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4705 |
tempDir := self createTempDirectory:nil forModule:nil. |
2127 | 4706 |
tempDir isNil ifTrue:[ |
4707 |
('CVSSourceCodeManager [error]: no tempDir - cannot extract log') errorPrintCR. |
|
4708 |
^ nil. |
|
4709 |
]. |
|
1464
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4710 |
]. |
1362 | 4711 |
|
4712 |
[ |
|
1464
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4713 |
|cmd revArg| |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4714 |
|
4055 | 4715 |
packageDir isEmptyOrNil ifTrue:[ |
4227 | 4716 |
modulePath := moduleDir |
4055 | 4717 |
] ifFalse:[ |
4227 | 4718 |
modulePath := moduleDir , '/' , packageDir. |
4055 | 4719 |
]. |
4289 | 4720 |
classFileName isNil ifTrue:[ |
4721 |
fullName := modulePath , '/' , (clsOrNil classFilename). |
|
4722 |
] ifFalse:[ |
|
4723 |
fullName := modulePath , '/' , classFileName. |
|
4724 |
]. |
|
4725 |
||
1464
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4726 |
self use_rlog ifFalse:[ |
4227 | 4727 |
self createEntryFor:fullName |
1464
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4728 |
module:moduleDir |
4227 | 4729 |
in:(tempDir construct:modulePath) |
4730 |
revision:'1.1' |
|
4731 |
date:'dummy' |
|
1464
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4732 |
special:'' |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4733 |
overwrite:false. |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4734 |
]. |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4735 |
|
1362 | 4736 |
revArg := ''. |
4737 |
headerOnly := false. |
|
2211
3d6f4b6bc4ee
comment/format in: #revisionLogOf:fromRevision:toRevision:numberOfRevisions:fileName:directory:module:
Claus Gittinger <cg@exept.de>
parents:
2206
diff
changeset
|
4738 |
(firstRevOrNil notNil or:[lastRevOrNil notNil]) ifTrue:[ |
3d6f4b6bc4ee
comment/format in: #revisionLogOf:fromRevision:toRevision:numberOfRevisions:fileName:directory:module:
Claus Gittinger <cg@exept.de>
parents:
2206
diff
changeset
|
4739 |
(firstRevOrNil == 0 and:[lastRevOrNil == 0]) ifTrue:[ |
1362 | 4740 |
revArg := '-h'. |
4741 |
headerOnly := true. |
|
4742 |
] ifFalse:[ |
|
4743 |
revArg := '-r'. |
|
2211
3d6f4b6bc4ee
comment/format in: #revisionLogOf:fromRevision:toRevision:numberOfRevisions:fileName:directory:module:
Claus Gittinger <cg@exept.de>
parents:
2206
diff
changeset
|
4744 |
firstRevOrNil notNil ifTrue:[ |
3d6f4b6bc4ee
comment/format in: #revisionLogOf:fromRevision:toRevision:numberOfRevisions:fileName:directory:module:
Claus Gittinger <cg@exept.de>
parents:
2206
diff
changeset
|
4745 |
revArg := revArg , firstRevOrNil |
1362 | 4746 |
]. |
4747 |
revArg := revArg , ':'. |
|
2211
3d6f4b6bc4ee
comment/format in: #revisionLogOf:fromRevision:toRevision:numberOfRevisions:fileName:directory:module:
Claus Gittinger <cg@exept.de>
parents:
2206
diff
changeset
|
4748 |
lastRevOrNil notNil ifTrue:[ |
3d6f4b6bc4ee
comment/format in: #revisionLogOf:fromRevision:toRevision:numberOfRevisions:fileName:directory:module:
Claus Gittinger <cg@exept.de>
parents:
2206
diff
changeset
|
4749 |
revArg := revArg , lastRevOrNil |
1362 | 4750 |
]. |
4751 |
] |
|
4752 |
]. |
|
4753 |
||
4754 |
headerOnly ifTrue:[ |
|
3870 | 4755 |
msg := 'CVS: Fetching revision info ' |
1362 | 4756 |
] ifFalse:[ |
3870 | 4757 |
msg := 'CVS: Reading revision log ' |
1362 | 4758 |
]. |
4759 |
clsOrNil isNil ifTrue:[ |
|
4760 |
msg := msg , 'in ' , fullName. |
|
4761 |
] ifFalse:[ |
|
4762 |
msg := msg , 'of ', clsOrNil name. |
|
4763 |
]. |
|
1779 | 4764 |
self activityNotification:msg,'...'. |
1362 | 4765 |
|
1464
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4766 |
self use_rlog ifTrue:[ |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4767 |
cmd := ('rlog ' , revArg , ' ' , fullName). |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4768 |
] ifFalse:[ |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4769 |
cmd := ('log ' , revArg , ' ' , fullName). |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4770 |
]. |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4771 |
|
4227 | 4772 |
inStream := self |
4773 |
executeCVSCommand:('rlog ' , revArg , ' ' , fullName) |
|
4774 |
module:moduleDir |
|
4775 |
inDirectory:tempDir |
|
4776 |
log:true |
|
1362 | 4777 |
pipe:true. |
4778 |
||
3677 | 4779 |
(inStream isNil or:[inStream atEnd]) ifTrue:[ |
4780 |
('CVSSourceCodeManager [error]: cannot open pipe to "cvs log" ', fullName) errorPrintCR. |
|
4781 |
SourceCodeManagerError raiseRequestWith:'failed to open pipe to "cvs log"'. |
|
1362 | 4782 |
^ nil |
4783 |
]. |
|
4784 |
||
4785 |
"/ |
|
4786 |
"/ read the commands pipe output and extract the container info |
|
4787 |
"/ |
|
4788 |
info := IdentityDictionary new. |
|
4789 |
inHeaderInfo := true. |
|
4790 |
[inHeaderInfo and:[inStream atEnd not]] whileTrue:[ |
|
4791 |
line:= inStream nextLine. |
|
4792 |
line notNil ifTrue:[ |
|
4793 |
|gotIt| |
|
4794 |
||
4795 |
gotIt := false. |
|
4796 |
#('RCS file:' #container |
|
4797 |
'Working file:' #filename |
|
4798 |
'head:' #newestRevision |
|
4799 |
'total revisions:' #numberOfRevisions |
|
4800 |
) pairWiseDo:[:word :key | |
|
4801 |
gotIt ifFalse:[ |
|
4802 |
s := line restAfter:word withoutSeparators:true. |
|
4227 | 4803 |
s notNil ifTrue:[info at:key put:s. gotIt := true]. |
1362 | 4804 |
] |
4805 |
]. |
|
4806 |
gotIt ifFalse:[ |
|
1451 | 4807 |
(line startsWith:'symbolic names:') ifTrue:[ |
4808 |
|tags tokens| |
|
4809 |
||
4810 |
tags := Dictionary new. |
|
4811 |
line:= inStream nextLine. |
|
4227 | 4812 |
[line notNil |
1451 | 4813 |
and:[(line startsWith:Character space) or:[line startsWith:Character tab]]] whileTrue:[ |
4814 |
tokens := line asCollectionOfSubstringsSeparatedBy:$:. |
|
4815 |
tags at:(tokens first withoutSeparators) put:(tokens second withoutSeparators). |
|
4816 |
line:= inStream nextLine. |
|
4817 |
]. |
|
4818 |
info at:#symbolicNames put:tags. |
|
4819 |
]. |
|
2773
2e1a3c72e4f1
changed: #revisionLogOf:fromRevision:toRevision:numberOfRevisions:fileName:directory:module:
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
4820 |
(line notNil and:[line startsWith:'description:']) ifTrue:[inHeaderInfo := false]. |
1362 | 4821 |
] |
4822 |
] |
|
4823 |
]. |
|
4824 |
inStream nextLine. "/ skip separating line after description. |
|
4825 |
||
4826 |
info isEmpty ifTrue:[ |
|
4827 |
('CVSSourceCodeManager [warning]: no log for ', fullName) errorPrintCR. |
|
4828 |
^ nil |
|
4829 |
]. |
|
4830 |
||
4831 |
"/ strip selected revisions from the total-revisions entry |
|
4832 |
s := info at:#numberOfRevisions. |
|
4833 |
(idx := s indexOf:$;) ~~ 0 ifTrue:[ |
|
2822 | 4834 |
info at:#numberOfRevisions put:(Integer readFrom:(s copyTo:idx - 1)). |
4835 |
idx := s indexOf:$: startingAt:idx. |
|
4836 |
selectedRevisions := Integer readFrom:(s copyFrom:idx+1) onError:0. |
|
1362 | 4837 |
] ifFalse:[ |
2822 | 4838 |
info at:#numberOfRevisions put:(Integer readFrom:s onError:[1]). |
4839 |
selectedRevisions := 0. |
|
1362 | 4840 |
]. |
2822 | 4841 |
info at:#numberOfSelectedRevisions put:selectedRevisions. |
1362 | 4842 |
headerOnly ifFalse:[ |
4843 |
"/ |
|
4227 | 4844 |
"/ continue to read the commands pipe output |
1362 | 4845 |
"/ and extract revision info records |
4846 |
"/ |
|
2820
d6e9f3f4621c
changed: #revisionLogOf:fromRevision:toRevision:numberOfRevisions:fileName:directory:module:
Stefan Vogel <sv@exept.de>
parents:
2814
diff
changeset
|
4847 |
inStream atEnd ifTrue:[ |
2822 | 4848 |
selectedRevisions > 0 ifTrue:[ |
4849 |
"/ suppress warning. if we try to get the info of a non-existing revision" |
|
4850 |
('CVSSourceCodeManager [warning]: empty log for ', fullName) errorPrintCR. |
|
4851 |
]. |
|
4852 |
^ info |
|
2820
d6e9f3f4621c
changed: #revisionLogOf:fromRevision:toRevision:numberOfRevisions:fileName:directory:module:
Stefan Vogel <sv@exept.de>
parents:
2814
diff
changeset
|
4853 |
]. |
d6e9f3f4621c
changed: #revisionLogOf:fromRevision:toRevision:numberOfRevisions:fileName:directory:module:
Stefan Vogel <sv@exept.de>
parents:
2814
diff
changeset
|
4854 |
|
2822 | 4855 |
revisionRecords := OrderedCollection new:selectedRevisions. |
1362 | 4856 |
info at:#revisions put:revisionRecords. |
4857 |
||
4858 |
atEnd := false. |
|
4859 |
[atEnd or:[inStream atEnd]] whileFalse:[ |
|
4860 |
record := self readRevisionLogEntryFromStream:inStream. |
|
4861 |
record isNil ifTrue:[ |
|
4862 |
atEnd := true. |
|
4863 |
] ifFalse:[ |
|
4864 |
revisionRecords add:record. |
|
1451 | 4865 |
]. |
2211
3d6f4b6bc4ee
comment/format in: #revisionLogOf:fromRevision:toRevision:numberOfRevisions:fileName:directory:module:
Claus Gittinger <cg@exept.de>
parents:
2206
diff
changeset
|
4866 |
(numRevisionsOrNil notNil and:[revisionRecords size >= numRevisionsOrNil]) ifTrue:[ |
1451 | 4867 |
atEnd := true |
1362 | 4868 |
] |
4869 |
]. |
|
4870 |
]. |
|
4871 |
] ensure:[ |
|
4872 |
inStream notNil ifTrue:[inStream close]. |
|
1464
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4873 |
|
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4874 |
tempDir notNil ifTrue:[ |
4164 | 4875 |
OsError handle:[:ex | |
1464
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4876 |
('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
|
4877 |
] do:[ |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4878 |
tempDir recursiveRemove |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4879 |
]. |
edce7759095b
STEFAN: rlog does not work under WINDOWS !!!
Claus Gittinger <cg@exept.de>
parents:
1459
diff
changeset
|
4880 |
]. |
1779 | 4881 |
self activityNotification:nil. |
1362 | 4882 |
]. |
4883 |
^ info |
|
4884 |
||
4885 |
" |
|
4227 | 4886 |
SourceCodeManager revisionLogOf:Array |
4887 |
SourceCodeManager revisionLogOf:Array fromRevision:'1.40' toRevision:'1.43' |
|
4888 |
SourceCodeManager revisionLogOf:Array fromRevision:'1.40' toRevision:nil |
|
4889 |
SourceCodeManager revisionLogOf:Array fromRevision:nil toRevision:'1.3' |
|
4890 |
SourceCodeManager revisionLogOf:Array fromRevision:nil toRevision:nil |
|
4891 |
SourceCodeManager revisionLogOf:Array fromRevision:0 toRevision:0 |
|
1362 | 4892 |
" |
4893 |
||
1778
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
4894 |
"Created: / 16-11-1995 / 13:25:30 / cg" |
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
4895 |
"Modified: / 29-01-1997 / 16:51:30 / stefan" |
4289 | 4896 |
"Modified: / 06-12-2017 / 11:46:41 / cg" |
1362 | 4897 |
! |
4898 |
||
1989 | 4899 |
revisionLogOfPackageInDirectory:packageDir module:moduleDir |
4900 |
" |
|
4901 |
The returned information is a list of structures (IdentityDictionary) |
|
4902 |
each filled with: |
|
4157 | 4903 |
#container -> the CVS container file name |
1989 | 4904 |
#cvsRoot -> the CVS root (repository) |
4905 |
#filename -> the actual source file name |
|
4906 |
#newestRevision -> the revisionString of the newest revision |
|
4907 |
#numberOfRevisions -> the number of revisions in the container (nil for all) |
|
4908 |
#revisions -> collection of per-revision info (see below) |
|
4909 |
||
4910 |
firstRev / lastRef specify from which revisions a logEntry is wanted: |
|
4911 |
-If firstRev is nil, the first revision is the initial revision |
|
4912 |
otherwise, the log starts with that revision. |
|
4913 |
-If lastRef is nil, the last revision is the newest revision |
|
4914 |
otherwise, the log ends with that revision. |
|
4915 |
||
4916 |
-If both are nil, all logEntries are extracted. |
|
4917 |
-If both are 0 (not nil), no logEntries are extracted (i.e. only the header). |
|
4918 |
||
4919 |
per revision info consists of one record per revision: |
|
4920 |
||
4921 |
#revision -> the revision string |
|
4922 |
#author -> who checked that revision into the repository |
|
4923 |
#date -> when was it checked in |
|
4924 |
#state -> the RCS state |
|
4157 | 4925 |
#numberOfChangedLines -> the number of changed lines w.r.t the previous (as string with +n -n) |
1989 | 4926 |
#logMessage -> the checkIn log message |
4927 |
||
4928 |
revisions are ordered newest first |
|
4929 |
(i.e. the last entry is for the initial revision; the first for the most recent one) |
|
4930 |
Attention: if state = 'dead' that revision is no longer valid. |
|
4931 |
" |
|
4932 |
||
4933 |
|tempDir modulePath inStream inHeaderInfo atEnd line idx |
|
4934 |
info record revisionRecords s headerOnly msg infoCollection |
|
4935 |
fn container| |
|
4936 |
||
4937 |
self use_rlog ifFalse:[ |
|
4938 |
tempDir := self createTempDirectory:nil forModule:nil. |
|
4939 |
]. |
|
4940 |
||
4941 |
[ |
|
4942 |
|cmd revArg| |
|
4943 |
||
4055 | 4944 |
packageDir isEmptyOrNil ifTrue:[ |
4945 |
modulePath := moduleDir |
|
4946 |
] ifFalse:[ |
|
4947 |
modulePath := moduleDir , '/' , packageDir. |
|
4948 |
]. |
|
1989 | 4949 |
self use_rlog ifFalse:[ |
2027 | 4950 |
self halt:'non-rlog no longer supported'. |
1989 | 4951 |
^ self. |
4952 |
"/ self createEntryFor:fullName |
|
4953 |
"/ module:moduleDir |
|
4954 |
"/ in:(tempDir construct:modulePath) |
|
4955 |
"/ revision:'1.1' |
|
4956 |
"/ date:'dummy' |
|
4957 |
"/ special:'' |
|
4958 |
"/ overwrite:false. |
|
4959 |
]. |
|
4960 |
||
4961 |
revArg := ''. |
|
4962 |
headerOnly := false. |
|
4963 |
||
4964 |
headerOnly ifTrue:[ |
|
3870 | 4965 |
msg := 'CVS: Fetching revision info ' |
1989 | 4966 |
] ifFalse:[ |
3870 | 4967 |
msg := 'CVS: Reading revision log ' |
1989 | 4968 |
]. |
4969 |
msg := msg , 'in package ' , modulePath. |
|
4970 |
self activityNotification:msg,'...'. |
|
4971 |
||
4972 |
self use_rlog ifTrue:[ |
|
4973 |
cmd := ('rlog ' , revArg , ' ' , modulePath). |
|
4974 |
] ifFalse:[ |
|
4975 |
cmd := ('log ' , revArg , ' ' , modulePath). |
|
4976 |
]. |
|
4977 |
||
4978 |
inStream := self |
|
4979 |
executeCVSCommand:cmd |
|
4980 |
module:moduleDir |
|
4981 |
inDirectory:tempDir |
|
4982 |
log:true |
|
4983 |
pipe:true. |
|
4984 |
||
4985 |
inStream isNil ifTrue:[ |
|
4986 |
('CVSSourceCodeManager [error]: cannot open pipe to cvs log ', modulePath) errorPrintCR. |
|
4987 |
^ nil |
|
4988 |
]. |
|
4989 |
||
4990 |
infoCollection := Dictionary new. |
|
2188
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
4991 |
[inStream atEnd] whileFalse:[ |
1989 | 4992 |
"/ |
4993 |
"/ read the commands pipe output and extract the container info |
|
4994 |
"/ |
|
4995 |
info := IdentityDictionary new. |
|
4996 |
inHeaderInfo := true. |
|
4997 |
[inHeaderInfo and:[inStream atEnd not]] whileTrue:[ |
|
4998 |
line:= inStream nextLine. |
|
4999 |
line notEmptyOrNil ifTrue:[ |
|
5000 |
|gotIt| |
|
5001 |
||
5002 |
gotIt := false. |
|
5003 |
#('RCS file:' #container |
|
5004 |
'Working file:' #filename |
|
5005 |
'head:' #newestRevision |
|
5006 |
'total revisions:' #numberOfRevisions |
|
5007 |
) pairWiseDo:[:word :key | |
|
5008 |
gotIt ifFalse:[ |
|
5009 |
s := line restAfter:word withoutSeparators:true. |
|
5010 |
s notNil ifTrue:[info at:key put:s. gotIt := true]. |
|
5011 |
] |
|
5012 |
]. |
|
5013 |
gotIt ifFalse:[ |
|
5014 |
(line startsWith:'symbolic names:') ifTrue:[ |
|
5015 |
|tags tokens| |
|
5016 |
||
5017 |
tags := Dictionary new. |
|
5018 |
line:= inStream nextLine. |
|
5019 |
[line notNil |
|
5020 |
and:[(line startsWith:Character space) or:[line startsWith:Character tab]]] whileTrue:[ |
|
5021 |
tokens := line asCollectionOfSubstringsSeparatedBy:$:. |
|
5022 |
tags at:(tokens first withoutSeparators) put:(tokens second withoutSeparators). |
|
5023 |
line:= inStream nextLine. |
|
5024 |
]. |
|
5025 |
info at:#symbolicNames put:tags. |
|
5026 |
]. |
|
5027 |
(line startsWith:'description:') ifTrue:[inHeaderInfo := false]. |
|
5028 |
] |
|
5029 |
] |
|
5030 |
]. |
|
5031 |
inStream nextLine. "/ skip separating line after description. |
|
5032 |
||
5033 |
info isEmpty ifTrue:[ |
|
5034 |
('CVSSourceCodeManager [warning]: no log for ', modulePath) errorPrintCR. |
|
5035 |
] ifFalse:[ |
|
5036 |
||
5037 |
"/ strip selected revisions from the total-revisions entry |
|
5038 |
s := info at:#numberOfRevisions. |
|
5039 |
(idx := s indexOf:$;) ~~ 0 ifTrue:[ |
|
5040 |
info at:#numberOfRevisions put:(Integer readFrom:(s copyTo:idx - 1)) |
|
5041 |
] ifFalse:[ |
|
5042 |
info at:#numberOfRevisions put:(Integer readFrom:s onError:[1]) |
|
5043 |
]. |
|
5044 |
headerOnly ifFalse:[ |
|
5045 |
|numRevisions| |
|
5046 |
||
5047 |
"/ |
|
5048 |
"/ continue to read the commands pipe output |
|
5049 |
"/ and extract revision info records |
|
5050 |
"/ |
|
5051 |
numRevisions := info at:#numberOfRevisions. |
|
5052 |
revisionRecords := OrderedCollection new:numRevisions. |
|
5053 |
info at:#revisions put:revisionRecords. |
|
5054 |
||
5055 |
atEnd := false. |
|
5056 |
[atEnd or:[inStream atEnd]] whileFalse:[ |
|
5057 |
record := self readRevisionLogEntryFromStream:inStream. |
|
5058 |
record isNil ifTrue:[ |
|
5059 |
atEnd := true. |
|
5060 |
] ifFalse:[ |
|
5061 |
revisionRecords add:record. |
|
5062 |
]. |
|
5063 |
(numRevisions notNil and:[revisionRecords size >= numRevisions]) ifTrue:[ |
|
5064 |
atEnd := true |
|
5065 |
] |
|
5066 |
]. |
|
5067 |
]. |
|
5068 |
]. |
|
5069 |
fn := info at:#filename ifAbsent:nil. |
|
5070 |
fn isNil ifTrue:[ |
|
5071 |
container := info at:#container ifAbsent:nil. |
|
3231
b3cce588c936
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
3112
diff
changeset
|
5072 |
fn := container asFilename baseName copyButLast:2. "/ remove ',v' suffix |
1989 | 5073 |
info at:#filename put:fn. |
5074 |
]. |
|
5075 |
infoCollection at:(info at:#filename) put:info. |
|
5076 |
]. |
|
5077 |
] ensure:[ |
|
5078 |
inStream notNil ifTrue:[inStream close]. |
|
5079 |
||
5080 |
tempDir notNil ifTrue:[ |
|
4164 | 5081 |
OsError handle:[:ex | |
1989 | 5082 |
('CVSSourceCodeManager [warning]: could not remove tempDir ', tempDir pathName) infoPrintCR. |
5083 |
] do:[ |
|
5084 |
tempDir recursiveRemove |
|
5085 |
]. |
|
5086 |
]. |
|
5087 |
self activityNotification:nil. |
|
5088 |
]. |
|
5089 |
^ infoCollection |
|
5090 |
||
5091 |
" |
|
5092 |
CVSSourceCodeManager revisionLogOfPackageInDirectory:'libbasic3' module:'stx' |
|
5093 |
" |
|
5094 |
! |
|
5095 |
||
2188
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5096 |
revisionsInModule:module directory:packageDir fromDate:aDateOrNilForNewest |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5097 |
"return a list of filename-module associations for the containers in |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5098 |
a package directory. Return nil on failure." |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5099 |
|
2938 | 5100 |
|tempDir modulePath inStream info| |
2188
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5101 |
|
3321 | 5102 |
tempDir := nil. "use the current directory" |
5103 |
||
2188
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5104 |
self use_rlog ifFalse:[ |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5105 |
"/ Uses 'cvs status' - rlog seems not to work |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5106 |
^ nil. |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5107 |
]. |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5108 |
|
4055 | 5109 |
packageDir isEmptyOrNil ifTrue:[ |
5110 |
modulePath := module |
|
5111 |
] ifFalse:[ |
|
5112 |
modulePath := module , '/' , packageDir. |
|
5113 |
]. |
|
2188
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5114 |
[ |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5115 |
|revisionUsed dateSelector searchFor| |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5116 |
|
3870 | 5117 |
self activityNotification:('CVS: Fetching revision infos for %1%2' |
2188
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5118 |
bindWith:modulePath |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5119 |
with:(aDateOrNilForNewest isNil |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5120 |
ifTrue:[ '' ] |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5121 |
ifFalse:[ ' of ',aDateOrNilForNewest printString])). |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5122 |
|
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5123 |
dateSelector := aDateOrNilForNewest isNil |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5124 |
ifTrue:[ '-h ' ] |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5125 |
ifFalse:[ '-S -d "%1"' bindWith:(aDateOrNilForNewest printStringFormat:'%y-%m-%d') ]. |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5126 |
inStream := self |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5127 |
executeCVSCommand:('rlog -N -l %1 %2' bindWith:dateSelector with:modulePath) |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5128 |
module:module |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5129 |
inDirectory:tempDir |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5130 |
log:true |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5131 |
pipe:true. |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5132 |
|
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5133 |
inStream isNil ifTrue:[ |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5134 |
('CVSSourceCodeManager [error]: cannot open pipe to cvs rlog ', modulePath) errorPrintCR. |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5135 |
^ nil |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5136 |
]. |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5137 |
|
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5138 |
"/ |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5139 |
"/ read the commands pipe output and extract the container infos |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5140 |
"/ |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5141 |
searchFor := aDateOrNilForNewest isNil |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5142 |
ifTrue:[ 'head:' ] |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5143 |
ifFalse:[ 'revision ' ]. |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5144 |
|
2938 | 5145 |
info := self fetchRevisionsFromRLogStream:inStream searchForKeyword:searchFor. |
2188
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5146 |
] ensure:[ |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5147 |
inStream notNil ifTrue:[inStream close]. |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5148 |
]. |
2297
c52adb2af4df
changed: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2296
diff
changeset
|
5149 |
self breakPoint:#cg. |
2188
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5150 |
^ info |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5151 |
|
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5152 |
" |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5153 |
SourceCodeManager |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5154 |
revisionsInModule:'exept' directory:'osi/asn1' fromDate:(Date today subtractDays:7) |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5155 |
SourceCodeManager |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5156 |
revisionsInModule:'exept' directory:'osi/asn1' fromDate:nil |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5157 |
" |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5158 |
|
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5159 |
"Created: / 12-10-2006 / 10:12:59 / cg" |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5160 |
! |
04731db1087e
added: #revisionsInModule:directory:fromDate:
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
5161 |
|
2938 | 5162 |
revisionsInModule:module directory:packageDir taggedAs:symbolicName |
5163 |
"return a list of filename-module associations for the containers in |
|
5164 |
a package directory. Return nil on failure." |
|
5165 |
||
5166 |
|tempDir modulePath inStream info| |
|
5167 |
||
3321 | 5168 |
tempDir := nil. "use the current directory" |
2938 | 5169 |
self use_rlog ifFalse:[ |
5170 |
"/ Uses 'cvs status' - rlog seems not to work |
|
5171 |
^ nil. |
|
5172 |
]. |
|
5173 |
||
4055 | 5174 |
packageDir isEmptyOrNil ifTrue:[ |
5175 |
modulePath := module |
|
5176 |
] ifFalse:[ |
|
5177 |
modulePath := module , '/' , packageDir. |
|
5178 |
]. |
|
3870 | 5179 |
self activityNotification:('CVS: Fetching revision infos for %1%2' |
2947
f58effe8daf2
project diff fixed (care for version and loos methods)
Claus Gittinger <cg@exept.de>
parents:
2938
diff
changeset
|
5180 |
bindWith:modulePath |
f58effe8daf2
project diff fixed (care for version and loos methods)
Claus Gittinger <cg@exept.de>
parents:
2938
diff
changeset
|
5181 |
with:(' tagged as "',symbolicName,'"')). |
f58effe8daf2
project diff fixed (care for version and loos methods)
Claus Gittinger <cg@exept.de>
parents:
2938
diff
changeset
|
5182 |
|
2938 | 5183 |
[ |
5184 |
|revisionUsed tagSelector searchFor| |
|
5185 |
||
2947
f58effe8daf2
project diff fixed (care for version and loos methods)
Claus Gittinger <cg@exept.de>
parents:
2938
diff
changeset
|
5186 |
tagSelector := '-S -r"%1"' bindWith:symbolicName. |
2938 | 5187 |
inStream := self |
5188 |
executeCVSCommand:('rlog -N -l %1 %2' bindWith:tagSelector with:modulePath) |
|
5189 |
module:module |
|
5190 |
inDirectory:tempDir |
|
5191 |
log:true |
|
5192 |
pipe:true. |
|
5193 |
||
5194 |
inStream isNil ifTrue:[ |
|
5195 |
('CVSSourceCodeManager [error]: cannot open pipe to cvs rlog ', modulePath) errorPrintCR. |
|
5196 |
^ nil |
|
5197 |
]. |
|
5198 |
||
5199 |
"/ |
|
5200 |
"/ read the commands pipe output and extract the container infos |
|
5201 |
"/ |
|
5202 |
info := self fetchRevisionsFromRLogStream:inStream searchForKeyword:'revision '. |
|
5203 |
] ensure:[ |
|
5204 |
inStream notNil ifTrue:[inStream close]. |
|
5205 |
]. |
|
5206 |
self breakPoint:#cg. |
|
5207 |
^ info |
|
5208 |
||
5209 |
" |
|
5210 |
SourceCodeManager |
|
5211 |
revisionsInModule:'stx' directory:'libbasic2' taggedAs:'stable' |
|
5212 |
" |
|
5213 |
||
5214 |
"Created: / 12-10-2006 / 10:12:59 / cg" |
|
5215 |
! |
|
5216 |
||
4273 | 5217 |
setSymbolicName:symbolicName asBranch:asBranch revision:rev overWrite:overWriteBool classes:aCollectionOfClasses |
1783 | 5218 |
"set a symbolicName for revision rev. |
5219 |
If rev is nil, set it for the head (most recent) revision. |
|
5220 |
If rev is 0, delete the symbolic name. |
|
5221 |
If overWriteBool is true, the symbolicName will be changed, even if it has already been set. |
|
5222 |
If overWriteBool is false, an error will be raised if symbolicName has already been set. |
|
5223 |
||
5224 |
If filename is nil, the symbolicName for a whole package is set" |
|
5225 |
||
4273 | 5226 |
|pathes| |
5227 |
||
5228 |
pathes := self pathesForClasses:aCollectionOfClasses. |
|
5229 |
self setSymbolicName:symbolicName asBranch:asBranch revision:rev overWrite:overWriteBool pathes:pathes |
|
1783 | 5230 |
|
5231 |
" |
|
5232 |
self setSymbolicName:'foo' revision:nil overWrite:false classes:(Array with:True with:False) |
|
5233 |
self setSymbolicName:'foo' revision:nil overWrite:true classes:(Array with:True with:False) |
|
5234 |
self setSymbolicName:'foo' revision:nil overWrite:true classes:(Array with:True with:False) |
|
5235 |
self setSymbolicName:'foo' revision:'1.1' overWrite:true classes:(Array with:True with:False) |
|
5236 |
self setSymbolicName:'foo' revision:0 overWrite:true classes:(Array with:True with:False) |
|
5237 |
" |
|
5238 |
||
4273 | 5239 |
"Created: / 04-12-2017 / 18:53:08 / cg" |
1783 | 5240 |
! |
5241 |
||
4273 | 5242 |
setSymbolicName:symbolicNameArg asBranch:asBranch revision:rev overWrite:overWriteBool pathes:pathsInRepository |
1783 | 5243 |
"set a symbolicName for revision rev. |
5244 |
If rev is nil, set it for the head (most recent) revision. |
|
5245 |
If rev is 0, delete the symbolic name. |
|
5246 |
If overWriteBool is true, the symbolicName will be changed, even if it has already been set. |
|
5247 |
If overWriteBool is false, an error will be raised if symbolicName has already been set. |
|
5248 |
||
5249 |
If filename is nil, the symbolicName for a whole package is set. |
|
4084 | 5250 |
If multiple paths are given, the revision MUST be nil." |
1783 | 5251 |
|
4280 | 5252 |
|argumentString result errorStream outStream moduleDirs symbolicName cvsErrorOutput cvsOutput| |
1783 | 5253 |
|
4084 | 5254 |
symbolicName := (symbolicNameArg includes:Character space) |
1783 | 5255 |
ifTrue:[ '"',symbolicNameArg,'"' ] |
5256 |
ifFalse:[ symbolicNameArg ]. |
|
5257 |
||
4239 | 5258 |
pathsInRepository size > 1 ifTrue:[ |
4084 | 5259 |
self assert:(rev isNil or:[rev == 0]) "revision must be nil (for head) or 0 (for delete) with multiple paths" |
1783 | 5260 |
]. |
5261 |
||
4239 | 5262 |
moduleDirs := pathsInRepository |
1783 | 5263 |
collect:[:pathInRepository | |
5264 |
(pathInRepository asCollectionOfSubstringsSeparatedByAny:'/\') first. |
|
4280 | 5265 |
] as:Set. |
1783 | 5266 |
moduleDirs do:[:moduleDir | |
4084 | 5267 |
|pathsInModule pathsInModuleAsArgument| |
5268 |
||
4239 | 5269 |
pathsInModule := pathsInRepository |
1783 | 5270 |
select:[:pathInRepository | |
5271 |
|moduleOfThisPath| |
|
5272 |
||
5273 |
moduleOfThisPath := (pathInRepository asCollectionOfSubstringsSeparatedByAny:'/\') first. |
|
5274 |
moduleOfThisPath = moduleDir |
|
5275 |
]. |
|
5276 |
||
5277 |
rev = 0 ifTrue:[ |
|
5278 |
argumentString := ' -d '. |
|
5279 |
] ifFalse:[ |
|
5280 |
argumentString := ' -r ', (rev ? 'HEAD'). |
|
5281 |
overWriteBool ifTrue:[ |
|
5282 |
argumentString := argumentString, ' -F' |
|
5283 |
]. |
|
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
5284 |
]. |
4273 | 5285 |
asBranch ifTrue:[ |
5286 |
argumentString := '-b ',argumentString. |
|
5287 |
]. |
|
5288 |
||
4084 | 5289 |
pathsInModuleAsArgument := pathsInModule |
1783 | 5290 |
collect:[:eachPath | |
5291 |
(eachPath includes:Character space) ifTrue:[ |
|
5292 |
'"',eachPath,'"' |
|
5293 |
] ifFalse:[ |
|
5294 |
eachPath |
|
5295 |
]. |
|
5296 |
]. |
|
4084 | 5297 |
pathsInModuleAsArgument := pathsInModuleAsArgument asStringCollection asStringWith:Character space. |
5298 |
||
5299 |
self activityNotification:('CVS: Setting symbolic name "%1" for: %2' bindWith:symbolicName with:pathsInModuleAsArgument). |
|
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
5300 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
5301 |
errorStream := '' writeStream. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
5302 |
outStream := '' writeStream. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
5303 |
|
4084 | 5304 |
result := self |
5305 |
executeCVSCommand:('rtag ' , argumentString, ' ', symbolicName, ' ', pathsInModuleAsArgument) |
|
5306 |
module:moduleDir |
|
5307 |
inDirectory:nil |
|
1783 | 5308 |
log:true |
5309 |
outputTo:outStream |
|
5310 |
errorTo:errorStream. |
|
4280 | 5311 |
|
3294 | 5312 |
self activityNotification:nil. |
4280 | 5313 |
cvsErrorOutput := errorStream contents. |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
5314 |
(result not or:[errorStream size ~~ 0]) ifTrue:[ |
4280 | 5315 |
SourceCodeManagerError raiseRequestWith:cvsErrorOutput errorString:' cvs tag failed: ', pathsInModuleAsArgument. |
3279 | 5316 |
] ifFalse:[ |
4280 | 5317 |
cvsOutput := outStream contents. |
5318 |
(cvsOutput asStringCollection contains:[:someLine| someLine startsWithAnyOf:'WE']) ifTrue:[ |
|
5319 |
SourceCodeManagerError raiseRequestWith:cvsOutput errorString:' cvs tag could not be set: ', pathsInModuleAsArgument. |
|
3279 | 5320 |
]. |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
5321 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
5322 |
]. |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
5323 |
|
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
5324 |
" |
1783 | 5325 |
self setSymbolicName:'stable' revision:nil overWrite:false path:'stx/libbasic/Array.st' |
5326 |
self setSymbolicName:'stable' revision:nil overWrite:true path:'stx/libbasic/Array.st' |
|
5327 |
||
4084 | 5328 |
self |
5329 |
setSymbolicName:'test1' |
|
5330 |
revision:nil |
|
5331 |
overWrite:true |
|
1783 | 5332 |
path:'bosch/dapasx/datenbasis/DAPASX__HierarchicalList.st' |
5333 |
||
4084 | 5334 |
self |
5335 |
setSymbolicName:'test2' |
|
5336 |
revision:nil |
|
5337 |
overWrite:true |
|
5338 |
pathes:#( 'bosch/dapasx/datenbasis/DAPASX__HierarchicalList.st' |
|
1783 | 5339 |
'bosch/dapasx/datenbasis/DAPASX__ProjectSearch.st' ) |
5340 |
||
4084 | 5341 |
self |
5342 |
setSymbolicName:'test2' |
|
5343 |
revision:0 |
|
5344 |
overWrite:true |
|
5345 |
pathes:#( 'bosch/dapasx/datenbasis/DAPASX__HierarchicalList.st' |
|
1783 | 5346 |
'bosch/dapasx/datenbasis/DAPASX__ProjectSearch.st' ) |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
5347 |
" |
1783 | 5348 |
|
4273 | 5349 |
"Created: / 04-12-2017 / 18:52:14 / cg" |
4280 | 5350 |
"Modified (format): / 06-12-2017 / 03:23:45 / cg" |
4273 | 5351 |
! |
5352 |
||
5353 |
setSymbolicName:symbolicName revision:rev overWrite:overWriteBool class:aClass |
|
5354 |
"set a symbolicName for revision rev. |
|
5355 |
If rev is nil, set it for the head (most recent) revision. |
|
5356 |
If rev is 0, delete the symbolic name. |
|
5357 |
If overWriteBool is true, the symbolicName will be changed, even if it has already been set. |
|
5358 |
If overWriteBool is false, an error will be raised if symbolicName has already been set. |
|
5359 |
||
5360 |
If filename is nil, the symbolicName for a whole package is set" |
|
5361 |
||
5362 |
self |
|
5363 |
setSymbolicName:symbolicName |
|
5364 |
revision:rev |
|
5365 |
overWrite:overWriteBool |
|
5366 |
path:((self sourceInfoOfClass:aClass) at:#pathInRepository) |
|
5367 |
||
5368 |
" |
|
5369 |
self setSymbolicName:'foo' revision:nil overWrite:false class:Array |
|
5370 |
self setSymbolicName:'foo' revision:nil overWrite:true class:Array |
|
5371 |
self setSymbolicName:'foo' revision:nil overWrite:true class:Array |
|
5372 |
self setSymbolicName:'foo' revision:'1.1' overWrite:true class:Array |
|
5373 |
self setSymbolicName:'foo' revision:0 overWrite:true class:Array |
|
5374 |
" |
|
5375 |
||
5376 |
"Created: / 12-09-2006 / 12:56:52 / cg" |
|
5377 |
! |
|
5378 |
||
5379 |
setSymbolicName:symbolicName revision:rev overWrite:overWriteBool classes:aCollectionOfClasses |
|
5380 |
"set a symbolicName for revision rev. |
|
5381 |
If rev is nil, set it for the head (most recent) revision. |
|
5382 |
If rev is 0, delete the symbolic name. |
|
5383 |
If overWriteBool is true, the symbolicName will be changed, even if it has already been set. |
|
5384 |
If overWriteBool is false, an error will be raised if symbolicName has already been set. |
|
5385 |
||
5386 |
If filename is nil, the symbolicName for a whole package is set" |
|
5387 |
||
5388 |
self setSymbolicName:symbolicName asBranch:false revision:rev overWrite:overWriteBool classes:aCollectionOfClasses |
|
5389 |
||
5390 |
" |
|
5391 |
self setSymbolicName:'foo' revision:nil overWrite:false classes:(Array with:True with:False) |
|
5392 |
self setSymbolicName:'foo' revision:nil overWrite:true classes:(Array with:True with:False) |
|
5393 |
self setSymbolicName:'foo' revision:nil overWrite:true classes:(Array with:True with:False) |
|
5394 |
self setSymbolicName:'foo' revision:'1.1' overWrite:true classes:(Array with:True with:False) |
|
5395 |
self setSymbolicName:'foo' revision:0 overWrite:true classes:(Array with:True with:False) |
|
5396 |
" |
|
5397 |
||
5398 |
"Created: / 12-09-2006 / 12:58:23 / cg" |
|
5399 |
"Modified: / 04-12-2017 / 18:53:26 / cg" |
|
5400 |
! |
|
5401 |
||
5402 |
setSymbolicName:symbolicName revision:rev overWrite:overWriteBool path:pathInRepository |
|
5403 |
"set a symbolicName for revision rev. |
|
5404 |
If rev is nil, set it for the head (most recent) revision. |
|
5405 |
If rev is 0, delete the symbolic name. |
|
5406 |
If overWriteBool is true, the symbolicName will be changed, even if it has already been set. |
|
5407 |
If overWriteBool is false, an error will be raised if symbolicName has already been set. |
|
5408 |
||
5409 |
If filename is nil, the symbolicName for a whole package is set" |
|
5410 |
||
4280 | 5411 |
self setSymbolicName:symbolicName revision:rev overWrite:overWriteBool pathes:(Array with:pathInRepository) |
4273 | 5412 |
|
5413 |
" |
|
5414 |
self setSymbolicName:'stable' revision:nil overWrite:false path:'stx/libbasic/Array.st' |
|
5415 |
self setSymbolicName:'stable' revision:nil overWrite:true path:'stx/libbasic/Array.st' |
|
5416 |
self setSymbolicName:'stable' revision:nil overWrite:true path:'stx/libbasic/Array.st' |
|
5417 |
self setSymbolicName:'stable' revision:'1.1' overWrite:true path:'stx/libbasic/Array.st' |
|
5418 |
" |
|
5419 |
||
5420 |
"Modified: / 12-09-2006 / 12:37:20 / cg" |
|
4280 | 5421 |
"Modified (format): / 05-12-2017 / 22:56:04 / cg" |
4273 | 5422 |
! |
5423 |
||
5424 |
setSymbolicName:symbolicNameArg revision:rev overWrite:overWriteBool pathes:pathsInRepository |
|
5425 |
"set a symbolicName for revision rev. |
|
5426 |
If rev is nil, set it for the head (most recent) revision. |
|
5427 |
If rev is 0, delete the symbolic name. |
|
5428 |
If overWriteBool is true, the symbolicName will be changed, even if it has already been set. |
|
5429 |
If overWriteBool is false, an error will be raised if symbolicName has already been set. |
|
5430 |
||
5431 |
If filename is nil, the symbolicName for a whole package is set. |
|
5432 |
If multiple paths are given, the revision MUST be nil." |
|
5433 |
||
5434 |
self setSymbolicName:symbolicNameArg asBranch:false revision:rev overWrite:overWriteBool pathes:pathsInRepository |
|
5435 |
||
5436 |
" |
|
5437 |
self setSymbolicName:'stable' revision:nil overWrite:false path:'stx/libbasic/Array.st' |
|
5438 |
self setSymbolicName:'stable' revision:nil overWrite:true path:'stx/libbasic/Array.st' |
|
5439 |
||
5440 |
self |
|
5441 |
setSymbolicName:'test1' |
|
5442 |
revision:nil |
|
5443 |
overWrite:true |
|
5444 |
path:'bosch/dapasx/datenbasis/DAPASX__HierarchicalList.st' |
|
5445 |
||
5446 |
self |
|
5447 |
setSymbolicName:'test2' |
|
5448 |
revision:nil |
|
5449 |
overWrite:true |
|
5450 |
pathes:#( 'bosch/dapasx/datenbasis/DAPASX__HierarchicalList.st' |
|
5451 |
'bosch/dapasx/datenbasis/DAPASX__ProjectSearch.st' ) |
|
5452 |
||
5453 |
self |
|
5454 |
setSymbolicName:'test2' |
|
5455 |
revision:0 |
|
5456 |
overWrite:true |
|
5457 |
pathes:#( 'bosch/dapasx/datenbasis/DAPASX__HierarchicalList.st' |
|
5458 |
'bosch/dapasx/datenbasis/DAPASX__ProjectSearch.st' ) |
|
5459 |
" |
|
5460 |
||
1783 | 5461 |
"Created: / 12-09-2006 / 12:36:44 / cg" |
4273 | 5462 |
"Modified: / 04-12-2017 / 18:52:43 / cg" |
1457
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
5463 |
! |
8383e94050aa
Use cvs rlog and cvs rls to avoid temp directory creation
Stefan Vogel <sv@exept.de>
parents:
1451
diff
changeset
|
5464 |
|
3931 | 5465 |
standardRevisionStringFor:aClass inModule:moduleDir directory:packageDir container:fileName revision:revisionString |
5466 |
"utility function: return a string usable as initial revision string" |
|
5467 |
||
5468 |
^ 'Header: %1/%2/%3,v %4, %5 %6 %7 Exp' |
|
5469 |
bindWith:moduleDir |
|
5470 |
with:packageDir |
|
5471 |
with:fileName |
|
5472 |
with:revisionString |
|
5473 |
with:(Date today printStringFormat:'%y/%m/%d') |
|
5474 |
with:(Time now printStringFormat:'%h:%m:%s') |
|
5475 |
with:(OperatingSystem getLoginName) |
|
5476 |
||
5477 |
||
5478 |
" |
|
5479 |
self |
|
5480 |
revisionStringFor:Array |
|
5481 |
inModule:'stx' |
|
5482 |
directory:'libbasic' |
|
5483 |
container:'Array.st' |
|
5484 |
revision:'123' |
|
5485 |
" |
|
5486 |
||
5487 |
"Created: / 23-07-2012 / 18:46:29 / cg" |
|
5488 |
! |
|
5489 |
||
1362 | 5490 |
statusOf:clsOrNil fileName:classFileName directory:packageDir module:moduleDir |
3649 | 5491 |
"return info about the status of a repository container. |
1362 | 5492 |
Return nil on failure. |
5493 |
||
5494 |
The returned information is a structure (IdentityDictionary) |
|
5495 |
filled with: |
|
5496 |
#newestRevision -> the revisionString of the newest revision |
|
5497 |
||
5498 |
This is much faster than revisionLog info (especially, if there are many revisions), |
|
3649 | 5499 |
and all we need is a class's newest version number." |
1362 | 5500 |
|
5501 |
|tempDir fullName modulePath inStream line |
|
5502 |
info s msg| |
|
5503 |
||
4055 | 5504 |
packageDir isEmptyOrNil ifTrue:[ |
5505 |
modulePath := moduleDir. |
|
5506 |
] ifFalse:[ |
|
5507 |
modulePath := moduleDir , '/' , packageDir. |
|
5508 |
]. |
|
1362 | 5509 |
fullName := modulePath , '/' , classFileName. |
5510 |
tempDir := self createTempDirectory:nil forModule:nil. |
|
2127 | 5511 |
tempDir isNil ifTrue:[ |
3322 | 5512 |
('CVSSourceCodeManager [error]: no tempDir - cannot extract status') errorPrintCR. |
2127 | 5513 |
^ nil. |
5514 |
]. |
|
1362 | 5515 |
|
5516 |
[ |
|
5517 |
self createEntryFor:fullName |
|
5518 |
module:moduleDir |
|
5519 |
in:(tempDir construct:modulePath) |
|
5520 |
revision:'1.1' |
|
5521 |
date:'dummy' |
|
5522 |
special:'' |
|
5523 |
overwrite:false. |
|
5524 |
||
3870 | 5525 |
msg := 'CVS: fetching status info of '. |
1362 | 5526 |
clsOrNil isNil ifTrue:[ |
5527 |
msg := msg , fullName. |
|
5528 |
] ifFalse:[ |
|
5529 |
msg := msg , clsOrNil name. |
|
5530 |
]. |
|
5531 |
self activityNotification:msg. |
|
5532 |
||
5533 |
inStream := self |
|
5534 |
executeCVSCommand:('status ' , fullName) |
|
5535 |
module:moduleDir |
|
5536 |
inDirectory:tempDir |
|
5537 |
log:true |
|
5538 |
pipe:true. |
|
5539 |
||
3677 | 5540 |
(inStream isNil or:[inStream atEnd]) ifTrue:[ |
3322 | 5541 |
('CVSSourceCodeManager [error]: cannot open pipe to cvs status ', fullName) errorPrintCR. |
3870 | 5542 |
SourceCodeManagerError raiseRequestErrorString:'failed to open pipe to "cvs status"'. |
1362 | 5543 |
^ nil |
5544 |
]. |
|
5545 |
||
5546 |
"/ |
|
5547 |
"/ read the commands pipe output and extract the container info |
|
5548 |
"/ |
|
5549 |
info := IdentityDictionary new. |
|
5550 |
[inStream atEnd] whileFalse:[ |
|
5551 |
line:= inStream nextLine. |
|
5552 |
line notNil ifTrue:[ |
|
5553 |
line := line withoutSeparators. |
|
5554 |
]. |
|
5555 |
line size > 0 ifTrue:[ |
|
5556 |
|gotIt i| |
|
5557 |
||
3834 | 5558 |
((line includesString:'warning') |
5559 |
and:[ (line includesString:'is not') |
|
5560 |
and:[ (line includesString:'pertinent') ]]) ifTrue:[ |
|
5561 |
^ nil |
|
5562 |
]. |
|
5563 |
||
1362 | 5564 |
gotIt := false. |
5565 |
#( |
|
5566 |
'Repository revision:' #newestRevision |
|
1502 | 5567 |
'File:' #fileStatus |
1362 | 5568 |
) pairWiseDo:[:word :key | |
5569 |
gotIt ifFalse:[ |
|
5570 |
s := line restAfter:word withoutSeparators:true. |
|
5571 |
s notNil ifTrue:[ |
|
5572 |
i := s indexOfSeparator. |
|
5573 |
i ~~ 0 ifTrue:[ |
|
5574 |
s := s copyTo:i-1 |
|
5575 |
]. |
|
5576 |
info at:key put:s. |
|
5577 |
gotIt := true. |
|
5578 |
]. |
|
5579 |
] |
|
5580 |
]. |
|
5581 |
] |
|
5582 |
]. |
|
5583 |
info isEmpty ifTrue:[ |
|
3870 | 5584 |
('CVSSourceCodeManager [warning]: no status for "', fullName,'"') errorPrintCR. |
5585 |
SourceCodeManagerError raiseRequestErrorString:'no status for "', fullName,'"'. |
|
1362 | 5586 |
^ nil |
5587 |
]. |
|
5588 |
] ensure:[ |
|
5589 |
inStream notNil ifTrue:[inStream close]. |
|
5590 |
tempDir recursiveRemove |
|
5591 |
]. |
|
5592 |
^ info |
|
5593 |
||
5594 |
" |
|
5595 |
SourceCodeManager statusOf:Array |
|
5596 |
SourceCodeManager statusOf:Array fileName:'Array.st' directory:'libbasic' module:'stx' |
|
5597 |
SourceCodeManager statusOf:Filename fileName:'Filename.st' directory:'libbasic' module:'stx' |
|
5598 |
SourceCodeManager statusOf:NewSystemBrowser fileName:'NewSystemBrowser.st' directory:'libtool' module:'stx' |
|
5599 |
" |
|
1502 | 5600 |
|
1778
5c84a32c9fe4
sourceCache organized as package-hierarchy to prevent
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
5601 |
"Modified: / 29-08-2006 / 13:18:00 / cg" |
1362 | 5602 |
! ! |
5603 |
||
4157 | 5604 |
!CVSSourceCodeManager class methodsFor:'source code utilities'! |
5605 |
||
5606 |
annotationsFor:clsOrNil fileName:classFileName directory:packageDir module:moduleDir |
|
5607 |
"return info about who changed what and when. |
|
5608 |
Return nil on failure. |
|
5609 |
||
5610 |
The returned information is a structure entry for each line |
|
5611 |
#revision -> version of last change |
|
5612 |
#author -> author |
|
5613 |
#date -> change date |
|
5614 |
" |
|
5615 |
||
5616 |
|tempDir fullName modulePath inStream inHeaderInfo line info msg| |
|
5617 |
||
5618 |
tempDir := self createTempDirectory:nil forModule:nil. |
|
5619 |
tempDir isNil ifTrue:[ |
|
5620 |
('CVSSourceCodeManager [error]: no tempDir - cannot extract log') errorPrintCR. |
|
5621 |
^ nil. |
|
5622 |
]. |
|
5623 |
||
5624 |
[ |
|
5625 |
|cmd revArg| |
|
5626 |
||
5627 |
modulePath := moduleDir , '/' , packageDir. |
|
5628 |
fullName := modulePath , '/' , classFileName. |
|
5629 |
||
5630 |
self createEntryFor:fullName |
|
5631 |
module:moduleDir |
|
5632 |
in:(tempDir construct:modulePath) |
|
5633 |
revision:'1.1' |
|
5634 |
date:'dummy' |
|
5635 |
special:'' |
|
5636 |
overwrite:false. |
|
5637 |
||
5638 |
msg := 'Fetching annotation log '. |
|
5639 |
clsOrNil isNil ifTrue:[ |
|
5640 |
msg := msg , 'in ' , fullName. |
|
5641 |
] ifFalse:[ |
|
5642 |
msg := msg , 'of ', clsOrNil name. |
|
5643 |
]. |
|
5644 |
self activityNotification:msg,'...'. |
|
5645 |
||
5646 |
inStream := self |
|
5647 |
executeCVSCommand:('annotate ' , fullName) |
|
5648 |
module:moduleDir |
|
5649 |
inDirectory:tempDir |
|
5650 |
log:true |
|
5651 |
pipe:true. |
|
5652 |
||
5653 |
inStream isNil ifTrue:[ |
|
5654 |
('CVSSourceCodeManager [error]: cannot open pipe to cvs annotate ', fullName) errorPrintCR. |
|
5655 |
^ nil |
|
5656 |
]. |
|
5657 |
||
5658 |
"/ |
|
5659 |
"/ read the commands pipe output and extract the info |
|
5660 |
"/ |
|
5661 |
info := IdentityDictionary new. |
|
5662 |
inHeaderInfo := true. |
|
5663 |
[inHeaderInfo and:[inStream atEnd not]] whileTrue:[ |
|
5664 |
line:= inStream nextLine. |
|
5665 |
((line ? '') startsWith:'*******') ifTrue:[ |
|
5666 |
inHeaderInfo := false. |
|
5667 |
] |
|
5668 |
]. |
|
5669 |
||
5670 |
"/ |
|
5671 |
"/ continue to read the commands pipe output |
|
5672 |
"/ and extract change info records |
|
5673 |
"/ |
|
5674 |
[inStream atEnd] whileFalse:[ |
|
5675 |
line := inStream nextLine. |
|
5676 |
Transcript showCR:line. |
|
5677 |
]. |
|
5678 |
] ensure:[ |
|
5679 |
inStream notNil ifTrue:[inStream close]. |
|
5680 |
||
5681 |
tempDir notNil ifTrue:[ |
|
4164 | 5682 |
OsError handle:[:ex | |
4157 | 5683 |
('CVSSourceCodeManager [warning]: could not remove tempDir ', tempDir pathName) infoPrintCR. |
5684 |
] do:[ |
|
5685 |
tempDir recursiveRemove |
|
5686 |
]. |
|
5687 |
]. |
|
5688 |
self activityNotification:nil. |
|
5689 |
]. |
|
5690 |
^ info |
|
5691 |
||
5692 |
" |
|
5693 |
SourceCodeManager |
|
5694 |
annotationsFor:Array |
|
5695 |
fileName:'Array.st' directory:'libbasic' module:'stx' |
|
5696 |
" |
|
5697 |
" |
|
5698 |
SourceCodeManager |
|
5699 |
annotationsFor:MenuPanel |
|
5700 |
fileName:'MenuPanel.st' directory:'libwidg2' module:'stx' |
|
5701 |
" |
|
5702 |
! |
|
5703 |
||
5704 |
diffListFor:clsOrNil fileName:classFileNameArg directory:packageDir module:moduleDir revision1:rev1 revision2:rev2 cache:cacheIt |
|
5705 |
"return diff info. This is supposed to return a standard diff-like |
|
5706 |
list of lines, representing the diffs between two revisions. |
|
5707 |
experimental (for ownershipGraph). |
|
5708 |
Here we ask cvs to give us the diff list" |
|
5709 |
||
5710 |
|tempDir fullName modulePath inStream list msg cacheDir cachedFile classFileName diffDir| |
|
5711 |
||
5712 |
clsOrNil notNil ifTrue:[ |
|
5713 |
modulePath := clsOrNil package copyReplaceAll:$: with:$/. |
|
5714 |
fullName := modulePath , '/' , (classFileName := clsOrNil getClassFilename). |
|
5715 |
] ifFalse:[ |
|
5716 |
modulePath := moduleDir , '/' , packageDir. |
|
5717 |
fullName := modulePath , '/' , (classFileName := classFileNameArg). |
|
5718 |
]. |
|
5719 |
||
5720 |
(cacheIt) ifTrue:[ |
|
5721 |
(cacheDir := self sourceCacheDirectory) isNil ifTrue:[ |
|
5722 |
('CVSSourceCodeManager [warning]: no source cache directory') infoPrintCR. |
|
5723 |
] ifFalse:[ |
|
5724 |
diffDir := (cacheDir / modulePath / '.diffs'). |
|
5725 |
diffDir exists ifFalse:[ |
|
5726 |
diffDir makeDirectory. |
|
5727 |
]. |
|
5728 |
cachedFile := diffDir / (classFileName,'_',rev1,'_',rev2). |
|
5729 |
cachedFile exists ifTrue:[ |
|
5730 |
^ cachedFile contents |
|
5731 |
]. |
|
5732 |
]. |
|
5733 |
]. |
|
5734 |
||
5735 |
tempDir := self createTempDirectory:nil forModule:nil. |
|
5736 |
tempDir isNil ifTrue:[ |
|
5737 |
('CVSSourceCodeManager [error]: no tempDir - cannot extract status') errorPrintCR. |
|
5738 |
^ nil. |
|
5739 |
]. |
|
5740 |
||
5741 |
[ |
|
5742 |
self createEntryFor:fullName |
|
5743 |
module:moduleDir |
|
5744 |
in:(tempDir construct:modulePath) |
|
5745 |
revision:'1.1' |
|
5746 |
date:'dummy' |
|
5747 |
special:'' |
|
5748 |
overwrite:false. |
|
5749 |
||
5750 |
msg := 'CVS: Fetching diff list of '. |
|
5751 |
clsOrNil isNil ifTrue:[ |
|
5752 |
msg := msg , fullName. |
|
5753 |
] ifFalse:[ |
|
5754 |
msg := msg , clsOrNil name. |
|
5755 |
]. |
|
5756 |
msg := msg , ' ' , rev1 , ' vs. ' , rev2. |
|
5757 |
self activityNotification:msg. |
|
5758 |
||
5759 |
inStream := self |
|
5760 |
executeCVSCommand:('diff -w -r%1 -r%2 %3' bindWith:rev1 with:rev2 with:fullName) |
|
5761 |
module:moduleDir |
|
5762 |
inDirectory:tempDir |
|
5763 |
log:true |
|
5764 |
pipe:true. |
|
5765 |
||
5766 |
inStream isNil ifTrue:[ |
|
5767 |
('CVSSourceCodeManager [error]: cannot open pipe to cvs diff ', fullName) errorPrintCR. |
|
5768 |
^ nil |
|
5769 |
]. |
|
5770 |
||
5771 |
"/ |
|
5772 |
"/ read the command's pipe output, skipping some administrative info |
|
5773 |
"/ |
|
5774 |
[ inStream nextLine startsWith:'diff -'] whileFalse. |
|
5775 |
||
5776 |
list := inStream contents. |
|
5777 |
] ensure:[ |
|
5778 |
inStream notNil ifTrue:[inStream close]. |
|
5779 |
tempDir recursiveRemove |
|
5780 |
]. |
|
5781 |
list := list reject:[:line | line startsWith:'\ ']. |
|
5782 |
||
5783 |
cachedFile notNil ifTrue:[ |
|
5784 |
cachedFile contents:list. |
|
5785 |
]. |
|
5786 |
^ list |
|
5787 |
||
5788 |
" |
|
5789 |
SourceCodeManager statusOf:Array |
|
5790 |
SourceCodeManager statusOf:Array fileName:'Array.st' directory:'libbasic' module:'stx' |
|
5791 |
SourceCodeManager statusOf:Filename fileName:'Filename.st' directory:'libbasic' module:'stx' |
|
5792 |
SourceCodeManager statusOf:NewSystemBrowser fileName:'NewSystemBrowser.st' directory:'libtool' module:'stx' |
|
5793 |
" |
|
5794 |
||
5795 |
"Modified: / 29-08-2006 / 13:18:00 / cg" |
|
5796 |
! |
|
5797 |
||
5798 |
initialRCSRevisionStringFor:aClass in:dir container:fileName |
|
5799 |
"return a string usable as initial revision string" |
|
5800 |
||
5801 |
"/ do not make the string below into one string; |
|
5802 |
"/ RCS would expand it into a wrong rev-string |
|
5803 |
||
5804 |
|nm oldRev idx special| |
|
5805 |
||
5806 |
nm := fileName. |
|
5807 |
(nm endsWith:',v') ifTrue:[ |
|
5808 |
nm := nm copyButLast:2 |
|
5809 |
]. |
|
5810 |
(nm endsWith:'.st') ifFalse:[ |
|
5811 |
nm := nm , '.st' |
|
5812 |
]. |
|
5813 |
||
5814 |
oldRev := aClass revisionString. |
|
5815 |
special := ''. |
|
5816 |
||
5817 |
oldRev notNil ifTrue:[ |
|
5818 |
idx := oldRev lastIndexOf:$[. |
|
5819 |
idx ~~ 0 ifTrue:[ |
|
5820 |
idx := oldRev indexOf:$[ startingAt:idx+1. |
|
5821 |
idx ~~ 0 ifTrue:[ |
|
5822 |
special := ' ' , (oldRev copyFrom:idx). |
|
5823 |
] |
|
5824 |
] |
|
5825 |
]. |
|
5826 |
||
5827 |
||
5828 |
^ '$' , 'Header: ' , dir , '/' , fileName , ',v $' |
|
5829 |
, special |
|
5830 |
||
5831 |
"Modified: 17.9.1996 / 15:57:15 / cg" |
|
5832 |
"Created: 14.2.1997 / 20:59:28 / cg" |
|
5833 |
! |
|
5834 |
||
5835 |
initialRevisionStringFor:aClass inModule:moduleDir directory:packageDir container:fileName |
|
5836 |
"return a string usable as initial revision string" |
|
5837 |
||
5838 |
|cvsRoot fullName| |
|
5839 |
||
5840 |
cvsRoot := self getCVSROOTForModule:moduleDir. |
|
5841 |
cvsRoot := self repositoryTopDirectoryFromCVSRoot:cvsRoot. |
|
5842 |
packageDir isEmptyOrNil ifTrue:[ |
|
5843 |
fullName := (cvsRoot , '/' , moduleDir) |
|
5844 |
] ifFalse:[ |
|
5845 |
fullName := (cvsRoot , '/' , moduleDir , '/' , packageDir) |
|
5846 |
]. |
|
5847 |
^ self initialRCSRevisionStringFor:aClass in:fullName container:fileName |
|
5848 |
||
5849 |
"Modified: / 16-01-1998 / 17:34:13 / stefan" |
|
5850 |
"Created: / 23-08-2006 / 14:05:46 / cg" |
|
5851 |
! ! |
|
5852 |
||
1526 | 5853 |
!CVSSourceCodeManager class methodsFor:'testing'! |
5854 |
||
5855 |
isCVS |
|
5856 |
^ true |
|
5857 |
||
5858 |
"Created: / 16-08-2006 / 10:58:19 / cg" |
|
5859 |
! ! |
|
5860 |
||
4144 | 5861 |
!CVSSourceCodeManager::CVSVersionInfo class methodsFor:'documentation'! |
5862 |
||
5863 |
copyright |
|
5864 |
" |
|
5865 |
COPYRIGHT (c) 2009 by eXept Software AG |
|
5866 |
All Rights Reserved |
|
5867 |
||
5868 |
This software is furnished under a license and may be used |
|
5869 |
only in accordance with the terms of that license and with the |
|
5870 |
inclusion of the above copyright notice. This software may not |
|
5871 |
be provided or otherwise made available to, or used by, any |
|
5872 |
other person. No title to or ownership of the software is |
|
5873 |
hereby transferred. |
|
5874 |
" |
|
5875 |
! |
|
5876 |
||
5877 |
documentation |
|
5878 |
" |
|
5879 |
In ancient times, Class used to return a Dictionary when asked for versionInfo. |
|
5880 |
This has been replaced by instances of VersionInfo and subclasses. |
|
5881 |
||
5882 |
CVSVersionInfo adds some CVS specific data. |
|
5883 |
||
5884 |
[author:] |
|
5885 |
cg (cg@AQUA-DUO) |
|
5886 |
" |
|
5887 |
! |
|
5888 |
||
5889 |
version |
|
5890 |
^ '$Header$' |
|
5891 |
! |
|
5892 |
||
5893 |
version_CVS |
|
5894 |
^ '$Header$' |
|
5895 |
! ! |
|
5896 |
||
5897 |
!CVSSourceCodeManager::CVSVersionInfo class methodsFor:'instance creation'! |
|
5898 |
||
5899 |
fromRCSString:aString |
|
5900 |
"{ Pragma: +optSpace }" |
|
5901 |
||
5902 |
"I know how to parse RCS/CVS version id strings. |
|
5903 |
Return an instance filled with revision info which is |
|
5904 |
extracted from aString. This must be in RCS/CVS format." |
|
5905 |
||
5906 |
|words firstWord nextWord info nm s fn revString d | |
|
5907 |
||
5908 |
s := aString readStream. |
|
5909 |
s skipSeparators. |
|
5910 |
firstWord := s upToSeparator. |
|
5911 |
||
5912 |
info := self new. |
|
5913 |
||
5914 |
"/ |
|
5915 |
"/ supported formats: |
|
5916 |
"/ |
|
5917 |
"/ $-Header: pathName rev date time user state $ |
|
5918 |
"/ $-Revision: rev $ |
|
5919 |
"/ $-Id: fileName rev date time user state $ |
|
5920 |
"/ |
|
4239 | 5921 |
(firstWord = '$Header:' or:[firstWord = '§Header:']) ifTrue:[ |
4144 | 5922 |
d := firstWord first. |
5923 |
s skipSeparators. |
|
5924 |
nm := s throughAll:',v '. |
|
5925 |
nm := nm withoutSeparators. |
|
5926 |
info repositoryPathName:nm. |
|
5927 |
info fileName:(nm asFilename baseName copyButLast:2). |
|
5928 |
words := s upToEnd asCollectionOfWords readStream. |
|
5929 |
||
5930 |
words atEnd ifFalse:[ |
|
5931 |
nextWord := words next. |
|
5932 |
nextWord first ~= d ifTrue:[ |
|
5933 |
info revision:nextWord. |
|
5934 |
nextWord := words next. |
|
5935 |
(nextWord notNil and:[nextWord first ~= d]) ifTrue:[ |
|
5936 |
info date:nextWord. |
|
5937 |
info time:words next. |
|
5938 |
nextWord := words next. |
|
5939 |
(nextWord notNil and:[nextWord startsWithAnyOf:'+-']) ifTrue:[ |
|
5940 |
info timezone:nextWord. |
|
5941 |
nextWord := words next. |
|
5942 |
]. |
|
5943 |
info user:nextWord. |
|
5944 |
info state:words next. |
|
5945 |
] |
|
5946 |
]. |
|
5947 |
]. |
|
5948 |
^ info |
|
5949 |
]. |
|
5950 |
||
4239 | 5951 |
(firstWord = '$Revision:' or:[firstWord = '§Revision:']) ifTrue:[ |
4144 | 5952 |
info revision:(s upToEnd asCollectionOfWords first). |
5953 |
^ info |
|
5954 |
]. |
|
5955 |
||
4239 | 5956 |
(firstWord = '$Id:' or:[firstWord = '§Id:']) ifTrue:[ |
4144 | 5957 |
"/commented out by Jan Vrany, 2009/10/20 |
5958 |
"/according to http://svnbook.red-bean.com/en/1.5/svn.advanced.props.special.keywords.html |
|
5959 |
"/svn has no support for $ Header $ expansion. Therefore |
|
4228 | 5960 |
"/libsvn uses $ Id: $ instead. |
4227 | 5961 |
"/self halt:'no longer supported'. |
4144 | 5962 |
words := s upToEnd asCollectionOfWords readStream. |
4227 | 5963 |
fn := words next. |
4144 | 5964 |
(fn endsWith:',v') ifFalse:[ |
5965 |
"/ not a CVS version |
|
5966 |
^ nil |
|
5967 |
]. |
|
4227 | 5968 |
info fileName:(fn copyButLast:2). |
4144 | 5969 |
info revision:(revString := words next). |
5970 |
||
5971 |
"/ do not use matchesRegex:'[0-9]+\.[0-9]+.*') here: regex is an optional package |
|
5972 |
((revString conform:[:c | c isDigit or:[c == $.]]) |
|
5973 |
and:[revString includes:$.]) ifFalse:[ |
|
5974 |
"/ not a CVS version |
|
5975 |
^ nil |
|
5976 |
]. |
|
5977 |
info date:(words next). |
|
5978 |
info time:(words next). |
|
5979 |
info user:(words next). |
|
5980 |
info state:(words next). |
|
5981 |
^ info |
|
5982 |
]. |
|
5983 |
||
5984 |
^ nil |
|
5985 |
||
5986 |
" |
|
5987 |
CVSVersionInfo fromRCSString:('$' , 'Revision: 1.122 $') |
|
5988 |
CVSVersionInfo fromRCSString:(CVSSourceCodeManager version) |
|
5989 |
CVSVersionInfo fromRCSString:(SVNSourceCodeManager version_CVS) |
|
5990 |
" |
|
5991 |
||
5992 |
"Modified (comment): / 11-10-2011 / 23:41:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
5993 |
"Modified: / 22-11-2011 / 16:15:49 / cg" |
|
5994 |
"Modified (format): / 24-11-2011 / 10:56:51 / cg" |
|
4228 | 5995 |
"Modified (format): / 07-03-2017 / 22:25:54 / mawalch" |
4144 | 5996 |
! ! |
5997 |
||
5998 |
!CVSSourceCodeManager::CVSVersionInfo methodsFor:'accessing'! |
|
5999 |
||
4157 | 6000 |
changedLinesInfo |
6001 |
^ changedLinesInfo |
|
6002 |
! |
|
6003 |
||
6004 |
changedLinesInfo:aString |
|
6005 |
changedLinesInfo := aString. |
|
6006 |
! |
|
6007 |
||
4144 | 6008 |
repositoryPathName |
6009 |
^ repositoryPathName |
|
6010 |
! |
|
6011 |
||
6012 |
repositoryPathName:something |
|
6013 |
repositoryPathName := something. |
|
6014 |
! |
|
6015 |
||
6016 |
timeZone |
|
6017 |
^ timeZone |
|
6018 |
! |
|
6019 |
||
6020 |
timeZone:something |
|
6021 |
timeZone := something. |
|
6022 |
! |
|
6023 |
||
6024 |
timezone |
|
6025 |
^ timeZone |
|
6026 |
||
6027 |
"Created: / 22-10-2008 / 20:50:39 / cg" |
|
6028 |
! |
|
6029 |
||
6030 |
timezone:something |
|
6031 |
timeZone := something. |
|
6032 |
||
6033 |
"Created: / 22-10-2008 / 20:50:32 / cg" |
|
6034 |
! ! |
|
6035 |
||
1362 | 6036 |
!CVSSourceCodeManager class methodsFor:'documentation'! |
6037 |
||
2479 | 6038 |
version |
3890 | 6039 |
^ '$Header$' |
2486
3c88b7c8f7fa
changed: #checkinClass:fileName:directory:module:source:logMessage:force:
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
6040 |
! |
3c88b7c8f7fa
changed: #checkinClass:fileName:directory:module:source:logMessage:force:
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
6041 |
|
3c88b7c8f7fa
changed: #checkinClass:fileName:directory:module:source:logMessage:force:
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
6042 |
version_CVS |
3890 | 6043 |
^ '$Header$' |
1362 | 6044 |
! ! |
1170 | 6045 |
|
3104 | 6046 |
|
130 | 6047 |
CVSSourceCodeManager initialize! |