40
|
1 |
"{ Package: 'cvut:stx/goodies/libsvn' }"
|
|
2 |
|
|
3 |
"{ NameSpace: SVN }"
|
|
4 |
|
|
5 |
Entry subclass:#WCEntry
|
|
6 |
instanceVariableNames:'wc status'
|
|
7 |
classVariableNames:''
|
|
8 |
poolDictionaries:''
|
|
9 |
category:'SVN-Working copy'
|
|
10 |
!
|
|
11 |
|
|
12 |
!WCEntry class methodsFor:'documentation'!
|
|
13 |
|
|
14 |
version_SVN
|
|
15 |
^'$Id$'
|
|
16 |
! !
|
|
17 |
|
|
18 |
!WCEntry class methodsFor:'instance creation'!
|
|
19 |
|
|
20 |
path: aString
|
|
21 |
|
|
22 |
^self new
|
|
23 |
path: aString;
|
|
24 |
yourself
|
|
25 |
|
|
26 |
"Created: / 27-08-2009 / 08:19:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
27 |
!
|
|
28 |
|
|
29 |
readFromXml: aXMLNode
|
|
30 |
|
|
31 |
self assert: (aXMLNode isKindOf: XML::Node).
|
|
32 |
^self new readFromXml: aXMLNode
|
|
33 |
|
|
34 |
"Created: / 18-08-2009 / 14:27:46 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
35 |
! !
|
|
36 |
|
|
37 |
!WCEntry methodsFor:'accessing'!
|
|
38 |
|
|
39 |
readStream
|
|
40 |
|
|
41 |
^self asFilename readStream
|
|
42 |
|
|
43 |
"Created: / 27-08-2009 / 09:52:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
44 |
!
|
|
45 |
|
|
46 |
status
|
|
47 |
^ status
|
|
48 |
|
|
49 |
"Created: / 17-08-2009 / 17:39:47 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
50 |
!
|
|
51 |
|
|
52 |
wc
|
|
53 |
^ wc
|
|
54 |
!
|
|
55 |
|
|
56 |
wc:aSVNWorkingCopy
|
|
57 |
wc := aSVNWorkingCopy.
|
|
58 |
! !
|
|
59 |
|
|
60 |
!WCEntry methodsFor:'conversion'!
|
|
61 |
|
|
62 |
asFilename
|
|
63 |
|
|
64 |
^wc path / path
|
|
65 |
|
|
66 |
"Created: / 27-08-2009 / 09:52:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
67 |
! !
|
|
68 |
|
|
69 |
!WCEntry methodsFor:'initialization'!
|
|
70 |
|
|
71 |
readFromXml: xmlNode
|
|
72 |
|
|
73 |
path := xmlNode @ 'path'.
|
|
74 |
status := Status withName: (xmlNode / 'wc-status' @ 'item').
|
|
75 |
(status isUnversioned or:[status isAdded]) ifFalse:
|
|
76 |
[| commitNode |
|
|
77 |
commitNode := xmlNode / 'wc-status' / 'commit'.
|
|
78 |
revision := (commitNode first
|
|
79 |
valueOfAttribute: 'revision'
|
|
80 |
ifAbsent:[self error:'No revision attribute!!']) asNumber.
|
|
81 |
author := (commitNode / 'author') characterData.
|
|
82 |
date := Timestamp readISO8601From: (commitNode / 'date') characterData]
|
|
83 |
|
|
84 |
"Modified: / 06-04-2008 / 21:36:51 / janfrog"
|
|
85 |
"Created: / 18-08-2009 / 14:28:19 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
86 |
! !
|
|
87 |
|
|
88 |
!WCEntry methodsFor:'presentation'!
|
|
89 |
|
|
90 |
pathText
|
|
91 |
|
|
92 |
^status isNormal
|
|
93 |
ifTrue:[path]
|
|
94 |
ifFalse:[path asText allBold]
|
|
95 |
|
|
96 |
"Created: / 11-04-2008 / 11:28:03 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
97 |
!
|
|
98 |
|
|
99 |
statusIcon
|
|
100 |
^ status icon
|
|
101 |
|
|
102 |
"Created: / 17-08-2009 / 17:40:17 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
103 |
! !
|
|
104 |
|
|
105 |
!WCEntry methodsFor:'printing & storing'!
|
|
106 |
|
|
107 |
printOn: stream
|
|
108 |
|
|
109 |
stream
|
|
110 |
space; nextPutAll: 'path: '; nextPutAll: path; cr;
|
|
111 |
space; nextPutAll: 'status: '; nextPutAll: status printString; cr.
|
|
112 |
status isUnversioned ifFalse:[
|
|
113 |
stream
|
|
114 |
space; nextPutAll: 'revision: '; nextPutAll: revision printString; cr;
|
|
115 |
space; nextPutAll: 'author: '; nextPutAll: author ? '<unknown>'; cr;
|
|
116 |
space; nextPutAll: 'date: '; nextPutAll: date printString; cr]
|
|
117 |
|
|
118 |
"Created: / 16-03-2008 / 08:18:05 / janfrog"
|
|
119 |
"Modified: / 11-04-2008 / 09:47:51 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
120 |
! !
|
|
121 |
|
|
122 |
!WCEntry methodsFor:'queries'!
|
|
123 |
|
|
124 |
sourceClassName
|
|
125 |
|
|
126 |
"Guess name of the class contained in this source. Guess is based only
|
|
127 |
on file name"
|
|
128 |
|
|
129 |
| name |
|
|
130 |
name := path copyFrom:(path lastIndexOf: $/) + 1 to: (path size - self sourceLanguage sourceFileSuffix size) - 1.
|
|
131 |
name := name replaceAll:$_ with: $:.
|
|
132 |
^name asSymbol
|
|
133 |
|
|
134 |
"Created: / 27-08-2009 / 08:40:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
135 |
!
|
|
136 |
|
|
137 |
sourceLanguage
|
|
138 |
|
|
139 |
"Guess language of source, nil if not language guessed. Current
|
|
140 |
implementation is bit stupid - guess language by file suffix"
|
|
141 |
|
|
142 |
ProgrammingLanguage allDo:
|
|
143 |
[:lang|(path endsWith: lang sourceFileSuffix) ifTrue:[^lang]].
|
|
144 |
^nil
|
|
145 |
|
|
146 |
"Created: / 27-08-2009 / 08:42:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
147 |
! !
|
|
148 |
|
|
149 |
!WCEntry methodsFor:'testing'!
|
|
150 |
|
|
151 |
isDirEntry
|
|
152 |
|
|
153 |
^kind isDir
|
|
154 |
|
|
155 |
"Created: / 27-08-2009 / 08:38:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
156 |
!
|
|
157 |
|
|
158 |
isFileEntry
|
|
159 |
|
|
160 |
^kind isFile
|
|
161 |
|
|
162 |
"Created: / 27-08-2009 / 08:26:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
163 |
!
|
|
164 |
|
|
165 |
isSourceFileEntry
|
|
166 |
|
|
167 |
^self isFile and: [self sourceLanguage notNil]
|
|
168 |
|
|
169 |
"Created: / 27-08-2009 / 08:38:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
170 |
! !
|
|
171 |
|
|
172 |
!WCEntry class methodsFor:'documentation'!
|
|
173 |
|
|
174 |
version
|
|
175 |
^ '$Header$'
|
|
176 |
! !
|