Monticello

Philippe Marschall philippe.marschall at gmail.com
Tue Dec 12 05:49:32 UTC 2006


2006/12/12, Ramon Leon <ramon.leon at allresnet.com>:
> Anyone know how to script Monticello to load the latest version of a package
> by name, from a given repository?

The following is the "Monticello Code" I use. I does not really load
the latest version. It loads the version with the biggest version
number. This has the advantage that it does not download all the
versions in order to find out their timestamp. This works better for
large repositories like Seaside.

loadLatestPackage: aString from: aPath
	| repository versionsBlock versions tries version |
	repository := MCHttpRepository
		location: aPath
		user: username
		password: password.
	
	versionsBlock := [ (repository allVersionNames select: [ :each |
		each beginsWith: aString ])
		asSortedCollection: [ :a :b |
			(a copyAfterLast: $.) asNumber <= (b copyAfterLast: $.) asNumber ]
] fixTemps.
	versions := versionsBlock value.
	
	tries := 0.
	[ versions isEmpty and: [ tries < 3 ] ] whileTrue: [
		versions := versionsBlock value.
		tries := tries + 1 ].
	versions isEmpty ifTrue: [ self error: 'problems when accessing
squeaksource' ].
	
	version := (repository versionReaderForFileNamed: versions last ,
'.mcz') version.
	version load.
	version workingCopy repositoryGroup addRepository: repository.

Philippe



More information about the Squeak-dev mailing list