author | Claus Gittinger <cg@exept.de> |
Fri, 12 Jul 1996 23:46:48 +0200 | |
changeset 375 | 476a8a705f0d |
parent 266 | 6ef60ca4a583 |
child 433 | 273920a11e41 |
permissions | -rw-r--r-- |
56
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1 |
" |
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2 |
COPYRIGHT (c) 1995 by Claus Gittinger |
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3 |
All Rights Reserved |
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4 |
|
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5 |
This software is furnished under a license and may be used |
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6 |
only in accordance with the terms of that license and with the |
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7 |
inclusion of the above copyright notice. This software may not |
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8 |
be provided or otherwise made available to, or used by, any |
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9 |
other person. No title to or ownership of the software is |
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
10 |
hereby transferred. |
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
11 |
" |
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
12 |
|
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
13 |
Object subclass:#AbstractSourceCodeManager |
147 | 14 |
instanceVariableNames:'' |
158
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
15 |
classVariableNames:'DefaultManager CachingSources CacheDirectoryName UseWorkTree |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
16 |
WorkTreeDirectoryName' |
147 | 17 |
poolDictionaries:'' |
218 | 18 |
category:'System-SourceCodeManagement' |
56
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
19 |
! |
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
20 |
|
375
476a8a705f0d
show reason why fileOut failed (on stderr)
Claus Gittinger <cg@exept.de>
parents:
266
diff
changeset
|
21 |
!AbstractSourceCodeManager class methodsFor:'documentation'! |
56
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
22 |
|
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
23 |
copyright |
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
24 |
" |
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
25 |
COPYRIGHT (c) 1995 by Claus Gittinger |
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
26 |
All Rights Reserved |
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
27 |
|
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
28 |
This software is furnished under a license and may be used |
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
29 |
only in accordance with the terms of that license and with the |
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
30 |
inclusion of the above copyright notice. This software may not |
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
31 |
be provided or otherwise made available to, or used by, any |
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
32 |
other person. No title to or ownership of the software is |
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
33 |
hereby transferred. |
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
34 |
" |
71 | 35 |
! |
36 |
||
37 |
documentation |
|
38 |
" |
|
39 |
Abstract superclass for sourceCodeManagers. |
|
40 |
Concrete subclasses provide access to a source repository. |
|
41 |
All protocol here traps into subclassResponsbility errors. |
|
42 |
Please read more documentation in concrete subclasses |
|
43 |
(especially: CVSSourceCodeManager) for how to use this manager. |
|
236 | 44 |
|
45 |
[author:] |
|
46 |
Claus Gittinger |
|
71 | 47 |
" |
93
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
48 |
! ! |
56
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
49 |
|
375
476a8a705f0d
show reason why fileOut failed (on stderr)
Claus Gittinger <cg@exept.de>
parents:
266
diff
changeset
|
50 |
!AbstractSourceCodeManager class methodsFor:'initialization'! |
63 | 51 |
|
52 |
initCacheDirPath |
|
53 |
|path| |
|
54 |
||
65
098be8484211
dont cache classes of which the newest rev. has been checked out
Claus Gittinger <cg@exept.de>
parents:
64
diff
changeset
|
55 |
path := OperatingSystem getEnvironment:'STX_TMPPATH'. |
63 | 56 |
path isNil ifTrue:[ |
158
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
57 |
path := OperatingSystem getEnvironment:'TMPPATH'. |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
58 |
path isNil ifTrue:[ |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
59 |
path := '/tmp' |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
60 |
] |
63 | 61 |
]. |
64 | 62 |
CacheDirectoryName := path , '/stx_sourceCache'. |
158
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
63 |
|
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
64 |
"Modified: 16.12.1995 / 15:39:42 / cg" |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
65 |
! |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
66 |
|
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
67 |
initialize |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
68 |
CachingSources := UseWorkTree := false. |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
69 |
CacheDirectoryName := WorkTreeDirectoryName := ''. |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
70 |
|
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
71 |
"Modified: 16.12.1995 / 15:39:42 / cg" |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
72 |
"Created: 16.12.1995 / 15:41:00 / cg" |
63 | 73 |
! ! |
74 |
||
375
476a8a705f0d
show reason why fileOut failed (on stderr)
Claus Gittinger <cg@exept.de>
parents:
266
diff
changeset
|
75 |
!AbstractSourceCodeManager class methodsFor:'accessing'! |
112 | 76 |
|
158
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
77 |
cacheDirectoryName |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
78 |
^ CacheDirectoryName |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
79 |
! |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
80 |
|
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
81 |
cacheDirectoryName:aStringOrFilename |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
82 |
CacheDirectoryName := aStringOrFilename |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
83 |
|
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
84 |
"Created: 16.12.1995 / 15:18:43 / cg" |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
85 |
! |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
86 |
|
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
87 |
cachingSources |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
88 |
^ CachingSources |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
89 |
|
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
90 |
"Created: 16.12.1995 / 15:17:50 / cg" |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
91 |
"Modified: 16.12.1995 / 15:18:03 / cg" |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
92 |
! |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
93 |
|
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
94 |
cachingSources:aBoolean |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
95 |
CachingSources := aBoolean |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
96 |
|
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
97 |
"Created: 16.12.1995 / 15:18:13 / cg" |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
98 |
! |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
99 |
|
112 | 100 |
defaultManager |
101 |
^ DefaultManager |
|
102 |
||
103 |
"Created: 7.12.1995 / 17:14:22 / cg" |
|
158
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
104 |
! |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
105 |
|
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
106 |
useWorkTree |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
107 |
^ UseWorkTree |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
108 |
|
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
109 |
"Created: 16.12.1995 / 15:36:48 / cg" |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
110 |
"Modified: 16.12.1995 / 15:37:17 / cg" |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
111 |
! |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
112 |
|
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
113 |
useWorkTree:aBoolean |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
114 |
UseWorkTree := aBoolean |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
115 |
|
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
116 |
"Modified: 16.12.1995 / 15:18:03 / cg" |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
117 |
"Created: 16.12.1995 / 15:37:29 / cg" |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
118 |
! |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
119 |
|
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
120 |
workTreeDirectoryName |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
121 |
^ WorkTreeDirectoryName |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
122 |
|
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
123 |
"Created: 16.12.1995 / 15:35:21 / cg" |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
124 |
! |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
125 |
|
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
126 |
workTreeDirectoryName:aStringOrFilename |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
127 |
WorkTreeDirectoryName := aStringOrFilename |
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
128 |
|
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
129 |
"Created: 16.12.1995 / 15:35:34 / cg" |
112 | 130 |
! ! |
131 |
||
375
476a8a705f0d
show reason why fileOut failed (on stderr)
Claus Gittinger <cg@exept.de>
parents:
266
diff
changeset
|
132 |
!AbstractSourceCodeManager class methodsFor:'private'! |
71 | 133 |
|
179 | 134 |
containerFromSourceInfo:info |
135 |
(info includesKey:#fileName) ifTrue:[ |
|
136 |
^ info at:#fileName |
|
137 |
]. |
|
138 |
(info includesKey:#expectedFileName) ifTrue:[ |
|
139 |
^ info at:#expectedFileName |
|
140 |
]. |
|
141 |
^ (info at:#classFileNameBase) , '.st' |
|
142 |
||
143 |
"Modified: 6.2.1996 / 17:27:24 / cg" |
|
144 |
! |
|
145 |
||
96 | 146 |
directoryFromContainerPath:containerPath |
148 | 147 |
"given a full path as in an RCS header, extract the directory (i.e. package)." |
148 |
||
96 | 149 |
|path idx| |
150 |
||
151 |
path := self pathInRepositoryFrom:containerPath. |
|
152 |
path notNil ifTrue:[ |
|
148 | 153 |
idx := path indexOf:(Filename separator). |
154 |
idx ~~ 0 ifTrue:[ |
|
155 |
path := path copyFrom:(idx + 1) |
|
156 |
]. |
|
157 |
^ path asFilename directoryName |
|
96 | 158 |
]. |
159 |
^ nil |
|
160 |
||
161 |
" |
|
162 |
SourceCodeManager directoryFromContainerPath:'/files/CVS/stx/libbasic/Array.st' |
|
163 |
" |
|
164 |
||
165 |
"Created: 25.11.1995 / 18:42:20 / cg" |
|
148 | 166 |
"Modified: 13.12.1995 / 13:06:15 / cg" |
96 | 167 |
! |
168 |
||
169 |
filenameFromContainerPath:containerPath |
|
148 | 170 |
"given some path as present in an RCS Header string, extract the containers |
171 |
name. |
|
172 |
OBSOLETE - this is no longer used." |
|
173 |
||
96 | 174 |
|top rest| |
175 |
||
176 |
containerPath notNil ifTrue:[ |
|
148 | 177 |
top := self repositoryTopDirectory. |
178 |
top notNil ifTrue:[ |
|
179 |
(containerPath startsWith:(top , '/')) ifTrue:[ |
|
180 |
rest := containerPath copyFrom:(top size + 2). |
|
181 |
^ rest asFilename baseName |
|
182 |
] |
|
183 |
] |
|
96 | 184 |
]. |
185 | 185 |
^ containerPath |
96 | 186 |
|
187 |
"Created: 25.11.1995 / 18:42:34 / cg" |
|
185 | 188 |
"Modified: 19.2.1996 / 13:35:29 / cg" |
96 | 189 |
! |
190 |
||
191 |
moduleFromContainerPath:containerPath |
|
148 | 192 |
"given a full path as in an RCS header, extract the module." |
193 |
||
96 | 194 |
|path idx| |
195 |
||
196 |
path := self pathInRepositoryFrom:containerPath. |
|
197 |
path notNil ifTrue:[ |
|
148 | 198 |
idx := path indexOf:(Filename separator). |
199 |
idx == 0 ifTrue:[^ path]. |
|
200 |
^ path copyTo:(idx - 1) |
|
96 | 201 |
]. |
202 |
^ nil |
|
203 |
||
204 |
" |
|
205 |
SourceCodeManager moduleFromContainerPath:'/files/CVS/stx/libbasic/Array.st' |
|
206 |
" |
|
207 |
||
208 |
"Created: 25.11.1995 / 18:42:20 / cg" |
|
148 | 209 |
"Modified: 13.12.1995 / 13:06:03 / cg" |
96 | 210 |
! |
211 |
||
179 | 212 |
moduleFromSourceInfo:info |
213 |
^ info at:#module. "/ use the modules name as CVS module |
|
214 |
||
215 |
"Created: 6.2.1996 / 17:26:38 / cg" |
|
216 |
! |
|
217 |
||
218 |
packageFromSourceInfo:info |
|
219 |
^ info at:#directory. |
|
220 |
||
221 |
"Created: 6.2.1996 / 17:26:23 / cg" |
|
222 |
! |
|
223 |
||
96 | 224 |
pathInRepositoryFrom:containerPath |
148 | 225 |
"this tries to extract the path within a repository, given some path |
226 |
as present in an RCS Header string. |
|
227 |
Typically, this ought to be that string directly; |
|
228 |
however, if the repository directory is accessed via a symbolic link during |
|
229 |
ci/co, some systems extract different strings with co. |
|
230 |
One such system here had a symbolic link from /phys/ibm/CVS... to /file/CVS, |
|
231 |
and extracted sources had /phys/ibm/CVS in their header. |
|
232 |
Do not depend on the code below to work correctly all the time." |
|
233 |
||
96 | 234 |
|top rest lastTop idx| |
235 |
||
236 |
containerPath notNil ifTrue:[ |
|
148 | 237 |
top := self repositoryTopDirectory. |
238 |
top notNil ifTrue:[ |
|
239 |
(containerPath startsWith:(top , '/')) ifTrue:[ |
|
240 |
^ containerPath copyFrom:(top size + 2). |
|
241 |
]. |
|
242 |
||
243 |
"/ hardcase - the repository-filename in the versionInfo |
|
244 |
"/ does no match my repository top. |
|
245 |
"/ check for mangled prefix (happens with symbolic links) |
|
246 |
||
247 |
lastTop := '/' , top asFilename baseName, '/'. |
|
248 |
idx := containerPath indexOfSubCollection:lastTop. |
|
249 |
idx ~~ 0 ifTrue:[ |
|
266 | 250 |
('SOURCEMGR: warning: repository path mismatch: ' , (containerPath copyTo:idx-1) , lastTop , ' vs. ' , top , '/') infoPrintCR. |
251 |
'SOURCEMGR: warning: assuming that mismatch is ok.' infoPrintCR. |
|
148 | 252 |
^ containerPath copyFrom:(idx + lastTop size). |
253 |
] |
|
254 |
] |
|
96 | 255 |
]. |
256 |
^ rest |
|
257 |
||
258 |
" |
|
259 |
SourceCodeManager pathInRepositoryFrom:'/files/CVS/stx/libbasic/Array.st' |
|
260 |
SourceCodeManager pathInRepositoryFrom:'/phys/ibm/CVS/stx/libbasic/Array.st' |
|
261 |
" |
|
262 |
||
263 |
"Created: 25.11.1995 / 18:42:20 / cg" |
|
266 | 264 |
"Modified: 20.5.1996 / 10:30:41 / cg" |
96 | 265 |
! |
266 |
||
267 |
repositoryTopDirectory |
|
268 |
^ nil |
|
269 |
||
270 |
"Created: 25.11.1995 / 18:38:59 / cg" |
|
271 |
! |
|
272 |
||
87 | 273 |
revisionAfter:aRevisionString |
274 |
|idx s| |
|
275 |
||
276 |
idx := aRevisionString lastIndexOf:$.. |
|
277 |
idx == 0 ifTrue:[ |
|
278 |
^ ((Integer readFrom:aRevisionString) + 1) printString |
|
279 |
]. |
|
280 |
||
281 |
^ (aRevisionString copyTo:idx) , ((Integer readFrom:(aRevisionString copyFrom:(idx+1)))+1) printString |
|
282 |
||
283 |
" |
|
284 |
SourceCodeManager revisionAfter:'1.2.3.4' |
|
285 |
SourceCodeManager revisionAfter:'123' |
|
286 |
SourceCodeManager revisionAfter:'1.24' |
|
287 |
" |
|
288 |
||
289 |
"Created: 20.11.1995 / 12:54:05 / cg" |
|
290 |
! |
|
291 |
||
71 | 292 |
sourceCacheDirectory |
293 |
|dir nm| |
|
294 |
||
295 |
(nm := self cacheDirectoryName) isNil ifTrue:[^ nil]. |
|
69 | 296 |
|
71 | 297 |
(dir := nm asFilename) exists ifFalse:[ |
173
d73d61190510
make sourceCache rwx-able for all
Claus Gittinger <cg@exept.de>
parents:
160
diff
changeset
|
298 |
dir makeDirectory. |
d73d61190510
make sourceCache rwx-able for all
Claus Gittinger <cg@exept.de>
parents:
160
diff
changeset
|
299 |
dir exists ifFalse:[ |
266 | 300 |
'SOURCEMGR: could not create cache dir ''' , CacheDirectoryName , '''' infoPrintCR. |
173
d73d61190510
make sourceCache rwx-able for all
Claus Gittinger <cg@exept.de>
parents:
160
diff
changeset
|
301 |
^ nil |
d73d61190510
make sourceCache rwx-able for all
Claus Gittinger <cg@exept.de>
parents:
160
diff
changeset
|
302 |
]. |
d73d61190510
make sourceCache rwx-able for all
Claus Gittinger <cg@exept.de>
parents:
160
diff
changeset
|
303 |
"/ |
d73d61190510
make sourceCache rwx-able for all
Claus Gittinger <cg@exept.de>
parents:
160
diff
changeset
|
304 |
"/ make it read/writable for everyone |
d73d61190510
make sourceCache rwx-able for all
Claus Gittinger <cg@exept.de>
parents:
160
diff
changeset
|
305 |
"/ |
d73d61190510
make sourceCache rwx-able for all
Claus Gittinger <cg@exept.de>
parents:
160
diff
changeset
|
306 |
dir makeReadableForAll. |
d73d61190510
make sourceCache rwx-able for all
Claus Gittinger <cg@exept.de>
parents:
160
diff
changeset
|
307 |
dir makeWritableForAll. |
d73d61190510
make sourceCache rwx-able for all
Claus Gittinger <cg@exept.de>
parents:
160
diff
changeset
|
308 |
dir makeExecutableForAll. |
71 | 309 |
]. |
310 |
^ dir |
|
173
d73d61190510
make sourceCache rwx-able for all
Claus Gittinger <cg@exept.de>
parents:
160
diff
changeset
|
311 |
|
266 | 312 |
"Modified: 20.5.1996 / 10:30:44 / cg" |
71 | 313 |
! |
69 | 314 |
|
96 | 315 |
sourceInfoOfClass:aClass |
316 |
"helper: return a classes sourceCodeInfo" |
|
317 |
||
183 | 318 |
|cls binaryInfo revInfo actualSourceFileName classFileNameBase |
179 | 319 |
newInfo revisionInfo container expectedFileName |
320 |
directoryFromRev moduleFromRev fileNameFromRev directoryFromBin moduleFromBin| |
|
96 | 321 |
|
322 |
cls := aClass. |
|
323 |
cls isMeta ifTrue:[ |
|
160 | 324 |
cls := cls soleInstance |
96 | 325 |
]. |
326 |
||
179 | 327 |
newInfo := IdentityDictionary new. |
328 |
||
96 | 329 |
"/ |
330 |
"/ the info given by the classes source ... |
|
331 |
"/ |
|
332 |
revInfo := aClass revisionInfo. |
|
179 | 333 |
revInfo notNil ifTrue:[ |
334 |
revInfo keysAndValuesDo:[:key :value | |
|
335 |
newInfo at:key put:value |
|
336 |
] |
|
337 |
]. |
|
96 | 338 |
|
339 |
"/ |
|
340 |
"/ the info given by the classes binary ... |
|
341 |
"/ if present, we better trust that one. |
|
179 | 342 |
"/ however, it only contains partial information (directory & module). |
343 |
"/ (but is available even without a source) |
|
96 | 344 |
"/ |
179 | 345 |
binaryInfo := cls packageSourceCodeInfo. |
346 |
binaryInfo notNil ifTrue:[ |
|
347 |
binaryInfo keysAndValuesDo:[:key :value | |
|
348 |
newInfo at:key put:value |
|
160 | 349 |
] |
96 | 350 |
]. |
351 |
||
179 | 352 |
"/ |
353 |
"/ no information |
|
354 |
"/ |
|
355 |
(binaryInfo isNil and:[revInfo isNil]) ifTrue:[ |
|
266 | 356 |
('SOURCEMGR: class `' , aClass name , ''' has neither source nor compiled-in info') infoPrintCR. |
179 | 357 |
^ nil |
358 |
]. |
|
96 | 359 |
|
360 |
"/ |
|
179 | 361 |
"/ validate for conflicts |
362 |
"/ trust binary if in doubt |
|
363 |
"/ (in case some cheater edited the version string) |
|
364 |
||
365 |
revInfo notNil ifTrue:[ |
|
366 |
(revInfo includesKey:#repositoryPathName) ifTrue:[ |
|
367 |
container := revInfo at:#repositoryPathName ifAbsent:nil. |
|
368 |
newInfo at:#directory put:(directoryFromRev := self directoryFromContainerPath:container). |
|
369 |
newInfo at:#module put:(moduleFromRev := self moduleFromContainerPath:container). |
|
185 | 370 |
fileNameFromRev := container asFilename baseName. |
371 |
||
372 |
"/ fileNameFromRev := self filenameFromContainerPath:container. |
|
179 | 373 |
newInfo at:#fileName put:(fileNameFromRev copyWithoutLast:2). |
374 |
||
375 |
binaryInfo notNil ifTrue:[ |
|
376 |
(binaryInfo includesKey:#directory) ifTrue:[ |
|
377 |
directoryFromBin := binaryInfo at:#directory. |
|
378 |
moduleFromBin := binaryInfo at:#module. |
|
96 | 379 |
|
179 | 380 |
(directoryFromBin ~= directoryFromRev |
381 |
or:[moduleFromBin ~= moduleFromRev]) ifTrue:[ |
|
187
fdda79120bbb
in sourceInfoOfClass: be prepared for binInfo present, but no sourceInfo
Claus Gittinger <cg@exept.de>
parents:
185
diff
changeset
|
382 |
(directoryFromRev isNil or:[moduleFromRev isNil]) ifTrue:[ |
fdda79120bbb
in sourceInfoOfClass: be prepared for binInfo present, but no sourceInfo
Claus Gittinger <cg@exept.de>
parents:
185
diff
changeset
|
383 |
('SOURCEMGR: using binary info: ' |
194 | 384 |
, directoryFromBin , '/' , moduleFromBin |
266 | 385 |
) infoPrintCR. |
187
fdda79120bbb
in sourceInfoOfClass: be prepared for binInfo present, but no sourceInfo
Claus Gittinger <cg@exept.de>
parents:
185
diff
changeset
|
386 |
] ifFalse:[ |
fdda79120bbb
in sourceInfoOfClass: be prepared for binInfo present, but no sourceInfo
Claus Gittinger <cg@exept.de>
parents:
185
diff
changeset
|
387 |
('SOURCEMGR: conflicting source infos (binary: ' |
fdda79120bbb
in sourceInfoOfClass: be prepared for binInfo present, but no sourceInfo
Claus Gittinger <cg@exept.de>
parents:
185
diff
changeset
|
388 |
, directoryFromBin , '/' , moduleFromBin |
fdda79120bbb
in sourceInfoOfClass: be prepared for binInfo present, but no sourceInfo
Claus Gittinger <cg@exept.de>
parents:
185
diff
changeset
|
389 |
, ' vs. source:' |
fdda79120bbb
in sourceInfoOfClass: be prepared for binInfo present, but no sourceInfo
Claus Gittinger <cg@exept.de>
parents:
185
diff
changeset
|
390 |
, directoryFromRev , '/' , moduleFromRev |
266 | 391 |
, ')') infoPrintCR. |
187
fdda79120bbb
in sourceInfoOfClass: be prepared for binInfo present, but no sourceInfo
Claus Gittinger <cg@exept.de>
parents:
185
diff
changeset
|
392 |
]. |
179 | 393 |
newInfo at:#directory put:directoryFromBin. |
394 |
newInfo at:#module put:moduleFromBin. |
|
395 |
] |
|
396 |
] |
|
397 |
]. |
|
398 |
] |
|
399 |
]. |
|
400 |
||
401 |
"/ |
|
402 |
"/ the filename I'd expect from its name ... |
|
403 |
"/ |
|
404 |
classFileNameBase := Smalltalk fileNameForClass:aClass. |
|
405 |
||
406 |
(newInfo includesKey:#fileName) ifFalse:[ |
|
407 |
newInfo at:#fileName put:(classFileNameBase , '.st') |
|
408 |
]. |
|
409 |
||
410 |
"/ guess on the container |
|
411 |
container isNil ifTrue:[ |
|
183 | 412 |
(newInfo includesKey:#directory) ifTrue:[ |
413 |
(newInfo includesKey:#module) ifTrue:[ |
|
414 |
(newInfo includesKey:#module) ifTrue:[ |
|
415 |
container := (newInfo at:#directory) |
|
179 | 416 |
, '/' |
183 | 417 |
, (newInfo at:#module) |
179 | 418 |
, '/' |
419 |
, classFileNameBase , '.st,v'. |
|
420 |
] |
|
421 |
] |
|
422 |
] |
|
423 |
]. |
|
424 |
||
425 |
container notNil ifTrue:[ |
|
426 |
newInfo at:#repositoryPathName put:container. |
|
96 | 427 |
]. |
428 |
||
429 |
"/ check .. |
|
430 |
revInfo notNil ifTrue:[ |
|
160 | 431 |
actualSourceFileName := revInfo at:#fileName ifAbsent:nil. |
432 |
actualSourceFileName notNil ifTrue:[ |
|
179 | 433 |
expectedFileName := classFileNameBase , '.st'. |
434 |
actualSourceFileName ~= expectedFileName ifTrue:[ |
|
266 | 435 |
('SOURCEMGR: source of class ' , aClass name , ' in ' , actualSourceFileName , ';') infoPrintCR. |
436 |
('SOURCEMGR: (expected: ' , expectedFileName , '); renamed or missing abbreviation ?') infoPrintCR. |
|
437 |
('SOURCEMGR: This may fail to autoload later if left unchanged.') infoPrintCR. |
|
179 | 438 |
newInfo at:#expectedFileName put:expectedFileName. |
160 | 439 |
newInfo at:#renamed put:true. |
179 | 440 |
classFileNameBase := actualSourceFileName copyWithoutLast:3 |
160 | 441 |
] |
442 |
] |
|
96 | 443 |
]. |
444 |
||
179 | 445 |
newInfo at:#classFileNameBase put:classFileNameBase. |
96 | 446 |
^ newInfo |
447 |
||
448 |
"Created: 25.11.1995 / 12:40:19 / cg" |
|
266 | 449 |
"Modified: 20.5.1996 / 10:30:49 / cg" |
96 | 450 |
! |
451 |
||
71 | 452 |
streamForClass:cls fileName:classFileName revision:revision directory:packageDir module:moduleDir cache:cacheIt |
453 |
self subclassResponsibility. |
|
454 |
^ nil |
|
455 |
||
456 |
"Created: 4.11.1995 / 19:09:12 / cg" |
|
457 |
"Modified: 4.11.1995 / 19:15:43 / cg" |
|
95 | 458 |
! ! |
459 |
||
375
476a8a705f0d
show reason why fileOut failed (on stderr)
Claus Gittinger <cg@exept.de>
parents:
266
diff
changeset
|
460 |
!AbstractSourceCodeManager class methodsFor:'source code access'! |
95 | 461 |
|
127
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
462 |
checkinClass:aClass fileName:classFileName directory:packageDir module:moduleDir logMessage:logMessage |
95 | 463 |
"checkin of a class into the source repository. |
464 |
Return true if ok, false if not." |
|
465 |
||
127
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
466 |
|tempDir tempFile ok| |
71 | 467 |
|
468 |
tempDir := (Filename newTemporaryIn:nil) makeDirectory. |
|
469 |
[ |
|
114
bb18f2290ec6
dont write a changeLog if nothing changed (i.e. no checkin was done)
Claus Gittinger <cg@exept.de>
parents:
112
diff
changeset
|
470 |
|aStream| |
75 | 471 |
|
127
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
472 |
tempFile := tempDir construct:classFileName. |
114
bb18f2290ec6
dont write a changeLog if nothing changed (i.e. no checkin was done)
Claus Gittinger <cg@exept.de>
parents:
112
diff
changeset
|
473 |
aStream := tempFile writeStream. |
bb18f2290ec6
dont write a changeLog if nothing changed (i.e. no checkin was done)
Claus Gittinger <cg@exept.de>
parents:
112
diff
changeset
|
474 |
aStream isNil ifTrue:[ |
375
476a8a705f0d
show reason why fileOut failed (on stderr)
Claus Gittinger <cg@exept.de>
parents:
266
diff
changeset
|
475 |
'SOURCEMGR: temporary fileout failed' errorPrintCR. |
114
bb18f2290ec6
dont write a changeLog if nothing changed (i.e. no checkin was done)
Claus Gittinger <cg@exept.de>
parents:
112
diff
changeset
|
476 |
^ false |
bb18f2290ec6
dont write a changeLog if nothing changed (i.e. no checkin was done)
Claus Gittinger <cg@exept.de>
parents:
112
diff
changeset
|
477 |
]. |
71 | 478 |
|
184
e682441f91cb
flush methods fileCache before filingOut
Claus Gittinger <cg@exept.de>
parents:
183
diff
changeset
|
479 |
Method flushSourceStreamCache. |
114
bb18f2290ec6
dont write a changeLog if nothing changed (i.e. no checkin was done)
Claus Gittinger <cg@exept.de>
parents:
112
diff
changeset
|
480 |
Class fileOutErrorSignal handle:[:ex | |
375
476a8a705f0d
show reason why fileOut failed (on stderr)
Claus Gittinger <cg@exept.de>
parents:
266
diff
changeset
|
481 |
'SOURCEMGR: fileout failed.' errorPrintCR. |
476a8a705f0d
show reason why fileOut failed (on stderr)
Claus Gittinger <cg@exept.de>
parents:
266
diff
changeset
|
482 |
'SOURCEMGR: reason: ' errorPrint. ex errorString printCR. |
476a8a705f0d
show reason why fileOut failed (on stderr)
Claus Gittinger <cg@exept.de>
parents:
266
diff
changeset
|
483 |
|
114
bb18f2290ec6
dont write a changeLog if nothing changed (i.e. no checkin was done)
Claus Gittinger <cg@exept.de>
parents:
112
diff
changeset
|
484 |
aStream close. |
bb18f2290ec6
dont write a changeLog if nothing changed (i.e. no checkin was done)
Claus Gittinger <cg@exept.de>
parents:
112
diff
changeset
|
485 |
^ false |
bb18f2290ec6
dont write a changeLog if nothing changed (i.e. no checkin was done)
Claus Gittinger <cg@exept.de>
parents:
112
diff
changeset
|
486 |
] do:[ |
bb18f2290ec6
dont write a changeLog if nothing changed (i.e. no checkin was done)
Claus Gittinger <cg@exept.de>
parents:
112
diff
changeset
|
487 |
aClass fileOutOn:aStream withTimeStamp:false. |
bb18f2290ec6
dont write a changeLog if nothing changed (i.e. no checkin was done)
Claus Gittinger <cg@exept.de>
parents:
112
diff
changeset
|
488 |
]. |
bb18f2290ec6
dont write a changeLog if nothing changed (i.e. no checkin was done)
Claus Gittinger <cg@exept.de>
parents:
112
diff
changeset
|
489 |
aStream close. |
71 | 490 |
|
127
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
491 |
tempFile exists ifFalse:[ |
375
476a8a705f0d
show reason why fileOut failed (on stderr)
Claus Gittinger <cg@exept.de>
parents:
266
diff
changeset
|
492 |
'SOURCEMGR: temporary fileout failed' errorPrintCR. |
114
bb18f2290ec6
dont write a changeLog if nothing changed (i.e. no checkin was done)
Claus Gittinger <cg@exept.de>
parents:
112
diff
changeset
|
493 |
^ false |
bb18f2290ec6
dont write a changeLog if nothing changed (i.e. no checkin was done)
Claus Gittinger <cg@exept.de>
parents:
112
diff
changeset
|
494 |
]. |
75 | 495 |
|
114
bb18f2290ec6
dont write a changeLog if nothing changed (i.e. no checkin was done)
Claus Gittinger <cg@exept.de>
parents:
112
diff
changeset
|
496 |
ok := self |
bb18f2290ec6
dont write a changeLog if nothing changed (i.e. no checkin was done)
Claus Gittinger <cg@exept.de>
parents:
112
diff
changeset
|
497 |
checkinClass:aClass |
bb18f2290ec6
dont write a changeLog if nothing changed (i.e. no checkin was done)
Claus Gittinger <cg@exept.de>
parents:
112
diff
changeset
|
498 |
fileName:classFileName |
bb18f2290ec6
dont write a changeLog if nothing changed (i.e. no checkin was done)
Claus Gittinger <cg@exept.de>
parents:
112
diff
changeset
|
499 |
directory:packageDir |
bb18f2290ec6
dont write a changeLog if nothing changed (i.e. no checkin was done)
Claus Gittinger <cg@exept.de>
parents:
112
diff
changeset
|
500 |
module:moduleDir |
bb18f2290ec6
dont write a changeLog if nothing changed (i.e. no checkin was done)
Claus Gittinger <cg@exept.de>
parents:
112
diff
changeset
|
501 |
source:(tempFile name) |
bb18f2290ec6
dont write a changeLog if nothing changed (i.e. no checkin was done)
Claus Gittinger <cg@exept.de>
parents:
112
diff
changeset
|
502 |
logMessage:logMessage. |
bb18f2290ec6
dont write a changeLog if nothing changed (i.e. no checkin was done)
Claus Gittinger <cg@exept.de>
parents:
112
diff
changeset
|
503 |
|
bb18f2290ec6
dont write a changeLog if nothing changed (i.e. no checkin was done)
Claus Gittinger <cg@exept.de>
parents:
112
diff
changeset
|
504 |
^ ok |
71 | 505 |
] valueNowOrOnUnwindDo:[ |
114
bb18f2290ec6
dont write a changeLog if nothing changed (i.e. no checkin was done)
Claus Gittinger <cg@exept.de>
parents:
112
diff
changeset
|
506 |
tempDir recursiveRemove |
71 | 507 |
]. |
508 |
^ false |
|
509 |
||
510 |
" |
|
511 |
SourceCodeManager checkinClass:Array |
|
512 |
" |
|
513 |
||
514 |
"Created: 6.11.1995 / 18:56:00 / cg" |
|
375
476a8a705f0d
show reason why fileOut failed (on stderr)
Claus Gittinger <cg@exept.de>
parents:
266
diff
changeset
|
515 |
"Modified: 12.7.1996 / 23:38:36 / cg" |
127
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
516 |
! |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
517 |
|
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
518 |
checkinClass:aClass logMessage:logMessage |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
519 |
"checkin of a class into the source repository. |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
520 |
Return true if ok, false if not." |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
521 |
|
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
522 |
|sourceInfo packageDir moduleDir classFileName| |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
523 |
|
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
524 |
sourceInfo := self sourceInfoOfClass:aClass. |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
525 |
sourceInfo isNil ifTrue:[ |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
526 |
('SOURCEMGR: no sourceInfo for class: ' , aClass name) errorPrintNL. |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
527 |
^ false |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
528 |
]. |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
529 |
|
179 | 530 |
packageDir := self packageFromSourceInfo:sourceInfo. |
531 |
moduleDir := self moduleFromSourceInfo:sourceInfo. "/ use the modules name as CVS module |
|
532 |
classFileName := self containerFromSourceInfo:sourceInfo. |
|
127
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
533 |
|
179 | 534 |
^ self checkinClass:aClass fileName:classFileName directory:packageDir module:moduleDir logMessage:logMessage |
127
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
535 |
|
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
536 |
|
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
537 |
" |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
538 |
SourceCodeManager checkinClass:Array |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
539 |
" |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
540 |
|
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
541 |
"Created: 6.11.1995 / 18:56:00 / cg" |
179 | 542 |
"Modified: 6.2.1996 / 17:37:20 / cg" |
71 | 543 |
! |
544 |
||
133 | 545 |
mostRecentSourceStreamForClassNamed:aClassName |
546 |
|cls sourceInfo classFileName packageDir moduleDir| |
|
71 | 547 |
|
133 | 548 |
cls := Smalltalk classNamed:aClassName. |
549 |
cls notNil ifTrue:[ |
|
550 |
sourceInfo := self sourceInfoOfClass:cls. |
|
551 |
]. |
|
552 |
sourceInfo notNil ifTrue:[ |
|
179 | 553 |
packageDir := self packageFromSourceInfo:sourceInfo. |
554 |
moduleDir := self moduleFromSourceInfo:sourceInfo. "/ use the modules name as CVS module |
|
555 |
classFileName := self containerFromSourceInfo:sourceInfo. |
|
133 | 556 |
] ifFalse:[ |
179 | 557 |
classFileName := (Smalltalk fileNameForClass:aClassName) , '.st'. |
133 | 558 |
packageDir := Smalltalk sourceDirectoryNameOfClass:aClassName. |
559 |
moduleDir := 'stx'. |
|
560 |
]. |
|
561 |
||
562 |
packageDir isNil ifTrue:[ |
|
563 |
'SRCMGR: could not extract packageDir' errorPrintNL. |
|
564 |
^ nil |
|
565 |
]. |
|
71 | 566 |
|
567 |
^ self |
|
133 | 568 |
streamForClass:nil |
569 |
fileName:classFileName |
|
570 |
revision:#newest |
|
571 |
directory:packageDir |
|
572 |
module:moduleDir |
|
573 |
cache:false |
|
71 | 574 |
|
575 |
"Created: 6.11.1995 / 16:09:06 / cg" |
|
179 | 576 |
"Modified: 6.2.1996 / 17:34:57 / cg" |
71 | 577 |
! |
578 |
||
56
6705671acee8
source code managers (optional) These are involved, if no
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
579 |
sourceStreamFor:aClass |
58 | 580 |
"extract a classes source code and return an open readStream on it. |
581 |
The classes source code is extracted using the revision and the sourceCodeInfo, |
|
582 |
which itself is extracted from the classes packageString." |
|
583 |
||
83
250202dc956e
added sourceStreamFor:revision: - to access a specific (older) revision
Claus Gittinger <cg@exept.de>
parents:
77
diff
changeset
|
584 |
^ self sourceStreamFor:aClass revision:nil |
250202dc956e
added sourceStreamFor:revision: - to access a specific (older) revision
Claus Gittinger <cg@exept.de>
parents:
77
diff
changeset
|
585 |
! |
250202dc956e
added sourceStreamFor:revision: - to access a specific (older) revision
Claus Gittinger <cg@exept.de>
parents:
77
diff
changeset
|
586 |
|
250202dc956e
added sourceStreamFor:revision: - to access a specific (older) revision
Claus Gittinger <cg@exept.de>
parents:
77
diff
changeset
|
587 |
sourceStreamFor:aClass revision:aRevisionStringOrNil |
250202dc956e
added sourceStreamFor:revision: - to access a specific (older) revision
Claus Gittinger <cg@exept.de>
parents:
77
diff
changeset
|
588 |
"extract a classes source code and return an open readStream on it. |
250202dc956e
added sourceStreamFor:revision: - to access a specific (older) revision
Claus Gittinger <cg@exept.de>
parents:
77
diff
changeset
|
589 |
A revision of nil selects the current (in image) revision. |
250202dc956e
added sourceStreamFor:revision: - to access a specific (older) revision
Claus Gittinger <cg@exept.de>
parents:
77
diff
changeset
|
590 |
The classes source code is extracted using the revision and the sourceCodeInfo, |
250202dc956e
added sourceStreamFor:revision: - to access a specific (older) revision
Claus Gittinger <cg@exept.de>
parents:
77
diff
changeset
|
591 |
which itself is extracted from the classes packageString." |
250202dc956e
added sourceStreamFor:revision: - to access a specific (older) revision
Claus Gittinger <cg@exept.de>
parents:
77
diff
changeset
|
592 |
|
96 | 593 |
|classFileName revision |
594 |
packageDir moduleDir sourceInfo revInfo| |
|
58 | 595 |
|
83
250202dc956e
added sourceStreamFor:revision: - to access a specific (older) revision
Claus Gittinger <cg@exept.de>
parents:
77
diff
changeset
|
596 |
aRevisionStringOrNil isNil ifTrue:[ |
179 | 597 |
revision := aClass binaryRevision. |
598 |
revision isNil ifTrue:[ |
|
191
ebdb455a26ce
take revision if no binaryRevision is available (in sourceStream for ...)
ca
parents:
187
diff
changeset
|
599 |
revision := aClass revision. |
ebdb455a26ce
take revision if no binaryRevision is available (in sourceStream for ...)
ca
parents:
187
diff
changeset
|
600 |
revision isNil ifTrue:[ |
266 | 601 |
('SOURCEMGR: class `' , aClass name , ''' has no revision string') infoPrintCR. |
191
ebdb455a26ce
take revision if no binaryRevision is available (in sourceStream for ...)
ca
parents:
187
diff
changeset
|
602 |
^ nil. |
ebdb455a26ce
take revision if no binaryRevision is available (in sourceStream for ...)
ca
parents:
187
diff
changeset
|
603 |
]. |
266 | 604 |
('SOURCEMGR: trusting classes revision ...') infoPrintCR. |
179 | 605 |
] |
83
250202dc956e
added sourceStreamFor:revision: - to access a specific (older) revision
Claus Gittinger <cg@exept.de>
parents:
77
diff
changeset
|
606 |
] ifFalse:[ |
179 | 607 |
revision := aRevisionStringOrNil |
58 | 608 |
]. |
609 |
||
95 | 610 |
sourceInfo := self sourceInfoOfClass:aClass. |
611 |
sourceInfo isNil ifTrue:[^ nil]. |
|
58 | 612 |
|
179 | 613 |
packageDir := self packageFromSourceInfo:sourceInfo. |
614 |
moduleDir := self moduleFromSourceInfo:sourceInfo. "/ use the modules name as CVS module |
|
615 |
classFileName := self containerFromSourceInfo:sourceInfo. |
|
58 | 616 |
|
617 |
^ self |
|
179 | 618 |
streamForClass:aClass |
619 |
fileName:classFileName |
|
620 |
revision:revision |
|
621 |
directory:packageDir |
|
622 |
module:moduleDir |
|
623 |
cache:true |
|
65
098be8484211
dont cache classes of which the newest rev. has been checked out
Claus Gittinger <cg@exept.de>
parents:
64
diff
changeset
|
624 |
|
266 | 625 |
"Modified: 20.5.1996 / 10:30:52 / cg" |
58 | 626 |
! ! |
627 |
||
375
476a8a705f0d
show reason why fileOut failed (on stderr)
Claus Gittinger <cg@exept.de>
parents:
266
diff
changeset
|
628 |
!AbstractSourceCodeManager class methodsFor:'source code administration'! |
59
3bb0b97dffa2
reorganized; shared methods into AbstractSCMMgr
Claus Gittinger <cg@exept.de>
parents:
58
diff
changeset
|
629 |
|
122
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
630 |
checkForExistingContainerInModule:moduleName package:dirName container:fileName |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
631 |
self subclassResponsibility. |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
632 |
^ false |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
633 |
|
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
634 |
"Created: 9.12.1995 / 19:02:23 / cg" |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
635 |
"Modified: 9.12.1995 / 19:43:39 / cg" |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
636 |
! |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
637 |
|
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
638 |
checkForExistingModule:moduleName |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
639 |
self subclassResponsibility. |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
640 |
^ false |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
641 |
|
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
642 |
"Created: 9.12.1995 / 19:02:23 / cg" |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
643 |
"Modified: 9.12.1995 / 19:43:54 / cg" |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
644 |
! |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
645 |
|
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
646 |
checkForExistingModule:moduleDir package:packageDir |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
647 |
self subclassResponsibility. |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
648 |
^ false |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
649 |
|
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
650 |
"Created: 9.12.1995 / 19:02:23 / cg" |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
651 |
"Modified: 9.12.1995 / 19:44:04 / cg" |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
652 |
! |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
653 |
|
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
654 |
createContainerFor:aClass inModule:moduleName directory:dirName container:fileName |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
655 |
self subclassResponsibility. |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
656 |
^ false |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
657 |
|
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
658 |
"Created: 9.12.1995 / 19:02:47 / cg" |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
659 |
"Modified: 9.12.1995 / 19:28:15 / cg" |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
660 |
! |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
661 |
|
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
662 |
createModule:moduleName |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
663 |
self subclassResponsibility. |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
664 |
^ false |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
665 |
|
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
666 |
"Created: 9.12.1995 / 19:02:23 / cg" |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
667 |
"Modified: 9.12.1995 / 19:53:23 / cg" |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
668 |
! |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
669 |
|
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
670 |
createModule:module package:package |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
671 |
self subclassResponsibility. |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
672 |
^ false |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
673 |
|
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
674 |
"Created: 9.12.1995 / 19:02:23 / cg" |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
675 |
"Modified: 9.12.1995 / 19:54:26 / cg" |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
676 |
! |
4dd60cb14bc6
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
121
diff
changeset
|
677 |
|
207
9366df6c32ea
added query for newestRevision string
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
678 |
newestRevisionOf:aClass |
9366df6c32ea
added query for newestRevision string
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
679 |
"return the newest revision (as string) found in the repository. |
9366df6c32ea
added query for newestRevision string
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
680 |
Return nil on failure." |
9366df6c32ea
added query for newestRevision string
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
681 |
|
9366df6c32ea
added query for newestRevision string
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
682 |
|log| |
9366df6c32ea
added query for newestRevision string
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
683 |
|
9366df6c32ea
added query for newestRevision string
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
684 |
log := self revisionLogOf:aClass. |
9366df6c32ea
added query for newestRevision string
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
685 |
log isNil ifTrue:[^ nil]. |
9366df6c32ea
added query for newestRevision string
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
686 |
^ log at:#newestRevision ifAbsent:nil |
9366df6c32ea
added query for newestRevision string
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
687 |
|
9366df6c32ea
added query for newestRevision string
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
688 |
" |
9366df6c32ea
added query for newestRevision string
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
689 |
SourceCodeManager newestRevisionOf:Array |
9366df6c32ea
added query for newestRevision string
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
690 |
SourceCodeManager newestRevisionOf:Connection |
9366df6c32ea
added query for newestRevision string
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
691 |
" |
9366df6c32ea
added query for newestRevision string
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
692 |
|
9366df6c32ea
added query for newestRevision string
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
693 |
"Modified: 10.4.1996 / 23:14:24 / cg" |
9366df6c32ea
added query for newestRevision string
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
694 |
! |
9366df6c32ea
added query for newestRevision string
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
695 |
|
93
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
696 |
revisionLogOf:aClass |
95 | 697 |
"return info about the repository container and |
698 |
the revisionlog as a collection of revision entries. |
|
699 |
Return nil on failure. |
|
93
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
700 |
The returned information is a structure (IdentityDictionary) |
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
701 |
filled with: |
95 | 702 |
#container -> the RCS container file name |
703 |
#filename -> the actual source file name |
|
704 |
#newestRevision -> the revisionString of the newest revision |
|
705 |
#numberOfRevisions -> the number of revisions in the container |
|
706 |
#revisions -> collection of per-revision info |
|
93
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
707 |
|
95 | 708 |
per revision info consists of one record per revision: |
93
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
709 |
|
95 | 710 |
#revision -> the revision string |
711 |
#author -> who checked that revision into the repository |
|
712 |
#date -> when was it checked in |
|
713 |
#state -> the RCS state |
|
714 |
#numberOfChangedLines -> the number of changed line w.r.t the previous |
|
93
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
715 |
|
95 | 716 |
revisions are ordered newest first |
717 |
(i.e. the last entry is for the initial revision; the first for the most recent one) |
|
718 |
" |
|
93
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
719 |
|
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
720 |
^ self |
95 | 721 |
revisionLogOf:aClass fromRevision:nil toRevision:nil |
93
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
722 |
|
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
723 |
" |
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
724 |
SourceCodeManager revisionLogOf:Array |
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
725 |
" |
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
726 |
|
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
727 |
"Created: 25.11.1995 / 11:25:02 / cg" |
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
728 |
"Modified: 25.11.1995 / 11:56:16 / cg" |
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
729 |
! |
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
730 |
|
110 | 731 |
revisionLogOf:aClass fromRevision:rev1 |
732 |
"return info about the repository container and |
|
733 |
(part of) the revisionlog as a collection of revision entries. |
|
734 |
Return nil on failure. |
|
735 |
||
736 |
The returned information is a structure (IdentityDictionary) |
|
737 |
filled with: |
|
112 | 738 |
#container -> the RCS container file name |
739 |
#filename -> the actual source file name |
|
740 |
#newestRevision -> the revisionString of the newest revision |
|
741 |
#numberOfRevisions -> the number of revisions in the container |
|
742 |
#revisions -> collection of per-revision info (see below) |
|
110 | 743 |
|
112 | 744 |
for some classes, additional info is returned: |
110 | 745 |
|
112 | 746 |
#renamed -> true if the class has been renamed or copied |
747 |
and the sourceInfo is from the previous one |
|
748 |
#expectedFileName -> the filename we would expect (i.e. for the new class) |
|
110 | 749 |
|
112 | 750 |
rev1 / rev2 specify from which revisions a logEntry is wanted: |
751 |
If rev1 is nil, the first revision is the initial revision |
|
752 |
otherwise, the log starts with that revision. |
|
753 |
If rev2 is nil, the last revision is the newest revision |
|
754 |
otherwise, the log ends with that revision. |
|
755 |
If both are nil, no logEntries are extracted (i.e. only the header). |
|
110 | 756 |
|
112 | 757 |
per revision info consists of one record per revision: |
110 | 758 |
|
112 | 759 |
#revision -> the revision string |
760 |
#author -> who checked that revision into the repository |
|
761 |
#date -> when was it checked in |
|
762 |
#state -> the RCS state |
|
763 |
#numberOfChangedLines -> the number of changed line w.r.t the previous |
|
110 | 764 |
|
112 | 765 |
revisions are ordered newest first |
766 |
(i.e. the last entry is for the initial revision; the first for the most recent one) |
|
767 |
" |
|
110 | 768 |
|
769 |
^ self revisionLogOf:aClass fromRevision:rev1 toRevision:nil |
|
770 |
||
771 |
" |
|
772 |
SourceCodeManager revisionLogOf:Array fromRevision:'1.40' |
|
773 |
" |
|
774 |
||
775 |
"Created: 6.11.1995 / 18:56:00 / cg" |
|
776 |
"Modified: 7.12.1995 / 11:51:15 / cg" |
|
777 |
! |
|
778 |
||
93
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
779 |
revisionLogOf:aClass fromRevision:rev1 toRevision:rev2 |
95 | 780 |
"return info about the repository container and |
781 |
(part of) the revisionlog as a collection of revision entries. |
|
782 |
Return nil on failure. |
|
783 |
||
93
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
784 |
The returned information is a structure (IdentityDictionary) |
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
785 |
filled with: |
127
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
786 |
#container -> the RCS container file name |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
787 |
#filename -> the actual source file name |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
788 |
#newestRevision -> the revisionString of the newest revision |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
789 |
#numberOfRevisions -> the number of revisions in the container |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
790 |
#revisions -> collection of per-revision info (see below) |
93
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
791 |
|
127
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
792 |
for some classes, additional info is returned: |
96 | 793 |
|
127
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
794 |
#renamed -> true if the class has been renamed or copied |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
795 |
and the sourceInfo is from the previous one |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
796 |
#expectedFileName -> the filename we would expect (i.e. for the new class) |
93
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
797 |
|
127
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
798 |
rev1 / rev2 specify from which revisions a logEntry is wanted: |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
799 |
If rev1 is nil, the first revision is the initial revision |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
800 |
otherwise, the log starts with that revision. |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
801 |
If rev2 is nil, the last revision is the newest revision |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
802 |
otherwise, the log ends with that revision. |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
803 |
If both are nil, no logEntries are extracted (i.e. only the header). |
96 | 804 |
|
127
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
805 |
per revision info consists of one record per revision: |
93
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
806 |
|
127
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
807 |
#revision -> the revision string |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
808 |
#author -> who checked that revision into the repository |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
809 |
#date -> when was it checked in |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
810 |
#state -> the RCS state |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
811 |
#numberOfChangedLines -> the number of changed line w.r.t the previous |
93
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
812 |
|
127
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
813 |
revisions are ordered newest first |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
814 |
(i.e. the last entry is for the initial revision; the first for the most recent one) |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
815 |
" |
93
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
816 |
|
96 | 817 |
|cls sourceInfo packageDir moduleDir classFileName info| |
95 | 818 |
|
819 |
sourceInfo := self sourceInfoOfClass:aClass. |
|
820 |
sourceInfo isNil ifTrue:[^ nil]. |
|
93
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
821 |
|
179 | 822 |
packageDir := self packageFromSourceInfo:sourceInfo. |
823 |
moduleDir := self moduleFromSourceInfo:sourceInfo. "/ use the modules name as CVS module |
|
824 |
classFileName := self containerFromSourceInfo:sourceInfo. |
|
93
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
825 |
|
96 | 826 |
info := self |
127
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
827 |
revisionLogOf:aClass |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
828 |
fromRevision:rev1 |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
829 |
toRevision:rev2 |
179 | 830 |
fileName:classFileName |
127
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
831 |
directory:packageDir |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
832 |
module:moduleDir. |
96 | 833 |
|
834 |
info notNil ifTrue:[ |
|
179 | 835 |
"/ (sourceInfo includesKey:#renamed) ifTrue:[ |
836 |
"/ info at:#renamed put:(sourceInfo at:#renamed) |
|
837 |
"/ ]. |
|
127
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
838 |
(sourceInfo includesKey:#expectedFileName) ifTrue:[ |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
839 |
info at:#expectedFileName put:(sourceInfo at:#expectedFileName) |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
840 |
] |
96 | 841 |
]. |
842 |
^ info |
|
93
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
843 |
|
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
844 |
" |
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
845 |
SourceCodeManager revisionLogOf:Array fromRevision:'1.40' toRevision:'1.43' |
96 | 846 |
SourceCodeManager revisionLogOf:XtBoxNew |
93
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
847 |
" |
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
848 |
|
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
849 |
"Created: 6.11.1995 / 18:56:00 / cg" |
179 | 850 |
"Modified: 6.2.1996 / 17:29:05 / cg" |
93
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
851 |
! |
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
852 |
|
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
853 |
revisionLogOf:cls fromRevision:rev1 toRevision:rev2 fileName:classFileName directory:packageDir module:moduleDir |
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
854 |
"this must be implemented by a concrete source-code manager" |
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
855 |
|
87 | 856 |
self subclassResponsibility. |
73 | 857 |
|
87 | 858 |
"Created: 15.11.1995 / 18:12:51 / cg" |
93
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
859 |
"Modified: 25.11.1995 / 11:56:38 / cg" |
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
860 |
! |
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
861 |
|
213 | 862 |
revisionsOf:aClass |
863 |
"return a collection of revisions (as strings) found in the repository. |
|
864 |
The most recent (newest) revision will be the first in the list. |
|
865 |
Return nil on failure." |
|
866 |
||
867 |
|log revisions| |
|
868 |
||
869 |
log := self revisionLogOf:aClass. |
|
870 |
log isNil ifTrue:[^ nil]. |
|
871 |
revisions := log at:#revisions ifAbsent:nil. |
|
872 |
revisions isNil ifTrue:[^ nil]. |
|
873 |
^ revisions collect:[:rev | rev at:#revision]. |
|
874 |
||
875 |
" |
|
876 |
SourceCodeManager revisionsOf:Array |
|
877 |
SourceCodeManager newestRevisionOf:Array |
|
878 |
" |
|
879 |
||
880 |
"Modified: 10.4.1996 / 23:14:24 / cg" |
|
881 |
"Created: 19.4.1996 / 17:24:34 / cg" |
|
882 |
! |
|
883 |
||
147 | 884 |
writeHistoryLogSince:timeGoal filterSTSources:filter to:aStream |
885 |
self writeHistoryLogSince:timeGoal filterSTSources:filter filterUser:nil to:aStream |
|
886 |
||
887 |
"Modified: 13.12.1995 / 11:03:01 / cg" |
|
888 |
! |
|
889 |
||
890 |
writeHistoryLogSince:timeGoal to:aStream |
|
891 |
self writeHistoryLogSince:timeGoal filterSTSources:true filterUser:nil to:aStream |
|
892 |
||
893 |
"Created: 13.12.1995 / 10:28:27 / cg" |
|
894 |
"Modified: 13.12.1995 / 11:00:49 / cg" |
|
895 |
! |
|
896 |
||
96 | 897 |
writeRevisionLogMessagesFrom:log to:aStream |
898 |
"helper; send the revisionlog to aStream" |
|
93
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
899 |
|
138
386f2d831989
optional include header info in revision list
Claus Gittinger <cg@exept.de>
parents:
135
diff
changeset
|
900 |
self writeRevisionLogMessagesFrom:log withHeader:true to:aStream |
386f2d831989
optional include header info in revision list
Claus Gittinger <cg@exept.de>
parents:
135
diff
changeset
|
901 |
|
386f2d831989
optional include header info in revision list
Claus Gittinger <cg@exept.de>
parents:
135
diff
changeset
|
902 |
"Created: 10.12.1995 / 16:51:30 / cg" |
386f2d831989
optional include header info in revision list
Claus Gittinger <cg@exept.de>
parents:
135
diff
changeset
|
903 |
! |
386f2d831989
optional include header info in revision list
Claus Gittinger <cg@exept.de>
parents:
135
diff
changeset
|
904 |
|
386f2d831989
optional include header info in revision list
Claus Gittinger <cg@exept.de>
parents:
135
diff
changeset
|
905 |
writeRevisionLogMessagesFrom:log withHeader:header to:aStream |
386f2d831989
optional include header info in revision list
Claus Gittinger <cg@exept.de>
parents:
135
diff
changeset
|
906 |
"helper; send the revisionlog to aStream" |
386f2d831989
optional include header info in revision list
Claus Gittinger <cg@exept.de>
parents:
135
diff
changeset
|
907 |
|
386f2d831989
optional include header info in revision list
Claus Gittinger <cg@exept.de>
parents:
135
diff
changeset
|
908 |
header ifTrue:[ |
179 | 909 |
"/ (log at:#renamed ifAbsent:false) ifTrue:[ |
910 |
"/ aStream nextPutAll:' Class was probably renamed; revision info is from original class.'. |
|
911 |
"/ aStream cr; nextPutAll:' You may have to create a new container for it.'. |
|
912 |
"/ aStream cr; cr. |
|
913 |
"/ ]. |
|
138
386f2d831989
optional include header info in revision list
Claus Gittinger <cg@exept.de>
parents:
135
diff
changeset
|
914 |
|
386f2d831989
optional include header info in revision list
Claus Gittinger <cg@exept.de>
parents:
135
diff
changeset
|
915 |
aStream nextPutAll:' Total revisions: '; nextPutAll:(log at:#numberOfRevisions) printString; cr. |
386f2d831989
optional include header info in revision list
Claus Gittinger <cg@exept.de>
parents:
135
diff
changeset
|
916 |
aStream nextPutAll:' Newest revision: '; nextPutAll:(log at:#newestRevision) printString; cr. |
96 | 917 |
]. |
93
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
918 |
|
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
919 |
(log at:#revisions) do:[:entry | |
127
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
920 |
|logMsg| |
96 | 921 |
|
127
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
922 |
aStream cr. |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
923 |
aStream nextPutAll:' revision '; nextPutAll:(entry at:#revision); tab. |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
924 |
aStream nextPutAll:' date: '; nextPutAll:(entry at:#date); tab. |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
925 |
aStream nextPutAll:' author: '; nextPutAll:(entry at:#author); tab. |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
926 |
aStream cr. |
93
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
927 |
|
127
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
928 |
logMsg := entry at:#logMessage. |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
929 |
(logMsg isEmpty or:[logMsg isBlank or:[logMsg withoutSeparators = '.']]) ifTrue:[ |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
930 |
logMsg := '*** empty log message ***' |
7686a4413407
more protocol to create containers for new classes
Claus Gittinger <cg@exept.de>
parents:
123
diff
changeset
|
931 |
]. |
138
386f2d831989
optional include header info in revision list
Claus Gittinger <cg@exept.de>
parents:
135
diff
changeset
|
932 |
aStream tab; nextPutAll:logMsg. |
386f2d831989
optional include header info in revision list
Claus Gittinger <cg@exept.de>
parents:
135
diff
changeset
|
933 |
aStream cr. |
93
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
934 |
]. |
96 | 935 |
|
936 |
"Created: 16.11.1995 / 13:25:30 / cg" |
|
179 | 937 |
"Modified: 6.2.1996 / 17:24:38 / cg" |
73 | 938 |
! |
939 |
||
77 | 940 |
writeRevisionLogOf:aClass fromRevision:rev1 toRevision:rev2 to:aStream |
73 | 941 |
"extract a classes log and append it to aStream." |
942 |
||
96 | 943 |
|log | |
73 | 944 |
|
96 | 945 |
log := self revisionLogOf:aClass fromRevision:rev1 toRevision:rev2. |
946 |
log isNil ifTrue:[^ false]. |
|
947 |
||
948 |
self writeRevisionLogMessagesFrom:log to:aStream. |
|
949 |
^ true |
|
73 | 950 |
|
951 |
" |
|
77 | 952 |
SourceCodeManager writeRevisionLogOf:Array fromRevision:'1.40' toRevision:'1.43' to:Transcript |
73 | 953 |
" |
954 |
||
955 |
"Created: 6.11.1995 / 18:56:00 / cg" |
|
96 | 956 |
"Modified: 25.11.1995 / 17:24:55 / cg" |
77 | 957 |
! |
958 |
||
87 | 959 |
writeRevisionLogOf:aClass to:aStream |
960 |
"extract a classes log and append it to aStream." |
|
961 |
||
962 |
^ self |
|
963 |
writeRevisionLogOf:aClass fromRevision:nil toRevision:nil to:aStream |
|
77 | 964 |
|
87 | 965 |
" |
966 |
SourceCodeManager writeRevisionLogOf:Array to:Transcript |
|
967 |
" |
|
968 |
! ! |
|
77 | 969 |
|
375
476a8a705f0d
show reason why fileOut failed (on stderr)
Claus Gittinger <cg@exept.de>
parents:
266
diff
changeset
|
970 |
!AbstractSourceCodeManager class methodsFor:'documentation'! |
93
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
971 |
|
83042eccb8d1
revisionLogOf... extracts the log manager dependent; writeRevisionLog is now here
Claus Gittinger <cg@exept.de>
parents:
87
diff
changeset
|
972 |
version |
375
476a8a705f0d
show reason why fileOut failed (on stderr)
Claus Gittinger <cg@exept.de>
parents:
266
diff
changeset
|
973 |
^ '$Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.57 1996-07-12 21:46:48 cg Exp $' |
123
9a1dff152656
dummy entries to check-for & create modules & directories
Claus Gittinger <cg@exept.de>
parents:
122
diff
changeset
|
974 |
! ! |
158
27f76f9d8a25
preparations of workTree-stuff
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
975 |
AbstractSourceCodeManager initialize! |