Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathieu Cartaud2016-09-07 04:56:03 -0400
committerMathieu Cartaud2016-09-12 11:50:01 -0400
commit741f9ffd6108a4a0e42b2a2648bd29cb048e6ea7 (patch)
treea282265fce31951cfea78389f4f0aab2d1e8e93e
parentd46e8c85b4cdbb7b79c05d43cf77b411dcd9f71a (diff)
downloadorg.eclipse.emf.compare-741f9ffd6108a4a0e42b2a2648bd29cb048e6ea7.tar.gz
org.eclipse.emf.compare-741f9ffd6108a4a0e42b2a2648bd29cb048e6ea7.tar.xz
org.eclipse.emf.compare-741f9ffd6108a4a0e42b2a2648bd29cb048e6ea7.zip
[442897] Fix markers issue in SMV
Some markers of required or rejected diffs don't have the correct color in the gutter. It was previously fixed by review 37012 but this fix finally introduces other problems. This commit reverts this previous fix and adopts the following solution: pseudo conflicts are simply not taken into account when computing merge dependencies since there is nothing to do with them, the changes have already been made on both sides. Change-Id: I554ccb6c3c6617882ba4420bfc3f0cd7f6784f8c Signed-off-by: Mathieu Cartaud <mathieu.cartaud@obeo.fr>
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/ConflictDetectionTest.java34
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/ConflictImplicationsTest_Bug484579.java16
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/ConflictMergeTest.java8
-rw-r--r--plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/conflict/DefaultConflictDetector.java60
-rw-r--r--plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/conflict/MatchBasedConflictDetector.java66
-rw-r--r--plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/merge/MergeDependenciesUtil.java41
6 files changed, 64 insertions, 161 deletions
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/ConflictDetectionTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/ConflictDetectionTest.java
index 15ac2c236..c88fb7951 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/ConflictDetectionTest.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/ConflictDetectionTest.java
@@ -13,6 +13,8 @@ package org.eclipse.emf.compare.tests.conflict;
import static com.google.common.base.Predicates.and;
import static com.google.common.base.Predicates.not;
+import static com.google.common.collect.Iterables.filter;
+import static com.google.common.collect.Iterables.size;
import static org.eclipse.emf.compare.ConflictKind.PSEUDO;
import static org.eclipse.emf.compare.ConflictKind.REAL;
import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
@@ -20,6 +22,7 @@ import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToAttribut
import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedAttribute;
import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.containsConflictOfTypes;
import static org.eclipse.emf.compare.utils.EMFComparePredicates.fromSide;
import static org.eclipse.emf.compare.utils.EMFComparePredicates.hasConflict;
import static org.eclipse.emf.compare.utils.EMFComparePredicates.moved;
@@ -39,7 +42,6 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
import com.google.common.collect.Iterators;
import java.io.IOException;
@@ -2137,9 +2139,11 @@ public class ConflictDetectionTest {
assertEquals(6, differences.size());
assertEquals(2, conflicts.size());
- for (Conflict conflict : conflicts) {
- assertSame(REAL, conflict.getKind());
- }
+ Iterable<Conflict> realConflicts = filter(conflicts, containsConflictOfTypes(REAL));
+ Iterable<Conflict> pseudoConflicts = filter(conflicts, containsConflictOfTypes(PSEUDO));
+
+ assertEquals(1, size(realConflicts));
+ assertEquals(1, size(pseudoConflicts));
}
@Test
@@ -2157,9 +2161,11 @@ public class ConflictDetectionTest {
assertEquals(8, differences.size());
assertEquals(3, conflicts.size());
- for (Conflict conflict : conflicts) {
- assertSame(REAL, conflict.getKind());
- }
+ Iterable<Conflict> realConflicts = filter(conflicts, containsConflictOfTypes(REAL));
+ Iterable<Conflict> pseudoConflicts = filter(conflicts, containsConflictOfTypes(PSEUDO));
+
+ assertEquals(1, size(realConflicts));
+ assertEquals(2, size(pseudoConflicts));
}
@Test
@@ -2177,9 +2183,11 @@ public class ConflictDetectionTest {
assertEquals(6, differences.size());
assertEquals(3, conflicts.size());
- for (Conflict conflict : conflicts) {
- assertSame(REAL, conflict.getKind());
- }
+ Iterable<Conflict> realConflicts = filter(conflicts, containsConflictOfTypes(REAL));
+ Iterable<Conflict> pseudoConflicts = filter(conflicts, containsConflictOfTypes(PSEUDO));
+
+ assertEquals(1, size(realConflicts));
+ assertEquals(2, size(pseudoConflicts));
}
@Test
@@ -2340,9 +2348,9 @@ public class ConflictDetectionTest {
assertEquals(5, differences.size());
assertEquals(2, conflicts.size());
- assertEquals(4, Iterables.size(Iterables.filter(differences, hasConflict(REAL))));
- Iterable<Diff> nonConflictingDiffs = Iterables.filter(differences, not(hasConflict(REAL, PSEUDO)));
- assertEquals(1, Iterables.size(nonConflictingDiffs));
+ assertEquals(4, size(filter(differences, hasConflict(REAL))));
+ Iterable<Diff> nonConflictingDiffs = filter(differences, not(hasConflict(REAL, PSEUDO)));
+ assertEquals(1, size(nonConflictingDiffs));
Diff nonConflictingDiff = nonConflictingDiffs.iterator().next();
assertTrue(nonConflictingDiff instanceof ResourceAttachmentChange);
assertEquals(DifferenceSource.RIGHT, nonConflictingDiff.getSource());
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/ConflictImplicationsTest_Bug484579.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/ConflictImplicationsTest_Bug484579.java
index e131bbf62..1c50801e1 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/ConflictImplicationsTest_Bug484579.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/ConflictImplicationsTest_Bug484579.java
@@ -85,7 +85,7 @@ public class ConflictImplicationsTest_Bug484579 {
MergeDependenciesChecker checker = getChecker(deletePackageY);
checker.rightToLeft().implies(1).rejects(0).check();
- checker.leftToRight().implies(5).rejects(0).check();
+ checker.leftToRight().implies(1).rejects(0).check();
}
/**
@@ -216,11 +216,11 @@ public class ConflictImplicationsTest_Bug484579 {
differences.remove(diff);
checker = getChecker(diff);
if (diff.getSource() == DifferenceSource.LEFT) {
- checker.rightToLeft().implies(7).rejects(0).check();
+ checker.rightToLeft().implies(4).rejects(0).check();
checker.leftToRight().implies(2).rejects(0).check();
} else {
checker.rightToLeft().implies(2).rejects(0).check();
- checker.leftToRight().implies(7).rejects(0).check();
+ checker.leftToRight().implies(2).rejects(0).check();
}
}
@@ -234,16 +234,16 @@ public class ConflictImplicationsTest_Bug484579 {
checker = getChecker(diff);
if (diff.getSource() == DifferenceSource.LEFT) {
checker.rightToLeft().implies(3).rejects(0).check();
- checker.leftToRight().implies(4).rejects(0).check();
+ checker.leftToRight().implies(2).rejects(0).check();
} else {
- checker.rightToLeft().implies(4).rejects(0).check();
- checker.leftToRight().implies(3).rejects(0).check();
+ checker.rightToLeft().implies(2).rejects(0).check();
+ checker.leftToRight().implies(2).rejects(0).check();
}
}
checker = getChecker(deleteClassB);
checker.rightToLeft().implies(2).rejects(0).check();
- checker.leftToRight().implies(3).rejects(1).check();
+ checker.leftToRight().implies(1).rejects(1).check();
checker = getChecker(renameClassB);
checker.rightToLeft().implies(1).rejects(2).check();
@@ -251,7 +251,7 @@ public class ConflictImplicationsTest_Bug484579 {
checker = getChecker(deletePackageA);
checker.rightToLeft().implies(1).rejects(0).check();
- checker.leftToRight().implies(4).rejects(2).check();
+ checker.leftToRight().implies(2).rejects(2).check();
checker = getChecker(renamePackageA);
checker.rightToLeft().implies(1).rejects(1).check();
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/ConflictMergeTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/ConflictMergeTest.java
index 9d275deae..24704a3b0 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/ConflictMergeTest.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/ConflictMergeTest.java
@@ -119,7 +119,7 @@ public class ConflictMergeTest {
assertEquals(DifferenceState.MERGED, diffNodeCLeft.getState());
assertEquals(DifferenceState.MERGED, diffNodeCRight.getState());
- assertEquals(DifferenceState.UNRESOLVED, diffNodeDLeft.getState());
+ assertEquals(DifferenceState.MERGED, diffNodeDLeft.getState());
assertEquals(DifferenceState.MERGED, diffNodeDRight.getState());
assertEquals(DifferenceState.UNRESOLVED, diffNodeELeft.getState());
assertEquals(DifferenceState.MERGED, diffNodeFRight.getState());
@@ -182,7 +182,7 @@ public class ConflictMergeTest {
assertEquals(DifferenceState.UNRESOLVED, diffNodeCLeft.getState());
assertEquals(DifferenceState.MERGED, diffNodeCRight.getState());
- assertEquals(DifferenceState.UNRESOLVED, diffNodeDLeft.getState());
+ assertEquals(DifferenceState.MERGED, diffNodeDLeft.getState());
assertEquals(DifferenceState.MERGED, diffNodeDRight.getState());
assertEquals(DifferenceState.UNRESOLVED, diffNodeELeft.getState());
assertEquals(DifferenceState.MERGED, diffNodeFRight.getState());
@@ -246,7 +246,7 @@ public class ConflictMergeTest {
assertEquals(DifferenceState.MERGED, diffNodeCLeft.getState());
assertEquals(DifferenceState.UNRESOLVED, diffNodeCRight.getState());
assertEquals(DifferenceState.MERGED, diffNodeDLeft.getState());
- assertEquals(DifferenceState.UNRESOLVED, diffNodeDRight.getState());
+ assertEquals(DifferenceState.MERGED, diffNodeDRight.getState());
assertEquals(DifferenceState.MERGED, diffNodeELeft.getState());
assertEquals(DifferenceState.UNRESOLVED, diffNodeFRight.getState());
}
@@ -309,7 +309,7 @@ public class ConflictMergeTest {
assertEquals(DifferenceState.MERGED, diffNodeCLeft.getState());
assertEquals(DifferenceState.MERGED, diffNodeCRight.getState());
assertEquals(DifferenceState.MERGED, diffNodeDLeft.getState());
- assertEquals(DifferenceState.UNRESOLVED, diffNodeDRight.getState());
+ assertEquals(DifferenceState.MERGED, diffNodeDRight.getState());
assertEquals(DifferenceState.MERGED, diffNodeELeft.getState());
assertEquals(DifferenceState.UNRESOLVED, diffNodeFRight.getState());
}
diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/conflict/DefaultConflictDetector.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/conflict/DefaultConflictDetector.java
index 5ebd735fa..98ad60f4a 100644
--- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/conflict/DefaultConflictDetector.java
+++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/conflict/DefaultConflictDetector.java
@@ -13,13 +13,9 @@
package org.eclipse.emf.compare.conflict;
import static com.google.common.base.Predicates.and;
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.isEmpty;
import static org.eclipse.emf.compare.internal.utils.ComparisonUtil.isAddOrSetDiff;
import static org.eclipse.emf.compare.internal.utils.ComparisonUtil.isDeleteOrUnsetDiff;
import static org.eclipse.emf.compare.internal.utils.ComparisonUtil.isFeatureMapContainment;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.CONTAINMENT_REFERENCE_CHANGE;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.hasConflict;
import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
import static org.eclipse.emf.compare.utils.EMFComparePredicates.onFeature;
import static org.eclipse.emf.compare.utils.EMFComparePredicates.possiblyConflictingWith;
@@ -78,27 +74,6 @@ public class DefaultConflictDetector implements IConflictDetector {
private static final Logger LOGGER = Logger.getLogger(DefaultConflictDetector.class);
/**
- * This can be used to check whether a given conflict involves add containment reference changes.
- */
- private static final Predicate<? super Conflict> IS_REAL_CONTAINMENT_ADD_CONFLICT = new Predicate<Conflict>() {
- public boolean apply(Conflict input) {
- boolean isRealAddContainmentConflict = false;
- if (input != null && input.getKind() == ConflictKind.REAL) {
- Iterable<Diff> containmentRefs = filter(input.getDifferences(), CONTAINMENT_REFERENCE_CHANGE);
- if (!isEmpty(containmentRefs)) {
- for (Diff diff : containmentRefs) {
- if (diff.getKind() != DifferenceKind.ADD) {
- return false;
- }
- }
- isRealAddContainmentConflict = true;
- }
- }
- return isRealAddContainmentConflict;
- }
- };
-
- /**
* {@inheritDoc}
*
* @see org.eclipse.emf.compare.conflict.IConflictDetector#detect(org.eclipse.emf.compare.Comparison,
@@ -125,7 +100,6 @@ public class DefaultConflictDetector implements IConflictDetector {
checkConflict(comparison, diff, Iterables.filter(differences, possiblyConflictingWith(diff)));
}
- handlePseudoUnderRealAdd(comparison);
if (LOGGER.isInfoEnabled()) {
LOGGER.info(String.format("detect conflicts - END - Took %d ms", Long.valueOf(System //$NON-NLS-1$
.currentTimeMillis() - start)));
@@ -133,40 +107,6 @@ public class DefaultConflictDetector implements IConflictDetector {
}
/**
- * If a real add conflict contains pseudo conflicts, these pseudo conflicts must be changed to real
- * conflicts.
- *
- * @param comparison
- * The originating comparison of those diffs.
- */
- private void handlePseudoUnderRealAdd(Comparison comparison) {
- for (Conflict realContainmentAdd : filter(comparison.getConflicts(),
- IS_REAL_CONTAINMENT_ADD_CONFLICT)) {
- changeKindOfPseudoConflictsUnder(realContainmentAdd);
- }
- }
-
- /**
- * Change all pseudo conflicts under the given real conflict to real conflicts.
- *
- * @param conflict
- * the given conflict.
- */
- private void changeKindOfPseudoConflictsUnder(Conflict conflict) {
- for (Diff diff : conflict.getDifferences()) {
- final Match realConflictMatch = diff.getMatch();
- for (Match subMatch : realConflictMatch.getSubmatches()) {
- for (Diff conflictDiffUnder : filter(subMatch.getDifferences(),
- hasConflict(ConflictKind.PSEUDO))) {
- Conflict conflictUnder = conflictDiffUnder.getConflict();
- conflictUnder.setKind(ConflictKind.REAL);
- changeKindOfPseudoConflictsUnder(conflictUnder);
- }
- }
- }
- }
-
- /**
* This will be called once for each difference in the comparison model.
*
* @param comparison
diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/conflict/MatchBasedConflictDetector.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/conflict/MatchBasedConflictDetector.java
index ce2b34969..d152e21b6 100644
--- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/conflict/MatchBasedConflictDetector.java
+++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/conflict/MatchBasedConflictDetector.java
@@ -10,23 +10,12 @@
*******************************************************************************/
package org.eclipse.emf.compare.conflict;
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.isEmpty;
-import static org.eclipse.emf.compare.ConflictKind.PSEUDO;
-import static org.eclipse.emf.compare.ConflictKind.REAL;
-import static org.eclipse.emf.compare.DifferenceKind.ADD;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.CONTAINMENT_REFERENCE_CHANGE;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.hasConflict;
-
-import com.google.common.base.Predicate;
-
import java.util.List;
import org.apache.log4j.Logger;
import org.eclipse.emf.common.util.Monitor;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.ComparisonCanceledException;
-import org.eclipse.emf.compare.Conflict;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.EMFCompareMessages;
import org.eclipse.emf.compare.Match;
@@ -53,27 +42,6 @@ public class MatchBasedConflictDetector implements IConflictDetector {
private static final Logger LOGGER = Logger.getLogger(MatchBasedConflictDetector.class);
/**
- * This can be used to check whether a given conflict involves add containment reference changes.
- */
- private static final Predicate<? super Conflict> IS_REAL_CONTAINMENT_ADD_CONFLICT = new Predicate<Conflict>() {
- public boolean apply(Conflict input) {
- boolean isRealAddContainmentConflict = false;
- if (input != null && input.getKind() == REAL) {
- Iterable<Diff> containmentRefs = filter(input.getDifferences(), CONTAINMENT_REFERENCE_CHANGE);
- if (!isEmpty(containmentRefs)) {
- for (Diff diff : containmentRefs) {
- if (diff.getKind() != ADD) {
- return false;
- }
- }
- isRealAddContainmentConflict = true;
- }
- }
- return isRealAddContainmentConflict;
- }
- };
-
- /**
* {@inheritDoc}
*
* @see org.eclipse.emf.compare.conflict.IConflictDetector#detect(org.eclipse.emf.compare.Comparison,
@@ -101,43 +69,9 @@ public class MatchBasedConflictDetector implements IConflictDetector {
search.detectConflicts();
}
- handlePseudoUnderRealAdd(comparison);
if (LOGGER.isInfoEnabled()) {
LOGGER.info(String.format("detect conflicts - END - Took %d ms", Long.valueOf(System //$NON-NLS-1$
.currentTimeMillis() - start)));
}
}
-
- /**
- * If a real add conflict contains pseudo conflicts, these pseudo conflicts must be changed to real
- * conflicts.
- *
- * @param comparison
- * The originating comparison of those diffs.
- */
- private void handlePseudoUnderRealAdd(Comparison comparison) {
- for (Conflict realContainmentAdd : filter(comparison.getConflicts(),
- IS_REAL_CONTAINMENT_ADD_CONFLICT)) {
- changeKindOfPseudoConflictsUnder(realContainmentAdd);
- }
- }
-
- /**
- * Change all pseudo conflicts under the given real conflict to real conflicts.
- *
- * @param conflict
- * the given conflict.
- */
- private void changeKindOfPseudoConflictsUnder(Conflict conflict) {
- for (Diff diff : conflict.getDifferences()) {
- final Match realConflictMatch = diff.getMatch();
- for (Match subMatch : realConflictMatch.getSubmatches()) {
- for (Diff conflictDiffUnder : filter(subMatch.getDifferences(), hasConflict(PSEUDO))) {
- Conflict conflictUnder = conflictDiffUnder.getConflict();
- conflictUnder.setKind(REAL);
- changeKindOfPseudoConflictsUnder(conflictUnder);
- }
- }
- }
- }
}
diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/merge/MergeDependenciesUtil.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/merge/MergeDependenciesUtil.java
index 3a5365763..d7078c69b 100644
--- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/merge/MergeDependenciesUtil.java
+++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/merge/MergeDependenciesUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014, 2015 Obeo and others.
+ * Copyright (c) 2014, 2016 Obeo and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,8 +11,11 @@
*******************************************************************************/
package org.eclipse.emf.compare.internal.merge;
+import static com.google.common.base.Predicates.not;
import static com.google.common.collect.Iterables.addAll;
+import static org.eclipse.emf.compare.ConflictKind.PSEUDO;
import static org.eclipse.emf.compare.utils.EMFComparePredicates.fromSide;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.hasConflict;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
@@ -146,18 +149,30 @@ public final class MergeDependenciesUtil {
Set<Diff> relations = internalGetResultingMerges(diff, mergerRegistry, mergeRightToLeft,
diff.getSource());
- Set<Diff> difference = Sets.difference(relations, resultingMerges);
+ // We don't want to take in account pseudo conflicts since there is nothing to do with them
+ // and there dependencies may cause incorrect merge dependencies computation.
+ Set<Diff> difference = Sets.filter(Sets.difference(relations, resultingMerges),
+ not(hasConflict(PSEUDO)));
while (!difference.isEmpty()) {
final Set<Diff> newRelations = new LinkedHashSet<Diff>(difference);
resultingMerges.addAll(newRelations);
relations = new LinkedHashSet<Diff>();
for (Diff newRelation : newRelations) {
- relations.addAll(internalGetResultingMerges(newRelation, mergerRegistry, mergeRightToLeft,
- diff.getSource()));
+ Set<Diff> internalResultingMerges = internalGetResultingMerges(newRelation, mergerRegistry,
+ mergeRightToLeft, diff.getSource());
+ // We don't want to take in account pseudo conflicts since there is nothing to do with them
+ // and there dependencies may cause incorrect merge dependencies computation.
+ relations.addAll(Sets.filter(internalResultingMerges, not(hasConflict(PSEUDO))));
}
difference = Sets.difference(relations, resultingMerges);
}
+ // If a pseudo conflict is directly selected, we want to display other diffs of the pseudo conflict as
+ // resulting merge for the user
+ if (diff.getConflict() != null && diff.getConflict().getKind() == PSEUDO) {
+ resultingMerges.addAll(diff.getConflict().getDifferences());
+ }
+
return resultingMerges;
}
@@ -233,7 +248,10 @@ public final class MergeDependenciesUtil {
for (Diff resulting : allResultingMerges) {
Set<Diff> rejections = internalGetResultingRejections(resulting, mergerRegistry, mergeRightToLeft,
diff.getSource());
- Set<Diff> difference = Sets.difference(rejections, resultingRejections);
+ // We don't want to take in account pseudo conflicts since there is nothing to do with them
+ // and there dependencies may cause incorrect merge dependencies computation.
+ Set<Diff> difference = Sets.filter(Sets.difference(rejections, resultingRejections),
+ not(hasConflict(PSEUDO)));
while (!difference.isEmpty()) {
final Set<Diff> newRejections = new LinkedHashSet<Diff>(difference);
resultingRejections.addAll(newRejections);
@@ -241,16 +259,19 @@ public final class MergeDependenciesUtil {
for (Diff rejected : newRejections) {
final IMerger merger = mergerRegistry.getHighestRankingMerger(rejected);
if (merger instanceof IMerger2) {
- rejections.addAll(
- ((IMerger2)merger).getDirectMergeDependencies(rejected, mergeRightToLeft));
- rejections.addAll(
- ((IMerger2)merger).getDirectResultingMerges(rejected, mergeRightToLeft));
+ Set<Diff> directMergeDependencies = ((IMerger2)merger)
+ .getDirectMergeDependencies(rejected, mergeRightToLeft);
+ // We don't want to take in account pseudo conflicts since there is nothing to do with
+ // them and there dependencies may cause incorrect merge dependencies computation.
+ rejections.addAll(Sets.filter(directMergeDependencies, not(hasConflict(PSEUDO))));
+ Set<Diff> directResultingMerges = ((IMerger2)merger)
+ .getDirectResultingMerges(rejected, mergeRightToLeft);
+ rejections.addAll(Sets.filter(directResultingMerges, not(hasConflict(PSEUDO))));
}
}
difference = Sets.difference(rejections, resultingRejections);
}
}
-
return resultingRejections;
}

Back to the top