author | Jan Vrany <jan.vrany@labware.com> |
Tue, 11 Jul 2023 12:13:27 +0100 | |
branch | jv |
changeset 1173 | e3dd2050492e |
parent 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 |
||
1160
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
165 |
storePackage: packageName |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
166 |
"Smalltalk/X specific: store (fileout) a package named `packageName` |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
167 |
into this repository. |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
168 |
|
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
169 |
This is a utility method useful for automation: |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
170 |
|
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
171 |
(TonelRepository directory: '/tmp') storePackage: 'stx:goodies/monticello' |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
172 |
|
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
173 |
" |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
174 |
|
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
175 |
| mcpkg mcwc mcvi mcversion | |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
176 |
|
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
177 |
|
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
178 |
mcpkg := MCPackage named: packageName. |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
179 |
mcwc := mcpkg workingCopy. |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
180 |
mcvi := MCVersionInfo forPackage: packageName. |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
181 |
[ |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
182 |
mcversion := mcwc newVersion. |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
183 |
mcversion snapshot options includeExtrasForSTX:false. |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
184 |
] on:MCVersionNameAndMessageRequest do:[:ex | |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
185 |
ex resume:(Array with:mcvi name with:mcvi message) |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
186 |
]. |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
187 |
mcversion info:mcvi. |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
188 |
self storeVersion:mcversion. |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
189 |
|
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
190 |
" |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
191 |
(TonelRepository directory: '/tmp') storePackage: 'jv:libgdbs' |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
192 |
" |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
193 |
|
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
194 |
"Created: / 25-07-2022 / 11:00:55 / Jan Vrany <jan.vrany@labware.com>" |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
195 |
! |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
196 |
|
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
197 |
storeVersion: aVersion |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
198 |
| info | |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
199 |
|
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
200 |
|
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
201 |
self basicStoreVersion: (self prepareVersionForStorage: aVersion). |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
202 |
self sendNotificationsForVersion: aVersion. |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
203 |
|
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
204 |
"/ Add entry to changeset so user can figure out when the |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
205 |
"/ package was last saved and where. |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
206 |
info := '%1 into %2' bindWith: aVersion package name with: self description. |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
207 |
ChangeSet current addChange: |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
208 |
(InfoChange type: 'fileout' data: info timestamp: Timestamp now). |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
209 |
self class addInfoRecord: 'fileout ', info |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
210 |
|
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
211 |
"Modified: / 25-07-2022 / 10:42:08 / Jan Vrany <jan.vrany@labware.com>" |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
212 |
! |
1539e58bab91
Add utility method `MCRepository >> storePackage:`
Jan Vrany <jan.vrany@labware.com>
parents:
1159
diff
changeset
|
213 |
|
106 | 214 |
versionWithInfo: aVersionInfo |
215 |
^ self versionWithInfo: aVersionInfo ifAbsent: [nil] |
|
216 |
! |
|
217 |
||
218 |
versionWithInfo: aVersionInfo ifAbsent: aBlock |
|
219 |
self subclassResponsibility |
|
220 |
! ! |
|
221 |
||
514 | 222 |
!MCRepository methodsFor:'printing & storing'! |
223 |
||
224 |
basicStoreVersion: aVersion |
|
225 |
self subclassResponsibility |
|
226 |
! |
|
227 |
||
228 |
printOn: aStream |
|
229 |
super printOn: aStream. |
|
230 |
aStream |
|
231 |
nextPut: $(; |
|
232 |
nextPutAll: self description; |
|
233 |
nextPut: $). |
|
234 |
! ! |
|
235 |
||
910 | 236 |
!MCRepository methodsFor:'queries'! |
237 |
||
238 |
closestAncestorVersionFor: anAncestry ifNone: errorBlock |
|
239 |
| v | |
|
240 |
anAncestry breadthFirstAncestorsDo: |
|
241 |
[:ancestorInfo | |
|
242 |
(v := self versionWithInfo: ancestorInfo) ifNotNil: [ ^ v]]. |
|
243 |
^ errorBlock value |
|
244 |
! |
|
245 |
||
246 |
possiblyNewerVersionsOfAnyOf: someVersions |
|
247 |
^#() |
|
248 |
! ! |
|
249 |
||
106 | 250 |
!MCRepository methodsFor:'testing'! |
251 |
||
252 |
isValid |
|
253 |
^true |
|
254 |
! ! |
|
255 |
||
256 |
!MCRepository class methodsFor:'documentation'! |
|
257 |
||
258 |
version |
|
965 | 259 |
^ '$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
|
260 |
! |
98f158a061a2
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
106
diff
changeset
|
261 |
|
98f158a061a2
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
106
diff
changeset
|
262 |
version_CVS |
965 | 263 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCRepository.st,v 1.8 2015-02-07 10:17:20 cg Exp $' |
210 | 264 |
! |
265 |
||
266 |
version_SVN |
|
267 |
||
965 | 268 |
^'$Id: MCRepository.st,v 1.8 2015-02-07 10:17:20 cg Exp $' |
106 | 269 |
! ! |
270 |
||
910 | 271 |
|
106 | 272 |
MCRepository initialize! |