Marcel Taeumel uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-mt.970.mcz ==================== Summary ==================== Name: Tools-mt.970 Author: mt Time: 27 May 2020, 4:27:13.819043 pm UUID: dabe9e09-88fd-904b-9137-f3a206e7da6e Ancestors: Tools-mt.969 Adds a simple way to scan the .changes file for verions of methods that are not currently installed. So, you can recover such deletions even if you forgot about or deleted the corresponding change set. (Note that the code base in ChangeList is scary. I think I added this new feature in a way that matches the existing ones. But we should really clean up here.) =============== Diff against Tools-mt.969 =============== Item was added: + ----- Method: ChangeList class>>browseMethodVersions (in category 'public access') ----- + browseMethodVersions + + | changeList end changesFile filteredRecords | + changesFile := (SourceFiles at: 2) readOnlyCopy. + changesFile setConverterForCode. + end := changesFile size. + changeList := self new. + Cursor read showWhile: [ + [changeList scanFile: changesFile from: 0 to: end] + on: InvalidUTF8 do: [:err | err resume: '']]. + changesFile close. + + filteredRecords := Dictionary new. + changeList changeList + do: [:changeRecord | + changeRecord methodSelector ifNotNil: [:selector | + | class | + class := changeRecord methodClass. + "Only collect records that point to not-installed methods." + (class isNil or: [(class includesSelector: selector) not]) ifTrue: [ + (filteredRecords at: selector ifAbsentPut: [OrderedCollection new]) + add: changeRecord]]] + displayingProgress: [:changeRecord | 'Parsing source code at {1}...' format: {changeRecord position}]. + filteredRecords explore. "Open explorer to allow user to repeat the following step manually." + self browseMethodVersions: filteredRecords.! Item was added: + ----- Method: ChangeList class>>browseMethodVersions: (in category 'public access') ----- + browseMethodVersions: filteredRecords + + | changeList sortedKeys choice | + sortedKeys := filteredRecords keys sorted. + choice := Project uiManager chooseFrom: sortedKeys values: sortedKeys title: 'Recover method versions'. + choice ifNil: [^ self]. + + "Only ChangeList can handle the mix of (maybe non-existing) class references in records. For example, VersionsBrowser is not supported." + changeList := ChangeList new. + + (filteredRecords at: choice) do: [:changeRecord | + changeList + addItem: changeRecord + text: ('{1} {2}{3}{4} \{{5}\}' format: { + changeRecord stamp. + changeRecord methodClassName. + changeRecord isMetaClassChange + ifTrue: [' class '] ifFalse: [' ']. + choice. + changeRecord category})]. + changeList resetListSelections. + + self + open: changeList + name: 'All local versions for ', choice storeString + multiSelect: false! Item was added: + ----- Method: ChangeList>>resetListSelections (in category 'initialization-release') ----- + resetListSelections + + listSelections := Array new: list size withAll: false.! Item was changed: ----- Method: ChangeList>>scanFile:from:to: (in category 'scanning') ----- scanFile: aFile from: startPosition to: stopPosition file := aFile. changeList := OrderedCollection new. list := OrderedCollection new. listIndex := 0. file position: startPosition. 'Scanning ', aFile localName, '...' displayProgressFrom: startPosition to: stopPosition during: [:bar | | prevChar itemPosition item | [file position < stopPosition] whileTrue: [bar value: file position. [file atEnd not and: [file peek isSeparator]] whileTrue: [prevChar := file next]. (file peekFor: $!!) ifTrue: [(prevChar = Character cr or: [prevChar = Character lf]) ifTrue: [self scanCategory]] ifFalse: [itemPosition := file position. item := file nextChunk. file skipStyleChunk. item size > 0 ifTrue: [(item beginsWith: '----') ifTrue: [self addItem: (ChangeRecord new file: file position: itemPosition type: #misc) text: 'misc: ' , (item contractTo: 50)] ifFalse: [self addItem: (ChangeRecord new file: file position: itemPosition type: #doIt) text: 'do it: ' , (item contractTo: 50)]]]]]. + self resetListSelections.! - listSelections := Array new: list size withAll: false! |
Free forum by Nabble | Edit this page |