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