654
|
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 |
"
|
|
26 |
"{ Package: 'stx:libsvn' }"
|
|
27 |
|
|
28 |
"{ NameSpace: SVN }"
|
|
29 |
|
|
30 |
TestResource subclass:#RepositoryResource
|
|
31 |
instanceVariableNames:'manager repositories workingcopies'
|
|
32 |
classVariableNames:''
|
|
33 |
poolDictionaries:''
|
|
34 |
category:'SVN-Tests-Resources'
|
|
35 |
!
|
|
36 |
|
|
37 |
!RepositoryResource 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 |
! !
|
|
67 |
|
|
68 |
!RepositoryResource methodsFor:'accessing'!
|
|
69 |
|
|
70 |
manager
|
|
71 |
^ manager
|
|
72 |
! !
|
|
73 |
|
|
74 |
!RepositoryResource methodsFor:'private'!
|
|
75 |
|
|
76 |
packageIdToDirectoryName: package
|
|
77 |
|
|
78 |
| dirname |
|
|
79 |
dirname := package copy asString.
|
|
80 |
dirname replaceAll:$: with:$..
|
|
81 |
dirname replaceAll:$/ with:$..
|
|
82 |
^dirname
|
|
83 |
|
|
84 |
"Created: / 09-12-2009 / 10:11:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
85 |
! !
|
|
86 |
|
|
87 |
!RepositoryResource methodsFor:'running'!
|
|
88 |
|
|
89 |
setUp
|
|
90 |
|
|
91 |
| directory |
|
|
92 |
directory := Filename newTemporaryDirectory.
|
|
93 |
repositories := (directory / 'repositories') makeDirectory; yourself.
|
|
94 |
workingcopies := (directory / 'workingcopies') makeDirectory; yourself.
|
|
95 |
|
|
96 |
manager := SVN::RepositoryManager new
|
|
97 |
configurations: OrderedCollection new;
|
|
98 |
workingCopyBase: workingcopies pathName.
|
|
99 |
|
|
100 |
"Created: / 09-12-2009 / 09:53:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
101 |
!
|
|
102 |
|
|
103 |
tearDown
|
|
104 |
|
|
105 |
repositories directoryName asFilename recursiveRemove.
|
|
106 |
manager := nil
|
|
107 |
|
|
108 |
"Created: / 09-12-2009 / 09:54:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
109 |
! !
|
|
110 |
|
|
111 |
!RepositoryResource methodsFor:'utilities'!
|
|
112 |
|
|
113 |
createRepositoryFor: package
|
|
114 |
|
|
115 |
^self createRepositoryFor: package withExtraFiles: nil
|
|
116 |
|
|
117 |
"Created: / 09-12-2009 / 10:23:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
118 |
!
|
|
119 |
|
|
120 |
createRepositoryFor: package withExtraFiles: extraFiles
|
|
121 |
|
|
122 |
| repodir repo wc |
|
|
123 |
repodir := repositories / (self packageIdToDirectoryName: package).
|
|
124 |
repodir exists ifTrue:[repodir recursiveRemove].
|
|
125 |
manager configurations addFirst:
|
|
126 |
(RepositoryConfiguration
|
|
127 |
package: package
|
|
128 |
url: 'file://' , repodir asAbsoluteFilename pathName).
|
|
129 |
manager reset.
|
|
130 |
|
|
131 |
(CreateRepositoryCommand new)
|
|
132 |
repositoryPath:repodir pathName;
|
|
133 |
execute.
|
|
134 |
|
|
135 |
|
|
136 |
repo := manager repositoryForPackage: package.
|
|
137 |
wc := repo workingCopy.
|
|
138 |
wc path exists ifTrue:[wc path recursiveRemove].
|
|
139 |
wc checkout.
|
|
140 |
|
|
141 |
|
|
142 |
self
|
|
143 |
assert: extraFiles isNilOrEmptyCollection
|
|
144 |
description: 'extra package files are not yet supported'.
|
|
145 |
|
|
146 |
(wc path / 'trunk') makeDirectory.
|
|
147 |
(wc path / 'branches') makeDirectory.
|
|
148 |
(wc path / 'tags') makeDirectory.
|
|
149 |
|
|
150 |
(Smalltalk allClassesInPackage: package) do:
|
|
151 |
[:class|class fileOutIn: wc path / 'trunk' withTimeStamp: false].
|
|
152 |
|
|
153 |
(AddCommand new)
|
|
154 |
workingCopy: wc;
|
|
155 |
paths:#( '*' );
|
|
156 |
execute.
|
|
157 |
(CommitCommand new)
|
|
158 |
workingCopy: wc;
|
|
159 |
message:'Initial commit from SVN::RepositoryResource>>createRepositoryFor:withExtraFiles:';
|
|
160 |
execute.
|
|
161 |
wc path
|
|
162 |
recursiveRemove;
|
|
163 |
makeDirectory.
|
|
164 |
manager reset
|
|
165 |
|
|
166 |
"Modified: / 19-08-2009 / 13:22:13 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
167 |
"Created: / 09-12-2009 / 10:22:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
168 |
"Modified: / 09-12-2009 / 13:09:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
169 |
!
|
|
170 |
|
|
171 |
removeRepositoryFor: package
|
|
172 |
|
|
173 |
| repodir repo wc |
|
|
174 |
repodir := repositories / (self packageIdToDirectoryName: package).
|
|
175 |
repo := manager repositoryForPackage: package.
|
|
176 |
wc := repo workingCopy.
|
|
177 |
|
|
178 |
manager configurations remove:
|
|
179 |
(manager configurations detect:[:conf|conf package = package]).
|
|
180 |
|
|
181 |
wc path recursiveRemove.
|
|
182 |
repodir recursiveRemove.
|
|
183 |
manager reset.
|
|
184 |
|
|
185 |
"Created: / 09-12-2009 / 10:37:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
186 |
! !
|
|
187 |
|
|
188 |
!RepositoryResource class methodsFor:'documentation'!
|
|
189 |
|
|
190 |
version
|
|
191 |
^ '$Header$'
|
|
192 |
!
|
|
193 |
|
|
194 |
version_CVS
|
|
195 |
^ '$Header$'
|
|
196 |
!
|
|
197 |
|
|
198 |
version_SVN
|
|
199 |
^ '§Id: SVN__RepositoryResource.st 350 2011-07-07 18:42:56Z vranyj1 §'
|
|
200 |
! !
|