85
|
1 |
"{ Package: 'stx:goodies/monticello' }"
|
|
2 |
|
|
3 |
Object subclass:#MCVersion
|
|
4 |
instanceVariableNames:'package info snapshot dependencies'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'Monticello-Versioning'
|
|
8 |
!
|
|
9 |
|
|
10 |
|
|
11 |
!MCVersion class methodsFor:'instance creation'!
|
|
12 |
|
|
13 |
package: aPackageOrPackageID
|
|
14 |
aPackageOrPackageID isSymbol ifTrue:[
|
|
15 |
"/ an ST/X package-ID
|
|
16 |
^ super package: aPackageOrPackageID
|
|
17 |
].
|
|
18 |
"/ a monticello package-ID
|
|
19 |
^ self package: aPackageOrPackageID info: MCVersionInfo new
|
|
20 |
|
|
21 |
"Modified: / 22-11-2006 / 14:16:22 / cg"
|
|
22 |
!
|
|
23 |
|
|
24 |
package: aPackage info: aVersionInfo
|
|
25 |
^ self package: aPackage info: aVersionInfo snapshot: aPackage snapshot
|
|
26 |
!
|
|
27 |
|
|
28 |
package: aPackage info: aVersionInfo snapshot: aSnapshot
|
|
29 |
^ self package: aPackage info: aVersionInfo snapshot: aSnapshot dependencies: #()
|
|
30 |
!
|
|
31 |
|
|
32 |
package: aPackage info: aVersionInfo snapshot: aSnapshot dependencies: aCollection
|
|
33 |
^ self new initializeWithPackage: aPackage info: aVersionInfo snapshot: aSnapshot dependencies: aCollection
|
|
34 |
! !
|
|
35 |
|
|
36 |
!MCVersion methodsFor:'accessing'!
|
|
37 |
|
|
38 |
changes
|
|
39 |
^ self snapshot patchRelativeToBase: package snapshot
|
|
40 |
!
|
|
41 |
|
|
42 |
dependencies
|
|
43 |
^ dependencies ifNil: [#()]
|
|
44 |
!
|
|
45 |
|
|
46 |
fileName
|
|
47 |
^ info name, '.', self writerClass extension
|
|
48 |
!
|
|
49 |
|
|
50 |
info
|
|
51 |
^ info
|
|
52 |
!
|
|
53 |
|
|
54 |
package
|
|
55 |
^ package
|
|
56 |
!
|
|
57 |
|
|
58 |
snapshot
|
|
59 |
^ snapshot
|
|
60 |
!
|
|
61 |
|
531
|
62 |
snapshot:anMCSnapshot
|
|
63 |
snapshot := anMCSnapshot
|
|
64 |
|
|
65 |
"Created: / 02-12-2011 / 16:10:18 / cg"
|
|
66 |
!
|
|
67 |
|
85
|
68 |
summary
|
|
69 |
^ String streamContents:
|
|
70 |
[:s |
|
|
71 |
s nextPutAll: info summaryHeader.
|
|
72 |
(dependencies isNil or: [dependencies isEmpty]) ifFalse:
|
|
73 |
[s cr; nextPutAll: 'Dependencies: '.
|
|
74 |
dependencies
|
|
75 |
do: [:ea | s nextPutAll: ea versionInfo name]
|
|
76 |
separatedBy: [s nextPutAll: ', ']].
|
|
77 |
s cr; cr; nextPutAll: info message]
|
|
78 |
!
|
|
79 |
|
|
80 |
workingCopy
|
|
81 |
^ package workingCopy
|
|
82 |
!
|
|
83 |
|
|
84 |
writerClass
|
|
85 |
^ MCMczWriter
|
|
86 |
! !
|
|
87 |
|
|
88 |
!MCVersion methodsFor:'actions'!
|
|
89 |
|
|
90 |
addToCache
|
|
91 |
MCCacheRepository default storeVersion: self
|
|
92 |
!
|
|
93 |
|
|
94 |
adopt
|
|
95 |
self workingCopy adopt: self
|
|
96 |
!
|
|
97 |
|
|
98 |
browse
|
|
99 |
(MCSnapshotBrowser forSnapshot: self snapshot)
|
|
100 |
showLabelled: 'Snapshot of ', self fileName
|
|
101 |
!
|
|
102 |
|
|
103 |
fileOutOn: aStream
|
|
104 |
self writerClass fileOut: self on: aStream
|
|
105 |
!
|
|
106 |
|
|
107 |
load
|
|
108 |
MCVersionLoader loadVersion: self
|
|
109 |
!
|
|
110 |
|
|
111 |
merge
|
|
112 |
MCVersionMerger mergeVersion: self
|
|
113 |
!
|
|
114 |
|
|
115 |
open
|
|
116 |
(MCVersionInspector new version: self) show
|
|
117 |
! !
|
|
118 |
|
|
119 |
!MCVersion methodsFor:'converting'!
|
|
120 |
|
|
121 |
asDiffAgainst: aVersion
|
|
122 |
aVersion info = self info ifTrue: [self error: 'Cannot diff against self!!'].
|
|
123 |
^ MCDiffyVersion
|
|
124 |
package: self package
|
|
125 |
info: self info
|
|
126 |
snapshot: self snapshot
|
|
127 |
dependencies: self dependencies
|
|
128 |
baseVersion: aVersion
|
|
129 |
! !
|
|
130 |
|
|
131 |
!MCVersion methodsFor:'enumerating'!
|
|
132 |
|
|
133 |
allAvailableDependenciesDo: aBlock
|
|
134 |
| version |
|
|
135 |
self dependencies do:
|
|
136 |
[:ea |
|
|
137 |
[version _ ea resolve.
|
|
138 |
version allAvailableDependenciesDo: aBlock.
|
|
139 |
aBlock value: version]
|
|
140 |
on: Error do: []]
|
|
141 |
!
|
|
142 |
|
|
143 |
allDependenciesDo: aBlock
|
|
144 |
self allDependenciesDo: aBlock ifUnresolved: [:ignored | true]
|
|
145 |
!
|
|
146 |
|
|
147 |
allDependenciesDo: aBlock ifUnresolved: failBlock
|
|
148 |
| dict |
|
|
149 |
dict _ Dictionary new.
|
|
150 |
self allDependenciesNotIn: dict do: aBlock ifUnresolved: failBlock
|
|
151 |
!
|
|
152 |
|
|
153 |
allDependenciesNotIn: aDictionary do: aBlock ifUnresolved: failBlock
|
|
154 |
| version |
|
|
155 |
self dependencies do:
|
|
156 |
[:ea |
|
|
157 |
version := aDictionary at: ea ifAbsent: [ea resolve].
|
|
158 |
version
|
|
159 |
ifNil: [failBlock value: ea]
|
|
160 |
ifNotNil: [(aDictionary includes: version) ifFalse:
|
|
161 |
[aDictionary at: ea put: version.
|
|
162 |
version
|
|
163 |
allDependenciesNotIn: aDictionary
|
|
164 |
do: aBlock
|
|
165 |
ifUnresolved: failBlock.
|
|
166 |
aBlock value: version]]]
|
|
167 |
!
|
|
168 |
|
|
169 |
withAllDependenciesDo: aBlock
|
|
170 |
self allDependenciesDo: aBlock ifUnresolved: [:ignored].
|
|
171 |
aBlock value: self
|
|
172 |
!
|
|
173 |
|
|
174 |
withAllDependenciesDo: aBlock ifUnresolved: failBlock
|
|
175 |
| dict |
|
|
176 |
dict _ Dictionary new.
|
|
177 |
self allDependenciesNotIn: dict do: aBlock ifUnresolved: failBlock.
|
|
178 |
aBlock value: self
|
|
179 |
! !
|
|
180 |
|
|
181 |
!MCVersion methodsFor:'initialize-release'!
|
|
182 |
|
|
183 |
initializeWithPackage: aPackage info: aVersionInfo snapshot: aSnapshot dependencies: aCollection
|
|
184 |
package _ aPackage.
|
|
185 |
info _ aVersionInfo.
|
|
186 |
snapshot _ aSnapshot.
|
|
187 |
dependencies _ aCollection.
|
|
188 |
self addToCache.
|
|
189 |
!
|
|
190 |
|
|
191 |
setPackage: aPackage info: aVersionInfo snapshot: aSnapshot dependencies: aCollection
|
|
192 |
package _ aPackage.
|
|
193 |
info _ aVersionInfo.
|
|
194 |
snapshot _ aSnapshot.
|
|
195 |
dependencies _ aCollection
|
|
196 |
! !
|
|
197 |
|
|
198 |
!MCVersion methodsFor:'printing'!
|
|
199 |
|
|
200 |
printOn: aStream
|
|
201 |
super printOn: aStream.
|
|
202 |
aStream nextPut: $(.
|
|
203 |
aStream nextPutAll: self info name.
|
|
204 |
aStream nextPut: $).
|
|
205 |
! !
|
|
206 |
|
|
207 |
!MCVersion methodsFor:'testing'!
|
|
208 |
|
|
209 |
canOptimizeLoading
|
|
210 |
"Answer wether I can provide a patch for the working copy without the usual diff pass"
|
|
211 |
^false
|
|
212 |
!
|
|
213 |
|
|
214 |
isCacheable
|
|
215 |
^true
|
|
216 |
!
|
|
217 |
|
|
218 |
isDiffy
|
|
219 |
^ false
|
|
220 |
! !
|
|
221 |
|
|
222 |
!MCVersion class methodsFor:'documentation'!
|
|
223 |
|
|
224 |
version
|
531
|
225 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCVersion.st,v 1.2 2011-12-02 15:10:42 cg Exp $'
|
85
|
226 |
! !
|