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