author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Sun, 05 Feb 2012 02:51:09 +0100 | |
changeset 975 | 252400afabd6 |
parent 817 | c258e10fedc3 |
child 984 | b2a56a7b9539 |
permissions | -rw-r--r-- |
775 | 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 |
" |
|
403 | 26 |
"{ Package: 'stx:libsvn' }" |
9 | 27 |
|
28 |
"{ NameSpace: SVN }" |
|
29 |
||
30 |
Browser subclass:#WorkingCopyBrowser |
|
31 |
instanceVariableNames:'' |
|
32 |
classVariableNames:'' |
|
33 |
poolDictionaries:'' |
|
34 |
category:'SVN-UI-Browsers' |
|
35 |
! |
|
36 |
||
775 | 37 |
!WorkingCopyBrowser 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 |
!WorkingCopyBrowser class methodsFor:'instance creation'! |
|
69 |
||
70 |
on: aWorkingCopy |
|
71 |
||
72 |
^self new workingCopy: aWorkingCopy |
|
73 |
! ! |
|
9 | 74 |
|
75 |
!WorkingCopyBrowser class methodsFor:'interface specs'! |
|
76 |
||
77 |
windowSpec |
|
78 |
"This resource specification was automatically generated |
|
79 |
by the UIPainter of ST/X." |
|
80 |
||
81 |
"Do not manually edit this!! If it is corrupted, |
|
82 |
the UIPainter may not be able to read the specification." |
|
83 |
||
84 |
" |
|
775 | 85 |
UIPainter new openOnClass:SVN::WorkingCopyBrowser andSelector:#windowSpec |
86 |
SVN::WorkingCopyBrowser new openInterface:#windowSpec |
|
87 |
SVN::WorkingCopyBrowser open |
|
9 | 88 |
" |
89 |
||
90 |
<resource: #canvas> |
|
91 |
||
92 |
^ |
|
93 |
#(FullSpec |
|
94 |
name: windowSpec |
|
95 |
window: |
|
96 |
(WindowSpec |
|
97 |
label: 'Working Copy Status' |
|
98 |
name: 'Working Copy Status' |
|
99 |
min: (Point 10 10) |
|
975 | 100 |
bounds: (Rectangle 0 0 586 403) |
9 | 101 |
) |
102 |
component: |
|
103 |
(SpecCollection |
|
104 |
collection: ( |
|
105 |
(DataSetSpec |
|
106 |
name: 'WCEntryTable' |
|
107 |
layout: (LayoutFrame 0 0 0 0 0 1 -30 1) |
|
108 |
model: selectionHolder |
|
775 | 109 |
menu: entryMenu |
9 | 110 |
hasHorizontalScrollBar: true |
111 |
hasVerticalScrollBar: true |
|
112 |
dataList: workingCopyEntriesAspect |
|
113 |
useIndex: false |
|
114 |
columnHolder: wcEntryTableColumns |
|
115 |
) |
|
116 |
(CheckBoxSpec |
|
117 |
label: 'Show only changed etries' |
|
118 |
name: 'ShowOnlyChanged' |
|
975 | 119 |
layout: (LayoutFrame 0 0 -30 1 -170 1 0 1) |
9 | 120 |
model: showOnlyChanged |
121 |
translateLabel: true |
|
122 |
) |
|
975 | 123 |
(LinkButtonSpec |
124 |
label: 'Browse working copy' |
|
125 |
name: 'BrowseWC' |
|
126 |
layout: (LayoutFrame -170 1 -30 1 0 1 0 1) |
|
127 |
translateLabel: true |
|
128 |
labelChannel: browseWorkingCopyLabel |
|
129 |
adjust: right |
|
130 |
model: browseWorkingCopy |
|
131 |
) |
|
9 | 132 |
) |
133 |
||
134 |
) |
|
135 |
) |
|
136 |
! ! |
|
137 |
||
138 |
!WorkingCopyBrowser class methodsFor:'menu specs'! |
|
139 |
||
775 | 140 |
entryMenu |
9 | 141 |
"This resource specification was automatically generated |
142 |
by the MenuEditor of ST/X." |
|
143 |
||
144 |
"Do not manually edit this!! If it is corrupted, |
|
145 |
the MenuEditor may not be able to read the specification." |
|
146 |
||
147 |
" |
|
775 | 148 |
MenuEditor new openOnClass:SVN::WorkingCopyBrowser andSelector:#entryMenu |
149 |
(Menu new fromLiteralArrayEncoding:(SVN::WorkingCopyBrowser entryMenu)) startUp |
|
9 | 150 |
" |
151 |
||
152 |
<resource: #menu> |
|
153 |
||
154 |
^ |
|
155 |
#(Menu |
|
156 |
( |
|
157 |
(MenuItem |
|
775 | 158 |
label: 'Show changes' |
159 |
itemValue: entryMenuShowChanges |
|
9 | 160 |
translateLabel: true |
775 | 161 |
labelImage: (ResourceRetriever #'SVN::IconLibrary' compare 'Show changes') |
9 | 162 |
) |
163 |
(MenuItem |
|
775 | 164 |
label: '-' |
165 |
) |
|
166 |
(MenuItem |
|
167 |
label: 'Revert' |
|
168 |
itemValue: entryMenuRevert |
|
9 | 169 |
translateLabel: true |
775 | 170 |
labelImage: (ResourceRetriever #'SVN::IconLibrary' revert 'Revert') |
9 | 171 |
) |
172 |
) |
|
173 |
nil |
|
174 |
nil |
|
175 |
) |
|
775 | 176 |
! ! |
9 | 177 |
|
775 | 178 |
!WorkingCopyBrowser class methodsFor:'others'! |
179 |
||
180 |
version_CVS |
|
181 |
^ '$Header$' |
|
9 | 182 |
! ! |
183 |
||
184 |
!WorkingCopyBrowser class methodsFor:'plugIn spec'! |
|
185 |
||
186 |
aspectSelectors |
|
187 |
"This resource specification was automatically generated |
|
188 |
by the UIPainter of ST/X." |
|
189 |
||
190 |
"Do not manually edit this. If it is corrupted, |
|
191 |
the UIPainter may not be able to read the specification." |
|
192 |
||
193 |
"Return a description of exported aspects; |
|
194 |
these can be connected to aspects of an embedding application |
|
195 |
(if this app is embedded in a subCanvas)." |
|
196 |
||
197 |
^ #( |
|
198 |
#model |
|
199 |
). |
|
200 |
||
201 |
! ! |
|
202 |
||
203 |
!WorkingCopyBrowser class methodsFor:'tableColumns specs'! |
|
204 |
||
205 |
wcEntryTableColumns |
|
206 |
"This resource specification was automatically generated |
|
207 |
by the DataSetBuilder of ST/X." |
|
208 |
||
209 |
"Do not manually edit this!! If it is corrupted, |
|
210 |
the DataSetBuilder may not be able to read the specification." |
|
211 |
||
212 |
" |
|
213 |
DataSetBuilder new openOnClass:SVN::WorkingCopyStatusUI andSelector:#wcEntryTableColumns |
|
214 |
" |
|
215 |
||
216 |
<resource: #tableColumns> |
|
217 |
||
218 |
^#( |
|
219 |
(DataSetColumnSpec |
|
220 |
label: '' |
|
221 |
activeHelpKey: '' |
|
222 |
labelButtonType: Button |
|
223 |
printSelector: statusIcon |
|
224 |
canSelect: false |
|
225 |
showRowSeparator: false |
|
226 |
showColSeparator: false |
|
227 |
) |
|
228 |
(DataSetColumnSpec |
|
229 |
label: 'Container' |
|
230 |
activeHelpKey: '' |
|
231 |
labelButtonType: Button |
|
232 |
printSelector: pathText |
|
233 |
canSelect: false |
|
234 |
showRowSeparator: false |
|
235 |
showColSeparator: false |
|
236 |
) |
|
237 |
(DataSetColumnSpec |
|
238 |
label: 'Rev' |
|
239 |
activeHelpKey: '' |
|
240 |
labelButtonType: Button |
|
241 |
printSelector: revision |
|
242 |
canSelect: false |
|
243 |
showRowSeparator: false |
|
244 |
showColSeparator: false |
|
245 |
) |
|
246 |
(DataSetColumnSpec |
|
247 |
label: 'Author' |
|
248 |
activeHelpKey: '' |
|
249 |
labelButtonType: Button |
|
250 |
printSelector: author |
|
251 |
canSelect: false |
|
252 |
showRowSeparator: false |
|
253 |
showColSeparator: false |
|
254 |
) |
|
255 |
(DataSetColumnSpec |
|
256 |
label: 'Date' |
|
257 |
activeHelpKey: '' |
|
258 |
labelButtonType: Button |
|
259 |
printSelector: date |
|
260 |
canSelect: false |
|
261 |
showRowSeparator: false |
|
262 |
showColSeparator: false |
|
263 |
) |
|
264 |
) |
|
265 |
||
266 |
"Modified: / 18-08-2009 / 14:31:10 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
267 |
! ! |
|
268 |
||
269 |
!WorkingCopyBrowser methodsFor:'accessing'! |
|
270 |
||
271 |
workingCopy |
|
272 |
||
273 |
^self model |
|
274 |
||
275 |
"Created: / 11-04-2008 / 10:20:36 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
276 |
"Modified: / 12-04-2008 / 21:02:26 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
277 |
! |
|
278 |
||
279 |
workingCopy: aWorkingCopy |
|
280 |
||
281 |
self model: aWorkingCopy |
|
282 |
||
283 |
"Created: / 11-04-2008 / 10:20:22 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
284 |
"Modified: / 12-04-2008 / 21:02:34 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
285 |
! ! |
|
286 |
||
975 | 287 |
!WorkingCopyBrowser methodsFor:'actions'! |
288 |
||
289 |
browseWorkingCopy |
|
290 |
||
291 |
^UserPreferences current fileBrowserClass |
|
292 |
openOnDirectory: self workingCopy path |
|
293 |
||
294 |
"Created: / 05-02-2012 / 01:23:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
295 |
! |
|
296 |
||
297 |
browseWorkingCopyLabel |
|
298 |
||
299 |
^'Browse working copy...' asText |
|
300 |
colorizeAllWith: Color blue; |
|
301 |
actionForAll:[ self browseWorkingCopy ]; |
|
302 |
yourself |
|
303 |
||
304 |
"Created: / 05-02-2012 / 01:28:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
305 |
! ! |
|
306 |
||
9 | 307 |
!WorkingCopyBrowser methodsFor:'aspects'! |
308 |
||
309 |
showOnlyChanged |
|
310 |
||
311 |
|holder| |
|
312 |
||
313 |
(holder := builder bindingAt:#showOnlyChanged) isNil ifTrue:[ |
|
314 |
holder := true asValue. |
|
315 |
holder onChangeEvaluate: |
|
316 |
[self model changed]. |
|
317 |
builder aspectAt:#showOnlyChanged put:holder. |
|
318 |
]. |
|
319 |
^ holder. |
|
320 |
||
321 |
"Created: / 21-10-2008 / 18:53:39 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
322 |
! |
|
323 |
||
324 |
workingCopyEntriesAspect |
|
325 |
||
326 |
||
327 |
|holder| |
|
328 |
||
329 |
(holder := builder bindingAt:#workingCopyEntriesAspect) isNil ifTrue:[ |
|
330 |
holder := (PluggableAdaptor on: self modelHolder) |
|
331 |
getBlock:[:model|self workingCopyEntries] |
|
332 |
putBlock:[:model :value|self error:'Should never be sent'] |
|
333 |
updateBlock:[:model :aspect :value|true]. |
|
334 |
builder aspectAt:#workingCopyEntriesAspect put:holder. |
|
335 |
]. |
|
336 |
^ holder. |
|
337 |
||
338 |
"Created: / 11-04-2008 / 10:24:40 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
339 |
"Modified: / 21-10-2008 / 18:55:05 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
340 |
! ! |
|
341 |
||
342 |
!WorkingCopyBrowser methodsFor:'hooks'! |
|
343 |
||
344 |
commonPostBuild |
|
345 |
||
346 |
^self model changed |
|
347 |
||
348 |
"Created: / 11-04-2008 / 10:33:10 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
349 |
"Modified: / 12-04-2008 / 21:05:05 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
350 |
! ! |
|
351 |
||
352 |
!WorkingCopyBrowser methodsFor:'menu actions'! |
|
353 |
||
775 | 354 |
entryMenuRevert |
9 | 355 |
|
775 | 356 |
| entry | |
9 | 357 |
entry := self selection. |
775 | 358 |
entry ifNotNil:[entry revert] |
359 |
||
360 |
"Modified: / 09-10-2008 / 20:30:39 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
361 |
"Created: / 05-12-2009 / 20:10:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
362 |
! |
|
9 | 363 |
|
775 | 364 |
entryMenuShowChanges |
365 |
self entryMenuShowChangesAgainst:SVN::Revision head |
|
366 |
||
367 |
"Modified: / 09-10-2008 / 20:30:39 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
368 |
"Created: / 05-12-2009 / 20:10:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9 | 369 |
! |
370 |
||
775 | 371 |
entryMenuShowChangesAgainst:rev |
372 |
|wc entry wcChangeSet repoChangeSet diffset lang | |
|
9 | 373 |
wc := self model. |
374 |
entry := self selection. |
|
775 | 375 |
lang := entry programmingLanguage. |
376 |
(lang notNil and: [lang isSmalltalk]) ifTrue:[ |
|
377 |
wcChangeSet := wc changeSetForContainer:entry path. |
|
378 |
wcChangeSet name: wcChangeSet name, ' (working copy)'. |
|
379 |
repoChangeSet := wc branch changeSetForContainer:entry path revision:rev. |
|
380 |
diffset := ChangeSetDiff versionA:wcChangeSet versionB:repoChangeSet. |
|
381 |
(Tools::ChangeSetDiffTool new) |
|
382 |
beSingleColumn; |
|
383 |
diffset:diffset; |
|
384 |
title:('%1: Diffbetween working copy and rev. %2 ' bindWith: entry path with: rev printString); |
|
385 |
open |
|
386 |
] ifFalse:[ |
|
387 |
| text1 text2 | |
|
388 |
text1 := (wc containerReadStreamFor: entry path) contents asString. |
|
389 |
text2 := wc branch cat: entry path. |
|
390 |
(Tools::TextDiffTool new) |
|
817
c258e10fedc3
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
775
diff
changeset
|
391 |
labelA: 'Working copy'; |
c258e10fedc3
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
775
diff
changeset
|
392 |
labelB: ('r %1' bindWith: rev printString); |
c258e10fedc3
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
775
diff
changeset
|
393 |
textA: text1; textB: text2; |
775 | 394 |
title:('%1: Diffbetween working copy and rev. %2 ' bindWith: entry path with: rev printString); |
395 |
open |
|
396 |
] |
|
9 | 397 |
|
398 |
"Created: / 09-10-2008 / 20:14:24 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
399 |
"Modified: / 09-08-2009 / 14:14:21 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
775 | 400 |
"Modified: / 07-07-2011 / 23:09:09 / jv" |
817
c258e10fedc3
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
775
diff
changeset
|
401 |
"Modified: / 01-09-2011 / 12:15:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9 | 402 |
! ! |
403 |
||
404 |
!WorkingCopyBrowser methodsFor:'private'! |
|
405 |
||
406 |
workingCopyEntries |
|
407 |
| status | |
|
408 |
||
409 |
status := self model status. |
|
410 |
^ self showOnlyChanged value |
|
411 |
ifTrue: [ status reject: [:entry | entry status isNormal ] ] |
|
412 |
ifFalse: [ status ] |
|
413 |
||
414 |
"Created: / 21-10-2008 / 18:55:34 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
415 |
"Modified: / 18-08-2009 / 09:12:04 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
416 |
! ! |
|
417 |
||
418 |
!WorkingCopyBrowser class methodsFor:'documentation'! |
|
419 |
||
817
c258e10fedc3
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
775
diff
changeset
|
420 |
version |
c258e10fedc3
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
775
diff
changeset
|
421 |
^ '$Header$' |
c258e10fedc3
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
775
diff
changeset
|
422 |
! |
c258e10fedc3
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
775
diff
changeset
|
423 |
|
210 | 424 |
version_SVN |
817
c258e10fedc3
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
775
diff
changeset
|
425 |
^ '§Id: SVN__WorkingCopyBrowser.st 367 2011-09-01 11:32:31Z vranyj1 §' |
9 | 426 |
! ! |