author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 14 Mar 2012 18:46:28 +0100 | |
changeset 1065 | 35d1106a2336 |
parent 1063 | 75f4338d821a |
child 1101 | ffc2b5e1104f |
permissions | -rw-r--r-- |
678 | 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 |
" |
|
384 | 26 |
"{ Package: 'stx:libsvn' }" |
57 | 27 |
|
28 |
"{ NameSpace: SVN }" |
|
29 |
||
30 |
Object subclass:#WorkingCopy |
|
31 |
instanceVariableNames:'path repository branch packageClassesChanged |
|
32 |
packageExtensionsChanged' |
|
33 |
classVariableNames:'' |
|
34 |
poolDictionaries:'' |
|
35 |
category:'SVN-Core' |
|
36 |
! |
|
37 |
||
678 | 38 |
!WorkingCopy class methodsFor:'documentation'! |
39 |
||
40 |
copyright |
|
41 |
" |
|
42 |
Copyright (c) 2007-2010 Jan Vrany |
|
43 |
Copyright (c) 2009-2010 eXept Software AG |
|
44 |
||
45 |
Permission is hereby granted, free of charge, to any person |
|
46 |
obtaining a copy of this software and associated documentation |
|
47 |
files (the 'Software'), to deal in the Software without |
|
48 |
restriction, including without limitation the rights to use, |
|
49 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
50 |
copies of the Software, and to permit persons to whom the |
|
51 |
Software is furnished to do so, subject to the following |
|
52 |
conditions: |
|
53 |
||
54 |
The above copyright notice and this permission notice shall be |
|
55 |
included in all copies or substantial portions of the Software. |
|
56 |
||
57 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
58 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
59 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
60 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
61 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
62 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
63 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
64 |
OTHER DEALINGS IN THE SOFTWARE. |
|
65 |
||
66 |
" |
|
67 |
! ! |
|
57 | 68 |
|
69 |
!WorkingCopy class methodsFor:'instance creation'! |
|
70 |
||
71 |
branch: aBranch path: aStringOrFilename |
|
72 |
||
73 |
^self new |
|
74 |
branch: aBranch; |
|
75 |
path: aStringOrFilename; |
|
76 |
yourself |
|
77 |
||
78 |
"Created: / 19-08-2009 / 11:25:06 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
998 | 79 |
! |
80 |
||
81 |
path: aStringOrFilename |
|
82 |
||
83 |
^self new |
|
84 |
path: aStringOrFilename; |
|
85 |
yourself |
|
86 |
||
87 |
"Created: / 19-08-2009 / 11:25:06 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
88 |
"Created: / 07-02-2012 / 22:31:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
57 | 89 |
! ! |
90 |
||
678 | 91 |
!WorkingCopy class methodsFor:'others'! |
92 |
||
93 |
version_CVS |
|
905
58dc08c9d3b4
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
795
diff
changeset
|
94 |
^ '$Header$' |
678 | 95 |
! ! |
96 |
||
57 | 97 |
!WorkingCopy methodsFor:'accessing'! |
98 |
||
99 |
branch |
|
100 |
branch ifNil:[ |
|
678 | 101 |
branch := self isValid |
102 |
ifTrue:[self branchFromWorkingCopy] |
|
103 |
ifFalse:[self branchFromQuery]. |
|
57 | 104 |
branch ifNil:[branch := self defaultBranch]]. |
678 | 105 |
^ branch value |
57 | 106 |
|
107 |
"Created: / 31-03-2008 / 12:50:17 / janfrog" |
|
108 |
"Modified: / 14-04-2008 / 12:44:25 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
678 | 109 |
"Modified: / 09-01-2010 / 12:10:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
57 | 110 |
! |
111 |
||
112 |
branch: branchOrString |
|
113 |
||
114 |
branch := branchOrString isString |
|
115 |
ifFalse: |
|
116 |
[repository := branchOrString repository. |
|
117 |
branchOrString] |
|
118 |
ifTrue: |
|
678 | 119 |
["Do it in separate thread to speedup things" |
120 |
Promise value: |
|
121 |
[branch := |
|
122 |
repository branches |
|
123 |
detect:[:branch|branch path = branchOrString] |
|
124 |
ifNone:[self error:'No such branch: ', branchOrString]]]. |
|
57 | 125 |
|
126 |
"Created: / 31-03-2008 / 13:29:13 / janfrog" |
|
127 |
"Modified: / 19-08-2009 / 11:22:45 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
678 | 128 |
"Modified: / 09-01-2010 / 12:12:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
129 |
! |
|
130 |
||
131 |
branchOrNil |
|
132 |
||
133 |
| branches | |
|
134 |
||
135 |
branch ifNil: |
|
136 |
[branches := repository branches. |
|
137 |
branches size = 1 ifTrue:[^branch := branches anyOne]. |
|
138 |
repository preferredBranch |
|
139 |
ifNotNil: |
|
140 |
[branch := branches |
|
141 |
detect:[:branch|branch asString = repository preferredBranch] |
|
142 |
ifNone:[nil]]]. |
|
143 |
^branch |
|
144 |
||
145 |
"Created: / 31-03-2008 / 12:50:17 / janfrog" |
|
146 |
"Modified: / 14-04-2008 / 12:44:25 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
147 |
"Modified: / 29-03-2010 / 13:58:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
57 | 148 |
! |
149 |
||
150 |
commitMode |
|
151 |
||
152 |
"UI Helper" |
|
153 |
||
154 |
^self packageClassesChanged ifTrue:[#full] ifFalse:[#fast] |
|
155 |
||
156 |
"Created: / 13-08-2009 / 15:12:41 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
157 |
! |
|
158 |
||
159 |
commitMode: mode |
|
160 |
||
161 |
mode == #full ifTrue:[packageClassesChanged := true]. |
|
162 |
||
163 |
"Created: / 13-08-2009 / 15:13:08 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
164 |
! |
|
165 |
||
166 |
defaultBranch |
|
167 |
||
168 |
^repository branches |
|
169 |
detect:[:branch | branch isTrunk ] |
|
170 |
ifNone:[self error: 'No branch!!']. |
|
171 |
||
172 |
"Created: / 11-04-2008 / 13:15:34 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
173 |
"Modified: / 14-04-2008 / 11:53:04 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
174 |
! |
|
175 |
||
176 |
manager |
|
177 |
||
178 |
^repository manager |
|
179 |
||
180 |
"Created: / 11-06-2009 / 13:33:17 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
181 |
! |
|
182 |
||
183 |
package |
|
184 |
||
1006
f318a4c6a09d
Improvements for CommitDialog2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
185 |
^self branch package |
57 | 186 |
|
187 |
"Created: / 31-03-2008 / 13:04:52 / janfrog" |
|
1006
f318a4c6a09d
Improvements for CommitDialog2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
188 |
"Modified: / 08-02-2012 / 18:25:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
57 | 189 |
! |
190 |
||
191 |
packageClasses |
|
192 |
||
193 |
^self packageClassesWithPrivate reject:[:cls|cls owningClass notNil] |
|
194 |
||
195 |
"Created: / 31-03-2008 / 13:06:13 / janfrog" |
|
196 |
"Modified: / 23-03-2009 / 12:16:51 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
197 |
! |
|
198 |
||
199 |
packageClassesChanged |
|
200 |
packageClassesChanged := |
|
678 | 201 |
(packageClassesChanged == true) |
57 | 202 |
or:[self computePackageClassesChanged]. |
203 |
||
204 |
^ packageClassesChanged |
|
205 |
||
206 |
"Modified: / 13-08-2009 / 10:21:19 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
678 | 207 |
"Modified: / 21-04-2010 / 23:29:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
57 | 208 |
! |
209 |
||
210 |
packageClassesFiltered: classFilter |
|
211 |
||
212 |
^self packageClasses select: [:class|classFilter value: class]. |
|
213 |
||
214 |
"Created: / 23-03-2009 / 12:04:18 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
215 |
! |
|
216 |
||
217 |
packageClassesWithPrivate |
|
218 |
||
219 |
^ProjectDefinition searchForClassesWithProject: self package |
|
220 |
||
221 |
"Created: / 23-03-2009 / 12:06:58 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
222 |
! |
|
223 |
||
224 |
packageClassesWithPrivateFiltered: classFilter |
|
225 |
||
226 |
^self packageClassesWithPrivate select: [:class|classFilter value: class]. |
|
227 |
||
228 |
"Created: / 23-03-2009 / 12:07:58 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
229 |
! |
|
230 |
||
231 |
packageDefinition |
|
232 |
^ Smalltalk |
|
233 |
at:(ProjectDefinition initialClassNameForDefinitionOf:self package) |
|
234 |
asSymbol. |
|
235 |
||
236 |
"Created: / 15-06-2009 / 12:41:20 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
237 |
! |
|
238 |
||
239 |
packageExtensions |
|
240 |
||
241 |
^ProjectDefinition searchForExtensionsWithProject: self package |
|
242 |
||
243 |
"Created: / 31-03-2008 / 13:06:13 / janfrog" |
|
244 |
"Modified: / 11-04-2008 / 08:25:00 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
245 |
! |
|
246 |
||
247 |
packageExtensionsChanged |
|
248 |
packageExtensionsChanged := |
|
678 | 249 |
(packageExtensionsChanged == true) |
57 | 250 |
or:[self computePackageExtensionsChanged]. |
251 |
||
252 |
^ packageExtensionsChanged |
|
253 |
||
254 |
"Modified: / 13-08-2009 / 10:22:23 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
678 | 255 |
"Modified: / 21-04-2010 / 23:30:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
57 | 256 |
! |
257 |
||
258 |
packageExtensionsFiltered:aBlock |
|
259 |
||
260 |
^self packageExtensions select:aBlock |
|
261 |
||
262 |
"Created: / 11-06-2009 / 13:37:27 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
263 |
! |
|
264 |
||
265 |
path |
|
266 |
||
267 |
^ path |
|
268 |
||
269 |
"Created: / 31-03-2008 / 12:42:42 / janfrog" |
|
270 |
"Modified: / 21-08-2009 / 17:47:30 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
271 |
! |
|
272 |
||
273 |
path:aStringOrFilename |
|
274 |
path := aStringOrFilename asFilename. |
|
275 |
||
276 |
"Created: / 31-03-2008 / 12:42:42 / janfrog" |
|
277 |
! |
|
278 |
||
279 |
pathBase |
|
280 |
||
281 |
^self manager workingCopyBase. |
|
282 |
||
283 |
"Created: / 11-06-2009 / 13:32:54 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
284 |
! |
|
285 |
||
286 |
repository |
|
287 |
^ repository |
|
288 |
||
289 |
"Created: / 31-03-2008 / 12:42:22 / janfrog" |
|
290 |
! |
|
291 |
||
292 |
repository:aRepository |
|
293 |
repository := aRepository. |
|
294 |
||
295 |
"Created: / 31-03-2008 / 12:42:22 / janfrog" |
|
296 |
! |
|
297 |
||
298 |
url |
|
299 |
||
300 |
^branch url |
|
301 |
||
302 |
"Created: / 31-03-2008 / 13:05:01 / janfrog" |
|
303 |
! ! |
|
304 |
||
305 |
!WorkingCopy methodsFor:'accessing - change sets'! |
|
306 |
||
307 |
changeSet |
|
308 |
||
309 |
^self changeSetIgnoreAutoloaded: false |
|
310 |
||
311 |
"Created: / 23-03-2009 / 18:57:16 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
312 |
"Modified: / 12-08-2009 / 14:26:55 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
313 |
! |
|
314 |
||
315 |
changeSetForContainer: containerName |
|
316 |
||
678 | 317 |
^(ChangeSet fromStream: |
318 |
(self containerReadStreamFor: containerName)) |
|
319 |
name: containerName; |
|
320 |
yourself |
|
57 | 321 |
|
322 |
"Created: / 09-10-2008 / 20:21:56 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
678 | 323 |
"Modified: / 07-07-2011 / 21:47:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
57 | 324 |
! |
325 |
||
1027
1f9bcfa5013b
- added compare against HEAD & compare against BASE
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1006
diff
changeset
|
326 |
changeSetForContainer: containerName revision: rev |
1f9bcfa5013b
- added compare against HEAD & compare against BASE
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1006
diff
changeset
|
327 |
| containerContents | |
1f9bcfa5013b
- added compare against HEAD & compare against BASE
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1006
diff
changeset
|
328 |
|
1f9bcfa5013b
- added compare against HEAD & compare against BASE
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1006
diff
changeset
|
329 |
containerContents := self cat: containerName revision: rev. |
1f9bcfa5013b
- added compare against HEAD & compare against BASE
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1006
diff
changeset
|
330 |
^(ChangeSet fromStream: containerContents readStream) |
1f9bcfa5013b
- added compare against HEAD & compare against BASE
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1006
diff
changeset
|
331 |
name: containerName , ' (' , rev printString , ')'; |
1f9bcfa5013b
- added compare against HEAD & compare against BASE
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1006
diff
changeset
|
332 |
yourself |
1f9bcfa5013b
- added compare against HEAD & compare against BASE
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1006
diff
changeset
|
333 |
|
1f9bcfa5013b
- added compare against HEAD & compare against BASE
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1006
diff
changeset
|
334 |
"Created: / 10-02-2012 / 09:57:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1f9bcfa5013b
- added compare against HEAD & compare against BASE
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1006
diff
changeset
|
335 |
! |
1f9bcfa5013b
- added compare against HEAD & compare against BASE
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1006
diff
changeset
|
336 |
|
57 | 337 |
changeSetForUpdate |
338 |
|diffSet classesToRemove| |
|
339 |
||
340 |
diffSet := self diffSetBetweenImageAndWorkingCopy. |
|
341 |
classesToRemove := Set new. |
|
678 | 342 |
ActivityNotification notify:'Computing update change set'. |
343 |
"self = image, arg = revision" |
|
344 |
^ (diffSet onlyInArg) |
|
345 |
, (diffSet changed collect:[:changePair | changePair second ]) |
|
57 | 346 |
, (diffSet onlyInReceiver |
678 | 347 |
select:[:change | change isClassDefinitionChange ] |
348 |
thenCollect:[:change | |
|
349 |
classesToRemove add:change className. |
|
350 |
ClassRemoveChange className:change className |
|
351 |
]) |
|
352 |
, (diffSet onlyInReceiver |
|
353 |
select:[:change | |
|
354 |
change isMethodDefinitionChange |
|
355 |
and:[ (classesToRemove includes:change className) not ] |
|
356 |
] |
|
357 |
thenCollect:[:change | |
|
358 |
MethodRemoveChange className:change className selector:change selector |
|
359 |
]) |
|
360 |
"Created: / 24-03-2009 / 08:17:19 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
57 | 361 |
! |
362 |
||
363 |
changeSetIgnoreAutoloaded: ignoreAutoloaded |
|
364 |
||
365 |
| containersToIgnore changeSet | |
|
366 |
||
367 |
containersToIgnore := |
|
368 |
(self packageClassesFiltered:[:cls|cls isLoaded not]) |
|
369 |
collect:[:cls|repository containerNameForClass: cls]. |
|
370 |
||
371 |
changeSet := ChangeSet new. |
|
372 |
self containers do: |
|
373 |
[:container | |
|
374 |
(containersToIgnore includes: container) |
|
375 |
ifFalse: |
|
376 |
[changeSet addAll: |
|
377 |
(self changeSetForContainer: container)]]. |
|
378 |
^changeSet |
|
379 |
||
380 |
"Created: / 12-08-2009 / 14:26:39 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
381 |
! ! |
|
382 |
||
383 |
!WorkingCopy methodsFor:'accessing - containers'! |
|
384 |
||
385 |
containerFilenameFor: containerName |
|
386 |
||
387 |
^self path construct: containerName |
|
388 |
||
389 |
"Created: / 09-10-2008 / 20:25:02 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
390 |
! |
|
391 |
||
392 |
containerReadStreamFor: containerName |
|
393 |
||
394 |
| containerFile containerStream | |
|
395 |
containerFile := self containerFilenameFor: containerName. |
|
396 |
OperatingSystem isMSWINDOWSlike |
|
397 |
ifTrue: |
|
398 |
[" |
|
399 |
Dirty hack for MS Windows: |
|
400 |
Windows do not allow me to open some files for the first |
|
401 |
time (OpenError is raised). Second try after some time is usually OK. |
|
402 |
I don't know why this happens. Claus, do you have any idea? |
|
403 |
" |
|
404 |
[ containerStream := containerFile readStream ] |
|
405 |
on: OpenError do: |
|
406 |
[Delay waitForMilliseconds: 100. "A magic constant here :-(" |
|
407 |
containerStream := containerFile readStream]] |
|
408 |
ifFalse: |
|
409 |
[" |
|
410 |
Unix behaves pretty fine :-) |
|
411 |
" |
|
412 |
containerStream := containerFile readStream]. |
|
413 |
||
414 |
^containerStream |
|
415 |
||
416 |
"Created: / 09-10-2008 / 20:26:03 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
417 |
! |
|
418 |
||
419 |
containerSuffixes |
|
420 |
||
678 | 421 |
^ProgrammingLanguage all collect:[:each|each sourceFileSuffix] |
57 | 422 |
|
423 |
"Created: / 23-03-2009 / 18:53:56 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
678 | 424 |
"Modified: / 30-12-2009 / 18:15:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
57 | 425 |
! |
426 |
||
427 |
containerWriteStreamFor: containerName |
|
428 |
||
429 |
^(self containerFilenameFor: containerName) writeStream |
|
430 |
eolMode: #nl; |
|
431 |
yourself |
|
432 |
||
433 |
"Created: / 09-10-2008 / 20:24:44 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
434 |
! |
|
435 |
||
678 | 436 |
containerWriteStreamForExtensions: aProgrammingLanguage |
437 |
||
57 | 438 |
|
678 | 439 |
^self containerWriteStreamFor: |
440 |
(Repository containerNameForExtensions: aProgrammingLanguage) |
|
57 | 441 |
|
678 | 442 |
"Created: / 30-12-2009 / 18:14:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
443 |
"Modified: / 30-12-2009 / 22:00:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
57 | 444 |
! |
445 |
||
446 |
containers |
|
447 |
||
448 |
^(self path directoryContents |
|
449 |
select: |
|
450 |
[:container|self containerSuffixes anySatisfy: |
|
451 |
[:suffix|container endsWith:suffix]]) asSet |
|
452 |
||
453 |
"Created: / 23-03-2009 / 18:52:27 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
454 |
"Modified: / 12-06-2009 / 21:44:06 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
455 |
! |
|
456 |
||
457 |
containersToKeep |
|
458 |
||
678 | 459 |
| containers extensions | |
57 | 460 |
|
461 |
containers := self packageClasses |
|
462 |
collect:[:cls|self repository containerNameForClass: cls]. |
|
678 | 463 |
(extensions := self packageExtensions) notEmpty ifTrue: |
464 |
[| languages | |
|
465 |
languages := (extensions collect:[:each|each programmingLanguage]) asSet. |
|
466 |
languages do: |
|
467 |
[:lang|containers add: (Repository containerNameForExtensions: lang)]]. |
|
468 |
"Keep all directories" |
|
469 |
path directoryContents do: |
|
470 |
[:f| |
|
471 |
(f ~= '.svn' and: [(path / f) isDirectory]) ifTrue: |
|
472 |
[containers add: f]]. |
|
905
58dc08c9d3b4
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
795
diff
changeset
|
473 |
"Keep all .st files that are for with other operating systems" |
58dc08c9d3b4
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
795
diff
changeset
|
474 |
|
58dc08c9d3b4
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
795
diff
changeset
|
475 |
self packageDefinition classNamesAndAttributesDo: [:nm :attributes| |
58dc08c9d3b4
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
795
diff
changeset
|
476 |
attributes do:[:attr| |
58dc08c9d3b4
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
795
diff
changeset
|
477 |
(#(win32 unix vms autoload) includes: attr) ifTrue:[ |
58dc08c9d3b4
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
795
diff
changeset
|
478 |
containers add: ((SVN::Repository containerNameWithoutSuffixForClassNamed: nm) , '.st') |
58dc08c9d3b4
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
795
diff
changeset
|
479 |
] |
58dc08c9d3b4
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
795
diff
changeset
|
480 |
] |
58dc08c9d3b4
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
795
diff
changeset
|
481 |
]. |
58dc08c9d3b4
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
795
diff
changeset
|
482 |
|
678 | 483 |
|
57 | 484 |
^containers asSet. |
485 |
||
486 |
"Created: / 12-06-2009 / 21:27:12 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
905
58dc08c9d3b4
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
795
diff
changeset
|
487 |
"Modified: / 28-09-2011 / 17:15:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
57 | 488 |
! |
489 |
||
490 |
containersWriteStreamForClass:cls |
|
491 |
||
492 |
^self containerWriteStreamFor: (repository containerNameForClass:cls) |
|
493 |
||
494 |
"Created: / 09-10-2008 / 20:23:59 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
495 |
! ! |
|
496 |
||
497 |
!WorkingCopy methodsFor:'accessing - diff sets'! |
|
498 |
||
499 |
diffSetBetweenImageAndWorkingCopy |
|
500 |
||
501 |
| imageChangeSet revisionChangeSet | |
|
502 |
imageChangeSet := ChangeSet forPackage: self package ignoreAutoloaded: true. |
|
503 |
revisionChangeSet := self changeSetIgnoreAutoloaded: true. |
|
504 |
^imageChangeSet diffSetsAgainst: revisionChangeSet |
|
505 |
||
506 |
"Created: / 24-03-2009 / 08:17:26 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
507 |
"Modified: / 12-08-2009 / 14:32:03 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
508 |
! ! |
|
509 |
||
510 |
!WorkingCopy methodsFor:'accessing - tasks'! |
|
511 |
||
512 |
commitTask |
|
513 |
||
514 |
^CommitTask new workingCopy: self |
|
515 |
||
516 |
"Created: / 23-03-2009 / 11:47:27 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
517 |
! |
|
518 |
||
678 | 519 |
mergeTask |
520 |
||
521 |
^MergeTask new workingCopy: self |
|
522 |
||
523 |
"Created: / 25-11-2009 / 17:16:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
524 |
! |
|
525 |
||
57 | 526 |
updateTask |
527 |
||
528 |
^UpdateTask new workingCopy: self |
|
529 |
||
530 |
"Created: / 24-03-2009 / 15:13:20 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
531 |
! ! |
|
532 |
||
533 |
!WorkingCopy methodsFor:'commands'! |
|
534 |
||
535 |
cat: file |
|
536 |
||
678 | 537 |
^self cat: file revision: SVN::Revision head |
57 | 538 |
|
539 |
"Created: / 19-04-2008 / 10:52:22 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
540 |
"Modified: / 09-10-2008 / 20:16:53 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
541 |
! |
|
542 |
||
543 |
cat: file revision: revision |
|
544 |
||
678 | 545 |
^CatCommand new |
546 |
workingCopy: self; |
|
547 |
path: file; |
|
548 |
revision: revision; |
|
549 |
execute. |
|
57 | 550 |
|
678 | 551 |
"Created: / 19-04-2008 / 10:51:54 / Jan Vrany <vranyj1@fel.cvut.cz>" |
552 |
"Modified: / 19-08-2009 / 10:00:59 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
553 |
"Modified: / 02-01-2010 / 13:20:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
57 | 554 |
! |
555 |
||
556 |
checkout |
|
557 |
|pkgDef| |
|
558 |
||
559 |
pkgDef := self packageDefinition. |
|
560 |
self |
|
678 | 561 |
checkout:(pkgDef ifNotNil:[ pkgDef svnRevision ] ifNil:[ SVN::Revision head ]) |
57 | 562 |
! |
563 |
||
678 | 564 |
checkout:revision |
57 | 565 |
|
678 | 566 |
"Checkout a working copy. If full is true, then |
567 |
full checkout is performed, i.e., whole subtree |
|
568 |
is checked out. If not, only project files and |
|
569 |
common subdirectories are check out" |
|
570 |
||
571 |
||
572 |
^self checkout: revision full: false |
|
57 | 573 |
|
574 |
"Created: / 31-03-2008 / 12:57:58 / janfrog" |
|
575 |
"Modified: / 21-08-2009 / 17:45:43 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
678 | 576 |
"Modified: / 25-04-2011 / 15:19:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
577 |
! |
|
578 |
||
579 |
checkout:revision full: full |
|
580 |
||
581 |
"Checkout a working copy. If full is true, then |
|
582 |
full checkout is performed, i.e., whole subtree |
|
583 |
is checked out. If not, only project files and |
|
584 |
common subdirectories are check out" |
|
585 |
||
586 |
|checkoutInfo pkg | |
|
587 |
||
588 |
pkg := self package. |
|
589 |
self |
|
590 |
synchronized:[ |
|
591 |
self ensurePathExists. |
|
592 |
ActivityNotification notify:'Checking out ' , pkg. |
|
593 |
full ifTrue:[ |
|
594 |
checkoutInfo := (CheckoutCommand new) |
|
595 |
revision:revision; |
|
596 |
depth: 'infinity'; |
|
597 |
workingCopy:self; |
|
598 |
execute |
|
599 |
] ifFalse:[ |
|
600 |
"JV@2011-06-13: TODO: rewrite it so it does not set |
|
601 |
inifinite depth on subpackages. This requires to |
|
602 |
split this method..." |
|
603 |
||
604 |
| subdirs | |
|
605 |
checkoutInfo := (CheckoutCommand new) |
|
606 |
revision:revision; |
|
607 |
depth: 'immediates'; |
|
608 |
workingCopy:self; |
|
609 |
execute. |
|
610 |
"Checkout common subdirs" |
|
611 |
subdirs := #('resources' 'bitmaps' 'autopackage' 'builder') |
|
612 |
select:[:e| (path / e) isDirectory]. |
|
613 |
checkoutInfo addAll: |
|
614 |
(UpdateCommand new |
|
615 |
workingCopy: self; |
|
616 |
setDepth: 'infinity'; |
|
617 |
paths: subdirs; |
|
618 |
execute |
|
619 |
). |
|
620 |
"Checkout nested packages" |
|
621 |
subdirs := OrderedCollection new. |
|
622 |
Smalltalk allProjectIDs do: |
|
623 |
[:each | |
|
624 |
(each size > pkg size and:[(each at: pkg size + 1) == $/ and:[each startsWith: pkg]]) ifTrue: |
|
625 |
[subdirs add: ((each copyFrom: self package size + 2) replaceAll:$/ with: Filename separator)]]. |
|
626 |
subdirs notEmpty ifTrue:[ |
|
627 |
subdirs := subdirs asSortedCollection:[:a :b| a size < b size]. |
|
628 |
checkoutInfo addAll: |
|
629 |
(UpdateCommand new |
|
630 |
workingCopy: self; |
|
970 | 631 |
setDepth: 'empty'; |
678 | 632 |
paths: subdirs; |
633 |
execute |
|
634 |
). |
|
635 |
] |
|
636 |
] |
|
637 |
]. |
|
638 |
^ checkoutInfo |
|
639 |
||
640 |
"Modified: / 21-08-2009 / 17:45:43 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
641 |
"Created: / 25-04-2011 / 15:19:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
970 | 642 |
"Modified (format): / 24-01-2012 / 18:05:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
57 | 643 |
! |
644 |
||
645 |
cleanup |
|
646 |
||
647 |
self ensurePathExists. |
|
648 |
self isValid ifFalse:[^self]. |
|
649 |
^CleanupCommand new |
|
650 |
workingCopy: self path; |
|
651 |
execute. |
|
652 |
||
653 |
"Created: / 08-11-2008 / 08:12:50 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
654 |
! |
|
655 |
||
656 |
commit:message |
|
657 |
||
658 |
^self commitTask |
|
659 |
message: message; |
|
660 |
do |
|
661 |
||
662 |
"Created: / 31-03-2008 / 13:11:15 / janfrog" |
|
663 |
"Modified: / 07-04-2008 / 08:52:13 / janfrog" |
|
664 |
"Modified: / 23-03-2009 / 11:48:06 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
665 |
! |
|
666 |
||
1065 | 667 |
commit:message files: files |
668 |
||
669 |
^self commitTask |
|
670 |
message: message; |
|
671 |
paths: files; |
|
672 |
do |
|
673 |
||
674 |
"Created: / 31-03-2008 / 13:11:15 / janfrog" |
|
675 |
"Modified: / 07-04-2008 / 08:52:13 / janfrog" |
|
676 |
"Modified: / 23-03-2009 / 11:48:06 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
677 |
"Created: / 14-03-2012 / 17:15:25 / jv" |
|
678 |
! |
|
679 |
||
678 | 680 |
info: paths |
681 |
||
682 |
^SVN::InfoCommand new |
|
683 |
workingCopy: self; |
|
684 |
paths: paths; |
|
685 |
execute |
|
686 |
! |
|
687 |
||
57 | 688 |
log |
689 |
||
690 |
^self branch log |
|
691 |
||
692 |
"Created: / 19-04-2008 / 10:52:53 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
693 |
! |
|
694 |
||
695 |
log: aString |
|
696 |
||
697 |
^self branch log: aString |
|
698 |
||
699 |
"Created: / 19-04-2008 / 10:53:06 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
700 |
! |
|
701 |
||
702 |
revert |
|
703 |
||
704 |
self ensurePathExists. |
|
705 |
self isValid ifFalse:[^self checkout]. |
|
706 |
^RevertCommand new |
|
707 |
workingCopy: self path; |
|
708 |
execute. |
|
709 |
||
710 |
"Created: / 22-10-2008 / 16:46:18 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
711 |
! |
|
712 |
||
713 |
revert: containers |
|
714 |
||
715 |
| revertInfo | |
|
716 |
||
717 |
self ensurePathExists. |
|
718 |
self isValid ifFalse:[^self checkout]. |
|
719 |
self synchronized: |
|
720 |
[revertInfo := RevertCommand new |
|
678 | 721 |
workingCopy: self; |
57 | 722 |
paths: containers; |
723 |
execute]. |
|
724 |
^revertInfo |
|
725 |
||
726 |
"Created: / 03-11-2008 / 21:20:38 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
727 |
"Modified: / 07-11-2008 / 08:54:38 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
678 | 728 |
"Modified: / 05-12-2009 / 20:16:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
57 | 729 |
! |
730 |
||
731 |
status |
|
732 |
||
733 |
| status | |
|
734 |
self ensureIsValid. |
|
735 |
self synchronized: |
|
736 |
[status := StatusCommand new |
|
737 |
workingCopy: self; |
|
738 |
execute]. |
|
739 |
^status |
|
740 |
||
741 |
"Created: / 11-04-2008 / 09:22:13 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
742 |
"Modified: / 19-08-2009 / 14:35:49 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
743 |
! |
|
744 |
||
745 |
update |
|
746 |
||
747 |
| updateInfo | |
|
748 |
||
749 |
self ensurePathExists. |
|
750 |
self isValid ifFalse:[^self checkout]. |
|
751 |
self synchronized: |
|
752 |
[updateInfo := UpdateCommand new |
|
753 |
workingCopy: self path; |
|
754 |
execute]. |
|
755 |
^updateInfo |
|
756 |
||
757 |
"Created: / 21-05-2008 / 09:44:56 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
758 |
"Modified: / 19-08-2009 / 12:25:15 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
759 |
! ! |
|
760 |
||
761 |
!WorkingCopy methodsFor:'error reporting'! |
|
762 |
||
763 |
error |
|
764 |
||
765 |
self error:'Unknown error' |
|
766 |
||
767 |
"Created: / 31-03-2008 / 12:44:06 / janfrog" |
|
768 |
! |
|
769 |
||
770 |
error: aString |
|
771 |
||
772 |
WCError raiseWith:#error: errorString:aString |
|
773 |
||
774 |
"Created: / 31-03-2008 / 12:43:51 / janfrog" |
|
775 |
! ! |
|
776 |
||
795
79b13f902c1b
changed: #inspector2TabBrowser
Claus Gittinger <cg@exept.de>
parents:
678
diff
changeset
|
777 |
!WorkingCopy methodsFor:'inspecting'! |
79b13f902c1b
changed: #inspector2TabBrowser
Claus Gittinger <cg@exept.de>
parents:
678
diff
changeset
|
778 |
|
1043 | 779 |
browse |
780 |
"Opens a file browser on the working copy" |
|
781 |
||
782 |
UserPreferences current fileBrowserClass |
|
783 |
openOnDirectory: path asFilename |
|
784 |
||
785 |
"Created: / 04-02-2012 / 17:14:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
786 |
! |
|
787 |
||
795
79b13f902c1b
changed: #inspector2TabBrowser
Claus Gittinger <cg@exept.de>
parents:
678
diff
changeset
|
788 |
inspector2TabBrowser |
79b13f902c1b
changed: #inspector2TabBrowser
Claus Gittinger <cg@exept.de>
parents:
678
diff
changeset
|
789 |
|
79b13f902c1b
changed: #inspector2TabBrowser
Claus Gittinger <cg@exept.de>
parents:
678
diff
changeset
|
790 |
self exists ifTrue:[ |
79b13f902c1b
changed: #inspector2TabBrowser
Claus Gittinger <cg@exept.de>
parents:
678
diff
changeset
|
791 |
^self newInspector2Tab |
79b13f902c1b
changed: #inspector2TabBrowser
Claus Gittinger <cg@exept.de>
parents:
678
diff
changeset
|
792 |
label: 'Working copy'; |
79b13f902c1b
changed: #inspector2TabBrowser
Claus Gittinger <cg@exept.de>
parents:
678
diff
changeset
|
793 |
priority: 35; |
79b13f902c1b
changed: #inspector2TabBrowser
Claus Gittinger <cg@exept.de>
parents:
678
diff
changeset
|
794 |
application: (SVN::WorkingCopyBrowser on: self) |
79b13f902c1b
changed: #inspector2TabBrowser
Claus Gittinger <cg@exept.de>
parents:
678
diff
changeset
|
795 |
] ifFalse:[ |
79b13f902c1b
changed: #inspector2TabBrowser
Claus Gittinger <cg@exept.de>
parents:
678
diff
changeset
|
796 |
^self newInspector2Tab |
79b13f902c1b
changed: #inspector2TabBrowser
Claus Gittinger <cg@exept.de>
parents:
678
diff
changeset
|
797 |
label: 'Working copy'; |
79b13f902c1b
changed: #inspector2TabBrowser
Claus Gittinger <cg@exept.de>
parents:
678
diff
changeset
|
798 |
priority: 35; |
79b13f902c1b
changed: #inspector2TabBrowser
Claus Gittinger <cg@exept.de>
parents:
678
diff
changeset
|
799 |
view: (Label new label:'Not yet checked out'; yourself) |
79b13f902c1b
changed: #inspector2TabBrowser
Claus Gittinger <cg@exept.de>
parents:
678
diff
changeset
|
800 |
] |
79b13f902c1b
changed: #inspector2TabBrowser
Claus Gittinger <cg@exept.de>
parents:
678
diff
changeset
|
801 |
|
79b13f902c1b
changed: #inspector2TabBrowser
Claus Gittinger <cg@exept.de>
parents:
678
diff
changeset
|
802 |
"Modified: / 14-04-2011 / 17:42:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
79b13f902c1b
changed: #inspector2TabBrowser
Claus Gittinger <cg@exept.de>
parents:
678
diff
changeset
|
803 |
"Modified: / 13-09-2011 / 11:56:28 / cg" |
79b13f902c1b
changed: #inspector2TabBrowser
Claus Gittinger <cg@exept.de>
parents:
678
diff
changeset
|
804 |
! ! |
79b13f902c1b
changed: #inspector2TabBrowser
Claus Gittinger <cg@exept.de>
parents:
678
diff
changeset
|
805 |
|
57 | 806 |
!WorkingCopy methodsFor:'private'! |
807 |
||
678 | 808 |
branchFromQuery |
809 |
||
810 |
^BranchQuery new |
|
811 |
repository: repository; |
|
812 |
raiseRequest. |
|
813 |
! |
|
814 |
||
815 |
branchFromWorkingCopy |
|
816 |
||
817 |
| info bpath | |
|
818 |
info := (self info:#('.')) anyOne. |
|
819 |
bpath := info url copyFrom: info root size + 1. |
|
1006
f318a4c6a09d
Improvements for CommitDialog2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
820 |
repository isNil ifTrue:[ |
f318a4c6a09d
Improvements for CommitDialog2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
821 |
repository := Repository package: nil url: info root. |
f318a4c6a09d
Improvements for CommitDialog2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
822 |
]. |
f318a4c6a09d
Improvements for CommitDialog2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
823 |
^path isEmptyOrNil |
678 | 824 |
ifTrue:[nil] |
825 |
ifFalse:[Branch repository: repository path: bpath]. |
|
1006
f318a4c6a09d
Improvements for CommitDialog2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
826 |
|
f318a4c6a09d
Improvements for CommitDialog2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
998
diff
changeset
|
827 |
"Modified: / 08-02-2012 / 18:20:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
678 | 828 |
! |
829 |
||
57 | 830 |
commited |
831 |
||
832 |
packageExtensionsChanged := false. |
|
833 |
packageClassesChanged := false. |
|
834 |
||
835 |
"Created: / 13-08-2009 / 10:23:19 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
836 |
! |
|
837 |
||
838 |
computePackageClassesChanged |
|
839 |
" |
|
840 |
Answers true iff package classes differs from |
|
841 |
those listed in ProjectDefinition>>classNamesAndAttributes" |
|
842 |
||
843 |
|listedClasses realClasses| |
|
844 |
||
845 |
self packageDefinition ifNil:[^true]. |
|
846 |
||
847 |
listedClasses := self packageDefinition allClassNames. |
|
848 |
realClasses := self packageClasses collect:[:cls | cls fullName ]. |
|
849 |
listedClasses size ~= realClasses size |
|
850 |
ifTrue:[^ true]. |
|
851 |
(realClasses allSatisfy:[:realClass | listedClasses includes:realClass ]) |
|
852 |
ifFalse:[^true]. |
|
853 |
^false |
|
854 |
||
855 |
||
856 |
||
857 |
||
858 |
" |
|
678 | 859 |
(CommitTask new package: 'stx:libsvn') |
57 | 860 |
computePackageClassesChanged |
861 |
(CommitTask new package: 'cvut:fel/smallruby') |
|
862 |
computePackageClassesChanged |
|
863 |
||
864 |
" |
|
865 |
||
866 |
"Created: / 16-06-2009 / 10:08:28 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
867 |
"Modified: / 18-08-2009 / 10:47:10 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
868 |
! |
|
869 |
||
870 |
computePackageExtensionsChanged |
|
871 |
" |
|
872 |
Answers true iff package extension method differs from |
|
873 |
those listed in ProjectDefinition>>extensionMethodNames" |
|
874 |
||
875 |
|listedExtensions listedExtensionsDictionary realExtensions| |
|
876 |
||
877 |
realExtensions := self packageExtensions. |
|
878 |
listedExtensions := self packageDefinition |
|
879 |
extensionMethodNames. |
|
880 |
(listedExtensions size / 2) ~= realExtensions size ifTrue:[ |
|
881 |
^ true |
|
882 |
]. |
|
883 |
listedExtensionsDictionary := Dictionary new. |
|
884 |
listedExtensions |
|
885 |
pairWiseDo:[:className :selector | |
|
886 |
(listedExtensionsDictionary at:className |
|
887 |
ifAbsentPut:[ OrderedCollection new ]) add:selector |
|
888 |
]. |
|
889 |
^ (realExtensions |
|
890 |
allSatisfy:[:mth | |
|
891 |
(listedExtensionsDictionary includesKey:mth mclass name) |
|
892 |
and:[ (listedExtensionsDictionary at:mth mclass name) includes:mth selector ] |
|
893 |
]) |
|
894 |
not |
|
895 |
||
896 |
" |
|
678 | 897 |
(CommitTask new package: 'stx:libsvn') |
57 | 898 |
packageExtensionsHasChanged" |
899 |
||
900 |
"Created: / 16-06-2009 / 10:11:01 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
901 |
"Modified: / 13-08-2009 / 10:27:27 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
902 |
! |
|
903 |
||
904 |
ensureIsValid |
|
905 |
||
906 |
self isValid ifFalse: |
|
907 |
[self checkout]. |
|
908 |
self isValid ifFalse:[self error:'Cannot create working copy'] |
|
909 |
||
910 |
"Created: / 08-04-2008 / 14:19:28 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
911 |
! |
|
912 |
||
913 |
ensureMethodsHasAbsoluteSourceFiles |
|
914 |
||
915 |
Smalltalk allClassesDo: |
|
678 | 916 |
[:cls| | tryLocalSourceFirst makeLocalSource | |
57 | 917 |
makeLocalSource := |
918 |
[:mth| |
|
919 |
mth package = self package ifTrue: |
|
920 |
[mth makeSourceFileAbsolute]]. |
|
678 | 921 |
tryLocalSourceFirst := Class tryLocalSourceFirst. |
922 |
Class tryLocalSourceFirst: true. |
|
57 | 923 |
cls methodsDo: makeLocalSource. |
678 | 924 |
cls class methodsDo: makeLocalSource. |
925 |
Class tryLocalSourceFirst: tryLocalSourceFirst.]. |
|
57 | 926 |
|
927 |
"Created: / 21-08-2009 / 17:33:00 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
678 | 928 |
"Modified: / 09-01-2010 / 16:07:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
57 | 929 |
! |
930 |
||
931 |
ensurePathExists |
|
932 |
||
933 |
[path exists ifFalse: |
|
1063
75f4338d821a
changed: #ensurePathExists
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1043
diff
changeset
|
934 |
["/self ensureMethodsHasAbsoluteSourceFiles. |
57 | 935 |
path recursiveMakeDirectory |
936 |
]] |
|
937 |
on: Smalltalk::Error do:[:ex|self error:'Cannot create working copy']. |
|
938 |
||
939 |
"Created: / 08-04-2008 / 14:26:56 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
940 |
"Modified: / 21-08-2009 / 17:46:05 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
678 | 941 |
"Modified: / 09-01-2010 / 16:07:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1063
75f4338d821a
changed: #ensurePathExists
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1043
diff
changeset
|
942 |
"Modified: / 14-03-2012 / 11:17:21 / jv" |
57 | 943 |
! ! |
944 |
||
945 |
!WorkingCopy methodsFor:'private - file out'! |
|
946 |
||
678 | 947 |
fileOutClass:cls |
948 |
||
949 |
|stream| |
|
950 |
||
951 |
[stream := self containersWriteStreamForClass:cls. |
|
952 |
self fileOutClass:cls on:stream] |
|
953 |
ensure:[ stream ifNotNil:[ stream close ]] |
|
954 |
||
955 |
"Modified: / 11-06-2009 / 16:18:19 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
956 |
"Created: / 30-12-2009 / 19:04:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
957 |
! |
|
958 |
||
57 | 959 |
fileOutClass:cls on:clsStream |
960 |
||
678 | 961 |
"/ cls methodDictionary do: |
962 |
"/ [:each|each makeLocalStringSource]. |
|
963 |
"/ |
|
964 |
"/ cls class methodDictionary do: |
|
965 |
"/ [:each|each makeLocalStringSource]. |
|
966 |
||
967 |
SVNSourceCodeManager |
|
968 |
fileOutSourceCodeOf:cls |
|
969 |
on:clsStream |
|
970 |
withTimeStamp:false |
|
971 |
withInitialize:true |
|
972 |
withDefinition:true |
|
973 |
methodFilter:[:mth | mth package = self package ] |
|
974 |
||
975 |
" |
|
976 |
String streamContents:[:s| |
|
977 |
(SVN::RepositoryManager repositoryForPackage: Setup::ML package) |
|
978 |
workingCopy |
|
979 |
fileOutClass: Setup::ML on: s |
|
980 |
] |
|
981 |
||
982 |
" |
|
57 | 983 |
|
984 |
"Created: / 19-04-2008 / 09:58:11 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
985 |
"Modified: / 11-06-2009 / 16:18:19 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
678 | 986 |
"Modified: / 07-07-2011 / 20:21:59 / jv" |
987 |
"Modified (format): / 07-07-2011 / 20:29:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
988 |
! |
|
989 |
||
990 |
fileOutExtensions: extensionMethods |
|
991 |
||
992 |
ProgrammingLanguage all do: |
|
993 |
[:lang| | stream methods | |
|
994 |
methods := extensionMethods select:[:mth|mth programmingLanguage = lang]. |
|
995 |
methods notEmpty ifTrue: |
|
996 |
[ActivityNotification notify:'Filing out extension methods (', lang name , ')'. |
|
997 |
stream := self containerWriteStreamForExtensions: lang. |
|
998 |
[self fileOutExtensions: methods on:stream language: lang] |
|
999 |
ensure:[ stream close ]]]. |
|
1000 |
||
1001 |
"Created: / 30-12-2009 / 19:01:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
57 | 1002 |
! |
1003 |
||
678 | 1004 |
fileOutExtensions: extensionMethods on:stream language: language |
1005 |
||
1006 |
extensionMethods do:[:each|each makeLocalStringSource]. |
|
1007 |
||
973
3cbefbe6ddc2
changed: #fileOutExtensions:on:language:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
970
diff
changeset
|
1008 |
"Special hack for Smalltalk - use SourceCodeManager routine" |
3cbefbe6ddc2
changed: #fileOutExtensions:on:language:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
970
diff
changeset
|
1009 |
language isSmalltalk ifTrue:[ |
3cbefbe6ddc2
changed: #fileOutExtensions:on:language:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
970
diff
changeset
|
1010 |
"JV@2012-02-02: HACK HACK: Use respondsTo: to avoid DNU in |
3cbefbe6ddc2
changed: #fileOutExtensions:on:language:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
970
diff
changeset
|
1011 |
exept HEAD (I've forked libbasic3), sigh" |
3cbefbe6ddc2
changed: #fileOutExtensions:on:language:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
970
diff
changeset
|
1012 |
(SVNSourceCodeManager respondsTo: #fileOutSourceCodeExtensions:package:on:) ifTrue:[ |
3cbefbe6ddc2
changed: #fileOutExtensions:on:language:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
970
diff
changeset
|
1013 |
SVNSourceCodeManager fileOutSourceCodeExtensions: extensionMethods package: self package on: stream. |
3cbefbe6ddc2
changed: #fileOutExtensions:on:language:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
970
diff
changeset
|
1014 |
^self |
3cbefbe6ddc2
changed: #fileOutExtensions:on:language:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
970
diff
changeset
|
1015 |
]. |
3cbefbe6ddc2
changed: #fileOutExtensions:on:language:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
970
diff
changeset
|
1016 |
]. |
3cbefbe6ddc2
changed: #fileOutExtensions:on:language:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
970
diff
changeset
|
1017 |
|
3cbefbe6ddc2
changed: #fileOutExtensions:on:language:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
970
diff
changeset
|
1018 |
"/ Generic fileout " |
3cbefbe6ddc2
changed: #fileOutExtensions:on:language:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
970
diff
changeset
|
1019 |
|
678 | 1020 |
language sourceFileWriterClass new |
1021 |
fileOutPackageDefinition: self package on: stream; |
|
1022 |
fileOutMethods: extensionMethods on: stream |
|
1023 |
||
1024 |
"Modified: / 15-06-2009 / 11:55:26 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
1025 |
"Created: / 30-12-2009 / 19:01:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
973
3cbefbe6ddc2
changed: #fileOutExtensions:on:language:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
970
diff
changeset
|
1026 |
"Modified: / 02-02-2012 / 16:05:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
678 | 1027 |
! ! |
1028 |
||
1029 |
!WorkingCopy methodsFor:'queries'! |
|
57 | 1030 |
|
678 | 1031 |
exists |
1032 |
||
1033 |
^self isValid |
|
1034 |
||
1035 |
"Created: / 09-12-2010 / 23:36:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1036 |
! |
|
1037 |
||
1038 |
hasBranch |
|
1039 |
||
1040 |
branch ifNotNil:[^true]. |
|
1041 |
^repository preferredBranch |
|
1042 |
ifNotNil:[self branchOrNil notNil] |
|
1043 |
ifNil:[repository branches size == 1] |
|
1044 |
||
1045 |
"Modified: / 29-03-2010 / 13:57:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
57 | 1046 |
! ! |
1047 |
||
1048 |
!WorkingCopy methodsFor:'testing'! |
|
1049 |
||
1050 |
isValid |
|
1051 |
||
1052 |
| svnMetadataDir | |
|
1053 |
||
970 | 1054 |
svnMetadataDir := self path / '.svn'. |
1055 |
svnMetadataDir exists ifFalse:[ ^false ]. |
|
1056 |
(svnMetadataDir / 'entries') exists ifFalse:[ ^false ]. |
|
1057 |
(svnMetadataDir / 'text-base') exists ifFalse:[ ^false ]. |
|
1058 |
||
1059 |
self path directoryContents size = 1 ifTrue:[ ^ false ]. |
|
57 | 1060 |
|
1061 |
^true |
|
1062 |
||
1063 |
"Created: / 08-04-2008 / 14:17:03 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
1064 |
"Modified: / 16-07-2009 / 13:57:03 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
970 | 1065 |
"Modified: / 24-01-2012 / 18:10:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
57 | 1066 |
! ! |
1067 |
||
1068 |
!WorkingCopy class methodsFor:'documentation'! |
|
1069 |
||
905
58dc08c9d3b4
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
795
diff
changeset
|
1070 |
version |
58dc08c9d3b4
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
795
diff
changeset
|
1071 |
^ '$Header$' |
58dc08c9d3b4
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
795
diff
changeset
|
1072 |
! |
58dc08c9d3b4
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
795
diff
changeset
|
1073 |
|
137 | 1074 |
version_SVN |
905
58dc08c9d3b4
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
795
diff
changeset
|
1075 |
^ '§Id: SVN__WorkingCopy.st 371 2011-09-28 18:47:07Z vranyj1 §' |
57 | 1076 |
! ! |