author | Claus Gittinger <cg@exept.de> |
Fri, 25 Nov 2011 11:31:28 +0100 | |
changeset 514 | 68b325cf69cb |
parent 309 | cbe9b5c3ad92 |
child 675 | 0f3c79b5226a |
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 |
||
210 | 11 |
!MCRepository class methodsFor:'initialization'! |
12 |
||
13 |
initialize |
|
14 |
"self initialize" |
|
15 |
" |
|
16 |
ExternalSettings registerClient: self. |
|
17 |
" |
|
18 |
||
19 |
"Modified: / 13-10-2010 / 14:13:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
20 |
! ! |
|
21 |
||
106 | 22 |
!MCRepository class methodsFor:'as yet unclassified'! |
23 |
||
24 |
allConcreteSubclasses |
|
25 |
^ self withAllSubclasses reject: [:ea | ea isAbstract] |
|
26 |
! |
|
27 |
||
28 |
creationTemplate |
|
29 |
self subclassResponsibility. |
|
30 |
! |
|
31 |
||
32 |
description |
|
33 |
^ nil |
|
34 |
! |
|
35 |
||
36 |
fillInTheBlankRequest |
|
37 |
self subclassResponsibility. |
|
38 |
! |
|
39 |
||
40 |
isAbstract |
|
41 |
^ self description isNil |
|
42 |
! |
|
43 |
||
44 |
morphicConfigure |
|
45 |
^ self new |
|
46 |
! ! |
|
47 |
||
48 |
!MCRepository class methodsFor:'external settings'! |
|
49 |
||
50 |
fetchExternalSettingsIn: aDirectory |
|
51 |
"Scan for settings file" |
|
52 |
"MCRepository fetchExternalSettingsIn: ExternalSettings preferenceDirectory" |
|
53 |
||
54 |
| stream | |
|
55 |
(aDirectory fileExists: self settingsFileName) |
|
56 |
ifFalse: [^self]. |
|
210 | 57 |
stream := aDirectory readOnlyFileNamed: self settingsFileName. |
106 | 58 |
stream |
59 |
ifNotNil: [ |
|
210 | 60 |
[Settings := ExternalSettings parseServerEntryArgsFrom: stream] |
106 | 61 |
ensure: [stream close]]. |
210 | 62 |
|
106 | 63 |
! |
64 |
||
65 |
releaseExternalSettings |
|
66 |
Settings := nil. |
|
210 | 67 |
|
106 | 68 |
! |
69 |
||
70 |
settingsFileName |
|
71 |
^ 'mcSettings' |
|
72 |
! ! |
|
73 |
||
514 | 74 |
|
106 | 75 |
|
514 | 76 |
!MCRepository methodsFor:'as yet unclassified'! |
106 | 77 |
|
78 |
alwaysStoreDiffs |
|
79 |
^ storeDiffs ifNil: [false] |
|
80 |
! |
|
81 |
||
82 |
asCreationTemplate |
|
83 |
^ self creationTemplate |
|
84 |
! |
|
85 |
||
86 |
closestAncestorVersionFor: anAncestry ifNone: errorBlock |
|
210 | 87 |
| v | |
106 | 88 |
anAncestry breadthFirstAncestorsDo: |
89 |
[:ancestorInfo | |
|
210 | 90 |
(v := self versionWithInfo: ancestorInfo) ifNotNil: [ ^ v]]. |
106 | 91 |
^ errorBlock value |
92 |
! |
|
93 |
||
94 |
creationTemplate |
|
95 |
^ creationTemplate |
|
96 |
! |
|
97 |
||
98 |
creationTemplate: aString |
|
99 |
self creationTemplate ifNotNil: [ self error: 'Creation template already set for this MCRepository instance.' ]. |
|
100 |
||
210 | 101 |
creationTemplate := aString. |
106 | 102 |
! |
103 |
||
104 |
description |
|
105 |
^ self class name |
|
106 |
! |
|
107 |
||
108 |
doAlwaysStoreDiffs |
|
210 | 109 |
storeDiffs := true |
106 | 110 |
! |
111 |
||
112 |
doNotAlwaysStoreDiffs |
|
210 | 113 |
storeDiffs := false |
106 | 114 |
! |
115 |
||
116 |
notificationForVersion: aVersion |
|
117 |
^ MCVersionNotification version: aVersion repository: self |
|
118 |
! |
|
119 |
||
120 |
notifyList |
|
121 |
^ #() |
|
122 |
! |
|
123 |
||
124 |
possiblyNewerVersionsOfAnyOf: someVersions |
|
125 |
^#() |
|
126 |
! |
|
127 |
||
128 |
prepareVersionForStorage: aVersion |
|
129 |
^ self alwaysStoreDiffs |
|
130 |
ifTrue: [aVersion asDiffAgainst: |
|
131 |
(self closestAncestorVersionFor: aVersion info ifNone: [^ aVersion])] |
|
132 |
ifFalse: [aVersion] |
|
133 |
! |
|
134 |
||
135 |
sendNotificationsForVersion: aVersion |
|
136 |
| notification notifyList | |
|
210 | 137 |
notifyList := self notifyList. |
106 | 138 |
notifyList isEmpty ifFalse: |
210 | 139 |
[notification := self notificationForVersion: aVersion. |
106 | 140 |
notifyList do: [:ea | notification notify: ea]] |
514 | 141 |
! ! |
142 |
||
143 |
!MCRepository methodsFor:'comparing'! |
|
144 |
||
145 |
= other |
|
146 |
^ other species = self species and: [other description = self description] |
|
106 | 147 |
! |
148 |
||
514 | 149 |
hash |
150 |
^ self description hash |
|
106 | 151 |
! ! |
152 |
||
153 |
!MCRepository methodsFor:'interface'! |
|
154 |
||
155 |
includesVersionNamed: aString |
|
156 |
self subclassResponsibility |
|
157 |
! |
|
158 |
||
159 |
versionWithInfo: aVersionInfo |
|
160 |
^ self versionWithInfo: aVersionInfo ifAbsent: [nil] |
|
161 |
! |
|
162 |
||
163 |
versionWithInfo: aVersionInfo ifAbsent: aBlock |
|
164 |
self subclassResponsibility |
|
165 |
! ! |
|
166 |
||
514 | 167 |
!MCRepository methodsFor:'printing & storing'! |
168 |
||
169 |
basicStoreVersion: aVersion |
|
170 |
self subclassResponsibility |
|
171 |
! |
|
172 |
||
173 |
printOn: aStream |
|
174 |
super printOn: aStream. |
|
175 |
aStream |
|
176 |
nextPut: $(; |
|
177 |
nextPutAll: self description; |
|
178 |
nextPut: $). |
|
179 |
! |
|
180 |
||
181 |
storeVersion: aVersion |
|
182 |
self basicStoreVersion: (self prepareVersionForStorage: aVersion). |
|
183 |
self sendNotificationsForVersion: aVersion |
|
184 |
! ! |
|
185 |
||
106 | 186 |
!MCRepository methodsFor:'testing'! |
187 |
||
188 |
isValid |
|
189 |
^true |
|
190 |
! ! |
|
191 |
||
192 |
!MCRepository class methodsFor:'documentation'! |
|
193 |
||
194 |
version |
|
514 | 195 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCRepository.st,v 1.5 2011-11-25 10:31:28 cg Exp $' |
137
98f158a061a2
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
106
diff
changeset
|
196 |
! |
98f158a061a2
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
106
diff
changeset
|
197 |
|
98f158a061a2
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
106
diff
changeset
|
198 |
version_CVS |
514 | 199 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCRepository.st,v 1.5 2011-11-25 10:31:28 cg Exp $' |
210 | 200 |
! |
201 |
||
202 |
version_SVN |
|
203 |
||
204 |
^'§Id: MCRepository.st 18 2010-10-13 12:27:08Z vranyj1 §' |
|
106 | 205 |
! ! |
206 |
||
207 |
MCRepository initialize! |