[squeak-dev] The Trunk: UpdateStream-mt.14.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Wed Mar 4 08:34:28 UTC 2020

We might want to rename FilePackage class>>conflictsWithUpdatedMethods: to FilePackage class>>browseConflictsWithUpdatedMethods:.

Am 04.03.2020 09:33:45 schrieb Marcel Taeumel <marcel.taeumel at hpi.de>:
This is also about information hiding. The selector is called #conflictsWithUpdatedMethods. So, it should return a collection of conflicts. Under which circumstances a result may be empty does not matter at all. Could be user-cancelled or actually empty. :-)

Am 04.03.2020 09:30:34 schrieb commits at source.squeak.org <commits at source.squeak.org>:
Marcel Taeumel uploaded a new version of UpdateStream to project The Trunk:

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

Name: UpdateStream-mt.14
Author: mt
Time: 4 March 2020, 9:30:27.350885 am
UUID: 8238c043-21eb-284c-aec1-f376ec57389e
Ancestors: UpdateStream-ct.13

Fixes some contracts, i.e., "nil" vs. "#()" vs. "self".

=============== Diff against UpdateStream-ct.13 ===============

Item was changed:
----- Method: FilePackage class>>conflictsWithUpdatedMethods: (in category '*UpdateStream-instance creation') -----
conflictsWithUpdatedMethods: fullName
| conflicts changeList |
+ (conflicts := (self fromFileNamed: fullName) conflictsWithUpdatedMethods)
+ ifEmpty: [^ self].
- conflicts := (self fromFileNamed: fullName) conflictsWithUpdatedMethods.
- (conflicts isNil or: [conflicts isEmpty]) ifTrue: [^ self].
changeList := ChangeList new.
changes: conflicts
file: (FileDirectory default readOnlyFileNamed: fullName) close.
open: changeList
name: 'Conflicts for ', (FileDirectory localNameFor: fullName)
multiSelect: true.!

Item was changed:
----- Method: FilePackage>>conflictsWithUpdatedMethods (in category '*UpdateStream-conflict checker') -----
"Check this package for conflicts with methods in the image which are in newer updates."

| localFileName stream updateNumberString updateNumber imageUpdateNumber updateNumberChangeSet conflicts fileStream |

localFileName := FileDirectory localNameFor: fullName.
stream := ReadStream on: sourceSystem.
stream upToAll: 'latest update: #'.
updateNumberString := stream upTo: $].
stream close.

fileStream := FileStream readOnlyFileNamed: fullName.
(fileStream contentsOfEntireFile includes: Character linefeed)
ifTrue: [self notify: 'The changeset file ', localFileName, ' contains linefeeds. Proceed if...
you know that this is okay (e.g. the file contains raw binary data).'].
fileStream close.

updateNumberString isEmpty ifFalse: "remove prepended junk, if any"
[updateNumberString := (updateNumberString findTokens: Character space) last].
updateNumberString asInteger ifNil:
[(self confirm: 'Error: ', localFileName, ' has no valid Latest Update number in its header.
Do you want to enter an update number for this file?')
+ ifFalse: [^ #()]
- ifFalse: [^ nil]
ifTrue: [updateNumberString := UIManager default
request: 'Please enter the estimated update number (e.g. 4332).']].
+ updateNumberString asInteger ifNil: [self inform: 'Conflict check cancelled.'. ^ #()].
- updateNumberString asInteger ifNil: [self inform: 'Conflict check cancelled.'. ^ self].
updateNumber := updateNumberString asInteger.

imageUpdateNumber := SystemVersion current highestUpdate.
updateNumber > imageUpdateNumber ifTrue:
[(self confirm: 'Warning: The update number for this file (#', updateNumberString, ')
is greater than the highest update number for this image (#', imageUpdateNumber asString, ').
This probably means you need to update your image.
Should we proceed anyway as if the file update number is #', imageUpdateNumber asString, '?')
[updateNumber := imageUpdateNumber.
updateNumberString := imageUpdateNumber asString]
+ ifFalse: [^ #()]].
- ifFalse: [^ nil]].

updateNumberChangeSet := self findUpdateChangeSetMatching: updateNumber.
+ updateNumberChangeSet ifNil: [^ #()].
- updateNumberChangeSet ifNil: [^ nil].

Smalltalk isMorphic ifTrue: [self currentWorld findATranscript: self currentEvent].
self class logCr; logCr; log: 'Checking ', localFileName, ' (#', updateNumberString, ') for method conflicts with changesets after ', updateNumberChangeSet name, ' ...'.

conflicts := OrderedCollection new.
self classes do: [:pseudoClass |
(Array with: pseudoClass with: pseudoClass metaClass) do: [:classOrMeta |
classOrMeta selectorsDo: [:selector | | conflict |
conflict := self
checkForMoreRecentUpdateThanChangeSet: updateNumberChangeSet
pseudoClass: classOrMeta
selector: selector.
conflict ifNotNil: [conflicts add: conflict].
self class logCr; log: conflicts size asString, (' conflict' asPluralBasedOn: conflicts), ' found.'; logCr.
self class closeLog.
^ conflicts!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200304/b6d11b12/attachment.html>

More information about the Squeak-dev mailing list