[Pkg] The Trunk: MonticelloConfigurations-fbs.118.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Nov 21 21:20:36 UTC 2013

Frank Shearar uploaded a new version of MonticelloConfigurations to project The Trunk:

==================== Summary ====================

Name: MonticelloConfigurations-fbs.118
Author: fbs
Time: 21 November 2013, 9:20:19.085 pm
UUID: aaba44a1-8cfd-4147-8d94-69d5fc5ac571
Ancestors: MonticelloConfigurations-cmm.117

Move the #upgradeIsMerge preference to MCConfiguration.

=============== Diff against MonticelloConfigurations-cmm.117 ===============

Item was changed:
  Object subclass: #MCConfiguration
  	instanceVariableNames: 'name dependencies repositories log'
+ 	classVariableNames: 'DefaultLog ExtraProgressInfo LogToFile UpgradeIsMerge'
- 	classVariableNames: 'DefaultLog ExtraProgressInfo LogToFile'
  	poolDictionaries: ''
  	category: 'MonticelloConfigurations'!
  !MCConfiguration commentStamp: 'dtl 5/10/2010 23:03' prior: 0!
  An MCConfiguration specifies the configuration of a set of related Monticello packages. It maintains an ordered list of package versions and a list of repositories in which the packages may be found.
  An MCConfiguration may be filed out for storage as an array specification, and new instances can be created from a stored array specification.

Item was removed:
- ----- Method: MCConfiguration class>>initialize (in category 'class initialization') -----
- initialize
- 	"MCConfiguration initialize"
- 	Preferences addPreference: #upgradeIsMerge
- 		categories: #('updates') default: false 
- 		balloonHelp: 'When upgrading packages, use merge instead of load'.!

Item was added:
+ ----- Method: MCConfiguration class>>upgradeIsMerge (in category 'preferences') -----
+ upgradeIsMerge
+ 	"Answer true if you wish to merge upstream changes whenever you upgrade."
+ 	<preference: 'Upgrade is merge'
+ 		category: 'Monticello'
+ 		description: 'When upgrading packages, use merge instead of load'
+ 		type: #Boolean>
+ 	^UpgradeIsMerge ifNil: [true]!

Item was added:
+ ----- Method: MCConfiguration class>>upgradeIsMerge: (in category 'preferences') -----
+ upgradeIsMerge: aBoolean
+ 	UpgradeIsMerge := aBoolean.!

Item was changed:
  ----- Method: MCConfiguration>>upgrade (in category 'actions') -----
  	^self depsSatisfying: [:dep | dep isFulfilledByAncestors not]
  		versionDo: [:ver | 
+ 			(self class upgradeIsMerge and: [ver shouldMerge])
- 			(Preferences upgradeIsMerge and: [ver shouldMerge])
  				ifFalse: [ver load]
  				ifTrue: [[ver merge]
  					on: MCMergeResolutionRequest do: [:request |
  						request merger conflicts isEmpty
  							ifTrue: [request resume: true]
  							ifFalse: [request pass]]]]
  		displayingProgress: 'upgrading packages'

Item was changed:
  ----- Method: MCMcmUpdater class>>updateFromRepositories: (in category 'updating') -----
  updateFromRepositories: repositoryUrls
  	"MCMcmUpdater updateFromRepositories: #(
  	| repos config |
+ 	MCConfiguration upgradeIsMerge: true.
- 	Preferences enable: #upgradeIsMerge.
  	LastUpdateMap ifNil:[LastUpdateMap := Dictionary new].
  	"The list of repositories to consult in order"
  	repos := repositoryUrls collect:[:url| 
  		MCRepositoryGroup default repositories 
  			detect:[:r| r description = url]
  			ifNone:[ | r |
  				r := MCHttpRepository location: url user: '' password: ''.
  				MCRepositoryGroup default addRepository: r.
  	"The list of updates-author.version.mcm sorted by version"
  	repos do:[:r| r cacheAllFileNamesDuring:[
  		| updateList |
  		updateList := self updateListFor: r.
  		"Proceed only if there are updates available at all."
  		updateList ifNotEmpty: [
  			(LastUpdateMap at: r description ifAbsent: [0]) = 0 ifTrue: [
  				"No update has ever been loaded from this repo. If no package is
  				present in the image either, we can skip right to the latest config"
  				config := r versionNamed: updateList last value.
  				(config dependencies anySatisfy: [:dep| dep package hasWorkingCopy])
  					ifFalse: [ (self useLatestPackagesFrom: r)
  						ifTrue: [LastUpdateMap at: r description put: updateList last key.
  							updateList := #()]
  						ifFalse: [updateList := updateList last: 1]]].
  			"Now process each update file. Check if we have all dependencies and if not,
  			load the entire configuration (this is mostly to skip older updates quickly)"
  			updateList do:[:assoc|
  				ProgressNotification signal: '' extra: 'Processing ', assoc value.
  				config := r versionNamed: assoc value.
  				"Skip packages that were specifically unloaded"
  				config dependencies: (config dependencies 
  					reject: [:dep| self skipPackages includes: dep package name]).
  				self updateMissingPackages ifFalse:[
  					"Skip packages that are not in the image"
  					config dependencies: (config dependencies 
  						select: [:dep| dep package hasWorkingCopy])].
  				(config dependencies allSatisfy:[:dep| dep isFulfilled]) 
  					ifFalse:[config upgrade].
  				LastUpdateMap at: r description put: assoc key.
  			] displayingProgress: 'Processing configurations'.
  			"We've loaded all the provided update configurations.
  			Use the latest configuration to update all the remaining packages."
  			(self useLatestPackagesFrom: r) ifTrue: [
  				config updateFromRepositories.
  				config upgrade].

Item was added:
+ (PackageInfo named: 'MonticelloConfigurations') postscript: '"below, add code to be run after the loading of this package"
+ MonticelloConfigurations updateIsMerge: Preferences updateIsMerge.'!

More information about the Packages mailing list