[squeak-dev] The Inbox: Monticello-nice.499.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Mar 9 23:36:21 UTC 2012


A new version of Monticello was added to project The Inbox:
http://source.squeak.org/inbox/Monticello-nice.499.mcz

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

Name: Monticello-nice.499
Author: nice
Time: 10 March 2012, 12:35:41.922 am
UUID: e6eda11d-eec4-405b-8307-12b2b7324d52
Ancestors: Monticello-nice.498

Add a Monticello preference in order to #ignoreSourceCodeFormattingDifferences in method definitions.
This will affect the diff/merge behavior of Monticello.
When ignoring the differences, the diff is performed on the scanned tokens and _ := also compare equal.
It's generally a bad idea to ignore those diffs, but does really help when browsing diffs with distant cousins like Etoys or Pharo.

This preference must be considered as a quick hack.
A better idea would be to implement such filter in the Monticello UI, but this ain't gonna be as easy.

Ter because of lost source (?) and because _ replacement has to be recursive

=============== Diff against Monticello-nice.498 ===============

Item was changed:
  ----- Method: MCMethodDefinition>>= (in category 'comparing') -----
+ = aDefinition
+ 	self class ignoreSourceCodeFormattingDifferences ifTrue: [
+ 		^(super = aDefinition)
+ 			and: [aDefinition tokens = self tokens]].
+ 	^(super = aDefinition)
+ 		and: [aDefinition source = self source
+ 		and: [aDefinition category = self category
+ 		and: [aDefinition timeStamp = self timeStamp]]]!
- = t1 
- 	self class ignoreSourceCodeFormattingDifferences
- 		ifTrue: [^ super = t1
- 				and: [t1 tokens = self tokens]].
- 	^ super = t1
- 		and: [t1 source = self source
- 				and: [t1 category = self category
- 						and: [t1 timeStamp = self timeStamp]]]!

Item was changed:
  ----- Method: MCMethodDefinition>>hash (in category 'comparing') -----
  hash
+ 	| hash |
+ 	self class ignoreSourceCodeFormattingDifferences ifTrue: [
+ 		hash := classIsMeta asString hashWithInitialHash: self tokens hash.
+ 		hash := className hashWithInitialHash: hash.
+ 		^hash].
+ 	hash := classIsMeta asString hashWithInitialHash: 0.
+ 	hash := source hashWithInitialHash: hash.
+ 	hash := category hashWithInitialHash: hash.
+ 	hash := className hashWithInitialHash: hash.
+ 	^ hash!
- 	| t1 |
- 	self class ignoreSourceCodeFormattingDifferences
- 		ifTrue: [t1 := classIsMeta asString hashWithInitialHash: self tokens hash.
- 			t1 := className hashWithInitialHash: t1.
- 			^ t1].
- 	t1 := classIsMeta asString hashWithInitialHash: 0.
- 	t1 := source hashWithInitialHash: t1.
- 	t1 := category hashWithInitialHash: t1.
- 	t1 := className hashWithInitialHash: t1.
- 	^ t1!

Item was added:
+ ----- Method: MCMethodDefinition>>replaceUnderscoreInTokens: (in category 'accessing') -----
+ replaceUnderscoreInTokens: anArray
+ 	^anArray collect: [:e |
+ 		e == #'_'
+ 			ifTrue: [#':=']
+ 			ifFalse: [e class = Array
+ 				ifTrue: [self replaceUnderscoreInTokens: e]
+ 				ifFalse: [e]]]!

Item was changed:
  ----- Method: MCMethodDefinition>>tokens (in category 'accessing') -----
  tokens
+ 	^tokens ifNil: [tokens := self replaceUnderscoreInTokens: (Scanner new scanTokens: self source)]!
- 	^tokens ifNil: [tokens := (Scanner new scanTokens: self source) replaceAll: #'_' with: #':=']!



More information about the Squeak-dev mailing list