711
|
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 |
"
|
438
|
26 |
"{ Package: 'stx:libsvn' }"
|
40
|
27 |
|
|
28 |
"{ NameSpace: SVN }"
|
|
29 |
|
|
30 |
Entry subclass:#WCEntry
|
|
31 |
instanceVariableNames:'wc status'
|
|
32 |
classVariableNames:''
|
|
33 |
poolDictionaries:''
|
|
34 |
category:'SVN-Working copy'
|
|
35 |
!
|
|
36 |
|
711
|
37 |
!WCEntry 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 |
! !
|
40
|
67 |
|
|
68 |
!WCEntry class methodsFor:'instance creation'!
|
|
69 |
|
|
70 |
path: aString
|
|
71 |
|
|
72 |
^self new
|
|
73 |
path: aString;
|
|
74 |
yourself
|
|
75 |
|
|
76 |
"Created: / 27-08-2009 / 08:19:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
77 |
!
|
|
78 |
|
|
79 |
readFromXml: aXMLNode
|
|
80 |
|
|
81 |
self assert: (aXMLNode isKindOf: XML::Node).
|
|
82 |
^self new readFromXml: aXMLNode
|
|
83 |
|
|
84 |
"Created: / 18-08-2009 / 14:27:46 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
85 |
! !
|
|
86 |
|
711
|
87 |
!WCEntry class methodsFor:'others'!
|
|
88 |
|
|
89 |
version_CVS
|
|
90 |
^ '$ÂHeader: /cvs/stx/stx/libsvn/SVN__WCEntry.st,v 1.4 2009/10/19 12:23:25 fm Exp Â$'
|
|
91 |
! !
|
|
92 |
|
40
|
93 |
!WCEntry methodsFor:'accessing'!
|
|
94 |
|
711
|
95 |
directory
|
|
96 |
|
|
97 |
^self file directory
|
|
98 |
|
|
99 |
"Created: / 23-11-2009 / 17:29:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
100 |
!
|
|
101 |
|
|
102 |
file
|
|
103 |
|
|
104 |
^wc path / path
|
|
105 |
|
|
106 |
"Created: / 23-11-2009 / 17:29:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
107 |
!
|
|
108 |
|
|
109 |
fileMergeLeft
|
|
110 |
"Base"
|
|
111 |
|
|
112 |
| files revs |
|
|
113 |
files := self directory directoryContentsAsFilenamesMatching: (path , '*.r*').
|
|
114 |
files size = 0 ifTrue:[^nil].
|
|
115 |
files size ~= 2 ifTrue:[self error:'Unfinished/interrupted merge in working copy?'].
|
|
116 |
revs := files collect:[:each|(each suffix select:[:char|char isDigit]) asNumber].
|
|
117 |
^revs first < revs second
|
|
118 |
ifTrue:[files first]
|
|
119 |
ifFalse:[files second]
|
|
120 |
|
|
121 |
"Created: / 23-11-2009 / 17:32:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
122 |
"Modified: / 09-12-2009 / 21:24:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
123 |
!
|
|
124 |
|
|
125 |
fileMergeRight
|
|
126 |
"To be merged"
|
|
127 |
|
|
128 |
| files revs |
|
|
129 |
files := self directory directoryContentsAsFilenamesMatching: (path , '*.r*').
|
|
130 |
files size = 0 ifTrue:[^nil].
|
|
131 |
files size ~= 2 ifTrue:[self error:'Unfinished/interrupted merge in working copy?'].
|
|
132 |
revs := files collect:[:each|(each suffix select:[:char|char isDigit]) asNumber].
|
|
133 |
^revs first > revs second
|
|
134 |
ifTrue:[files first]
|
|
135 |
ifFalse:[files second]
|
|
136 |
|
|
137 |
"Created: / 23-11-2009 / 17:32:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
138 |
"Modified: / 09-12-2009 / 21:23:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
139 |
!
|
|
140 |
|
|
141 |
fileMergeWorking
|
|
142 |
|
|
143 |
| files |
|
|
144 |
files := self directory directoryContentsAsFilenamesMatching: (path , '.working').
|
|
145 |
files size = 0 ifTrue:[
|
|
146 |
files := self directory directoryContentsAsFilenamesMatching: (path , '.mine')].
|
|
147 |
files size = 0 ifTrue:[^nil].
|
|
148 |
files size > 1 ifTrue:[self error:'Unfinished/interrupted merge in working copy?'].
|
|
149 |
^files anyOne
|
|
150 |
|
|
151 |
"Created: / 23-11-2009 / 17:32:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
152 |
"Modified: / 09-12-2009 / 16:05:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
153 |
!
|
|
154 |
|
|
155 |
kind
|
|
156 |
|
|
157 |
kind ifNil:
|
|
158 |
[self file exists
|
|
159 |
ifFalse:
|
|
160 |
[kind := NodeKindUnknown instance]
|
|
161 |
ifTrue:
|
|
162 |
[self file isDirectory
|
|
163 |
ifTrue:[kind := NodeKindDir instance]
|
|
164 |
ifFalse:[kind := NodeKindFile instance]]].
|
|
165 |
^kind
|
|
166 |
|
|
167 |
"Created: / 24-11-2009 / 09:29:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
168 |
!
|
|
169 |
|
40
|
170 |
readStream
|
|
171 |
|
|
172 |
^self asFilename readStream
|
|
173 |
|
|
174 |
"Created: / 27-08-2009 / 09:52:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
175 |
!
|
|
176 |
|
|
177 |
status
|
|
178 |
^ status
|
|
179 |
|
|
180 |
"Created: / 17-08-2009 / 17:39:47 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
181 |
!
|
|
182 |
|
|
183 |
wc
|
|
184 |
^ wc
|
|
185 |
!
|
|
186 |
|
|
187 |
wc:aSVNWorkingCopy
|
|
188 |
wc := aSVNWorkingCopy.
|
|
189 |
! !
|
|
190 |
|
711
|
191 |
!WCEntry methodsFor:'actions - svn'!
|
|
192 |
|
|
193 |
revert
|
|
194 |
|
|
195 |
wc revert: (Array with: self path).
|
|
196 |
status := StatusNormal instance
|
|
197 |
|
|
198 |
"Created: / 05-12-2009 / 20:14:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
199 |
"Modified: / 13-02-2010 / 19:47:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
200 |
! !
|
|
201 |
|
40
|
202 |
!WCEntry methodsFor:'conversion'!
|
|
203 |
|
711
|
204 |
asChangeSet
|
|
205 |
|
|
206 |
^ChangeSet fromFile: self file pathName
|
|
207 |
|
|
208 |
"Created: / 26-11-2009 / 19:49:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
209 |
!
|
|
210 |
|
40
|
211 |
asFilename
|
|
212 |
|
711
|
213 |
^self file
|
40
|
214 |
|
|
215 |
"Created: / 27-08-2009 / 09:52:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
711
|
216 |
"Modified: / 23-11-2009 / 17:29:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
40
|
217 |
! !
|
|
218 |
|
|
219 |
!WCEntry methodsFor:'initialization'!
|
|
220 |
|
|
221 |
readFromXml: xmlNode
|
|
222 |
|
|
223 |
path := xmlNode @ 'path'.
|
|
224 |
status := Status withName: (xmlNode / 'wc-status' @ 'item').
|
711
|
225 |
(status isUnversioned or:[status isAdded or:[status isExternal]]) ifFalse:
|
40
|
226 |
[| commitNode |
|
|
227 |
commitNode := xmlNode / 'wc-status' / 'commit'.
|
|
228 |
revision := (commitNode first
|
|
229 |
valueOfAttribute: 'revision'
|
|
230 |
ifAbsent:[self error:'No revision attribute!!']) asNumber.
|
|
231 |
author := (commitNode / 'author') characterData.
|
|
232 |
date := Timestamp readISO8601From: (commitNode / 'date') characterData]
|
|
233 |
|
|
234 |
"Modified: / 06-04-2008 / 21:36:51 / janfrog"
|
|
235 |
"Created: / 18-08-2009 / 14:28:19 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
711
|
236 |
"Modified: / 09-04-2010 / 14:19:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
40
|
237 |
! !
|
|
238 |
|
|
239 |
!WCEntry methodsFor:'presentation'!
|
|
240 |
|
|
241 |
pathText
|
|
242 |
|
|
243 |
^status isNormal
|
|
244 |
ifTrue:[path]
|
|
245 |
ifFalse:[path asText allBold]
|
|
246 |
|
|
247 |
"Created: / 11-04-2008 / 11:28:03 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
248 |
!
|
|
249 |
|
|
250 |
statusIcon
|
|
251 |
^ status icon
|
|
252 |
|
|
253 |
"Created: / 17-08-2009 / 17:40:17 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
254 |
! !
|
|
255 |
|
|
256 |
!WCEntry methodsFor:'printing & storing'!
|
|
257 |
|
|
258 |
printOn: stream
|
|
259 |
|
|
260 |
stream
|
|
261 |
space; nextPutAll: 'path: '; nextPutAll: path; cr;
|
|
262 |
space; nextPutAll: 'status: '; nextPutAll: status printString; cr.
|
711
|
263 |
(status notNil and:[status isUnversioned not]) ifTrue:[
|
40
|
264 |
stream
|
|
265 |
space; nextPutAll: 'revision: '; nextPutAll: revision printString; cr;
|
|
266 |
space; nextPutAll: 'author: '; nextPutAll: author ? '<unknown>'; cr;
|
|
267 |
space; nextPutAll: 'date: '; nextPutAll: date printString; cr]
|
|
268 |
|
|
269 |
"Created: / 16-03-2008 / 08:18:05 / janfrog"
|
|
270 |
"Modified: / 11-04-2008 / 09:47:51 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
271 |
! !
|
|
272 |
|
|
273 |
!WCEntry methodsFor:'testing'!
|
|
274 |
|
|
275 |
isDirEntry
|
|
276 |
|
|
277 |
^kind isDir
|
|
278 |
|
|
279 |
"Created: / 27-08-2009 / 08:38:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
280 |
!
|
|
281 |
|
|
282 |
isFileEntry
|
|
283 |
|
|
284 |
^kind isFile
|
|
285 |
|
|
286 |
"Created: / 27-08-2009 / 08:26:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
287 |
! !
|
|
288 |
|
|
289 |
!WCEntry class methodsFor:'documentation'!
|
|
290 |
|
|
291 |
version
|
711
|
292 |
^ '$Id$'
|
168
|
293 |
!
|
|
294 |
|
|
295 |
version_SVN
|
711
|
296 |
^ '§Id: SVN__WCEntry.st 350 2011-07-07 18:42:56Z vranyj1 §'
|
40
|
297 |
! !
|