@Test public void mergeListAlreadyDone() { List<String> current = new ArrayList<String>(Arrays.asList("new1", "new2")); MergeManagerResult<List<String>, String> result = mergeManager.mergeList(Arrays.asList("old1", "old2"), Arrays.asList("new1", "new2"), current, new MergeConfiguration()); assertEquals(Arrays.asList("new1", "new2"), result.getMergeResult()); assertEquals(Arrays.asList("new1", "new2"), current); assertFalse(result.isModified()); assertFalse(result.hasConflicts()); }
@Override public <T> MergeManagerResult<List<T>, T> mergeList(List<T> commonAncestor, List<T> next, List<T> current, MergeConfiguration configuration) { MergeManagerResult<List<T>, T> mergeResult = new MergeManagerResult<>(); try { org.xwiki.diff.MergeResult<T> result = this.diffManager.merge(commonAncestor, next, current, getDefaultConfiguration(configuration)); mergeResult.getLog().addAll(result.getLog()); mergeResult.addConflicts(result.getConflicts()); mergeResult.setMergeResult(result.getMerged()); mergeResult.setModified(!result.getMerged().equals(current)); } catch (MergeException e) { mergeResult.getLog().error("Failed to execute merge lists", e); } return mergeResult; }
DefaultMergeManager implements MergeManager { @Override public <T> MergeManagerResult<List<T>, T> mergeList(List<T> commonAncestor, List<T> next, List<T> current, MergeConfiguration configuration) { MergeManagerResult<List<T>, T> mergeResult = new MergeManagerResult<>(); try { org.xwiki.diff.MergeResult<T> result = this.diffManager.merge(commonAncestor, next, current, getDefaultConfiguration(configuration)); mergeResult.getLog().addAll(result.getLog()); mergeResult.addConflicts(result.getConflicts()); mergeResult.setMergeResult(result.getMerged()); mergeResult.setModified(!result.getMerged().equals(current)); } catch (MergeException e) { mergeResult.getLog().error("Failed to execute merge lists", e); } return mergeResult; } }
DefaultMergeManager implements MergeManager { @Override public <T> MergeManagerResult<List<T>, T> mergeList(List<T> commonAncestor, List<T> next, List<T> current, MergeConfiguration configuration) { MergeManagerResult<List<T>, T> mergeResult = new MergeManagerResult<>(); try { org.xwiki.diff.MergeResult<T> result = this.diffManager.merge(commonAncestor, next, current, getDefaultConfiguration(configuration)); mergeResult.getLog().addAll(result.getLog()); mergeResult.addConflicts(result.getConflicts()); mergeResult.setMergeResult(result.getMerged()); mergeResult.setModified(!result.getMerged().equals(current)); } catch (MergeException e) { mergeResult.getLog().error("Failed to execute merge lists", e); } return mergeResult; }  }
DefaultMergeManager implements MergeManager { @Override public <T> MergeManagerResult<List<T>, T> mergeList(List<T> commonAncestor, List<T> next, List<T> current, MergeConfiguration configuration) { MergeManagerResult<List<T>, T> mergeResult = new MergeManagerResult<>(); try { org.xwiki.diff.MergeResult<T> result = this.diffManager.merge(commonAncestor, next, current, getDefaultConfiguration(configuration)); mergeResult.getLog().addAll(result.getLog()); mergeResult.addConflicts(result.getConflicts()); mergeResult.setMergeResult(result.getMerged()); mergeResult.setModified(!result.getMerged().equals(current)); } catch (MergeException e) { mergeResult.getLog().error("Failed to execute merge lists", e); } return mergeResult; }  @Override MergeManagerResult<String, String> mergeLines(String previousStr, String newStr, String currentStr,
        MergeConfiguration configuration); @Override MergeManagerResult<T, T> mergeObject(T previousObject, T newObject, T currentObject,
        MergeConfiguration configuration); @Override MergeManagerResult<String, Character> mergeCharacters(String previousStr, String newStr, String currentStr,
        MergeConfiguration configuration); @Override MergeManagerResult<List<T>, T> mergeList(List<T> commonAncestor, List<T> next, List<T> current,
        MergeConfiguration configuration); @Override MergeDocumentResult mergeDocument(DocumentModelBridge previousDocument,
        DocumentModelBridge newDocument, DocumentModelBridge currentDocument, MergeConfiguration configuration); }
DefaultMergeManager implements MergeManager { @Override public <T> MergeManagerResult<List<T>, T> mergeList(List<T> commonAncestor, List<T> next, List<T> current, MergeConfiguration configuration) { MergeManagerResult<List<T>, T> mergeResult = new MergeManagerResult<>(); try { org.xwiki.diff.MergeResult<T> result = this.diffManager.merge(commonAncestor, next, current, getDefaultConfiguration(configuration)); mergeResult.getLog().addAll(result.getLog()); mergeResult.addConflicts(result.getConflicts()); mergeResult.setMergeResult(result.getMerged()); mergeResult.setModified(!result.getMerged().equals(current)); } catch (MergeException e) { mergeResult.getLog().error("Failed to execute merge lists", e); } return mergeResult; }  @Override MergeManagerResult<String, String> mergeLines(String previousStr, String newStr, String currentStr,
        MergeConfiguration configuration); @Override MergeManagerResult<T, T> mergeObject(T previousObject, T newObject, T currentObject,
        MergeConfiguration configuration); @Override MergeManagerResult<String, Character> mergeCharacters(String previousStr, String newStr, String currentStr,
        MergeConfiguration configuration); @Override MergeManagerResult<List<T>, T> mergeList(List<T> commonAncestor, List<T> next, List<T> current,
        MergeConfiguration configuration); @Override MergeDocumentResult mergeDocument(DocumentModelBridge previousDocument,
        DocumentModelBridge newDocument, DocumentModelBridge currentDocument, MergeConfiguration configuration);  }