author | Claus Gittinger <cg@exept.de> |
Fri, 18 Nov 2016 16:14:26 +0100 | |
changeset 1180 | 92753f6cc822 |
parent 972 | f04418e4ea45 |
permissions | -rw-r--r-- |
692 | 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 |
" |
|
446 | 26 |
"{ Package: 'stx:libsvn' }" |
66 | 27 |
|
28 |
"{ NameSpace: SVN }" |
|
29 |
||
30 |
CVSTask subclass:#ImportFromCVSTask |
|
31 |
instanceVariableNames:'svnRoot' |
|
32 |
classVariableNames:'SVNRoot' |
|
33 |
poolDictionaries:'' |
|
34 |
category:'SVN-Tasks' |
|
35 |
! |
|
36 |
||
692 | 37 |
!ImportFromCVSTask 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 |
! ! |
|
66 | 67 |
|
68 |
!ImportFromCVSTask class methodsFor:'accessing'! |
|
69 |
||
70 |
svnRoot |
|
71 |
||
72 |
^SVNRoot |
|
73 |
||
74 |
" |
|
75 |
self svnRoot |
|
692 | 76 |
self svnRoot: '/home/jv/Projects/SmalltalkX/sandbox/svn' |
66 | 77 |
" |
78 |
||
79 |
"Created: / 25-05-2009 / 21:06:59 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
80 |
"Modified: / 29-05-2009 / 16:47:01 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
692 | 81 |
"Modified: / 19-11-2009 / 21:22:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
66 | 82 |
! |
83 |
||
84 |
svnRoot: aString |
|
85 |
||
86 |
SVNRoot := aString |
|
87 |
||
88 |
" |
|
89 |
self svnRoot |
|
692 | 90 |
self svnRoot: '/home/jv/Projects/SmalltalkX/sandbox/svn' |
91 |
||
92 |
USE THIS IN JV BOX (because of encryption) |
|
93 |
||
94 |
self svnRoot: '/tmp/migrated_svn_repos' |
|
66 | 95 |
" |
96 |
||
97 |
"Created: / 25-05-2009 / 21:07:14 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
98 |
"Modified: / 26-05-2009 / 18:26:37 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
692 | 99 |
"Modified: / 14-04-2011 / 19:45:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
66 | 100 |
! ! |
101 |
||
102 |
!ImportFromCVSTask class methodsFor:'examples'! |
|
103 |
||
104 |
migrate_eXept_repository |
|
105 |
self import:#( #'stx:libbasic' |
|
106 |
#'stx:libbasic2' |
|
107 |
#'stx:libbasic3' |
|
108 |
#'stx:libcomp' ) |
|
109 |
logOn:'/tmp/migrate_eXept.log' |
|
110 |
||
111 |
" |
|
112 |
SVN::CVSMigrationTool migrate_eXept_repository" |
|
113 |
"Created: / 26-05-2009 / 17:34:08 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
114 |
! |
|
115 |
||
116 |
migrate_eXept_repository_tinytalk |
|
117 |
self import:#( #'stx:libbasic' |
|
118 |
#'stx:libbasic2' |
|
119 |
#'stx:libbasic3' |
|
120 |
#'stx:libcomp' |
|
121 |
#'stx:projects/tinytalk' ) |
|
122 |
logOn:'/tmp/migrate_eXept.log' |
|
123 |
||
124 |
" |
|
125 |
SVN::CVSMigrationTool migrate_eXept_repository_tinytalk" |
|
126 |
"Created: / 27-05-2009 / 10:08:30 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
127 |
! |
|
128 |
||
692 | 129 |
migrate_eXpecco |
130 |
||
131 |
self import:#'exept:expecco' |
|
132 |
||
133 |
" |
|
134 |
SVN::CVSTask cvsRoot: '/home/jv/Repositories/mirrors/exept2.sytes.net/cvs/stx'. |
|
135 |
SVN::ImportFromCVSTask svnRoot: '/tmp/migrated_svn_repos'. |
|
136 |
||
137 |
SVN::ImportFromCVSTask migrate_eXpecco |
|
138 |
" |
|
139 |
||
140 |
"Modified: / 26-05-2009 / 18:22:16 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
141 |
"Modified: / 26-08-2010 / 11:16:11 / Jan Vrany <enter your email here>" |
|
142 |
"Created: / 14-04-2011 / 14:39:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
143 |
"Modified: / 14-04-2011 / 17:59:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
144 |
! |
|
145 |
||
66 | 146 |
migrate_stx_libbasic2 |
147 |
self import:#'stx:libbasic2' |
|
148 |
||
149 |
" |
|
692 | 150 |
SVN::ImportFromCVSTask migrate_stx_libbasic2 |
151 |
" |
|
152 |
||
66 | 153 |
"Created: / 25-05-2009 / 19:41:52 / Jan Vrany <vranyj1@fel.cvut.cz>" |
154 |
"Modified: / 27-05-2009 / 10:09:43 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
692 | 155 |
"Modified: / 26-08-2010 / 11:16:26 / Jan Vrany <enter your email here>" |
66 | 156 |
! |
157 |
||
972
f04418e4ea45
more examples for ImportFromCVS task
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
820
diff
changeset
|
158 |
migrate_stx_libbasic3 |
f04418e4ea45
more examples for ImportFromCVS task
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
820
diff
changeset
|
159 |
self import:#'stx:libbasic3' |
f04418e4ea45
more examples for ImportFromCVS task
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
820
diff
changeset
|
160 |
|
f04418e4ea45
more examples for ImportFromCVS task
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
820
diff
changeset
|
161 |
" |
f04418e4ea45
more examples for ImportFromCVS task
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
820
diff
changeset
|
162 |
SVN::ImportFromCVSTask migrate_stx_libbasic3 |
f04418e4ea45
more examples for ImportFromCVS task
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
820
diff
changeset
|
163 |
" |
f04418e4ea45
more examples for ImportFromCVS task
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
820
diff
changeset
|
164 |
|
f04418e4ea45
more examples for ImportFromCVS task
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
820
diff
changeset
|
165 |
"Created: / 27-01-2012 / 22:48:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
f04418e4ea45
more examples for ImportFromCVS task
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
820
diff
changeset
|
166 |
! |
f04418e4ea45
more examples for ImportFromCVS task
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
820
diff
changeset
|
167 |
|
66 | 168 |
migrate_stx_libtool |
692 | 169 |
self import:#'stx:libtool' |
66 | 170 |
|
171 |
" |
|
692 | 172 |
SVN::ImportFromCVSTask migrate_stx_libtool |
173 |
" |
|
174 |
||
66 | 175 |
"Created: / 25-05-2009 / 22:12:53 / Jan Vrany <vranyj1@fel.cvut.cz>" |
176 |
"Modified: / 26-05-2009 / 18:22:16 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
692 | 177 |
"Modified: / 26-08-2010 / 11:16:11 / Jan Vrany <enter your email here>" |
178 |
"Modified: / 14-04-2011 / 18:10:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
179 |
! |
|
180 |
||
181 |
migrate_workflow |
|
182 |
||
183 |
self import:#'exept:workflow' |
|
184 |
||
185 |
" |
|
186 |
SVN::CVSTask cvsRoot: '/home/jv/Repositories/mirrors/exept2.sytes.net/cvs/stx'. |
|
187 |
SVN::ImportFromCVSTask svnRoot: '/home/jv/Projects/SmalltalkX/sandbox/svn'. |
|
188 |
||
189 |
SVN::ImportFromCVSTask migrate_eXpecco |
|
190 |
" |
|
191 |
||
192 |
"Modified: / 26-05-2009 / 18:22:16 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
193 |
"Modified: / 26-08-2010 / 11:16:11 / Jan Vrany <enter your email here>" |
|
194 |
"Created: / 14-04-2011 / 17:58:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
66 | 195 |
! ! |
196 |
||
197 |
!ImportFromCVSTask class methodsFor:'migration'! |
|
198 |
||
199 |
import:pkgs |
|
200 |
^ self doFor:pkgs |
|
201 |
||
202 |
"Created: / 28-05-2009 / 11:08:54 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
203 |
! |
|
204 |
||
205 |
import:pkgs logOn:log |
|
206 |
^ self doFor:pkgs logOn:log |
|
207 |
||
208 |
"Created: / 28-05-2009 / 11:09:06 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
209 |
! ! |
|
210 |
||
692 | 211 |
!ImportFromCVSTask class methodsFor:'others'! |
212 |
||
213 |
version_CVS |
|
820
c88213cf7fd9
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
692
diff
changeset
|
214 |
^ '$Header$' |
692 | 215 |
! ! |
216 |
||
66 | 217 |
!ImportFromCVSTask methodsFor:'executing'! |
218 |
||
219 |
do |
|
220 |
self notify:'Importing package ' , package. |
|
692 | 221 |
|
222 |
(svnRoot construct:packageDir) exists ifFalse:[ |
|
66 | 223 |
self |
224 |
doChecks; |
|
225 |
doPrepareRepositories; |
|
692 | 226 |
doCVS2SVN. |
227 |
]. |
|
228 |
self |
|
66 | 229 |
doSVNFixPackageContent; |
230 |
doCleanup. |
|
231 |
self notify:'Package ' , package , ' imported' |
|
232 |
||
233 |
"Created: / 29-05-2009 / 18:05:01 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
234 |
"Modified: / 31-05-2009 / 10:17:18 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
692 | 235 |
"Modified: / 14-04-2011 / 17:30:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
66 | 236 |
! |
237 |
||
238 |
doCVS2SVN |
|
239 |
||
240 |
| cvs2svn | |
|
241 |
||
242 |
||
243 |
self notify: 'Importing CVS repository into SVN'. |
|
244 |
||
245 |
(svnRoot construct:packageDir) directory recursiveMakeDirectory. |
|
246 |
cvs2svn := OSProcess new |
|
247 |
executable: '/usr/bin/cvs2svn'; |
|
692 | 248 |
arguments: (#( |
249 |
'--quiet' '--quiet' |
|
250 |
"/'--use-cvs' |
|
251 |
'--use-rcs' |
|
252 |
'--encoding=ascii' |
|
253 |
'--encoding=utf8' |
|
254 |
'--encoding=latin_1' |
|
255 |
'--encoding=iso8859_2') , |
|
256 |
(Array with: '--tmpdir=' , (tmpDir construct:'cvs2svn-tmp') pathName) , |
|
257 |
(Array with: '--svnrepos' with: (svnRoot construct: packageDir) pathName) , |
|
258 |
(Array with: (cvsRoot construct: packageDir) pathName)); |
|
66 | 259 |
stdout: transcript; |
260 |
stderr: transcript. |
|
261 |
||
262 |
cvs2svn execute. |
|
263 |
self |
|
264 |
assert: cvs2svn exitValue = 0 |
|
265 |
message: 'cvs2svn failed to finish properly. Check transcript'. |
|
266 |
||
267 |
"Created: / 29-05-2009 / 18:05:42 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
268 |
"Modified: / 19-08-2009 / 11:48:19 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
692 | 269 |
"Modified: / 26-08-2010 / 11:15:42 / Jan Vrany <enter your email here>" |
66 | 270 |
! |
271 |
||
272 |
doChecks |
|
273 |
||
274 |
self notify: 'Checking repositories'. |
|
275 |
||
276 |
self |
|
277 |
assert:cvsRoot exists |
|
278 |
message:'cvsRoot does not exist'; |
|
279 |
||
280 |
assert:(cvsRoot construct:'CVSROOT') exists |
|
281 |
message:'cvsRoot seems not to be a valid CVS root (no CVSROOT directory)'; |
|
282 |
||
283 |
assert:(cvsRoot construct:packageDir) exists |
|
284 |
message:'cvsRoot seems does not contain given package'; |
|
285 |
||
286 |
assert:svnRoot exists |
|
287 |
message:'svnRoot does not exist'; |
|
288 |
||
692 | 289 |
"/ assert:(svnRoot construct:packageDir) exists not |
290 |
"/ message:'SVN repository already exists in svnRoot'; |
|
291 |
||
292 |
yourself. |
|
66 | 293 |
|
294 |
"Created: / 29-05-2009 / 17:18:57 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
295 |
"Modified: / 30-05-2009 / 16:03:29 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
692 | 296 |
"Modified: / 14-04-2011 / 17:30:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
66 | 297 |
! |
298 |
||
299 |
doPrepareRepositories |
|
300 |
self doCVSRemoveDuplicateCommaVFilesInAttic |
|
301 |
||
302 |
"Created: / 29-05-2009 / 18:02:49 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
303 |
! |
|
304 |
||
305 |
doSVNFixPackageContent |
|
692 | 306 |
|
307 |
| trunk | |
|
308 |
trunk := workingCopy path. |
|
309 |
||
66 | 310 |
self |
311 |
doSVNCheckout; |
|
692 | 312 |
doFixPackageContentIn: trunk; |
66 | 313 |
doSVNCommit |
314 |
||
315 |
"Created: / 29-05-2009 / 18:06:35 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
316 |
"Modified: / 19-08-2009 / 11:26:38 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
692 | 317 |
"Modified: / 14-04-2011 / 17:57:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
66 | 318 |
! ! |
319 |
||
320 |
!ImportFromCVSTask methodsFor:'executing - private'! |
|
321 |
||
322 |
doCVSRemoveDuplicateCommaVFilesInAttic |
|
323 |
||
324 |
self notify: 'Removing duplicate *,v files in Attic'. |
|
325 |
||
326 |
self doRemoveDuplicateCommaVFilesInAtticIn:(cvsRoot construct:packageDir). |
|
327 |
||
328 |
"Created: / 25-05-2009 / 22:28:16 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
329 |
"Modified: / 30-05-2009 / 16:04:36 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
330 |
! ! |
|
331 |
||
332 |
!ImportFromCVSTask methodsFor:'initialization'! |
|
333 |
||
334 |
initialize |
|
335 |
||
336 |
super initialize. |
|
337 |
svnRoot := self class svnRoot asFilename. |
|
338 |
||
339 |
"Created: / 28-05-2009 / 09:06:08 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
340 |
! ! |
|
341 |
||
342 |
!ImportFromCVSTask methodsFor:'private'! |
|
343 |
||
344 |
removeFiles: filenames |
|
692 | 345 |
|
346 |
| filenamesToDelete | |
|
347 |
filenamesToDelete := filenames |
|
348 |
select:[:each| (workingCopy path / each) exists]. |
|
349 |
||
350 |
filenamesToDelete isEmpty ifFalse:[ |
|
351 |
(DeleteCommand new) |
|
352 |
workingCopy: workingCopy; |
|
353 |
paths: filenamesToDelete; |
|
354 |
execute] |
|
66 | 355 |
|
356 |
"Created: / 30-05-2009 / 16:09:50 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
357 |
"Modified: / 19-08-2009 / 11:28:06 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
692 | 358 |
"Modified: / 19-11-2009 / 21:34:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
66 | 359 |
! |
360 |
||
692 | 361 |
renameFile: oldFilename to: newFilename |
362 |
||
363 |
newFilename exists ifFalse:[ |
|
66 | 364 |
(MoveCommand new) |
365 |
workingCopy: workingCopy; |
|
366 |
src: oldFilename pathName; |
|
367 |
dst: newFilename pathName; |
|
368 |
execute. |
|
692 | 369 |
] |
66 | 370 |
|
371 |
"Created: / 30-05-2009 / 16:09:10 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
372 |
"Modified: / 19-08-2009 / 11:28:13 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
692 | 373 |
"Modified: / 28-07-2010 / 22:37:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
66 | 374 |
! |
375 |
||
376 |
svnBranchPath |
|
377 |
"raise an error: must be redefined in concrete subclass(es)" |
|
378 |
||
692 | 379 |
^'trunk' |
66 | 380 |
|
381 |
"Modified: / 19-08-2009 / 11:18:34 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
692 | 382 |
"Modified: / 14-04-2011 / 17:45:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
66 | 383 |
! |
384 |
||
385 |
svnCommitMessage |
|
386 |
^ 'Manufactured by SVN::ImportFromCVSTask to fix repository layout' |
|
387 |
||
388 |
"Modified: / 30-05-2009 / 16:15:57 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
389 |
! |
|
390 |
||
391 |
svnRepositoryUrl |
|
692 | 392 |
^ 'file://' , (svnRoot asAbsoluteFilename construct:packageDir) pathName , '/%(BRANCH)' |
66 | 393 |
|
394 |
"Modified: / 19-08-2009 / 11:09:25 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
692 | 395 |
"Modified: / 14-04-2011 / 17:44:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
66 | 396 |
! ! |
397 |
||
398 |
!ImportFromCVSTask class methodsFor:'documentation'! |
|
399 |
||
400 |
version |
|
820
c88213cf7fd9
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
692
diff
changeset
|
401 |
^ '$Header$' |
138 | 402 |
! |
403 |
||
404 |
version_SVN |
|
820
c88213cf7fd9
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
692
diff
changeset
|
405 |
^ '§Id: SVN__ImportFromCVSTask.st 362 2011-08-08 13:07:42Z vranyj1 §' |
66 | 406 |
! ! |