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