The Trunk: Tools-mt.861.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Tools-mt.861.mcz

commits-2
Marcel Taeumel uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-mt.861.mcz

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

Name: Tools-mt.861
Author: mt
Time: 4 August 2019, 12:04:31.081314 pm
UUID: 7b061394-82bb-0941-b46b-304f857afa7c
Ancestors: Tools-mt.860

Merges Tools-ct.857, which I moved to treated inbox due to incompatible ancestry.

"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-mt.860 ===============

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'!