The Trunk: Monticello-nice.695.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Monticello-nice.695.mcz

commits-2
Nicolas Cellier uploaded a new version of Monticello to project The Trunk:
http://source.squeak.org/trunk/Monticello-nice.695.mcz

==================== 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
+ !