|
1 "{ Encoding: utf8 }" |
|
2 |
1 "{ Package: 'stx:goodies/monticello' }" |
3 "{ Package: 'stx:goodies/monticello' }" |
|
4 |
|
5 "{ NameSpace: Smalltalk }" |
2 |
6 |
3 Object subclass:#MCPackageLoader |
7 Object subclass:#MCPackageLoader |
4 instanceVariableNames:'requirements unloadableDefinitions overrideDefinitions |
8 instanceVariableNames:'requirements unloadableDefinitions overrideDefinitions |
5 obsoletions additions removals errorDefinitions provisions' |
9 obsoletions additions removals errorDefinitions provisions' |
6 classVariableNames:'Debugging' |
10 classVariableNames:'Debugging' |
256 warnAboutErrors |
260 warnAboutErrors |
257 |
261 |
258 | changes | |
262 | changes | |
259 |
263 |
260 errorDefinitions isNilOrEmptyCollection ifTrue:[^self]. |
264 errorDefinitions isNilOrEmptyCollection ifTrue:[^self]. |
261 changes := ChangeSet withAll:(errorDefinitions select:[:e|e notNil] thenCollect:[:e|e asChange]). |
265 changes := ChangeSet new. |
|
266 errorDefinitions select:[:e|e notNil] thenDo:[:e|e addChangesTo:changes]. |
262 |
267 |
263 changes := Tools::ChangeSetBrowser2 |
268 changes := Tools::ChangeSetBrowser2 |
264 openOn: changes |
269 openOn: changes |
265 label:'Error definitions'. |
270 label:'Error definitions'. |
266 |
271 |
273 |
278 |
274 | changes confirmedChanges definitions | |
279 | changes confirmedChanges definitions | |
275 |
280 |
276 overrideDefinitions isNilOrEmptyCollection ifTrue:[^self]. |
281 overrideDefinitions isNilOrEmptyCollection ifTrue:[^self]. |
277 self ifInteractive:[ |
282 self ifInteractive:[ |
278 changes := ChangeSet withAll:(overrideDefinitions collect:[:e|e asChange]). |
283 changes := ChangeSet new. |
|
284 overrideDefinitions do:[:e|e addChangesTo:changes]. |
279 self assert:(changes includes:nil) not. |
285 self assert:(changes includes:nil) not. |
|
286 |
280 confirmedChanges := Tools::ChangeSetBrowser2 |
287 confirmedChanges := Tools::ChangeSetBrowser2 |
281 confirmChanges: changes |
288 confirmChanges: changes |
282 label:'Overridden definitions. Load anyway?'. |
289 label:'Overridden definitions. Load anyway?'. |
283 confirmedChanges notEmpty ifTrue:[ |
290 confirmedChanges notEmpty ifTrue:[ |
284 confirmedChanges := confirmedChanges flatten. |
291 confirmedChanges := confirmedChanges flatten. |
285 definitions := confirmedChanges collect:[:e|e mcDefinition]. |
292 definitions := confirmedChanges collect:[:e|e mcDefinition] thenSelect:[:e | e notNil]. |
286 self assert:(definitions includes:nil) not. |
293 "/ we might get nil in a roundTrip |
|
294 "/ (eg. for mcDef --addChangesTo:--> classChange+commentChange --mcDefinition--> mcDef+nil) |
|
295 "/ self assert:(definitions includes:nil) not. |
|
296 |
287 self tryToLoadAll: definitions label: 'Loading overrides...'. |
297 self tryToLoadAll: definitions label: 'Loading overrides...'. |
288 ] |
298 ] |
289 ] else:[ |
299 ] else:[ |
290 self tryToLoadAll: overrideDefinitions label: 'Loading overrides...'. |
300 self tryToLoadAll: overrideDefinitions label: 'Loading overrides...'. |
291 ] |
301 ] |
299 |
309 |
300 | changes confirmedChanges definitions | |
310 | changes confirmedChanges definitions | |
301 |
311 |
302 unloadableDefinitions isNilOrEmptyCollection ifTrue:[^self]. |
312 unloadableDefinitions isNilOrEmptyCollection ifTrue:[^self]. |
303 self ifInteractive:[ |
313 self ifInteractive:[ |
304 changes := ChangeSet withAll:(unloadableDefinitions collect:[:e|e asChange]). |
314 changes := ChangeSet new. |
|
315 unloadableDefinitions do:[:e|e addChangesTo:changes]. |
305 self assert:(changes includes:nil) not. |
316 self assert:(changes includes:nil) not. |
|
317 |
306 confirmedChanges := Tools::ChangeSetBrowser2 |
318 confirmedChanges := Tools::ChangeSetBrowser2 |
307 confirmChanges: changes |
319 confirmChanges: changes |
308 label:'Unsatisfied dependencies. Load anyway?'. |
320 label:'Unsatisfied dependencies. Load anyway?'. |
309 confirmedChanges notEmpty ifTrue:[ |
321 confirmedChanges notEmpty ifTrue:[ |
310 confirmedChanges := confirmedChanges flatten. |
322 confirmedChanges := confirmedChanges flatten. |
311 definitions := confirmedChanges collect:[:e|e mcDefinition]. |
323 definitions := confirmedChanges collect:[:e|e mcDefinition] thenSelect:[:e | e notNil]. |
312 self assert:(definitions includes:nil) not. |
324 "/ we might get nil in a roundTrip |
|
325 "/ (eg. for mcDef --addChangesTo:--> classChange+commentChange --mcDefinition--> mcDef+nil) |
|
326 "/ self assert:(definitions includes:nil) not. |
|
327 |
313 self tryToLoadAll: definitions label: 'Loading unloadables...'. |
328 self tryToLoadAll: definitions label: 'Loading unloadables...'. |
314 ] |
329 ] |
315 ] else:[ |
330 ] else:[ |
316 self tryToLoadAll: unloadableDefinitions label: 'Loading unloadables...'. |
331 self tryToLoadAll: unloadableDefinitions label: 'Loading unloadables...'. |
317 ] |
332 ] |