<div dir="ltr">+1 to eliminate the duplication. Didn't review for mistakes though.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Am Sa., 18. Jan. 2020 um 16:05 Uhr schrieb <<a href="mailto:commits@source.squeak.org">commits@source.squeak.org</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Christoph Thiede uploaded a new version of Tools to project The Inbox:<br>
<a href="http://source.squeak.org/inbox/Tools-ct.931.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/inbox/Tools-ct.931.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Tools-ct.931<br>
Author: ct<br>
Time: 18 January 2020, 4:04:41.091813 pm<br>
UUID: f26680f1-98eb-1b46-bc36-2f6371daf249<br>
Ancestors: Tools-mt.929<br>
<br>
Eliminates massive duplication in VersionsBrowser>>#scanVersionsOf:class:meta:category:selector:. This logic is already defined in ChangeSet class.<br>
<br>
Better merge System-ct.1132 before, which fixes a bug regarding the versions' categories.<br>
<br>
=============== Diff against Tools-mt.929 ===============<br>
<br>
Item was changed:<br>
----- Method: VersionsBrowser>>scanVersionsOf:class:meta:category:selector: (in category 'init & update') -----<br>
scanVersionsOf: method class: class meta: meta category: category selector: selector<br>
+ <br>
- | position prevPos prevFileIndex preamble tokens sourceFilesCopy stamp cat |<br>
selectorOfMethod := selector.<br>
currentCompiledMethod := method.<br>
classOfMethod := meta ifTrue: [class class] ifFalse: [class].<br>
- cat := category ifNil: [''].<br>
changeList := OrderedCollection new.<br>
list := OrderedCollection new.<br>
self addedChangeRecord ifNotNil: [ :change |<br>
+ self<br>
+ addItem: change<br>
+ text: ('{1} (in {2})' translated<br>
+ format: { change stamp. change fileName }) ].<br>
- self addItem: change text: ('{1} (in {2})' translated format: { change stamp. change fileName }) ].<br>
listIndex := 0.<br>
+ (ChangeSet scanVersionsOf: method class: class meta: meta category: category selector: selector)<br>
+ do: [ :change |<br>
+ self<br>
+ addItem: change<br>
+ text: ('{1} {2} {3} \{{4}\}' translated format: {<br>
+ change stamp. classOfMethod name. selector. change category })].<br>
+ listSelections := Array new: list size withAll: false.!<br>
- position := method filePosition.<br>
- sourceFilesCopy := SourceFiles collect:<br>
- [:x | x isNil ifTrue: [ nil ]<br>
- ifFalse: [x readOnlyCopy]].<br>
- method fileIndex = 0 ifTrue: [^ nil].<br>
- file := sourceFilesCopy at: method fileIndex.<br>
- <br>
- [position notNil & file notNil]<br>
- whileTrue:<br>
- [preamble := method getPreambleFrom: file at: (0 max: position - 3).<br>
- <br>
- "Preamble is likely a linked method preamble, if we're in<br>
- a changes file (not the sources file). Try to parse it<br>
- for prior source position and file index"<br>
- prevPos := nil.<br>
- stamp := ''.<br>
- (preamble findString: 'methodsFor:' startingAt: 1) > 0<br>
- ifTrue: [tokens := Scanner new scanTokens: preamble]<br>
- ifFalse: [tokens := Array new "ie cant be back ref"].<br>
- ((tokens size between: 7 and: 8)<br>
- and: [(tokens at: tokens size - 5) = #methodsFor:])<br>
- ifTrue:<br>
- [(tokens at: tokens size - 3) = #stamp:<br>
- ifTrue: ["New format gives change stamp and unified prior pointer"<br>
- stamp := tokens at: tokens size - 2.<br>
- prevPos := tokens last.<br>
- prevFileIndex := sourceFilesCopy fileIndexFromSourcePointer: prevPos.<br>
- prevPos := sourceFilesCopy filePositionFromSourcePointer: prevPos]<br>
- ifFalse: ["Old format gives no stamp; prior pointer in two parts"<br>
- prevPos := tokens at: tokens size - 2.<br>
- prevFileIndex := tokens last].<br>
- cat := tokens at: tokens size - 4.<br>
- (prevPos = 0 or: [prevFileIndex = 0]) ifTrue: [prevPos := nil]].<br>
- ((tokens size between: 5 and: 6)<br>
- and: [(tokens at: tokens size - 3) = #methodsFor:])<br>
- ifTrue:<br>
- [(tokens at: tokens size - 1) = #stamp:<br>
- ifTrue: ["New format gives change stamp and unified prior pointer"<br>
- stamp := tokens at: tokens size].<br>
- cat := tokens at: tokens size - 2].<br>
- self addItem:<br>
- (ChangeRecord new file: file position: position type: #method<br>
- class: class name category: cat meta: meta stamp: stamp)<br>
- text: stamp , ' ' , class name , (meta ifTrue: [' class '] ifFalse: [' ']) , selector, ' {', cat, '}'.<br>
- position := prevPos.<br>
- prevPos notNil ifTrue:<br>
- [file := sourceFilesCopy at: prevFileIndex]].<br>
- sourceFilesCopy do: [:x | x notNil ifTrue: [x close]].<br>
- listSelections := Array new: list size withAll: false!<br>
<br>
<br>
</blockquote></div>