[squeak-dev] The Trunk: Monticello-ul.409.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Nov 16 03:58:20 UTC 2010
Levente Uzonyi uploaded a new version of Monticello to project The Trunk:
http://source.squeak.org/trunk/Monticello-ul.409.mcz
==================== Summary ====================
Name: Monticello-ul.409
Author: ul
Time: 16 November 2010, 4:58:01.516 am
UUID: 0594b7a0-c048-6f43-94e9-7ec3d50b8433
Ancestors: Monticello-ul.408
- use #= for integer comparison instead of #== (http://bugs.squeak.org/view.php?id=2788 )
=============== Diff against Monticello-ul.408 ===============
Item was changed:
----- Method: ChangeList class>>recentLogOn:startingFrom: (in category '*monticello') -----
recentLogOn: origChangesFile startingFrom: initialPos
"Prompt with a menu of how far back to go when browsing a changes file."
| end banners positions pos chunk i changesFile |
changesFile := origChangesFile readOnlyCopy.
banners := OrderedCollection new.
positions := OrderedCollection new.
end := changesFile size.
pos := initialPos.
[pos = 0
or: [banners size > 20]]
whileFalse: [changesFile position: pos.
chunk := changesFile nextChunk.
i := chunk indexOfSubCollection: 'priorSource: ' startingAt: 1.
i > 0
ifTrue: [positions addLast: pos.
banners
addLast: (chunk copyFrom: 5 to: i - 2).
pos := Number
readFrom: (chunk copyFrom: i + 13 to: chunk size)]
ifFalse: [pos := 0]].
changesFile close.
+ banners size = 0 ifTrue: [^self recent: end on: origChangesFile].
- banners size == 0 ifTrue: [^self recent: end on: origChangesFile].
pos := UIManager default chooseFrom: banners values: positions
title: 'Browse as far back as...'.
pos == nil
ifTrue: [^ self].
^self recent: end - pos on: origChangesFile!
Item was changed:
----- Method: MCMethodDefinition>>scanForPreviousVersion (in category 'installing') -----
scanForPreviousVersion
| sourceFilesCopy method position |
method := self actualClass compiledMethodAt: selector ifAbsent: [^ nil].
position := method filePosition.
sourceFilesCopy := SourceFiles collect:
[:x | x isNil ifTrue: [ nil ]
ifFalse: [x readOnlyCopy]].
[ | file prevPos tokens preamble methodCategory stamp prevFileIndex |
+ method fileIndex = 0 ifTrue: [^ nil].
- method fileIndex == 0 ifTrue: [^ nil].
file := sourceFilesCopy at: method fileIndex.
[position notNil & file notNil]
whileTrue:
[file position: (0 max: position-150). "Skip back to before the preamble"
[file position < (position-1)] "then pick it up from the front"
whileTrue: [preamble := file nextChunk].
"Preamble is likely a linked method preamble, if we're in
a changes file (not the sources file). Try to parse it
for prior source position and file index"
prevPos := nil.
stamp := ''.
(preamble findString: 'methodsFor:' startingAt: 1) > 0
ifTrue: [tokens := Scanner new scanTokens: preamble]
ifFalse: [tokens := Array new "ie cant be back ref"].
((tokens size between: 7 and: 8)
and: [(tokens at: tokens size-5) = #methodsFor:])
ifTrue:
[(tokens at: tokens size-3) = #stamp:
ifTrue: ["New format gives change stamp and unified prior pointer"
stamp := tokens at: tokens size-2.
prevPos := tokens last.
prevFileIndex := sourceFilesCopy fileIndexFromSourcePointer: prevPos.
prevPos := sourceFilesCopy filePositionFromSourcePointer: prevPos]
ifFalse: ["Old format gives no stamp; prior pointer in two parts"
prevPos := tokens at: tokens size-2.
prevFileIndex := tokens last].
(prevPos = 0 or: [prevFileIndex = 0]) ifTrue: [prevPos := nil]].
((tokens size between: 5 and: 6)
and: [(tokens at: tokens size-3) = #methodsFor:])
ifTrue:
[(tokens at: tokens size-1) = #stamp:
ifTrue: ["New format gives change stamp and unified prior pointer"
stamp := tokens at: tokens size]].
methodCategory := tokens after: #methodsFor: ifAbsent: ['as yet unclassifed'].
methodCategory = category ifFalse:
[methodCategory = (Smalltalk
at: #Categorizer
ifAbsent: [Smalltalk at: #ClassOrganizer])
default ifTrue: [methodCategory := methodCategory, ' '].
^ ChangeRecord new file: file position: position type: #method
class: className category: methodCategory meta: classIsMeta stamp: stamp].
position := prevPos.
prevPos notNil ifTrue:
[file := sourceFilesCopy at: prevFileIndex]].
^ nil]
ensure: [sourceFilesCopy do: [:x | x notNil ifTrue: [x close]]]
!
More information about the Squeak-dev
mailing list
|