Skip to content

Instantly share code, notes, and snippets.

@tinchodias
Created January 14, 2015 11:27
Show Gist options
  • Save tinchodias/2f04c0590c73d1a0c8ed to your computer and use it in GitHub Desktop.
Save tinchodias/2f04c0590c73d1a0c8ed to your computer and use it in GitHub Desktop.
Gofer migration 2
packageNames := #(ConfigurationOfEpiceaSorter EpiceaSorter EpiceaSorterAnalysis).
sourceHttpRepository :=
MCSmalltalkhubRepository
owner: 'MartinDias'
project: 'Epicea'
user: 'MartinDias'
password: 'xxxx'.
destinationHttpRepository :=
MCSmalltalkhubRepository
owner: 'MartinDias'
project: 'EpiceaUntangler'
user: 'MartinDias'
password: 'xxxx'.
errors := OrderedCollection new.
packageNames do: [ :aPackageName |
| fileNames |
fileNames := sourceHttpRepository fileNamesForPackageNamed: aPackageName.
fileNames
do: [ :aFileName |
[(destinationHttpRepository includesFileNamed: aFileName) ifFalse: [
| aVersion |
aVersion := sourceHttpRepository versionFromFileNamed: aFileName.
destinationHttpRepository storeVersion: aVersion] ]
on: Error
do: [ :e | errors add: aFileName -> e ]. ]
displayingProgress: [ 'Processing ', aPackageName, ' (total: ', fileNames size asString, ')' ]
].
missingFileNamesByPackageName := packageNames collect: [ :aPackageName |
| sourceFileNames destinationFileNames |
sourceFileNames := sourceHttpRepository fileNamesForPackageNamed: aPackageName.
destinationFileNames := destinationHttpRepository fileNamesForPackageNamed: aPackageName.
aPackageName -> (sourceFileNames difference: destinationFileNames).
].
errors2 := OrderedCollection new.
(missingFileNamesByPackageName flatCollect: #value) do: [ :aFileName |
[
(destinationHttpRepository includesFileNamed: aFileName) ifFalse: [
| aVersion |
aVersion := sourceHttpRepository versionFromFileNamed: aFileName.
destinationHttpRepository storeVersion: aVersion] ]
on: Error
do: [ :e | errors2 add: aFileName -> e ]. ]
displayingProgress: [ :aFileName | 'Re-trying with ', aFileName ].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment