[Pkg] The Trunk: Monticello-cmm.471.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Jun 8 21:21:49 UTC 2011
Chris Muller uploaded a new version of Monticello to project The Trunk:
http://source.squeak.org/trunk/Monticello-cmm.471.mcz
==================== Summary ====================
Name: Monticello-cmm.471
Author: cmm
Time: 8 June 2011, 2:55:08.148 pm
UUID: fc2562d3-d276-4240-b9bc-e3945fd4c751
Ancestors: Monticello-cmm.470
- Renamed #rename:toBe: to #handlePackageRename:to:.
- Don't complain about unregistering a package that isn't registered.
=============== Diff against Monticello-ul.466 ===============
Item was removed:
- SystemOrganization addCategory: #Monticello!
- SystemOrganization addCategory: #'Monticello-Base'!
- SystemOrganization addCategory: #'Monticello-Chunk Format'!
- SystemOrganization addCategory: #'Monticello-Loading'!
- SystemOrganization addCategory: #'Monticello-Merging'!
- SystemOrganization addCategory: #'Monticello-Mocks'!
- SystemOrganization addCategory: #'Monticello-Modeling'!
- SystemOrganization addCategory: #'Monticello-Patching'!
- SystemOrganization addCategory: #'Monticello-Repositories'!
- SystemOrganization addCategory: #'Monticello-Storing'!
- SystemOrganization addCategory: #'Monticello-UI'!
- SystemOrganization addCategory: #'Monticello-Utilities'!
- SystemOrganization addCategory: #'Monticello-Versioning'!
Item was added:
+ SystemOrganization addCategory: #'Monticello-Base'!
+ SystemOrganization addCategory: #'Monticello-Chunk Format'!
+ SystemOrganization addCategory: #'Monticello-Loading'!
+ SystemOrganization addCategory: #'Monticello-Merging'!
+ SystemOrganization addCategory: #'Monticello-Modeling'!
+ SystemOrganization addCategory: #'Monticello-Patching'!
+ SystemOrganization addCategory: #'Monticello-Repositories'!
+ SystemOrganization addCategory: #'Monticello-Storing'!
+ SystemOrganization addCategory: #'Monticello-UI'!
+ SystemOrganization addCategory: #'Monticello-Versioning'!
Item was added:
+ ----- Method: MCClassDefinition>>handlePackageRename:to: (in category 'renaming') -----
+ handlePackageRename: oldPackageName to: newPackageName
+ (self actualClass category beginsWith: newPackageName) ifFalse:
+ [ self actualClass category:
+ (self
+ newCategoryNameFor: self actualClass category
+ givenRenameFrom: oldPackageName
+ to: newPackageName) ]!
Item was added:
+ ----- Method: MCDefinition>>handlePackageRename:to: (in category 'renaming') -----
+ handlePackageRename: oldPackageName to: newPackageName
+ "Overridden as necessary in subclasses."!
Item was added:
+ ----- Method: MCDefinition>>newCategoryNameFor:givenRenameFrom:to: (in category 'renaming') -----
+ newCategoryNameFor: categoryName givenRenameFrom: oldPackageName to: newPackageName
+ ^ oldPackageName size < categoryName size
+ ifTrue:
+ [ newPackageName ,
+ (categoryName
+ copyFrom: oldPackageName size + 1
+ to: categoryName size) ]
+ ifFalse: [ newPackageName ]!
Item was added:
+ ----- Method: MCMethodDefinition>>handlePackageRename:to: (in category 'renaming') -----
+ handlePackageRename: oldPackageName to: newPackageName
+ "If I'm an extension or override method, rename the category to be prefixed with newPackageName."
+ ((self isExtensionMethod or: [ self isOverrideMethod ]) and: [ (self category allButFirst beginsWith: newPackageName asLowercase) not ]) ifTrue:
+ [ self actualClass organization
+ renameCategory: self category
+ toBe:
+ '*' ,
+ (self
+ newCategoryNameFor: self category allButFirst
+ givenRenameFrom: oldPackageName
+ to: newPackageName) ]!
Item was changed:
+ ----- Method: MCOrganizationDefinition>>= (in category 'testing') -----
- ----- Method: MCOrganizationDefinition>>= (in category 'as yet unclassified') -----
= aDefinition
^ (super = aDefinition)
and: [categories = aDefinition categories]!
Item was changed:
+ ----- Method: MCOrganizationDefinition>>accept: (in category 'actions') -----
- ----- Method: MCOrganizationDefinition>>accept: (in category 'as yet unclassified') -----
accept: aVisitor
^ aVisitor visitOrganizationDefinition: self!
Item was changed:
+ ----- Method: MCOrganizationDefinition>>categories (in category 'accessing') -----
- ----- Method: MCOrganizationDefinition>>categories (in category 'as yet unclassified') -----
categories
^ categories!
Item was changed:
+ ----- Method: MCOrganizationDefinition>>categories: (in category 'accessing') -----
- ----- Method: MCOrganizationDefinition>>categories: (in category 'as yet unclassified') -----
categories: anArray
categories := anArray!
Item was changed:
+ ----- Method: MCOrganizationDefinition>>commonPrefix (in category 'accessing') -----
- ----- Method: MCOrganizationDefinition>>commonPrefix (in category 'as yet unclassified') -----
commonPrefix
| stream |
categories isEmpty ifTrue: [^ ''].
stream := String new writeStream.
categories first withIndexDo:
[:c :i|
categories do:
[:ea |
(ea at: i ifAbsent: []) = c ifFalse: [^ stream contents]].
stream nextPut: c].
^ stream contents!
Item was changed:
+ ----- Method: MCOrganizationDefinition>>description (in category 'accessing') -----
- ----- Method: MCOrganizationDefinition>>description (in category 'as yet unclassified') -----
description
^ Array with: #organization with: self commonPrefix!
Item was added:
+ ----- Method: MCOrganizationDefinition>>handlePackageRename:to: (in category 'actions') -----
+ handlePackageRename: oldPackageName to: newPackageName
+ categories do:
+ [ : each | (each beginsWith: newPackageName) ifFalse:
+ [ | newCategoryName |
+ newCategoryName := self
+ newCategoryNameFor: each
+ givenRenameFrom: oldPackageName
+ to: newPackageName.
+ (SystemOrganizer default categories includes: newCategoryName) ifTrue: [ SystemOrganizer default removeCategory: newCategoryName ].
+ SystemOrganizer default
+ renameCategory: each
+ toBe: newCategoryName ] ]!
Item was changed:
+ ----- Method: MCOrganizationDefinition>>isOrganizationDefinition (in category 'testing') -----
- ----- Method: MCOrganizationDefinition>>isOrganizationDefinition (in category 'as yet unclassified') -----
isOrganizationDefinition
^ true!
Item was changed:
+ ----- Method: MCOrganizationDefinition>>postloadOver: (in category 'actions') -----
- ----- Method: MCOrganizationDefinition>>postloadOver: (in category 'as yet unclassified') -----
postloadOver: oldDefinition
SystemOrganization categories:
(self
reorderCategories: SystemOrganization categories
original: (oldDefinition ifNil: [#()] ifNotNil: [oldDefinition categories]))!
Item was changed:
+ ----- Method: MCOrganizationDefinition>>reorderCategories:original: (in category 'actions') -----
- ----- Method: MCOrganizationDefinition>>reorderCategories:original: (in category 'as yet unclassified') -----
reorderCategories: allCategories original: oldCategories
| first |
first := allCategories detect: [:ea | categories includes: ea] ifNone: [^ allCategories].
^ ((allCategories copyUpTo: first) copyWithoutAll: oldCategories, categories),
categories,
((allCategories copyAfter: first) copyWithoutAll: oldCategories, categories)
!
Item was changed:
+ ----- Method: MCOrganizationDefinition>>sortKey (in category 'accessing') -----
- ----- Method: MCOrganizationDefinition>>sortKey (in category 'as yet unclassified') -----
sortKey
^ '<organization>'!
Item was changed:
+ ----- Method: MCOrganizationDefinition>>source (in category 'accessing') -----
- ----- Method: MCOrganizationDefinition>>source (in category 'as yet unclassified') -----
source
^ String streamContents:
[:s |
categories do: [:ea | s nextPutAll: ea] separatedBy: [s cr]]!
Item was changed:
+ ----- Method: MCOrganizationDefinition>>summary (in category 'accessing') -----
- ----- Method: MCOrganizationDefinition>>summary (in category 'as yet unclassified') -----
summary
^ categories asArray printString!
Item was changed:
----- Method: MCPackageManager>>unregister (in category 'operations') -----
unregister
+ self class registry
+ removeKey: package
+ ifAbsent: [ "Should not complain when trying to clean up." ].
- self class registry removeKey: package.
self class changed: #allManagers!
Item was added:
+ ----- Method: MCWorkingCopy>>renameToBe: (in category 'operations') -----
+ renameToBe: newPackageName
+ | newWorkingCopy definitions |
+ self modified ifTrue: [ self error: 'Should only rename an unmodified package.' ].
+ (MCWorkingCopy allManagers anySatisfy:
+ [ : each | each packageName = newPackageName ]) ifTrue: [ self error: newPackageName , ' is already taken.' ].
+ definitions := self package snapshot definitions.
+ PackageInfo registerPackageName: newPackageName.
+ newWorkingCopy := (MCWorkingCopy forPackage: (MCPackage new name: newPackageName))
+ repositoryGroup: self repositoryGroup ;
+ requiredPackages: self requiredPackages copy ;
+ modified: true ;
+ yourself.
+ definitions do:
+ [ : each | each
+ handlePackageRename: self package name
+ to: newPackageName ].
+ self ancestors do:
+ [ : each | newWorkingCopy ancestry addAncestor: each ].
+ newWorkingCopy package snapshot definitions size = definitions size ifTrue:
+ [ PackageOrganizer default unregisterPackage: (PackageInfo named: self packageName).
+ self unregister ].
+ ^ newWorkingCopy!
Item was added:
+ ----- Method: MCWorkingCopy>>requiredPackages: (in category 'private') -----
+ requiredPackages: aCollection
+ requiredPackages := aCollection!
Item was added:
+ ----- Method: MCWorkingCopyBrowser>>renamePackage (in category 'actions') -----
+ renamePackage
+ | newName |
+ workingCopy ifNil:
+ [ UIManager inform: 'Please select a package to be renamed.'.
+ ^ self ].
+ workingCopy modified ifTrue:
+ [ UIManager inform: 'Only unmodified packages should be renamed.'.
+ ^ self ].
+ newName := FillInTheBlankMorph
+ request: 'New name of package:'
+ initialAnswer: workingCopy packageName.
+ newName isEmptyOrNil ifFalse:
+ [ | newWorkingCopy |
+ newWorkingCopy := workingCopy renameToBe: newName.
+ workingCopy package snapshot definitions
+ ifEmpty:
+ [ "It worked."
+ workingCopy unregister.
+ workingCopy := newWorkingCopy.
+ self repositorySelection: 0.
+ self
+ workingCopyListChanged ;
+ changed: #workingCopySelection ;
+ changed: #repositoryList.
+ self changedButtons ]
+ ifNotEmpty:
+ [ "It didn't work, browse the remaining definitions."
+ self browseWorkingCopy ] ]!
Item was changed:
----- Method: MCWorkingCopyBrowser>>workingCopyListMenu: (in category 'morphic ui') -----
workingCopyListMenu: aMenu
workingCopy ifNil: [^ aMenu].
self fillMenu: aMenu fromSpecs:
#(('add required package' #addRequiredPackage)
('clear required packages' #clearRequiredPackages)
('browse package' #browseWorkingCopy)
('view changes' #viewChanges)
('view history' #viewHistory)
('recompile package' #recompilePackage)
('revert package...' #revertPackage)
('unload package' #unloadPackage)
+ ('delete working copy' #deleteWorkingCopy)
+ ('rename package...' #renamePackage)).
- ('delete working copy' #deleteWorkingCopy)).
(Smalltalk includesKey: #SARMCPackageDumper) ifTrue: [
aMenu add: 'make SAR' target: self selector: #fileOutAsSAR
].
self insertExternalMenuEntries: aMenu.
^aMenu!
More information about the Packages
mailing list