author | Claus Gittinger <cg@exept.de> |
Fri, 18 Nov 2016 16:14:26 +0100 | |
changeset 1180 | 92753f6cc822 |
parent 982 | ce6f8dd98682 |
permissions | -rw-r--r-- |
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 |
|
982 | 31 |
instanceVariableNames:'wc status include' |
40 | 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 |
|
840
33bdd246d160
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
711
diff
changeset
|
90 |
^ '$Header$' |
711 | 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 |
||
982 | 155 |
include |
156 |
"Returns true if the entry should be included in commit, false otherwise" |
|
157 |
||
158 |
^ include |
|
159 |
||
160 |
"Modified (comment): / 07-02-2012 / 23:04:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
161 |
! |
|
162 |
||
163 |
include:aBoolean |
|
164 |
"Sets whether the entry should be included in commit or not" |
|
165 |
||
166 |
include := aBoolean. |
|
167 |
||
168 |
"Modified (comment): / 07-02-2012 / 23:04:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
169 |
! |
|
170 |
||
711 | 171 |
kind |
172 |
||
173 |
kind ifNil: |
|
174 |
[self file exists |
|
175 |
ifFalse: |
|
176 |
[kind := NodeKindUnknown instance] |
|
177 |
ifTrue: |
|
178 |
[self file isDirectory |
|
179 |
ifTrue:[kind := NodeKindDir instance] |
|
180 |
ifFalse:[kind := NodeKindFile instance]]]. |
|
181 |
^kind |
|
182 |
||
183 |
"Created: / 24-11-2009 / 09:29:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
184 |
! |
|
185 |
||
40 | 186 |
readStream |
187 |
||
188 |
^self asFilename readStream |
|
189 |
||
190 |
"Created: / 27-08-2009 / 09:52:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
191 |
! |
|
192 |
||
193 |
status |
|
194 |
^ status |
|
195 |
||
196 |
"Created: / 17-08-2009 / 17:39:47 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
197 |
! |
|
198 |
||
199 |
wc |
|
200 |
^ wc |
|
201 |
! |
|
202 |
||
203 |
wc:aSVNWorkingCopy |
|
204 |
wc := aSVNWorkingCopy. |
|
205 |
! ! |
|
206 |
||
711 | 207 |
!WCEntry methodsFor:'actions - svn'! |
208 |
||
209 |
revert |
|
210 |
||
211 |
wc revert: (Array with: self path). |
|
212 |
status := StatusNormal instance |
|
213 |
||
214 |
"Created: / 05-12-2009 / 20:14:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
215 |
"Modified: / 13-02-2010 / 19:47:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
216 |
! ! |
|
217 |
||
40 | 218 |
!WCEntry methodsFor:'conversion'! |
219 |
||
711 | 220 |
asChangeSet |
221 |
||
222 |
^ChangeSet fromFile: self file pathName |
|
223 |
||
224 |
"Created: / 26-11-2009 / 19:49:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
225 |
! |
|
226 |
||
40 | 227 |
asFilename |
228 |
||
711 | 229 |
^self file |
40 | 230 |
|
231 |
"Created: / 27-08-2009 / 09:52:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
711 | 232 |
"Modified: / 23-11-2009 / 17:29:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
40 | 233 |
! ! |
234 |
||
235 |
!WCEntry methodsFor:'initialization'! |
|
236 |
||
237 |
readFromXml: xmlNode |
|
238 |
||
982 | 239 |
include := true. |
40 | 240 |
path := xmlNode @ 'path'. |
241 |
status := Status withName: (xmlNode / 'wc-status' @ 'item'). |
|
982 | 242 |
(status isUnversioned or:[status isAdded or:[status isExternal or:[status isMissing]]]) ifFalse: |
40 | 243 |
[| commitNode | |
244 |
commitNode := xmlNode / 'wc-status' / 'commit'. |
|
245 |
revision := (commitNode first |
|
246 |
valueOfAttribute: 'revision' |
|
247 |
ifAbsent:[self error:'No revision attribute!!']) asNumber. |
|
248 |
author := (commitNode / 'author') characterData. |
|
249 |
date := Timestamp readISO8601From: (commitNode / 'date') characterData] |
|
250 |
||
251 |
"Modified: / 06-04-2008 / 21:36:51 / janfrog" |
|
252 |
"Created: / 18-08-2009 / 14:28:19 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
982 | 253 |
"Modified: / 07-02-2012 / 23:04:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
40 | 254 |
! ! |
255 |
||
256 |
!WCEntry methodsFor:'presentation'! |
|
257 |
||
258 |
pathText |
|
259 |
||
260 |
^status isNormal |
|
261 |
ifTrue:[path] |
|
262 |
ifFalse:[path asText allBold] |
|
263 |
||
264 |
"Created: / 11-04-2008 / 11:28:03 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
265 |
! |
|
266 |
||
267 |
statusIcon |
|
268 |
^ status icon |
|
269 |
||
270 |
"Created: / 17-08-2009 / 17:40:17 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
271 |
! ! |
|
272 |
||
273 |
!WCEntry methodsFor:'printing & storing'! |
|
274 |
||
275 |
printOn: stream |
|
276 |
||
277 |
stream |
|
278 |
space; nextPutAll: 'path: '; nextPutAll: path; cr; |
|
279 |
space; nextPutAll: 'status: '; nextPutAll: status printString; cr. |
|
711 | 280 |
(status notNil and:[status isUnversioned not]) ifTrue:[ |
40 | 281 |
stream |
282 |
space; nextPutAll: 'revision: '; nextPutAll: revision printString; cr; |
|
283 |
space; nextPutAll: 'author: '; nextPutAll: author ? '<unknown>'; cr; |
|
284 |
space; nextPutAll: 'date: '; nextPutAll: date printString; cr] |
|
285 |
||
286 |
"Created: / 16-03-2008 / 08:18:05 / janfrog" |
|
287 |
"Modified: / 11-04-2008 / 09:47:51 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
288 |
! ! |
|
289 |
||
290 |
!WCEntry methodsFor:'testing'! |
|
291 |
||
292 |
isDirEntry |
|
293 |
||
294 |
^kind isDir |
|
295 |
||
296 |
"Created: / 27-08-2009 / 08:38:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
297 |
! |
|
298 |
||
299 |
isFileEntry |
|
300 |
||
301 |
^kind isFile |
|
302 |
||
303 |
"Created: / 27-08-2009 / 08:26:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
304 |
! ! |
|
305 |
||
306 |
!WCEntry class methodsFor:'documentation'! |
|
307 |
||
308 |
version |
|
840
33bdd246d160
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
711
diff
changeset
|
309 |
^ '$Header$' |
168 | 310 |
! |
311 |
||
312 |
version_SVN |
|
840
33bdd246d160
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
711
diff
changeset
|
313 |
^ '§Id: SVN__WCEntry.st 363 2011-08-08 13:49:48Z vranyj1 §' |
40 | 314 |
! ! |