author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Sat, 01 Oct 2011 13:15:27 +0200 | |
changeset 851 | 32edde5d1f19 |
parent 797 | 48f8701af829 |
child 921 | 6c3ba44ed3a5 |
permissions | -rw-r--r-- |
665 | 1 |
" |
2 |
Copyright (c) 2007-2010 Jan Vrany |
|
3 |
Copyright (c) 2009-2010 eXept Software AG |
|
4 |
||
5 |
Permission is hereby granted, free of charge, to any person |
|
6 |
obtaining a copy of this software and associated documentation |
|
7 |
files (the 'Software'), to deal in the Software without |
|
8 |
restriction, including without limitation the rights to use, |
|
9 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
10 |
copies of the Software, and to permit persons to whom the |
|
11 |
Software is furnished to do so, subject to the following |
|
12 |
conditions: |
|
13 |
||
14 |
The above copyright notice and this permission notice shall be |
|
15 |
included in all copies or substantial portions of the Software. |
|
16 |
||
17 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
18 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
19 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
20 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
21 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
22 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
23 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
24 |
OTHER DEALINGS IN THE SOFTWARE. |
|
25 |
" |
|
482 | 26 |
"{ Package: 'stx:libsvn' }" |
378 | 27 |
|
28 |
AbstractSourceCodeManager subclass:#SVNSourceCodeManager |
|
29 |
instanceVariableNames:'' |
|
665 | 30 |
classVariableNames:'LoadInProgressQuery' |
378 | 31 |
poolDictionaries:'' |
32 |
category:'System-SourceCodeManagement' |
|
33 |
! |
|
34 |
||
35 |
!SVNSourceCodeManager class methodsFor:'documentation'! |
|
36 |
||
665 | 37 |
copyright |
38 |
" |
|
39 |
Copyright (c) 2007-2010 Jan Vrany |
|
40 |
Copyright (c) 2009-2010 eXept Software AG |
|
41 |
||
42 |
Permission is hereby granted, free of charge, to any person |
|
43 |
obtaining a copy of this software and associated documentation |
|
44 |
files (the 'Software'), to deal in the Software without |
|
45 |
restriction, including without limitation the rights to use, |
|
46 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
47 |
copies of the Software, and to permit persons to whom the |
|
48 |
Software is furnished to do so, subject to the following |
|
49 |
conditions: |
|
50 |
||
51 |
The above copyright notice and this permission notice shall be |
|
52 |
included in all copies or substantial portions of the Software. |
|
53 |
||
54 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
55 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
56 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
57 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
58 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
59 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
60 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
61 |
OTHER DEALINGS IN THE SOFTWARE. |
|
62 |
||
63 |
" |
|
64 |
! |
|
65 |
||
378 | 66 |
documentation |
67 |
" |
|
68 |
For now, this is a dummy SourceCodeManager. |
|
69 |
It is only provided to deliver the correct versionMethodNameTemplates |
|
70 |
and versionMethod names. |
|
71 |
||
72 |
Might get more in the future. |
|
73 |
" |
|
74 |
! ! |
|
75 |
||
665 | 76 |
!SVNSourceCodeManager class methodsFor:'* As yet uncategorized *'! |
77 |
||
78 |
revisionInfoFromString:aString inClass:aClass |
|
79 |
||
80 |
^ CVSSourceCodeManager revisionInfoFromString:aString inClass:aClass |
|
81 |
||
82 |
"Created: / 05-07-2011 / 18:48:42 / jv" |
|
83 |
! |
|
84 |
||
85 |
savePreferencesOn:aFileStream |
|
86 |
||
87 |
"Nothing to do, since my preferences are stored in |
|
88 |
UserPreferences dictionary" |
|
89 |
||
90 |
"Created: / 10-06-2011 / 14:15:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
91 |
! ! |
|
92 |
||
93 |
!SVNSourceCodeManager class methodsFor:'Signal constants'! |
|
94 |
||
95 |
loadInProgressQuery |
|
96 |
||
97 |
LoadInProgressQuery ifNil: |
|
98 |
[LoadInProgressQuery := QuerySignal new]. |
|
99 |
^LoadInProgressQuery |
|
100 |
! ! |
|
101 |
||
102 |
!SVNSourceCodeManager class methodsFor:'basic access'! |
|
103 |
||
104 |
checkinClass:aClass fileName:classFileName directory:packageDir module:moduleDir source:sourceFile logMessage:logMessage force:force |
|
105 |
"checkin of a class into the source repository. |
|
106 |
Return true if ok, false if not." |
|
107 |
||
108 |
^ self shouldImplement |
|
109 |
! |
|
110 |
||
111 |
checkoutModule:aModule directory:aPackage andDo:aBlock |
|
112 |
"check out everything from a package into a temporary directory. |
|
113 |
Then evaluate aBlock, passing the name of that temp-directory. |
|
114 |
Afterwards, the tempDir is removed. |
|
115 |
Return true, if OK, false if any error occurred." |
|
116 |
||
117 |
| pkg tempDir repo workingCopy ok | |
|
118 |
pkg := (PackageId module: aModule directory: aPackage) asSymbol. |
|
119 |
repo := SVN::RepositoryManager repositoryForPackage: pkg. |
|
120 |
repo ifNil:[self error:('No repository for package %1' bindWith: pkg)]. |
|
121 |
[ok := false. |
|
122 |
tempDir := Filename newTemporaryDirectory. |
|
123 |
workingCopy := repo workingCopyIn: tempDir. |
|
124 |
workingCopy checkout. |
|
125 |
ok := true. |
|
126 |
aBlock value: tempDir] ensure: |
|
127 |
[[tempDir recursiveRemove] |
|
128 |
on: Error do: |
|
129 |
[:ex| |
|
130 |
OperatingSystem isMSWINDOWSlike |
|
131 |
ifTrue:[Delay waitForSeconds: 3.[tempDir recursiveRemove] on: Error do:["nothing"]] |
|
132 |
ifFalse:[ex pass]]]. |
|
133 |
^ok |
|
134 |
||
135 |
"Modified: / 19-04-2010 / 20:13:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
136 |
! |
|
137 |
||
138 |
streamForClass:aClass fileName:classFileName revision:revisionString directory:packageDir module:moduleDir cache:doCache |
|
139 |
"extract a classes source code and return an open readStream on it. |
|
140 |
A revision of nil selects the current (in image) revision. |
|
141 |
The classes source code is extracted using the revision and the sourceCodeInfo, |
|
142 |
which itself is extracted from the classes packageString." |
|
143 |
||
144 |
| pkg repo rev | |
|
145 |
pkg := moduleDir , ':' , packageDir. |
|
146 |
repo := SVN::RepositoryManager repositoryForPackage: pkg. |
|
147 |
repo ifNil:[^self error:'No repository for package ', pkg]. |
|
148 |
rev := SVN::Revision fromString: revisionString. |
|
149 |
^(repo cat: classFileName revision: rev) readStream |
|
150 |
||
151 |
"Modified: / 02-01-2010 / 13:25:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
152 |
! ! |
|
153 |
||
154 |
!SVNSourceCodeManager class methodsFor:'basic administration'! |
|
155 |
||
156 |
checkForExistingContainer:fileName inModule:moduleName directory:dirName |
|
157 |
"check for a container to be present" |
|
158 |
||
159 |
^ self shouldImplement |
|
160 |
! |
|
161 |
||
162 |
checkForExistingModule:moduleName |
|
163 |
"check for a module directory to be present" |
|
164 |
||
165 |
^ self shouldImplement |
|
166 |
! |
|
167 |
||
168 |
checkForExistingModule:moduleDir directory:packageDir |
|
169 |
"check for a package directory to be present" |
|
170 |
||
171 |
^ self shouldImplement |
|
172 |
! |
|
173 |
||
174 |
createContainerFor:aClass inModule:moduleName directory:dirName container:fileName |
|
175 |
"create a new container & check into it an initial version of aClass" |
|
176 |
||
177 |
^ self shouldImplement |
|
178 |
! |
|
179 |
||
180 |
createModule:moduleName |
|
181 |
"create a new module directory" |
|
182 |
||
183 |
^ self shouldImplement |
|
184 |
! |
|
185 |
||
186 |
createModule:module directory:directory |
|
187 |
"create a new package directory" |
|
188 |
||
189 |
^ self shouldImplement |
|
190 |
! |
|
191 |
||
192 |
initialRevisionStringFor:aClass inModule:moduleDir directory:packageDir container:fileName |
|
193 |
"return a string usable as initial revision string" |
|
194 |
||
195 |
^ self shouldImplement |
|
196 |
! |
|
197 |
||
198 |
revisionLogOf:clsOrNil fromRevision:rev1OrNil toRevision:rev2OrNil numberOfRevisions:limitOrNil fileName:classFileName directory:packageDir module:moduleDir |
|
199 |
"actually do return a revisionLog. The main worker method. |
|
200 |
This must be implemented by a concrete source-code manager" |
|
201 |
||
202 |
^ self shouldImplement |
|
203 |
! ! |
|
204 |
||
205 |
!SVNSourceCodeManager class methodsFor:'others'! |
|
206 |
||
207 |
version_CVS |
|
851
32edde5d1f19
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
797
diff
changeset
|
208 |
^ '$Header$' |
665 | 209 |
! ! |
210 |
||
378 | 211 |
!SVNSourceCodeManager class methodsFor:'queries'! |
212 |
||
213 |
isExperimental |
|
665 | 214 |
^ false |
215 |
"/^ OperatingSystem getLoginName ~= 'cg'. |
|
216 |
"/^ true |
|
570 | 217 |
|
665 | 218 |
"Modified: / 05-12-2009 / 10:23:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
570 | 219 |
! |
220 |
||
665 | 221 |
isResponsibleForPackage: packageId |
222 |
||
223 |
UserPreferences current svnEnabled ifFalse:[^false]. |
|
224 |
||
225 |
^SVN::RepositoryManager current hasRepositoryForPackage: packageId |
|
226 |
||
227 |
"Created: / 05-12-2009 / 10:36:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
228 |
"Modified: / 15-09-2010 / 14:55:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
378 | 229 |
! |
230 |
||
231 |
managerTypeName |
|
665 | 232 |
^ 'SubVersion' |
233 |
||
234 |
"Modified: / 07-07-2011 / 23:11:41 / jv" |
|
378 | 235 |
! |
236 |
||
237 |
nameOfVersionMethodForExtensions |
|
238 |
^ #'extensionsVersion_SVN' |
|
239 |
! |
|
240 |
||
241 |
nameOfVersionMethodInClasses |
|
242 |
^ #'version_SVN' |
|
586
8f0468063710
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
571
diff
changeset
|
243 |
! |
8f0468063710
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
571
diff
changeset
|
244 |
|
8f0468063710
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
571
diff
changeset
|
245 |
settingsApplicationClass |
587
02d7ed119335
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
246 |
"link to my settings application (needed for the settings dialog" |
02d7ed119335
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
247 |
|
665 | 248 |
^ SVN::ConfigurationApp |
249 |
||
250 |
"Modified: / 07-07-2011 / 23:12:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
251 |
! |
|
252 |
||
851
32edde5d1f19
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
797
diff
changeset
|
253 |
versionMethodKeyword |
586
8f0468063710
added: #settingsApplicationClass
Claus Gittinger <cg@exept.de>
parents:
571
diff
changeset
|
254 |
|
851
32edde5d1f19
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
797
diff
changeset
|
255 |
"Answers the keyword used by the version management system to |
32edde5d1f19
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
797
diff
changeset
|
256 |
expand a current version in a file (_without_ dollars). For |
32edde5d1f19
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
797
diff
changeset
|
257 |
CVS it is 'Header', for SVN 'Id', others may use different |
32edde5d1f19
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
797
diff
changeset
|
258 |
keywords. If nil is returned, then the version management does |
32edde5d1f19
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
797
diff
changeset
|
259 |
not use any keyword." |
665 | 260 |
|
851
32edde5d1f19
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
797
diff
changeset
|
261 |
^'Id' |
665 | 262 |
|
851
32edde5d1f19
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
797
diff
changeset
|
263 |
"Created: / 27-09-2011 / 16:46:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
378 | 264 |
! ! |
265 |
||
539 | 266 |
!SVNSourceCodeManager class methodsFor:'source code access'! |
267 |
||
268 |
loadPackageWithId: aPackageId fromRepositoryAsAutoloaded: doLoadAsAutoloaded |
|
269 |
||
541 | 270 |
"Return true if loaded, false otherwise." |
271 |
||
540 | 272 |
| retval loadBlock | |
539 | 273 |
|
274 |
loadBlock := [ |
|
540 | 275 |
| repo packageDir manager| |
276 |
manager := SVN::RepositoryManager current. |
|
539 | 277 |
repo := manager repositoryForPackage: aPackageId. |
278 |
retval := (repo notNil and:[repo exists]) ifTrue:[ |
|
665 | 279 |
repo workingCopy checkout: SVN::Revision head full: true. |
539 | 280 |
packageDir := Smalltalk packageDirectoryForPackageId:aPackageId. |
665 | 281 |
"Quick and dirty hack to support old version of Smalltalk/X" |
282 |
(Smalltalk respondsTo: #loadPackage:fromDirectory:asAutoloaded:) |
|
283 |
ifTrue: |
|
284 |
["New API" |
|
285 |
Smalltalk |
|
286 |
loadPackage:aPackageId |
|
287 |
fromDirectory:packageDir |
|
288 |
asAutoloaded:doLoadAsAutoloaded] |
|
289 |
ifFalse: |
|
290 |
["Old API" |
|
291 |
Smalltalk |
|
292 |
loadPackageWithId:aPackageId |
|
293 |
fromDirectory:packageDir |
|
294 |
asAutoloaded:doLoadAsAutoloaded |
|
295 |
]. |
|
539 | 296 |
] ifFalse:[false] |
297 |
]. |
|
298 |
||
665 | 299 |
(SVNSourceCodeManager loadInProgressQuery query == true) |
539 | 300 |
ifTrue:[loadBlock value] |
301 |
ifFalse:[ |
|
665 | 302 |
SVNSourceCodeManager loadInProgressQuery |
539 | 303 |
answer: true |
304 |
do:[ |
|
305 |
SVN::ProgressDialog |
|
306 |
openOn: loadBlock |
|
307 |
title: ' Loading...' |
|
308 |
subtitle: aPackageId asText allItalic |
|
309 |
] |
|
310 |
]. |
|
311 |
||
541 | 312 |
^ retval |
539 | 313 |
|
314 |
"Created: / 09-04-2009 / 17:20:01 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
665 | 315 |
"Modified: / 25-04-2011 / 15:20:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
539 | 316 |
! ! |
317 |
||
571
28a4f762f3e8
added: #revisionInfoFromString:
Claus Gittinger <cg@exept.de>
parents:
570
diff
changeset
|
318 |
!SVNSourceCodeManager class methodsFor:'source code administration'! |
28a4f762f3e8
added: #revisionInfoFromString:
Claus Gittinger <cg@exept.de>
parents:
570
diff
changeset
|
319 |
|
665 | 320 |
getExistingContainersInModule:aModule directory:aPackage |
321 |
"{ Pragma: +optSpace }" |
|
322 |
||
323 |
^ self shouldImplement |
|
324 |
! |
|
325 |
||
326 |
getExistingDirectoriesInModule:aModule |
|
327 |
"{ Pragma: +optSpace }" |
|
328 |
||
329 |
^ self shouldImplement |
|
330 |
! |
|
331 |
||
332 |
getExistingModules |
|
333 |
"{ Pragma: +optSpace }" |
|
334 |
||
335 |
^ self shouldImplement |
|
336 |
! |
|
337 |
||
571
28a4f762f3e8
added: #revisionInfoFromString:
Claus Gittinger <cg@exept.de>
parents:
570
diff
changeset
|
338 |
revisionInfoFromString:aString |
28a4f762f3e8
added: #revisionInfoFromString:
Claus Gittinger <cg@exept.de>
parents:
570
diff
changeset
|
339 |
"{ Pragma: +optSpace }" |
28a4f762f3e8
added: #revisionInfoFromString:
Claus Gittinger <cg@exept.de>
parents:
570
diff
changeset
|
340 |
|
28a4f762f3e8
added: #revisionInfoFromString:
Claus Gittinger <cg@exept.de>
parents:
570
diff
changeset
|
341 |
"return a dictionary filled with revision info. |
28a4f762f3e8
added: #revisionInfoFromString:
Claus Gittinger <cg@exept.de>
parents:
570
diff
changeset
|
342 |
This extracts the relevant info from aString." |
28a4f762f3e8
added: #revisionInfoFromString:
Claus Gittinger <cg@exept.de>
parents:
570
diff
changeset
|
343 |
|
797
48f8701af829
changed: #revisionInfoFromString:
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
344 |
^ SVNVersionInfo fromSVNString:aString |
571
28a4f762f3e8
added: #revisionInfoFromString:
Claus Gittinger <cg@exept.de>
parents:
570
diff
changeset
|
345 |
|
28a4f762f3e8
added: #revisionInfoFromString:
Claus Gittinger <cg@exept.de>
parents:
570
diff
changeset
|
346 |
" |
797
48f8701af829
changed: #revisionInfoFromString:
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
347 |
self revisionInfoFromString:(Array version_SVN) |
48f8701af829
changed: #revisionInfoFromString:
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
348 |
self revisionInfoFromString:(stx_libbasic2 extensionsVersion_SVN) |
571
28a4f762f3e8
added: #revisionInfoFromString:
Claus Gittinger <cg@exept.de>
parents:
570
diff
changeset
|
349 |
" |
28a4f762f3e8
added: #revisionInfoFromString:
Claus Gittinger <cg@exept.de>
parents:
570
diff
changeset
|
350 |
|
797
48f8701af829
changed: #revisionInfoFromString:
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
351 |
"Modified (comment): / 29-09-2011 / 21:54:26 / cg" |
571
28a4f762f3e8
added: #revisionInfoFromString:
Claus Gittinger <cg@exept.de>
parents:
570
diff
changeset
|
352 |
! ! |
28a4f762f3e8
added: #revisionInfoFromString:
Claus Gittinger <cg@exept.de>
parents:
570
diff
changeset
|
353 |
|
665 | 354 |
!SVNSourceCodeManager class methodsFor:'subclass responsibility'! |
355 |
||
356 |
reportHistoryLogSince:timeGoal filterSTSources:filter filterUser:userFilter filterRepository:repositoryFilter filterModules:moduleFilter inTo:aBlock |
|
357 |
"superclass AbstractSourceCodeManager class says that I am responsible to implement this method" |
|
358 |
||
359 |
^ self shouldImplement |
|
360 |
! ! |
|
361 |
||
378 | 362 |
!SVNSourceCodeManager class methodsFor:'testing'! |
363 |
||
364 |
isSVN |
|
365 |
^ true |
|
366 |
! ! |
|
367 |
||
368 |
!SVNSourceCodeManager class methodsFor:'documentation'! |
|
369 |
||
851
32edde5d1f19
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
797
diff
changeset
|
370 |
version |
32edde5d1f19
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
797
diff
changeset
|
371 |
^ '$Header$' |
32edde5d1f19
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
797
diff
changeset
|
372 |
! |
32edde5d1f19
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
797
diff
changeset
|
373 |
|
665 | 374 |
version_SVN |
375 |
^ '§Id§' |
|
378 | 376 |
! ! |