[squeak-dev] The Trunk: Monticello-nice.695.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Feb 14 12:46:57 UTC 2019

Nicolas Cellier uploaded a new version of Monticello to project The Trunk:

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

Name: Monticello-nice.695
Author: nice
Time: 14 February 2019, 1:46:52.89164 pm
UUID: 1933b192-0ab2-bc46-af47-b06f031516b9
Ancestors: Monticello-nice.694

Add a utility for finding last merge of two versions.

A use case:

| mcw allBF540 |
mcw := (MCPackage named: 'Monticello') workingCopy ancestry.
allBF540 := (mcw allAncestors select: [:e | e versionName = 'Monticello-bf.540' ]) asArray.
^mcw lastMergeOf: allBF540 first and: allBF540 last.

Note: implementation is sub-optimal but just works

=============== Diff against Monticello-nice.694 ===============

Item was added:
+ ----- Method: MCAncestry>>lastMergeOf:and: (in category 'progeny') -----
+ lastMergeOf: aNode and: anotherNode
+ 	"Find the last merge of two Nodes starting from myself.
+ 	Answer nil if there is none.
+ 	Note: there might have been several merges, in which case we take the common merge of merges.
+ 	Example: if c is a merge of a and b, d is also a merge of a and b, and e is a merge of c and d, then asnwer e."
+ 	| common |
+ 	(self hasAncestor: aNode) ifFalse: [^nil].
+ 	(self hasAncestor: anotherNode) ifFalse: [^nil].
+ 	common := ancestors collect: [:e | e lastMergeOf: aNode and: anotherNode] as: Set.
+ 	common remove: nil ifAbsent: [].
+ 	common size = 1 ifTrue: [^common anyOne].
+ 	^self
+ 	!

More information about the Squeak-dev mailing list