author | Claus Gittinger <cg@exept.de> |
Wed, 12 Feb 2014 15:53:34 +0100 | |
changeset 903 | ce9914318a74 |
parent 675 | 0f3c79b5226a |
child 910 | 6a56267a1e3c |
permissions | -rw-r--r-- |
106 | 1 |
"{ Package: 'stx:goodies/monticello' }" |
2 |
||
3 |
Object subclass:#MCRepository |
|
4 |
instanceVariableNames:'creationTemplate storeDiffs' |
|
5 |
classVariableNames:'Settings' |
|
6 |
poolDictionaries:'' |
|
675 | 7 |
category:'SCM-Monticello-Repositories' |
106 | 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 |
|
75 |
!MCRepository methodsFor:'as yet unclassified'! |
|
106 | 76 |
|
77 |
alwaysStoreDiffs |
|
78 |
^ storeDiffs ifNil: [false] |
|
79 |
! |
|
80 |
||
81 |
asCreationTemplate |
|
82 |
^ self creationTemplate |
|
83 |
! |
|
84 |
||
85 |
closestAncestorVersionFor: anAncestry ifNone: errorBlock |
|
210 | 86 |
| v | |
106 | 87 |
anAncestry breadthFirstAncestorsDo: |
88 |
[:ancestorInfo | |
|
210 | 89 |
(v := self versionWithInfo: ancestorInfo) ifNotNil: [ ^ v]]. |
106 | 90 |
^ errorBlock value |
91 |
! |
|
92 |
||
93 |
creationTemplate |
|
94 |
^ creationTemplate |
|
95 |
! |
|
96 |
||
97 |
creationTemplate: aString |
|
98 |
self creationTemplate ifNotNil: [ self error: 'Creation template already set for this MCRepository instance.' ]. |
|
99 |
||
210 | 100 |
creationTemplate := aString. |
106 | 101 |
! |
102 |
||
103 |
description |
|
104 |
^ self class name |
|
105 |
! |
|
106 |
||
107 |
doAlwaysStoreDiffs |
|
210 | 108 |
storeDiffs := true |
106 | 109 |
! |
110 |
||
111 |
doNotAlwaysStoreDiffs |
|
210 | 112 |
storeDiffs := false |
106 | 113 |
! |
114 |
||
115 |
notificationForVersion: aVersion |
|
116 |
^ MCVersionNotification version: aVersion repository: self |
|
117 |
! |
|
118 |
||
119 |
notifyList |
|
120 |
^ #() |
|
121 |
! |
|
122 |
||
123 |
possiblyNewerVersionsOfAnyOf: someVersions |
|
124 |
^#() |
|
125 |
! |
|
126 |
||
127 |
prepareVersionForStorage: aVersion |
|
128 |
^ self alwaysStoreDiffs |
|
129 |
ifTrue: [aVersion asDiffAgainst: |
|
130 |
(self closestAncestorVersionFor: aVersion info ifNone: [^ aVersion])] |
|
131 |
ifFalse: [aVersion] |
|
132 |
! |
|
133 |
||
134 |
sendNotificationsForVersion: aVersion |
|
135 |
| notification notifyList | |
|
210 | 136 |
notifyList := self notifyList. |
106 | 137 |
notifyList isEmpty ifFalse: |
210 | 138 |
[notification := self notificationForVersion: aVersion. |
106 | 139 |
notifyList do: [:ea | notification notify: ea]] |
514 | 140 |
! ! |
141 |
||
142 |
!MCRepository methodsFor:'comparing'! |
|
143 |
||
144 |
= other |
|
145 |
^ other species = self species and: [other description = self description] |
|
106 | 146 |
! |
147 |
||
514 | 148 |
hash |
149 |
^ self description hash |
|
106 | 150 |
! ! |
151 |
||
152 |
!MCRepository methodsFor:'interface'! |
|
153 |
||
154 |
includesVersionNamed: aString |
|
155 |
self subclassResponsibility |
|
156 |
! |
|
157 |
||
158 |
versionWithInfo: aVersionInfo |
|
159 |
^ self versionWithInfo: aVersionInfo ifAbsent: [nil] |
|
160 |
! |
|
161 |
||
162 |
versionWithInfo: aVersionInfo ifAbsent: aBlock |
|
163 |
self subclassResponsibility |
|
164 |
! ! |
|
165 |
||
514 | 166 |
!MCRepository methodsFor:'printing & storing'! |
167 |
||
168 |
basicStoreVersion: aVersion |
|
169 |
self subclassResponsibility |
|
170 |
! |
|
171 |
||
172 |
printOn: aStream |
|
173 |
super printOn: aStream. |
|
174 |
aStream |
|
175 |
nextPut: $(; |
|
176 |
nextPutAll: self description; |
|
177 |
nextPut: $). |
|
178 |
! |
|
179 |
||
180 |
storeVersion: aVersion |
|
181 |
self basicStoreVersion: (self prepareVersionForStorage: aVersion). |
|
182 |
self sendNotificationsForVersion: aVersion |
|
183 |
! ! |
|
184 |
||
106 | 185 |
!MCRepository methodsFor:'testing'! |
186 |
||
187 |
isValid |
|
188 |
^true |
|
189 |
! ! |
|
190 |
||
191 |
!MCRepository class methodsFor:'documentation'! |
|
192 |
||
193 |
version |
|
675 | 194 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCRepository.st,v 1.6 2012-09-11 21:28:17 cg Exp $' |
137
98f158a061a2
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
106
diff
changeset
|
195 |
! |
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 |
version_CVS |
675 | 198 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCRepository.st,v 1.6 2012-09-11 21:28:17 cg Exp $' |
210 | 199 |
! |
200 |
||
201 |
version_SVN |
|
202 |
||
203 |
^'§Id: MCRepository.st 18 2010-10-13 12:27:08Z vranyj1 §' |
|
106 | 204 |
! ! |
205 |
||
206 |
MCRepository initialize! |