author | Jan Vrany <jan.vrany@labware.com> |
Mon, 25 Jul 2022 10:53:39 +0100 | |
branch | jv |
changeset 1159 | 5f3f06a99a93 |
parent 1095 | 87f223484bc3 |
child 1160 | 1539e58bab91 |
permissions | -rw-r--r-- |
1159
5f3f06a99a93
Make all repository types to store info change record
Jan Vrany <jan.vrany@labware.com>
parents:
1095
diff
changeset
|
1 |
" |
5f3f06a99a93
Make all repository types to store info change record
Jan Vrany <jan.vrany@labware.com>
parents:
1095
diff
changeset
|
2 |
COPYRIGHT (c) 2022 LabWare |
5f3f06a99a93
Make all repository types to store info change record
Jan Vrany <jan.vrany@labware.com>
parents:
1095
diff
changeset
|
3 |
" |
1095
87f223484bc3
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
965
diff
changeset
|
4 |
"{ Package: 'stx:goodies/monticello' }" |
87f223484bc3
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
965
diff
changeset
|
5 |
|
87f223484bc3
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
965
diff
changeset
|
6 |
"{ NameSpace: Smalltalk }" |
87f223484bc3
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
965
diff
changeset
|
7 |
|
87f223484bc3
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
965
diff
changeset
|
8 |
Object subclass:#MCRepository |
87f223484bc3
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
965
diff
changeset
|
9 |
instanceVariableNames:'creationTemplate storeDiffs' |
87f223484bc3
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
965
diff
changeset
|
10 |
classVariableNames:'Settings' |
87f223484bc3
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
965
diff
changeset
|
11 |
poolDictionaries:'' |
87f223484bc3
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
965
diff
changeset
|
12 |
category:'SCM-Monticello-Repositories' |
87f223484bc3
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
965
diff
changeset
|
13 |
! |
106 | 14 |
|
1159
5f3f06a99a93
Make all repository types to store info change record
Jan Vrany <jan.vrany@labware.com>
parents:
1095
diff
changeset
|
15 |
!MCRepository class methodsFor:'documentation'! |
5f3f06a99a93
Make all repository types to store info change record
Jan Vrany <jan.vrany@labware.com>
parents:
1095
diff
changeset
|
16 |
|
5f3f06a99a93
Make all repository types to store info change record
Jan Vrany <jan.vrany@labware.com>
parents:
1095
diff
changeset
|
17 |
copyright |
5f3f06a99a93
Make all repository types to store info change record
Jan Vrany <jan.vrany@labware.com>
parents:
1095
diff
changeset
|
18 |
" |
5f3f06a99a93
Make all repository types to store info change record
Jan Vrany <jan.vrany@labware.com>
parents:
1095
diff
changeset
|
19 |
COPYRIGHT (c) 2022 LabWare |
5f3f06a99a93
Make all repository types to store info change record
Jan Vrany <jan.vrany@labware.com>
parents:
1095
diff
changeset
|
20 |
|
5f3f06a99a93
Make all repository types to store info change record
Jan Vrany <jan.vrany@labware.com>
parents:
1095
diff
changeset
|
21 |
|
5f3f06a99a93
Make all repository types to store info change record
Jan Vrany <jan.vrany@labware.com>
parents:
1095
diff
changeset
|
22 |
" |
5f3f06a99a93
Make all repository types to store info change record
Jan Vrany <jan.vrany@labware.com>
parents:
1095
diff
changeset
|
23 |
! ! |
106 | 24 |
|
210 | 25 |
!MCRepository class methodsFor:'initialization'! |
26 |
||
27 |
initialize |
|
28 |
"self initialize" |
|
29 |
" |
|
30 |
ExternalSettings registerClient: self. |
|
31 |
" |
|
32 |
||
33 |
"Modified: / 13-10-2010 / 14:13:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
34 |
! ! |
|
35 |
||
106 | 36 |
!MCRepository class methodsFor:'as yet unclassified'! |
37 |
||
38 |
fillInTheBlankRequest |
|
39 |
self subclassResponsibility. |
|
40 |
! |
|
41 |
||
42 |
morphicConfigure |
|
43 |
^ self new |
|
44 |
! ! |
|
45 |
||
46 |
!MCRepository class methodsFor:'external settings'! |
|
47 |
||
48 |
fetchExternalSettingsIn: aDirectory |
|
49 |
"Scan for settings file" |
|
50 |
"MCRepository fetchExternalSettingsIn: ExternalSettings preferenceDirectory" |
|
51 |
||
52 |
| stream | |
|
53 |
(aDirectory fileExists: self settingsFileName) |
|
54 |
ifFalse: [^self]. |
|
210 | 55 |
stream := aDirectory readOnlyFileNamed: self settingsFileName. |
106 | 56 |
stream |
57 |
ifNotNil: [ |
|
210 | 58 |
[Settings := ExternalSettings parseServerEntryArgsFrom: stream] |
106 | 59 |
ensure: [stream close]]. |
210 | 60 |
|
106 | 61 |
! |
62 |
||
63 |
releaseExternalSettings |
|
64 |
Settings := nil. |
|
210 | 65 |
|
106 | 66 |
! |
67 |
||
68 |
settingsFileName |
|
69 |
^ 'mcSettings' |
|
70 |
! ! |
|
71 |
||
910 | 72 |
!MCRepository class methodsFor:'queries'! |
106 | 73 |
|
910 | 74 |
allConcreteSubclasses |
75 |
^ self withAllSubclasses reject: [:ea | ea isAbstract] |
|
76 |
! |
|
77 |
||
78 |
creationTemplate |
|
79 |
self subclassResponsibility. |
|
106 | 80 |
! |
81 |
||
910 | 82 |
description |
83 |
^ nil |
|
106 | 84 |
! |
85 |
||
910 | 86 |
isAbstract |
87 |
^ self description isNil |
|
88 |
! ! |
|
89 |
||
90 |
!MCRepository methodsFor:'accessing'! |
|
106 | 91 |
|
92 |
creationTemplate |
|
93 |
^ creationTemplate |
|
94 |
! |
|
95 |
||
96 |
creationTemplate: aString |
|
97 |
self creationTemplate ifNotNil: [ self error: 'Creation template already set for this MCRepository instance.' ]. |
|
98 |
||
210 | 99 |
creationTemplate := aString. |
106 | 100 |
! |
101 |
||
102 |
description |
|
103 |
^ self class name |
|
910 | 104 |
! ! |
105 |
||
106 |
!MCRepository methodsFor:'as yet unclassified'! |
|
107 |
||
108 |
alwaysStoreDiffs |
|
109 |
^ storeDiffs ifNil: [false] |
|
110 |
! |
|
111 |
||
112 |
asCreationTemplate |
|
113 |
^ self creationTemplate |
|
106 | 114 |
! |
115 |
||
116 |
doAlwaysStoreDiffs |
|
210 | 117 |
storeDiffs := true |
106 | 118 |
! |
119 |
||
120 |
doNotAlwaysStoreDiffs |
|
210 | 121 |
storeDiffs := false |
106 | 122 |
! |
123 |
||
124 |
notificationForVersion: aVersion |
|
125 |
^ MCVersionNotification version: aVersion repository: self |
|
126 |
! |
|
127 |
||
128 |
notifyList |
|
129 |
^ #() |
|
130 |
! |
|
131 |
||
132 |
prepareVersionForStorage: aVersion |
|
965 | 133 |
self alwaysStoreDiffs ifTrue: [ |
134 |
^ aVersion |
|
135 |
asDiffAgainst: (self closestAncestorVersionFor: aVersion info ifNone: [^ aVersion]) |
|
136 |
] ifFalse: [ |
|
137 |
^ aVersion |
|
138 |
] |
|
106 | 139 |
! |
140 |
||
141 |
sendNotificationsForVersion: aVersion |
|
142 |
| notification notifyList | |
|
210 | 143 |
notifyList := self notifyList. |
106 | 144 |
notifyList isEmpty ifFalse: |
210 | 145 |
[notification := self notificationForVersion: aVersion. |
106 | 146 |
notifyList do: [:ea | notification notify: ea]] |
514 | 147 |
! ! |
148 |
||
149 |
!MCRepository methodsFor:'comparing'! |
|
150 |
||
151 |
= other |
|
152 |
^ other species = self species and: [other description = self description] |
|
106 | 153 |
! |
154 |
||
514 | 155 |
hash |
156 |
^ self description hash |
|
106 | 157 |
! ! |
158 |
||
159 |
!MCRepository methodsFor:'interface'! |
|
160 |
||
161 |
includesVersionNamed: aString |
|
162 |
self subclassResponsibility |
|
163 |
! |
|
164 |
||
165 |
versionWithInfo: aVersionInfo |
|
166 |
^ self versionWithInfo: aVersionInfo ifAbsent: [nil] |
|
167 |
! |
|
168 |
||
169 |
versionWithInfo: aVersionInfo ifAbsent: aBlock |
|
170 |
self subclassResponsibility |
|
171 |
! ! |
|
172 |
||
514 | 173 |
!MCRepository methodsFor:'printing & storing'! |
174 |
||
175 |
basicStoreVersion: aVersion |
|
176 |
self subclassResponsibility |
|
177 |
! |
|
178 |
||
179 |
printOn: aStream |
|
180 |
super printOn: aStream. |
|
181 |
aStream |
|
182 |
nextPut: $(; |
|
183 |
nextPutAll: self description; |
|
184 |
nextPut: $). |
|
185 |
! |
|
186 |
||
187 |
storeVersion: aVersion |
|
1159
5f3f06a99a93
Make all repository types to store info change record
Jan Vrany <jan.vrany@labware.com>
parents:
1095
diff
changeset
|
188 |
| info | |
5f3f06a99a93
Make all repository types to store info change record
Jan Vrany <jan.vrany@labware.com>
parents:
1095
diff
changeset
|
189 |
|
5f3f06a99a93
Make all repository types to store info change record
Jan Vrany <jan.vrany@labware.com>
parents:
1095
diff
changeset
|
190 |
|
5f3f06a99a93
Make all repository types to store info change record
Jan Vrany <jan.vrany@labware.com>
parents:
1095
diff
changeset
|
191 |
self basicStoreVersion: (self prepareVersionForStorage: aVersion). |
5f3f06a99a93
Make all repository types to store info change record
Jan Vrany <jan.vrany@labware.com>
parents:
1095
diff
changeset
|
192 |
self sendNotificationsForVersion: aVersion. |
5f3f06a99a93
Make all repository types to store info change record
Jan Vrany <jan.vrany@labware.com>
parents:
1095
diff
changeset
|
193 |
|
5f3f06a99a93
Make all repository types to store info change record
Jan Vrany <jan.vrany@labware.com>
parents:
1095
diff
changeset
|
194 |
"/ Add entry to changeset so user can figure out when the |
5f3f06a99a93
Make all repository types to store info change record
Jan Vrany <jan.vrany@labware.com>
parents:
1095
diff
changeset
|
195 |
"/ package was last saved and where. |
5f3f06a99a93
Make all repository types to store info change record
Jan Vrany <jan.vrany@labware.com>
parents:
1095
diff
changeset
|
196 |
info := '%1 into %2' bindWith: aVersion package name with: self description. |
5f3f06a99a93
Make all repository types to store info change record
Jan Vrany <jan.vrany@labware.com>
parents:
1095
diff
changeset
|
197 |
ChangeSet current addChange: |
5f3f06a99a93
Make all repository types to store info change record
Jan Vrany <jan.vrany@labware.com>
parents:
1095
diff
changeset
|
198 |
(InfoChange type: 'fileout' data: info timestamp: Timestamp now). |
5f3f06a99a93
Make all repository types to store info change record
Jan Vrany <jan.vrany@labware.com>
parents:
1095
diff
changeset
|
199 |
self class addInfoRecord: 'fileout ', info |
5f3f06a99a93
Make all repository types to store info change record
Jan Vrany <jan.vrany@labware.com>
parents:
1095
diff
changeset
|
200 |
|
5f3f06a99a93
Make all repository types to store info change record
Jan Vrany <jan.vrany@labware.com>
parents:
1095
diff
changeset
|
201 |
"Modified: / 25-07-2022 / 10:42:08 / Jan Vrany <jan.vrany@labware.com>" |
514 | 202 |
! ! |
203 |
||
910 | 204 |
!MCRepository methodsFor:'queries'! |
205 |
||
206 |
closestAncestorVersionFor: anAncestry ifNone: errorBlock |
|
207 |
| v | |
|
208 |
anAncestry breadthFirstAncestorsDo: |
|
209 |
[:ancestorInfo | |
|
210 |
(v := self versionWithInfo: ancestorInfo) ifNotNil: [ ^ v]]. |
|
211 |
^ errorBlock value |
|
212 |
! |
|
213 |
||
214 |
possiblyNewerVersionsOfAnyOf: someVersions |
|
215 |
^#() |
|
216 |
! ! |
|
217 |
||
106 | 218 |
!MCRepository methodsFor:'testing'! |
219 |
||
220 |
isValid |
|
221 |
^true |
|
222 |
! ! |
|
223 |
||
224 |
!MCRepository class methodsFor:'documentation'! |
|
225 |
||
226 |
version |
|
965 | 227 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCRepository.st,v 1.8 2015-02-07 10:17:20 cg Exp $' |
137
98f158a061a2
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
106
diff
changeset
|
228 |
! |
98f158a061a2
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
106
diff
changeset
|
229 |
|
98f158a061a2
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
106
diff
changeset
|
230 |
version_CVS |
965 | 231 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCRepository.st,v 1.8 2015-02-07 10:17:20 cg Exp $' |
210 | 232 |
! |
233 |
||
234 |
version_SVN |
|
235 |
||
965 | 236 |
^'$Id: MCRepository.st,v 1.8 2015-02-07 10:17:20 cg Exp $' |
106 | 237 |
! ! |
238 |
||
910 | 239 |
|
106 | 240 |
MCRepository initialize! |