77
|
1 |
"{ Package: 'cvut:stx/goodies/libsvn' }"
|
|
2 |
|
|
3 |
"{ NameSpace: SVN }"
|
|
4 |
|
|
5 |
FileoutLikeTask subclass:#UpdateTask
|
|
6 |
instanceVariableNames:'revision notifications updates conflicts resolution'
|
|
7 |
classVariableNames:''
|
|
8 |
poolDictionaries:''
|
|
9 |
category:'SVN-Tasks'
|
|
10 |
!
|
|
11 |
|
|
12 |
!UpdateTask class methodsFor:'documentation'!
|
|
13 |
|
|
14 |
version_SVN
|
|
15 |
^'$Id$'
|
|
16 |
! !
|
|
17 |
|
|
18 |
!UpdateTask methodsFor:'accessing'!
|
|
19 |
|
|
20 |
revision
|
|
21 |
^ revision
|
|
22 |
|
|
23 |
"Modified: / 09-04-2009 / 09:39:42 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
24 |
!
|
|
25 |
|
|
26 |
revision:aRevision
|
|
27 |
revision := aRevision.
|
|
28 |
loadChangeSet := mergeDiffSet := updateChangeSet := nil.
|
|
29 |
|
|
30 |
"Modified: / 23-03-2009 / 18:40:00 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
31 |
! !
|
|
32 |
|
|
33 |
!UpdateTask methodsFor:'executing'!
|
|
34 |
|
|
35 |
do
|
|
36 |
"
|
|
37 |
Perform whole task"
|
|
38 |
|
|
39 |
self assert: revision notNil message: 'No revision specified'.
|
|
40 |
self doUpdateWorkingCopy doApplyMergedChangeSet
|
|
41 |
|
|
42 |
"Modified: / 09-04-2009 / 09:40:28 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
43 |
!
|
|
44 |
|
|
45 |
doApplyResolutions
|
|
46 |
self do:
|
|
47 |
[resolution isNilOrEmptyCollection ifFalse:
|
|
48 |
[(Class updateChangeFileQuerySignal , Class updateChangeListQuerySignal)
|
|
49 |
answer: false
|
|
50 |
do:
|
|
51 |
[resolution withIndexDo:
|
|
52 |
[:change :index |
|
|
53 |
change apply.
|
|
54 |
SVN::ProgressNotification
|
|
55 |
notify: 'Applying changes'
|
|
56 |
progress: (100 / resolution size) * index ] ] ].
|
|
57 |
self doCompileSvnRevisionNrMethod: true]
|
|
58 |
|
|
59 |
"Created: / 23-03-2009 / 18:36:32 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
60 |
"Modified: / 17-08-2009 / 19:39:17 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
61 |
!
|
|
62 |
|
|
63 |
doUpdateWorkingCopy
|
|
64 |
self do:
|
|
65 |
[ self workingCopy ensureIsValid.
|
|
66 |
self
|
|
67 |
doRevert;
|
|
68 |
doFileOutAll;
|
|
69 |
doUpdate;
|
|
70 |
doLoadChanges ]
|
|
71 |
|
|
72 |
"Created: / 23-03-2009 / 18:35:06 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
73 |
"Modified: / 17-08-2009 / 19:01:45 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
74 |
! !
|
|
75 |
|
|
76 |
!UpdateTask methodsFor:'executing - private'!
|
|
77 |
|
|
78 |
doLoadChanges
|
|
79 |
updates := ChangeSet new.
|
|
80 |
conflicts := ChangeSet::DiffSet new.
|
|
81 |
notifications do: [:each | self doLoadChangesFor: each ].
|
|
82 |
|
|
83 |
"Modified: / 18-08-2009 / 08:59:11 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
84 |
!
|
|
85 |
|
|
86 |
doLoadChangesFor: aWCActionNotify
|
|
87 |
|
|
88 |
"We should process only notifications for source
|
|
89 |
and/or conflicted entries"
|
|
90 |
|
|
91 |
(aWCActionNotify action isConflict or:
|
|
92 |
[aWCActionNotify entry isSourceFileEntry])
|
|
93 |
ifTrue:[aWCActionNotify processUsing: self]
|
|
94 |
|
|
95 |
"Created: / 18-08-2009 / 08:59:10 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
96 |
"Modified: / 27-08-2009 / 08:57:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
97 |
!
|
|
98 |
|
|
99 |
doRevert
|
|
100 |
SVN::ActivityNotification notify: 'Reverting local changes'.
|
|
101 |
(RevertCommand new)
|
|
102 |
workingCopy: self workingCopy path;
|
|
103 |
paths: (ProgrammingLanguage
|
|
104 |
allCollect: [:lang | '*.' , lang sourceFileSuffix ]);
|
|
105 |
execute.
|
|
106 |
!
|
|
107 |
|
|
108 |
doUpdate
|
|
109 |
SVN::ActivityNotification
|
|
110 |
notify: 'Updating working copy to revision ' , self revision printString.
|
|
111 |
notifications := (UpdateCommand new)
|
|
112 |
workingCopy: self workingCopy;
|
|
113 |
revision: self revision;
|
|
114 |
execute
|
|
115 |
|
|
116 |
"Modified: / 19-08-2009 / 12:22:49 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
117 |
! !
|
|
118 |
|
|
119 |
!UpdateTask methodsFor:'private'!
|
|
120 |
|
|
121 |
filterChangeSet: aChangeSet
|
|
122 |
"
|
|
123 |
Removes changes for methods that are not interesting
|
|
124 |
(such as version methods & autogenerated package description
|
|
125 |
methods)"
|
|
126 |
|
|
127 |
| changesToRemove |
|
|
128 |
|
|
129 |
changesToRemove := aChangeSet
|
|
130 |
select: [:change | change isForGeneratedSubject ].
|
|
131 |
aChangeSet removeAll: changesToRemove.
|
|
132 |
^ aChangeSet
|
|
133 |
|
|
134 |
"Created: / 08-04-2009 / 09:53:49 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
135 |
! !
|
|
136 |
|
|
137 |
!UpdateTask methodsFor:'processing - private'!
|
|
138 |
|
|
139 |
processAddedEntry: entry
|
|
140 |
|
|
141 |
entry sourceLanguage isSmalltalk
|
|
142 |
ifTrue:
|
|
143 |
[updates addAll:
|
|
144 |
(ChangeSet fromStream: entry readStream) ]
|
|
145 |
ifFalse:
|
|
146 |
[self error:'Non smalltalk source not yet supported']
|
|
147 |
|
|
148 |
"Created: / 27-08-2009 / 08:54:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
149 |
"Modified: / 27-08-2009 / 10:37:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
150 |
!
|
|
151 |
|
|
152 |
processDeletedEntry: entry
|
|
153 |
|
|
154 |
entry sourceLanguage isSmalltalk ifTrue:
|
|
155 |
[entry path = 'extensions.st' ifTrue:[self halt"not yet finished"].
|
|
156 |
self halt.]
|
|
157 |
|
|
158 |
"Created: / 27-08-2009 / 09:56:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
159 |
! !
|
|
160 |
|
|
161 |
!UpdateTask class methodsFor:'documentation'!
|
|
162 |
|
|
163 |
version
|
|
164 |
^ '$Header$'
|
|
165 |
! !
|