66
|
1 |
"{ Package: 'cvut:stx/goodies/libsvn' }"
|
|
2 |
|
|
3 |
"{ NameSpace: SVN }"
|
|
4 |
|
|
5 |
CVSTask subclass:#ImportFromCVSTask
|
|
6 |
instanceVariableNames:'svnRoot'
|
|
7 |
classVariableNames:'SVNRoot'
|
|
8 |
poolDictionaries:''
|
|
9 |
category:'SVN-Tasks'
|
|
10 |
!
|
|
11 |
|
|
12 |
!ImportFromCVSTask class methodsFor:'documentation'!
|
|
13 |
|
|
14 |
version_SVN
|
|
15 |
^'$Id$'
|
|
16 |
! !
|
|
17 |
|
|
18 |
!ImportFromCVSTask class methodsFor:'accessing'!
|
|
19 |
|
|
20 |
svnRoot
|
|
21 |
|
|
22 |
^SVNRoot
|
|
23 |
|
|
24 |
"
|
|
25 |
self svnRoot
|
|
26 |
self svnRoot: '/home/janfrog/Projects/SmalltalkX/sandbox/svn'
|
|
27 |
"
|
|
28 |
|
|
29 |
"Created: / 25-05-2009 / 21:06:59 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
30 |
"Modified: / 29-05-2009 / 16:47:01 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
31 |
!
|
|
32 |
|
|
33 |
svnRoot: aString
|
|
34 |
|
|
35 |
SVNRoot := aString
|
|
36 |
|
|
37 |
"
|
|
38 |
self svnRoot
|
|
39 |
self svnRoot: '/home/janfrog/Projects/SmalltalkX/sandbox/svn'
|
|
40 |
"
|
|
41 |
|
|
42 |
"Created: / 25-05-2009 / 21:07:14 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
43 |
"Modified: / 26-05-2009 / 18:26:37 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
44 |
! !
|
|
45 |
|
|
46 |
!ImportFromCVSTask class methodsFor:'examples'!
|
|
47 |
|
|
48 |
migrate_eXept_repository
|
|
49 |
self import:#( #'stx:libbasic'
|
|
50 |
#'stx:libbasic2'
|
|
51 |
#'stx:libbasic3'
|
|
52 |
#'stx:libcomp' )
|
|
53 |
logOn:'/tmp/migrate_eXept.log'
|
|
54 |
|
|
55 |
"
|
|
56 |
SVN::CVSMigrationTool migrate_eXept_repository"
|
|
57 |
"Created: / 26-05-2009 / 17:34:08 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
58 |
!
|
|
59 |
|
|
60 |
migrate_eXept_repository_tinytalk
|
|
61 |
self import:#( #'stx:libbasic'
|
|
62 |
#'stx:libbasic2'
|
|
63 |
#'stx:libbasic3'
|
|
64 |
#'stx:libcomp'
|
|
65 |
#'stx:projects/tinytalk' )
|
|
66 |
logOn:'/tmp/migrate_eXept.log'
|
|
67 |
|
|
68 |
"
|
|
69 |
SVN::CVSMigrationTool migrate_eXept_repository_tinytalk"
|
|
70 |
"Created: / 27-05-2009 / 10:08:30 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
71 |
!
|
|
72 |
|
|
73 |
migrate_stx_libbasic2
|
|
74 |
self import:#'stx:libbasic2'
|
|
75 |
|
|
76 |
"
|
|
77 |
SVN::CVSMigrationTool migrate_stx_libbasic2"
|
|
78 |
"Created: / 25-05-2009 / 19:41:52 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
79 |
"Modified: / 27-05-2009 / 10:09:43 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
80 |
!
|
|
81 |
|
|
82 |
migrate_stx_libtool
|
|
83 |
self import:#'stx:libbasic'
|
|
84 |
|
|
85 |
"
|
|
86 |
SVN::CVSMigrationTool migrate_stx_libtool"
|
|
87 |
"Created: / 25-05-2009 / 22:12:53 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
88 |
"Modified: / 26-05-2009 / 18:22:16 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
89 |
! !
|
|
90 |
|
|
91 |
!ImportFromCVSTask class methodsFor:'migration'!
|
|
92 |
|
|
93 |
import:pkgs
|
|
94 |
^ self doFor:pkgs
|
|
95 |
|
|
96 |
"Created: / 28-05-2009 / 11:08:54 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
97 |
!
|
|
98 |
|
|
99 |
import:pkgs logOn:log
|
|
100 |
^ self doFor:pkgs logOn:log
|
|
101 |
|
|
102 |
"Created: / 28-05-2009 / 11:09:06 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
103 |
! !
|
|
104 |
|
|
105 |
!ImportFromCVSTask methodsFor:'executing'!
|
|
106 |
|
|
107 |
do
|
|
108 |
self notify:'Importing package ' , package.
|
|
109 |
self
|
|
110 |
doChecks;
|
|
111 |
doPrepareRepositories;
|
|
112 |
doCVS2SVN;
|
|
113 |
doSVNFixPackageContent;
|
|
114 |
doCleanup.
|
|
115 |
self notify:'Package ' , package , ' imported'
|
|
116 |
|
|
117 |
"Created: / 29-05-2009 / 18:05:01 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
118 |
"Modified: / 31-05-2009 / 10:17:18 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
119 |
!
|
|
120 |
|
|
121 |
doCVS2SVN
|
|
122 |
|
|
123 |
| cvs2svn |
|
|
124 |
|
|
125 |
|
|
126 |
self notify: 'Importing CVS repository into SVN'.
|
|
127 |
|
|
128 |
(svnRoot construct:packageDir) directory recursiveMakeDirectory.
|
|
129 |
cvs2svn := OSProcess new
|
|
130 |
executable: '/usr/bin/cvs2svn';
|
|
131 |
arguments: {
|
|
132 |
'--quiet'. '--quiet'.
|
|
133 |
"/'--use-cvs'.
|
|
134 |
'--use-rcs'.
|
|
135 |
'--encoding=ascii'.
|
|
136 |
'--encoding=utf8'.
|
|
137 |
'--encoding=latin_1'.
|
|
138 |
'--encoding=iso8859_2'.
|
|
139 |
'--tmpdir=' , (tmpDir construct:'cvs2svn-tmp') pathName.
|
|
140 |
'--svnrepos'. (svnRoot construct: packageDir) pathName.
|
|
141 |
|
|
142 |
(cvsRoot construct: packageDir) pathName.
|
|
143 |
};
|
|
144 |
stdout: transcript;
|
|
145 |
stderr: transcript.
|
|
146 |
|
|
147 |
cvs2svn execute.
|
|
148 |
self
|
|
149 |
assert: cvs2svn exitValue = 0
|
|
150 |
message: 'cvs2svn failed to finish properly. Check transcript'.
|
|
151 |
|
|
152 |
"Created: / 29-05-2009 / 18:05:42 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
153 |
"Modified: / 19-08-2009 / 11:48:19 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
154 |
!
|
|
155 |
|
|
156 |
doChecks
|
|
157 |
|
|
158 |
self notify: 'Checking repositories'.
|
|
159 |
|
|
160 |
self
|
|
161 |
assert:cvsRoot exists
|
|
162 |
message:'cvsRoot does not exist';
|
|
163 |
|
|
164 |
assert:(cvsRoot construct:'CVSROOT') exists
|
|
165 |
message:'cvsRoot seems not to be a valid CVS root (no CVSROOT directory)';
|
|
166 |
|
|
167 |
assert:(cvsRoot construct:packageDir) exists
|
|
168 |
message:'cvsRoot seems does not contain given package';
|
|
169 |
|
|
170 |
assert:svnRoot exists
|
|
171 |
message:'svnRoot does not exist';
|
|
172 |
|
|
173 |
assert:(svnRoot construct:packageDir) exists not
|
|
174 |
message:'SVN repository already exists in svnRoot'
|
|
175 |
|
|
176 |
"Created: / 29-05-2009 / 17:18:57 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
177 |
"Modified: / 30-05-2009 / 16:03:29 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
178 |
!
|
|
179 |
|
|
180 |
doPrepareRepositories
|
|
181 |
self doCVSRemoveDuplicateCommaVFilesInAttic
|
|
182 |
|
|
183 |
"Created: / 29-05-2009 / 18:02:49 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
184 |
!
|
|
185 |
|
|
186 |
doSVNFixPackageContent
|
|
187 |
self
|
|
188 |
doSVNCheckout;
|
|
189 |
doFixPackageContentIn: workingCopy path;
|
|
190 |
doSVNSetSvnEolStylePropertyFor: #( '*.st' );
|
|
191 |
doSVNSetSvnKeywordPropertyFor: #( '*.st' );
|
|
192 |
doSVNCommit
|
|
193 |
|
|
194 |
"Created: / 29-05-2009 / 18:06:35 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
195 |
"Modified: / 19-08-2009 / 11:26:38 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
196 |
! !
|
|
197 |
|
|
198 |
!ImportFromCVSTask methodsFor:'executing - private'!
|
|
199 |
|
|
200 |
doCVSRemoveDuplicateCommaVFilesInAttic
|
|
201 |
|
|
202 |
self notify: 'Removing duplicate *,v files in Attic'.
|
|
203 |
|
|
204 |
self doRemoveDuplicateCommaVFilesInAtticIn:(cvsRoot construct:packageDir).
|
|
205 |
|
|
206 |
"Created: / 25-05-2009 / 22:28:16 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
207 |
"Modified: / 30-05-2009 / 16:04:36 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
208 |
! !
|
|
209 |
|
|
210 |
!ImportFromCVSTask methodsFor:'initialization'!
|
|
211 |
|
|
212 |
initialize
|
|
213 |
|
|
214 |
super initialize.
|
|
215 |
svnRoot := self class svnRoot asFilename.
|
|
216 |
|
|
217 |
"Created: / 28-05-2009 / 09:06:08 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
218 |
! !
|
|
219 |
|
|
220 |
!ImportFromCVSTask methodsFor:'private'!
|
|
221 |
|
|
222 |
removeFiles: filenames
|
|
223 |
(DeleteCommand new)
|
|
224 |
workingCopy: workingCopy;
|
|
225 |
paths: filenames;
|
|
226 |
execute
|
|
227 |
|
|
228 |
"Created: / 30-05-2009 / 16:09:50 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
229 |
"Modified: / 19-08-2009 / 11:28:06 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
230 |
!
|
|
231 |
|
|
232 |
renameFile: oldFilename to: newFilename
|
|
233 |
(MoveCommand new)
|
|
234 |
workingCopy: workingCopy;
|
|
235 |
src: oldFilename pathName;
|
|
236 |
dst: newFilename pathName;
|
|
237 |
execute.
|
|
238 |
|
|
239 |
"Created: / 30-05-2009 / 16:09:10 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
240 |
"Modified: / 19-08-2009 / 11:28:13 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
241 |
!
|
|
242 |
|
|
243 |
svnBranchPath
|
|
244 |
"raise an error: must be redefined in concrete subclass(es)"
|
|
245 |
|
|
246 |
^'/trunk'
|
|
247 |
|
|
248 |
"Modified: / 19-08-2009 / 11:18:34 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
249 |
!
|
|
250 |
|
|
251 |
svnCommitMessage
|
|
252 |
^ 'Manufactured by SVN::ImportFromCVSTask to fix repository layout'
|
|
253 |
|
|
254 |
"Modified: / 30-05-2009 / 16:15:57 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
255 |
!
|
|
256 |
|
|
257 |
svnRepositoryUrl
|
|
258 |
^ 'file://' , (svnRoot asAbsoluteFilename construct:packageDir) pathName
|
|
259 |
|
|
260 |
"Modified: / 19-08-2009 / 11:09:25 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
261 |
! !
|
|
262 |
|
|
263 |
!ImportFromCVSTask class methodsFor:'documentation'!
|
|
264 |
|
|
265 |
version
|
|
266 |
^ '$Header$'
|
|
267 |
! !
|