[squeak-dev] The Inbox: Tools-ct.857.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Aug 2 14:35:49 UTC 2019


A new version of Tools was added to project The Inbox:
http://source.squeak.org/inbox/Tools-ct.857.mcz

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

Name: Tools-ct.857
Author: ct
Time: 2 August 2019, 4:35:42.962625 pm
UUID: 4f55f36d-167e-944c-b2e8-731f025398e9
Ancestors: Tools-ct.855, Tools-mt.856, Tools-cmm.816

Fix & refactor ChangeList>>#compareToCurrentVersion

Deduplicate the code with overridden version in ClassCommentVersionBrowser, and fix a bug: As the feature is named "compare TO current version", I expect a comparison FROM the selected item to the current version, not the opposite (same as "compare to version ...").

=============== Diff against Tools-ct.855 ===============

Item was added:
+ ----- Method: ChangeList>>compareToCurrentSource: (in category 'menu actions') -----
+ compareToCurrentSource: currentSource
+ 	"If the current selection corresponds to a method in the system, then spawn a window showing the diffs as text"
+ 
+ 	| change selectedSource |
+ 	change := changeList at: listIndex ifAbsent: [^ self].
+ 	selectedSource := change string.
+ 	currentSource = selectedSource
+ 		ifTrue: [^ self inform: 'Exact Match'].
+ 	(StringHolder new
+ 		textContents: (TextDiffBuilder
+ 			buildDisplayPatchFrom: selectedSource
+ 			to: currentSource
+ 			inClass: change methodClass
+ 			prettyDiffs: self showingPrettyDiffs))
+ 		openLabel: 'Comparison to Current Version'.!

Item was changed:
  ----- Method: ChangeList>>compareToCurrentVersion (in category 'menu actions') -----
  compareToCurrentVersion
  	"If the current selection corresponds to a method in the system, then spawn a window showing the diffs as text"
  
+ 	| change class |
+ 	change := changeList at: listIndex ifAbsent: [^ self].
+ 	class := change methodClass.
+ 	(class notNil and: [(class includesSelector: change methodSelector)])
+ 		ifFalse: [^ self flash].
+ 	^ self compareToCurrentSource: (class sourceCodeAt: change methodSelector) asString!
- 	| change class s1 s2 |
- 	listIndex = 0
- 		ifTrue: [^ self].
- 	change := changeList at: listIndex.
- 	((class := change methodClass) notNil
- 			and: [class includesSelector: change methodSelector])
- 		ifTrue: [s1 := (class sourceCodeAt: change methodSelector) asString.
- 			s2 := change string.
- 			s1 = s2
- 				ifTrue: [^ self inform: 'Exact Match'].
- 			(StringHolder new
- 				textContents: (TextDiffBuilder buildDisplayPatchFrom: s1 to: s2 inClass: class  prettyDiffs: self showingPrettyDiffs))
- 				openLabel: 'Comparison to Current Version']
- 		ifFalse: [self flash]!

Item was changed:
  ----- Method: ClassCommentVersionsBrowser>>compareToCurrentVersion (in category 'menu') -----
  compareToCurrentVersion
  	"If the current selection corresponds to a method in the system, then spawn a window showing the diffs as text"
  
+ 	^ self compareToCurrentSource: classOfMethod organization classComment!
- 	| change s1 s2 |
- 	listIndex = 0
- 		ifTrue: [^ self].
- 	change := changeList at: listIndex.
- 	s1 := classOfMethod organization classComment.
- 	s2 := change string.
- 	s1 = s2
- 		ifTrue: [^ self inform: 'Exact Match'].
- 			(StringHolder new
- 				textContents: (TextDiffBuilder buildDisplayPatchFrom: s1 to: s2 inClass: classOfMethod  prettyDiffs: self showingPrettyDiffs))
- 				openLabel: 'Comparison to Current Version'!



More information about the Squeak-dev mailing list