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