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