diff --git a/Iceberg-Metacello-Integration/IceGithubRepositoryType.class.st b/Iceberg-Metacello-Integration/IceGithubRepositoryType.class.st index 00b3bf513c..846c3b946e 100644 --- a/Iceberg-Metacello-Integration/IceGithubRepositoryType.class.st +++ b/Iceberg-Metacello-Integration/IceGithubRepositoryType.class.st @@ -13,24 +13,3 @@ Class { IceGithubRepositoryType class >> type [ ^ 'github' ] - -{ #category : 'accessing' } -IceGithubRepositoryType >> mcRepository [ - | baseRepo | - - self guessRegisteredRepository - ifNotNil: [ :repo | - repo isValid ifTrue: [ ^ repo metacelloAdapter: self projectVersion ]. - "If the repo is not valid, we forget it and reget a new one. Because Metacello want to use it" - repo forget ]. - - baseRepo := self mcRepositoryClass location: self location. - ^ (Iceberg icebergRepositoriesURLs includes: baseRepo scpUrl) - ifTrue: [ - "Do not use Iceberg to load iceberg code, - see https://github.com/pharo-vcs/iceberg/issues/168" - baseRepo ] - ifFalse: [ - baseRepo getOrCreateIcebergRepository metacelloAdapter: self projectVersion ] - -] diff --git a/Iceberg-Metacello-Integration/IceProviderRepositoryType.class.st b/Iceberg-Metacello-Integration/IceProviderRepositoryType.class.st index 4036cf4c81..7b4951ff54 100644 --- a/Iceberg-Metacello-Integration/IceProviderRepositoryType.class.st +++ b/Iceberg-Metacello-Integration/IceProviderRepositoryType.class.st @@ -45,16 +45,22 @@ IceProviderRepositoryType >> guessRegisteredRepository [ { #category : 'accessing' } IceProviderRepositoryType >> mcRepository [ + | baseRepo | - - self guessRegisteredRepository - ifNotNil: [ :repo | - repo isValid ifTrue: [ ^ repo metacelloAdapter: self projectVersion ]. - "If the repo is not valid, we forget it and reget a new one. - Because Metacello want to use it" - repo forget ]. + self guessRegisteredRepository ifNotNil: [ :repo | + repo isValid ifTrue: [ ^ repo metacelloAdapter: self projectVersion ]. + "If the repo is not valid, we forget it and reget a new one. + Because Metacello want to use it" + repo forget ]. + baseRepo := self mcRepositoryClass location: self location. - ^ baseRepo getOrCreateIcebergRepository metacelloAdapter: self projectVersion + ^ (Iceberg icebergRepositoriesURLs includes: baseRepo scpUrl) + ifTrue: [ "Do not use Iceberg to load iceberg code, + see https://github.com/pharo-vcs/iceberg/issues/168" + baseRepo ] + ifFalse: [ + baseRepo getOrCreateIcebergRepository metacelloAdapter: + self projectVersion ] ] { #category : 'accessing' } diff --git a/Iceberg/IceMetacelloRepositoryAdapter.class.st b/Iceberg/IceMetacelloRepositoryAdapter.class.st index 43f6b91a27..d41a0fd3cf 100644 --- a/Iceberg/IceMetacelloRepositoryAdapter.class.st +++ b/Iceberg/IceMetacelloRepositoryAdapter.class.st @@ -59,6 +59,15 @@ IceMetacelloRepositoryAdapter >> description [ ^ self repository origin url, '[', projectVersion, ']' ] +{ #category : 'fetching' } +IceMetacelloRepositoryAdapter >> fetchPackageNamed: aString [ + "The fetch operation just makes sure we have the correct version in disk" + + self repository head description = projectVersion ifFalse: [ + (self repository commitishNamed: projectVersion) + checkoutWithStrategy: IceCheckoutDoNotLoadPackages new ] +] + { #category : 'initialization' } IceMetacelloRepositoryAdapter >> flushForScriptGet [ "do nothing" @@ -120,6 +129,18 @@ IceMetacelloRepositoryAdapter >> isValid [ ^ true ] +{ #category : 'accessing' } +IceMetacelloRepositoryAdapter >> loadPackageNamed: aName intoLoader: aLoader [ + + | package found | + package := self repository workingCopy packageNamed: aName. + found := package latestVersion mcVersion. + aLoader addVersion: found. + ^ { + found. + self } +] + { #category : 'MonticelloGUI' } IceMetacelloRepositoryAdapter >> morphicOpen: workingCopy [ @@ -138,6 +159,44 @@ Do you want to open the Iceberg Browser instead?' format: { IceTipRepositoriesBrowser new open ] +{ #category : 'accessing' } +IceMetacelloRepositoryAdapter >> packageNamed: aName [ + + ^ self packageNamed: aName ifAbsent: [ NotFound signal: aName ] +] + +{ #category : 'accessing' } +IceMetacelloRepositoryAdapter >> packageNamed: aName ifAbsent: aBlock [ + + ^ self + packageNamed: aName + ifPresent: [ :found | found ] + ifAbsent: aBlock +] + +{ #category : 'accessing' } +IceMetacelloRepositoryAdapter >> packageNamed: aName ifPresent: aBlock [ + + ^ self + packageNamed: aName + ifPresent: aBlock + ifAbsent: [ NotFound signal: aName ] +] + +{ #category : 'accessing' } +IceMetacelloRepositoryAdapter >> packageNamed: aName ifPresent: presentBlock ifAbsent: absentBlock [ + + | package | + self repository head description = projectVersion ifFalse: [ + (self repository commitishNamed: projectVersion) + checkoutWithStrategy: IceCheckoutDoNotLoadPackages new ]. + + package := self repository workingCopy + packageNamed: aName + ifAbsent: [ ^ absentBlock value ]. + ^ presentBlock value: package latestVersion mcVersion +] + { #category : 'accessing' } IceMetacelloRepositoryAdapter >> projectPath [ ^ self repository origin projectPath diff --git a/Iceberg/IceWorkingCopy.class.st b/Iceberg/IceWorkingCopy.class.st index 0d6ffe7727..782f0cd47b 100644 --- a/Iceberg/IceWorkingCopy.class.st +++ b/Iceberg/IceWorkingCopy.class.st @@ -462,20 +462,18 @@ IceWorkingCopy >> loadPackagesNamed: aCollection [ { #category : 'private - monticello' } IceWorkingCopy >> loadPackagesNamed: aCollection fromCommit: aCommit [ - + aCollection ifEmpty: [ ^ self ]. - - self ignoreNotificationsDuring: [ | loader | + + self ignoreNotificationsDuring: [ + | loader | loader := MCVersionLoader new. - aCollection do: [ :name | | package packageVersion | + aCollection do: [ :name | + | package packageVersion | package := self packageNamed: name. - packageVersion := (IceSavedPackageVersion - fromCommit: aCommit - package: package) - mcVersion. + packageVersion := (aCommit versionFor: package) mcVersion. loader addVersion: packageVersion. - package beClean. - ]. + package beClean ]. loader load ] ] @@ -560,6 +558,12 @@ IceWorkingCopy >> packageNamed: aString [ ^ self packagesDictionary at: aString ] +{ #category : 'API - packages' } +IceWorkingCopy >> packageNamed: aString ifAbsent: aBlock [ + + ^ self packagesDictionary at: aString ifAbsent: aBlock +] + { #category : 'API - packages' } IceWorkingCopy >> packageNames [