author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Mon, 08 Aug 2011 15:36:37 +0200 | |
changeset 755 | e179ad6a1952 |
parent 613 | d125cb2cd63a |
child 786 | 1fe365897492 |
permissions | -rw-r--r-- |
755 | 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 |
" |
|
390 | 26 |
"{ Package: 'stx:libsvn' }" |
62 | 27 |
|
28 |
"{ NameSpace: SVN }" |
|
29 |
||
492 | 30 |
Task subclass:#CVSTask |
755 | 31 |
instanceVariableNames:'packageDir tmpDir cvsRoot transcript' |
32 |
classVariableNames:'CVSRoot' |
|
33 |
poolDictionaries:'' |
|
34 |
category:'SVN-Tasks' |
|
62 | 35 |
! |
36 |
||
755 | 37 |
!CVSTask class methodsFor:'documentation'! |
38 |
||
39 |
copyright |
|
40 |
" |
|
41 |
Copyright (c) 2007-2010 Jan Vrany |
|
42 |
Copyright (c) 2009-2010 eXept Software AG |
|
43 |
||
44 |
Permission is hereby granted, free of charge, to any person |
|
45 |
obtaining a copy of this software and associated documentation |
|
46 |
files (the 'Software'), to deal in the Software without |
|
47 |
restriction, including without limitation the rights to use, |
|
48 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
49 |
copies of the Software, and to permit persons to whom the |
|
50 |
Software is furnished to do so, subject to the following |
|
51 |
conditions: |
|
52 |
||
53 |
The above copyright notice and this permission notice shall be |
|
54 |
included in all copies or substantial portions of the Software. |
|
55 |
||
56 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
57 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
58 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
59 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
60 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
61 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
62 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
63 |
OTHER DEALINGS IN THE SOFTWARE. |
|
64 |
||
65 |
" |
|
66 |
! ! |
|
62 | 67 |
|
68 |
!CVSTask class methodsFor:'instance creation'! |
|
69 |
||
70 |
new |
|
71 |
^ self basicNew initialize. |
|
72 |
! ! |
|
73 |
||
74 |
!CVSTask class methodsFor:'accessing'! |
|
75 |
||
76 |
cvsRoot |
|
77 |
||
78 |
^CVSRoot |
|
79 |
||
80 |
" |
|
755 | 81 |
self cvsRoot |
82 |
self cvsRoot: '/home/jv/Projects/SmalltalkX/sandbox/cvs' |
|
83 |
self cvsRoot: '/home/jv/Repositories/mirrors/exept2.sytes.net/cvs/stx' |
|
62 | 84 |
" |
85 |
||
86 |
"Created: / 25-05-2009 / 19:52:04 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
87 |
"Modified: / 26-05-2009 / 18:26:31 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
755 | 88 |
"Modified: / 14-04-2011 / 19:44:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
62 | 89 |
! |
90 |
||
91 |
cvsRoot: aString |
|
92 |
||
93 |
CVSRoot := aString |
|
94 |
||
95 |
" |
|
755 | 96 |
CVSTask cvsRoot: '/home/jv/Projects/SmalltalkX/repositories/cvs' |
62 | 97 |
" |
98 |
||
99 |
"Created: / 25-05-2009 / 19:51:49 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
755 | 100 |
"Modified: / 23-09-2010 / 15:43:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
62 | 101 |
! ! |
102 |
||
103 |
!CVSTask class methodsFor:'execution'! |
|
104 |
||
492 | 105 |
doFor:packages |
62 | 106 |
self doFor:packages |
755 | 107 |
logOn:Filename defaultTempDirectoryName pathName |
108 |
, Filename separatorString , 'convert.log' |
|
62 | 109 |
|
110 |
"Created: / 26-05-2009 / 18:20:25 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
111 |
"Modified: / 28-05-2009 / 11:41:56 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
112 |
! |
|
113 |
||
492 | 114 |
doFor: pkgs logOn: log |
62 | 115 |
| transcript packages failed | |
116 |
||
117 |
packages := pkgs isString ifTrue: [ Array with: pkgs ] ifFalse: [ pkgs ]. |
|
492 | 118 |
transcript := SplittingWriteStream |
613
d125cb2cd63a
Rename SVN::Error to SVN::SvnError for stc compatibility
Stefan Vogel <sv@exept.de>
parents:
492
diff
changeset
|
119 |
on: Transcript |
d125cb2cd63a
Rename SVN::Error to SVN::SvnError for stc compatibility
Stefan Vogel <sv@exept.de>
parents:
492
diff
changeset
|
120 |
and: log asFilename writeStream. |
62 | 121 |
transcript showCR: 'Logging on ' , log asString. |
122 |
||
123 |
failed := false. |
|
492 | 124 |
|
125 |
packages do: |
|
613
d125cb2cd63a
Rename SVN::Error to SVN::SvnError for stc compatibility
Stefan Vogel <sv@exept.de>
parents:
492
diff
changeset
|
126 |
[:pkg| |
d125cb2cd63a
Rename SVN::Error to SVN::SvnError for stc compatibility
Stefan Vogel <sv@exept.de>
parents:
492
diff
changeset
|
127 |
[self new package: pkg; transcript: transcript; do] |
755 | 128 |
on: Error do: |
613
d125cb2cd63a
Rename SVN::Error to SVN::SvnError for stc compatibility
Stefan Vogel <sv@exept.de>
parents:
492
diff
changeset
|
129 |
[:ex| |
d125cb2cd63a
Rename SVN::Error to SVN::SvnError for stc compatibility
Stefan Vogel <sv@exept.de>
parents:
492
diff
changeset
|
130 |
transcript showCR: 'ERROR: Synchronization of ' , pkg , ' failed!!'. |
d125cb2cd63a
Rename SVN::Error to SVN::SvnError for stc compatibility
Stefan Vogel <sv@exept.de>
parents:
492
diff
changeset
|
131 |
ex suspendedContext fullPrintAllOn:transcript. |
755 | 132 |
OperatingSystem getLoginName = 'jv' ifTrue:[ex pass]. |
613
d125cb2cd63a
Rename SVN::Error to SVN::SvnError for stc compatibility
Stefan Vogel <sv@exept.de>
parents:
492
diff
changeset
|
133 |
failed := true]]. |
62 | 134 |
failed ifTrue: |
613
d125cb2cd63a
Rename SVN::Error to SVN::SvnError for stc compatibility
Stefan Vogel <sv@exept.de>
parents:
492
diff
changeset
|
135 |
[transcript |
d125cb2cd63a
Rename SVN::Error to SVN::SvnError for stc compatibility
Stefan Vogel <sv@exept.de>
parents:
492
diff
changeset
|
136 |
showCR:'Synchronization of one or more packages failed!!'; |
d125cb2cd63a
Rename SVN::Error to SVN::SvnError for stc compatibility
Stefan Vogel <sv@exept.de>
parents:
492
diff
changeset
|
137 |
showCR:'See the log for details']. |
62 | 138 |
|
139 |
transcript outStream2 close. |
|
140 |
||
141 |
"Created: / 26-05-2009 / 18:08:41 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
142 |
"Modified: / 19-08-2009 / 12:39:35 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
755 | 143 |
"Modified: / 14-04-2011 / 14:42:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
144 |
! ! |
|
145 |
||
146 |
!CVSTask class methodsFor:'others'! |
|
147 |
||
148 |
version_CVS |
|
149 |
^ '$Header$' |
|
62 | 150 |
! ! |
151 |
||
152 |
!CVSTask methodsFor:'accessing'! |
|
153 |
||
154 |
cvsRoot |
|
155 |
^ cvsRoot |
|
156 |
! |
|
157 |
||
158 |
cvsRoot:aStringOrFilename |
|
159 |
cvsRoot := aStringOrFilename asFilename. |
|
160 |
||
161 |
"Modified: / 25-05-2009 / 19:54:38 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
162 |
! |
|
163 |
||
164 |
obsoleteFileNames |
|
165 |
||
166 |
^#( |
|
167 |
'.cvsignore' |
|
168 |
) |
|
169 |
||
170 |
"Created: / 30-05-2009 / 15:48:32 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
171 |
"Modified: / 02-06-2009 / 13:38:33 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
172 |
! |
|
173 |
||
174 |
package |
|
175 |
^ package |
|
176 |
! |
|
177 |
||
492 | 178 |
package: aStringOrSymbol |
62 | 179 |
package := aStringOrSymbol asSymbol. |
492 | 180 |
packageDir := (aStringOrSymbol asString copyReplaceAll: $: with: $/) |
755 | 181 |
asSymbol. |
62 | 182 |
workingCopy := self svnWorkingCopy. |
183 |
||
184 |
"Modified: / 19-08-2009 / 11:26:24 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
185 |
! |
|
186 |
||
187 |
svnWorkingCopyPath |
|
188 |
^ (tmpDir construct: 'svn-working-copy') construct: (packageDir asFilename baseName) |
|
189 |
||
190 |
"Modified: / 19-08-2009 / 11:25:48 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
191 |
! |
|
192 |
||
193 |
transcript |
|
194 |
^ transcript |
|
195 |
! |
|
196 |
||
197 |
transcript:something |
|
198 |
transcript := something. |
|
199 |
! ! |
|
200 |
||
201 |
!CVSTask methodsFor:'executing'! |
|
202 |
||
203 |
doCleanup |
|
204 |
||
205 |
tmpDir recursiveRemove |
|
206 |
||
207 |
"Created: / 29-05-2009 / 17:17:20 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
208 |
! |
|
209 |
||
210 |
doFixPackageContentIn: dir |
|
211 |
||
755 | 212 |
dir baseName = '.svn' ifTrue:[^self]. |
213 |
||
62 | 214 |
self |
215 |
doRemoveObsoleteFilesIn: dir; |
|
216 |
doNormalizeClassContainerNamesIn: dir; |
|
217 |
doNormalizeEndOfLineIn: dir; |
|
755 | 218 |
doNormalizeVersionMethodIn: dir. |
219 |
||
220 |
self |
|
221 |
doSVNSetSvnEolStylePropertyIn: dir for: #( '*.st' ); |
|
222 |
doSVNSetSvnKeywordPropertyIn: dir for: #( '*.st' ). |
|
223 |
||
224 |
dir directoryContentsAsFilenames do: |
|
225 |
[:file| |
|
226 |
file isDirectory ifTrue:[self doFixPackageContentIn: file]] |
|
62 | 227 |
|
228 |
"Created: / 02-06-2009 / 17:31:18 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
755 | 229 |
"Modified: / 14-04-2011 / 20:00:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
62 | 230 |
! ! |
231 |
||
232 |
!CVSTask methodsFor:'executing - helpers'! |
|
233 |
||
492 | 234 |
doNormalizeClassContainerNamesIn: dir |
62 | 235 |
| files | |
236 |
||
237 |
self notify: 'Normalizing class container names'. |
|
238 |
files := dir directoryContentsAsFilenamesMatching: '*.st'. |
|
492 | 239 |
files do: |
755 | 240 |
[:file | |
241 |
| changeset change | |
|
242 |
changeset := ChangeSet fromFile: file. |
|
243 |
changeset isEmpty ifFalse:[change := changeset first]. |
|
244 |
(change notNil and:[change isClassDefinitionChange]) |
|
245 |
ifTrue: |
|
246 |
[ | oldName newName | |
|
62 | 247 |
|
755 | 248 |
oldName := file baseName. |
249 |
newName := (change className replaceAll: $: with: $_) , '.st'. |
|
250 |
oldName ~= newName |
|
251 |
ifTrue: |
|
252 |
[ | sed files | |
|
62 | 253 |
|
755 | 254 |
self renameFile: (dir / oldName) to: (dir / newName). |
255 |
" |
|
256 |
Also, we have to update makefiles. Grrr, I hate this |
|
257 |
build system. |
|
258 |
" |
|
259 |
files := dir directoryContentsMatching: #( 'Make.*' 'Makefile' 'makefile' '*.mak' 'abbrev.stc' ). |
|
260 |
files isEmpty ifFalse:[ |
|
261 |
sed := (OSProcess new) |
|
262 |
executable: '/bin/sed'; |
|
263 |
workdir: dir; |
|
264 |
arguments: (Array |
|
265 |
with: '-i' |
|
266 |
with: '-e' |
|
267 |
with: ('"s/' , (oldName upTo: $.) , '/' , (newName upTo: $.) , '/g"')) |
|
268 |
, (dir |
|
269 |
directoryContentsMatching: #( 'Make.*' 'Makefile' 'makefile' '*.mak' 'abbrev.stc' )); |
|
270 |
stdout: transcript; |
|
271 |
stderr: transcript. |
|
272 |
sed execute. |
|
273 |
self assert: sed exitValue = 0 |
|
274 |
message: 'sed failed to finish properly. Check transcript'. ] ] ] ]. |
|
62 | 275 |
|
276 |
"Created: / 29-05-2009 / 18:27:10 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
277 |
"Modified: / 03-06-2009 / 12:19:41 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
755 | 278 |
"Modified: / 14-04-2011 / 20:05:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
62 | 279 |
! |
280 |
||
492 | 281 |
doNormalizeEndOfLineIn: dir |
62 | 282 |
| files sed | |
283 |
||
284 |
self notify: 'Normalizing end-of-lines'. |
|
285 |
files := dir directoryContentsAsFilenames select: [:e | e suffix = 'st' ]. |
|
755 | 286 |
files isEmpty ifTrue:[^self]. |
62 | 287 |
sed := (OSProcess new) |
755 | 288 |
executable: '/bin/sed'; |
289 |
arguments: (Array |
|
290 |
with: '-i' |
|
291 |
with: '-e' |
|
292 |
with: 's/\r[^\n]/\n/g') , (files collect: [:e | e pathName ]); |
|
293 |
stdout: transcript; |
|
294 |
stderr: transcript. |
|
62 | 295 |
sed execute. |
296 |
self assert: sed exitValue = 0 |
|
755 | 297 |
message: 'sed failed to finish properly. Check transcript'. |
62 | 298 |
|
299 |
"Created: / 29-05-2009 / 18:27:21 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
300 |
"Modified: / 30-05-2009 / 16:06:18 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
301 |
! |
|
302 |
||
303 |
doNormalizeVersionMethodIn: dir |
|
304 |
||
305 |
self doNormalizeVersionMethodIn: dir doCopy: false |
|
306 |
||
307 |
"Created: / 29-05-2009 / 18:27:29 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
308 |
"Modified: / 03-06-2009 / 11:22:37 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
309 |
! |
|
310 |
||
492 | 311 |
doNormalizeVersionMethodIn: dir doCopy: doCopy |
755 | 312 |
| files sed script | |
62 | 313 |
|
314 |
self notify: 'Normalizing #version methods'. |
|
492 | 315 |
files := dir |
755 | 316 |
directoryContentsAsFilenamesMatching: #( '*.st' "/ 'Make.*' 'Makefile' 'makefile' '*.mak' '*.c' '*.cc' |
317 |
). |
|
318 |
files isEmpty ifTrue:[^self]. |
|
492 | 319 |
doCopy |
755 | 320 |
ifTrue: |
321 |
[ files do: [:f | f copyTo: (f pathName , '~') asFilename ]. |
|
322 |
files := files collect: [:f | (f pathName , '~') asFilename ] ]. |
|
323 |
files do: [:file | |
|
324 |
self doNormalizeVersionMethodInFile: file |
|
325 |
]. |
|
326 |
||
327 |
||
328 |
||
329 |
||
330 |
"/Old, probably buggy code (umlaut-remover?) |
|
331 |
"/ sed := (OSProcess new) |
|
332 |
"/ executable: '/bin/sed'; |
|
333 |
"/ arguments: (Array |
|
334 |
"/ with: '-i' |
|
335 |
"/ with: '-f' |
|
336 |
"/ with: script pathName) |
|
337 |
"/ , (files collect: [:e | e pathName ]); |
|
338 |
"/ stdout: transcript; |
|
339 |
"/ stderr: transcript. |
|
340 |
"/ sed execute. |
|
341 |
"/ self assert: sed exitValue = 0 |
|
342 |
"/ message: 'sed failed to finish properly. Check transcript'. |
|
62 | 343 |
|
344 |
"Created: / 03-06-2009 / 11:26:16 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
755 | 345 |
"Modified: / 14-04-2011 / 19:51:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
346 |
"Modified: / 05-07-2011 / 12:39:27 / jv" |
|
347 |
! |
|
348 |
||
349 |
doNormalizeVersionMethodInFile: file |
|
350 |
||
351 |
| tmp src dst line line2 versionMethodSelector | |
|
352 |
||
353 |
versionMethodSelector := nil. |
|
354 |
||
355 |
tmp := Filename newTemporary. |
|
356 |
[ |
|
357 |
src := file asFilename readStream. |
|
358 |
dst := tmp writeStream. |
|
359 |
[ src atEnd ] whileFalse:[ |
|
360 |
line := src nextLine. |
|
361 |
(line includes: '"{ Encoding: ') ifTrue:[ |
|
362 |
(line includes: '"{ Encoding: utf8') ifTrue:[ |
|
363 |
src := EncodedStream stream: src encoder: CharacterEncoder encoderForUTF8. |
|
364 |
dst := EncodedStream stream: dst encoder: CharacterEncoder encoderForUTF8. |
|
365 |
] ifFalse:[ |
|
366 |
(line includes: '"{ Encoding: iso8859-1') ifTrue:[ |
|
367 |
src := EncodedStream stream: src encoder: (CharacterEncoder encoderFor:#'iso8859-1'). |
|
368 |
dst := EncodedStream stream: dst encoder: (CharacterEncoder encoderFor:#'iso8859-1') |
|
369 |
] ifFalse:[ |
|
370 |
self error: 'Unsupported encoding in a chunk, see chunk variable'. |
|
371 |
^self. |
|
372 |
] |
|
373 |
] |
|
374 |
]. |
|
375 |
||
376 |
||
377 |
((line = 'version') or:[line startsWith: 'version_']) ifTrue:[ |
|
378 |
versionMethodSelector := line asSymbol. |
|
379 |
]. |
|
380 |
versionMethodSelector notNil ifTrue:[ |
|
381 |
(#(version version_SVN) includes: versionMethodSelector) ifTrue:[ |
|
382 |
"Fix for bad version_SVN in some .st files" |
|
383 |
line = ' ^ '' Id ''' ifTrue:[ |
|
384 |
line := ' ^ ''Id''' |
|
385 |
]. |
|
386 |
(line startsWith: ' ^ '' Id: ') ifTrue:[ |
|
387 |
line := ' ^ ''',$$,'Id: ' , (line copyFrom: 13 to: (line lastIndexOf: $') - 1) , '$'''. |
|
388 |
||
389 |
] ifFalse:[ |
|
390 |
((line startsWith: ' ^ ''$Header: ' ) and:[versionMethodSelector == #version]) ifTrue:[ |
|
391 |
line := ' ^ ''', $$ , 'Id: ' , (line copyFrom: 17 to: (line lastIndexOf: $') - 1) , ''''. |
|
392 |
]. |
|
393 |
]. |
|
394 |
||
395 |
line2 := line copyReplaceAll: (Character codePoint:16rA7) "16rA7" with: $$. |
|
396 |
(line = line2) ifFalse:[versionMethodSelector := nil]. |
|
397 |
line := line2. |
|
398 |
] ifFalse:[ |
|
399 |
line2 := line copyReplaceAll: $$ with: (Character codePoint:16rA7) "16rA7". |
|
400 |
(line = line2) ifFalse:[versionMethodSelector := nil]. |
|
401 |
line := line2. |
|
402 |
]. |
|
403 |
]. |
|
404 |
src atEnd ifFalse:[ |
|
405 |
dst nextPutLine: line. |
|
406 |
] ifTrue:[ |
|
407 |
dst nextPutAll: line. |
|
408 |
] |
|
409 |
]. |
|
410 |
src close. |
|
411 |
dst close. |
|
412 |
" |
|
413 |
tmp contents asString. |
|
414 |
" |
|
415 |
tmp moveTo: file asFilename. |
|
416 |
||
417 |
||
418 |
] ensure: [ |
|
419 |
src close. |
|
420 |
dst close. |
|
421 |
tmp exists ifTrue:[tmp remove]. |
|
422 |
] |
|
423 |
||
424 |
" |
|
425 |
SVN::CVSTask basicNew doNormalizeVersionMethodInFile: |
|
426 |
'/tmp/stx/libbasic/LongFloat.st' |
|
427 |
" |
|
428 |
||
429 |
"Created: / 05-07-2011 / 18:54:54 / jv" |
|
430 |
"Modified: / 18-07-2011 / 15:49:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
62 | 431 |
! |
432 |
||
492 | 433 |
doRemoveDuplicateCommaVFilesInAtticIn:cvsDir |
62 | 434 |
|cvsAtticDir cvsDirContents| |
435 |
||
436 |
cvsAtticDir := cvsDir construct:'Attic'. |
|
437 |
cvsDirContents := cvsDir directoryContents. |
|
438 |
cvsAtticDir exists ifTrue:[ |
|
755 | 439 |
cvsAtticDir |
440 |
directoryContentsAsFilenamesDo:[:atticFile | |
|
441 |
(cvsDirContents includes:atticFile baseName) ifTrue:[ |
|
442 |
Transcript showCR:'removing stale file ' , atticFile baseName , ' in Attic'. |
|
443 |
atticFile isDirectory |
|
444 |
ifTrue:[atticFile recursiveRemove] |
|
445 |
ifFalse:[atticFile remove] |
|
492 | 446 |
|
755 | 447 |
"/cvsAtticDir remove. |
448 |
] |
|
449 |
] |
|
62 | 450 |
]. |
492 | 451 |
cvsDir |
755 | 452 |
directoryContentsAsFilenamesDo:[:file | |
453 |
(file isDirectory and:[ file baseName ~= 'Attic' ]) ifTrue:[ |
|
454 |
self doRemoveDuplicateCommaVFilesInAtticIn:file |
|
455 |
] |
|
456 |
] |
|
62 | 457 |
|
458 |
"Created: / 25-05-2009 / 22:35:16 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
459 |
"Modified: / 26-05-2009 / 18:27:06 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
755 | 460 |
"Modified: / 14-04-2011 / 18:01:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
62 | 461 |
! |
462 |
||
463 |
doRemoveObsoleteFilesIn: dir |
|
464 |
||
465 |
self notify: 'Removing obsolete files'. |
|
466 |
self removeFiles: self obsoleteFileNames. |
|
467 |
||
468 |
"Created: / 30-05-2009 / 15:43:50 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
469 |
! |
|
470 |
||
492 | 471 |
doSVNAddFilesFor: files |
62 | 472 |
self notify: 'Adding files'. |
473 |
files isEmpty ifTrue: [ ^ self ]. |
|
474 |
(AddCommand new) |
|
755 | 475 |
workingCopy: workingCopy; |
476 |
paths: files; |
|
477 |
execute |
|
62 | 478 |
|
479 |
"Created: / 02-06-2009 / 19:01:17 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
480 |
"Modified: / 19-08-2009 / 11:26:57 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
481 |
! |
|
482 |
||
755 | 483 |
doSVNSetProperty: propName to: propValue in: dir for: files |
484 |
| | |
|
485 |
self notify: 'Setting ',propName,' property to ', propValue. |
|
486 |
(dir asFilename / '.svn') exists ifFalse:[^self]. |
|
62 | 487 |
files isEmpty ifTrue: [ ^ self ]. |
488 |
(PropsetCommand new) |
|
755 | 489 |
workingCopy: (WorkingCopy branch: workingCopy branch path: dir); |
490 |
name:propName; |
|
491 |
value: propValue; |
|
492 |
paths: files; |
|
493 |
execute |
|
62 | 494 |
|
495 |
"Modified: / 19-08-2009 / 11:27:02 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
755 | 496 |
"Created: / 14-04-2011 / 17:25:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
497 |
"Modified: / 23-04-2011 / 12:20:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
498 |
! |
|
499 |
||
500 |
doSVNSetSvnEolStylePropertyFor: files |
|
501 |
| realFiles | |
|
502 |
self notify: 'Setting svn:eol-style property to LF'. |
|
503 |
files isEmpty ifTrue: [ ^ self ]. |
|
504 |
realFiles := files select: |
|
505 |
[:each|(workingCopy path / each) isRegularFile]. |
|
506 |
realFiles isEmpty ifTrue:[^self]. |
|
507 |
(PropsetCommand new) |
|
508 |
workingCopy: workingCopy; |
|
509 |
name: 'svn:eol-style'; |
|
510 |
value: 'LF'; |
|
511 |
paths: realFiles; |
|
512 |
execute |
|
513 |
||
514 |
"Modified: / 19-08-2009 / 11:27:02 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
515 |
"Modified: / 20-11-2009 / 13:27:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
516 |
! |
|
517 |
||
518 |
doSVNSetSvnEolStylePropertyIn: dir for: files |
|
519 |
||
520 |
^self doSVNSetProperty: 'svn:eol-style' to: 'LF' in: dir for: files. |
|
521 |
||
522 |
"Modified: / 19-08-2009 / 11:27:02 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
523 |
"Modified: / 14-04-2011 / 17:26:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
62 | 524 |
! |
525 |
||
492 | 526 |
doSVNSetSvnKeywordPropertyFor: files |
755 | 527 |
|
528 |
self doSVNSetSvnKeywordPropertyIn: workingCopy path for: files. |
|
62 | 529 |
|
530 |
"Modified: / 19-08-2009 / 11:27:05 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
755 | 531 |
"Modified: / 14-04-2011 / 17:12:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
532 |
! |
|
533 |
||
534 |
doSVNSetSvnKeywordPropertyIn: dir for: files |
|
535 |
||
536 |
^self doSVNSetProperty: 'svn:keywords' to: 'Id HeadURL' in: dir for: files. |
|
537 |
||
538 |
"Modified: / 19-08-2009 / 11:27:02 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
539 |
"Created: / 14-04-2011 / 17:18:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
62 | 540 |
! ! |
541 |
||
542 |
!CVSTask methodsFor:'executing - private'! |
|
543 |
||
544 |
doSVNCheckout |
|
545 |
self notify: 'Checking out'. |
|
755 | 546 |
workingCopy checkout: SVN::Revision head full: true |
62 | 547 |
|
548 |
"Modified: / 19-08-2009 / 12:42:48 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
755 | 549 |
"Modified: / 04-05-2011 / 18:30:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
62 | 550 |
! |
551 |
||
552 |
doSVNCommit |
|
755 | 553 |
" |
554 |
FileBrowserV2 openOnDirectory: workingCopy path |
|
555 |
" |
|
556 |
||
62 | 557 |
self notify: 'Commiting'. |
558 |
(CommitCommand new) |
|
755 | 559 |
workingCopy: workingCopy; |
560 |
message: self svnCommitMessage; |
|
561 |
execute |
|
62 | 562 |
|
563 |
"Created: / 29-05-2009 / 18:13:41 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
564 |
"Modified: / 19-08-2009 / 11:28:00 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
755 | 565 |
"Modified: / 20-11-2009 / 10:11:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
62 | 566 |
! ! |
567 |
||
568 |
!CVSTask methodsFor:'initialization'! |
|
569 |
||
570 |
initialize |
|
571 |
||
572 |
cvsRoot := self class cvsRoot asFilename. |
|
573 |
tmpDir := Filename newTemporaryDirectory. |
|
574 |
||
575 |
"Modified: / 29-05-2009 / 17:13:53 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
576 |
! ! |
|
577 |
||
578 |
!CVSTask methodsFor:'private'! |
|
579 |
||
580 |
removeFiles:arg |
|
581 |
"raise an error: must be redefined in concrete subclass(es)" |
|
582 |
||
583 |
^ self subclassResponsibility |
|
584 |
! |
|
585 |
||
586 |
renameFile:arg1 to:arg2 |
|
587 |
"raise an error: must be redefined in concrete subclass(es)" |
|
588 |
||
589 |
^ self subclassResponsibility |
|
590 |
! |
|
591 |
||
592 |
svnBranch |
|
593 |
||
594 |
^Branch repository: self svnRepository path: self svnBranchPath |
|
595 |
||
596 |
"Created: / 19-08-2009 / 11:20:16 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
597 |
! |
|
598 |
||
599 |
svnBranchPath |
|
600 |
"raise an error: must be redefined in concrete subclass(es)" |
|
601 |
||
602 |
^ self subclassResponsibility |
|
603 |
||
604 |
"Created: / 19-08-2009 / 11:18:18 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
605 |
! |
|
606 |
||
607 |
svnCommitMessage |
|
608 |
"raise an error: must be redefined in concrete subclass(es)" |
|
609 |
||
610 |
^ self subclassResponsibility |
|
611 |
! |
|
612 |
||
613 |
svnRepository |
|
614 |
||
615 |
^Repository package: package url: self svnRepositoryUrl |
|
616 |
||
617 |
"Created: / 19-08-2009 / 11:12:25 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
618 |
"Modified: / 19-08-2009 / 12:23:58 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
619 |
! |
|
620 |
||
621 |
svnRepositoryUrl |
|
622 |
"raise an error: must be redefined in concrete subclass(es)" |
|
623 |
||
624 |
^ self subclassResponsibility |
|
625 |
! |
|
626 |
||
627 |
svnWorkingCopy |
|
628 |
"raise an error: must be redefined in concrete subclass(es)" |
|
629 |
||
492 | 630 |
^WorkingCopy |
755 | 631 |
branch: self svnBranch |
632 |
path: self svnWorkingCopyPath |
|
62 | 633 |
|
634 |
"Created: / 19-08-2009 / 11:23:42 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
635 |
! ! |
|
636 |
||
637 |
!CVSTask class methodsFor:'documentation'! |
|
638 |
||
639 |
version |
|
640 |
^ '$Header$' |
|
131 | 641 |
! |
642 |
||
643 |
version_CVS |
|
644 |
^ '$Header$' |
|
645 |
! |
|
646 |
||
647 |
version_SVN |
|
755 | 648 |
^ '§Id: SVN__CVSTask.st 358 2011-07-18 15:01:44Z vranyj1 §' |
62 | 649 |
! ! |