author | Claus Gittinger <cg@exept.de> |
Mon, 26 Oct 2009 16:24:55 +0100 | |
changeset 137 | 98f158a061a2 |
parent 106 | 5d9bfc22f97b |
child 210 | 6948613cd845 |
permissions | -rw-r--r-- |
106 | 1 |
"{ Package: 'stx:goodies/monticello' }" |
2 |
||
3 |
Object subclass:#MCRepository |
|
4 |
instanceVariableNames:'creationTemplate storeDiffs' |
|
5 |
classVariableNames:'Settings' |
|
6 |
poolDictionaries:'' |
|
7 |
category:'Monticello-Repositories' |
|
8 |
! |
|
9 |
||
10 |
||
11 |
!MCRepository class methodsFor:'as yet unclassified'! |
|
12 |
||
13 |
allConcreteSubclasses |
|
14 |
^ self withAllSubclasses reject: [:ea | ea isAbstract] |
|
15 |
! |
|
16 |
||
17 |
creationTemplate |
|
18 |
self subclassResponsibility. |
|
19 |
! |
|
20 |
||
21 |
description |
|
22 |
^ nil |
|
23 |
! |
|
24 |
||
25 |
fillInTheBlankConfigure |
|
26 |
^ self fillInTheBlankConfigure: self creationTemplate |
|
27 |
||
28 |
! |
|
29 |
||
30 |
fillInTheBlankConfigure: aTemplateString |
|
31 |
| chunk repo | |
|
32 |
||
33 |
aTemplateString ifNil: [ ^ false ]. |
|
34 |
chunk _ FillInTheBlankMorph |
|
35 |
request: self fillInTheBlankRequest |
|
36 |
initialAnswer: aTemplateString |
|
37 |
centerAt: Sensor cursorPoint |
|
38 |
inWorld: World |
|
39 |
onCancelReturn: nil |
|
40 |
acceptOnCR: false |
|
41 |
answerExtent: 400@120. |
|
42 |
||
43 |
chunk |
|
44 |
ifNotNil: [ |
|
45 |
repo _ self readFrom: chunk readStream. |
|
46 |
repo creationTemplate: chunk. |
|
47 |
]. |
|
48 |
||
49 |
^ repo |
|
50 |
! |
|
51 |
||
52 |
fillInTheBlankRequest |
|
53 |
self subclassResponsibility. |
|
54 |
! |
|
55 |
||
56 |
isAbstract |
|
57 |
^ self description isNil |
|
58 |
! |
|
59 |
||
60 |
morphicConfigure |
|
61 |
^ self new |
|
62 |
! |
|
63 |
||
64 |
new |
|
65 |
^ self basicNew initialize |
|
66 |
! ! |
|
67 |
||
68 |
!MCRepository class methodsFor:'class initialization'! |
|
69 |
||
70 |
initialize |
|
137
98f158a061a2
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
106
diff
changeset
|
71 |
"self initialize" |
106 | 72 |
|
137
98f158a061a2
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
106
diff
changeset
|
73 |
Smalltalk isSmalltalkX ifFalse:[ |
98f158a061a2
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
106
diff
changeset
|
74 |
ExternalSettings registerClient: self. |
98f158a061a2
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
106
diff
changeset
|
75 |
] |
106 | 76 |
! ! |
77 |
||
78 |
!MCRepository class methodsFor:'external settings'! |
|
79 |
||
80 |
fetchExternalSettingsIn: aDirectory |
|
81 |
"Scan for settings file" |
|
82 |
"MCRepository fetchExternalSettingsIn: ExternalSettings preferenceDirectory" |
|
83 |
||
84 |
| stream | |
|
85 |
(aDirectory fileExists: self settingsFileName) |
|
86 |
ifFalse: [^self]. |
|
87 |
stream _ aDirectory readOnlyFileNamed: self settingsFileName. |
|
88 |
stream |
|
89 |
ifNotNil: [ |
|
90 |
[Settings _ ExternalSettings parseServerEntryArgsFrom: stream] |
|
91 |
ensure: [stream close]]. |
|
92 |
! |
|
93 |
||
94 |
releaseExternalSettings |
|
95 |
Settings := nil. |
|
96 |
! |
|
97 |
||
98 |
settingsFileName |
|
99 |
^ 'mcSettings' |
|
100 |
! ! |
|
101 |
||
102 |
!MCRepository methodsFor:'as yet unclassified'! |
|
103 |
||
104 |
= other |
|
105 |
^ other species = self species and: [other description = self description] |
|
106 |
! |
|
107 |
||
108 |
alwaysStoreDiffs |
|
109 |
^ storeDiffs ifNil: [false] |
|
110 |
! |
|
111 |
||
112 |
asCreationTemplate |
|
113 |
^ self creationTemplate |
|
114 |
! |
|
115 |
||
116 |
basicStoreVersion: aVersion |
|
117 |
self subclassResponsibility |
|
118 |
! |
|
119 |
||
120 |
closestAncestorVersionFor: anAncestry ifNone: errorBlock |
|
121 |
anAncestry breadthFirstAncestorsDo: |
|
122 |
[:ancestorInfo | |
|
123 |
(self versionWithInfo: ancestorInfo) ifNotNilDo: [:v | ^ v]]. |
|
124 |
^ errorBlock value |
|
125 |
! |
|
126 |
||
127 |
creationTemplate |
|
128 |
^ creationTemplate |
|
129 |
! |
|
130 |
||
131 |
creationTemplate: aString |
|
132 |
self creationTemplate ifNotNil: [ self error: 'Creation template already set for this MCRepository instance.' ]. |
|
133 |
||
134 |
creationTemplate _ aString. |
|
135 |
! |
|
136 |
||
137 |
description |
|
138 |
^ self class name |
|
139 |
! |
|
140 |
||
141 |
doAlwaysStoreDiffs |
|
142 |
storeDiffs _ true |
|
143 |
! |
|
144 |
||
145 |
doNotAlwaysStoreDiffs |
|
146 |
storeDiffs _ false |
|
147 |
! |
|
148 |
||
149 |
hash |
|
150 |
^ self description hash |
|
151 |
! |
|
152 |
||
153 |
initialize |
|
154 |
! |
|
155 |
||
156 |
notificationForVersion: aVersion |
|
157 |
^ MCVersionNotification version: aVersion repository: self |
|
158 |
! |
|
159 |
||
160 |
notifyList |
|
161 |
^ #() |
|
162 |
! |
|
163 |
||
164 |
possiblyNewerVersionsOfAnyOf: someVersions |
|
165 |
^#() |
|
166 |
! |
|
167 |
||
168 |
prepareVersionForStorage: aVersion |
|
169 |
^ self alwaysStoreDiffs |
|
170 |
ifTrue: [aVersion asDiffAgainst: |
|
171 |
(self closestAncestorVersionFor: aVersion info ifNone: [^ aVersion])] |
|
172 |
ifFalse: [aVersion] |
|
173 |
! |
|
174 |
||
175 |
printOn: aStream |
|
176 |
super printOn: aStream. |
|
177 |
aStream |
|
178 |
nextPut: $(; |
|
179 |
nextPutAll: self description; |
|
180 |
nextPut: $). |
|
181 |
! |
|
182 |
||
183 |
sendNotificationsForVersion: aVersion |
|
184 |
| notification notifyList | |
|
185 |
notifyList _ self notifyList. |
|
186 |
notifyList isEmpty ifFalse: |
|
187 |
[notification _ self notificationForVersion: aVersion. |
|
188 |
notifyList do: [:ea | notification notify: ea]] |
|
189 |
! |
|
190 |
||
191 |
storeVersion: aVersion |
|
192 |
self basicStoreVersion: (self prepareVersionForStorage: aVersion). |
|
193 |
self sendNotificationsForVersion: aVersion |
|
194 |
! ! |
|
195 |
||
196 |
!MCRepository methodsFor:'interface'! |
|
197 |
||
198 |
includesVersionNamed: aString |
|
199 |
self subclassResponsibility |
|
200 |
! |
|
201 |
||
202 |
morphicOpen |
|
203 |
self morphicOpen: nil |
|
204 |
! |
|
205 |
||
206 |
morphicOpen: aWorkingCopy |
|
207 |
self subclassResponsibility |
|
208 |
! |
|
209 |
||
210 |
openAndEditTemplateCopy |
|
211 |
^ self class fillInTheBlankConfigure: (self asCreationTemplate ifNil: [^nil]) |
|
212 |
! |
|
213 |
||
214 |
versionWithInfo: aVersionInfo |
|
215 |
^ self versionWithInfo: aVersionInfo ifAbsent: [nil] |
|
216 |
! |
|
217 |
||
218 |
versionWithInfo: aVersionInfo ifAbsent: aBlock |
|
219 |
self subclassResponsibility |
|
220 |
! ! |
|
221 |
||
222 |
!MCRepository methodsFor:'testing'! |
|
223 |
||
224 |
isValid |
|
225 |
^true |
|
226 |
! ! |
|
227 |
||
228 |
!MCRepository class methodsFor:'documentation'! |
|
229 |
||
230 |
version |
|
137
98f158a061a2
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
106
diff
changeset
|
231 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCRepository.st,v 1.2 2009-10-26 15:24:55 cg Exp $' |
98f158a061a2
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
106
diff
changeset
|
232 |
! |
98f158a061a2
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
106
diff
changeset
|
233 |
|
98f158a061a2
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
106
diff
changeset
|
234 |
version_CVS |
98f158a061a2
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
106
diff
changeset
|
235 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCRepository.st,v 1.2 2009-10-26 15:24:55 cg Exp $' |
106 | 236 |
! ! |
237 |
||
238 |
MCRepository initialize! |