public boolean hasMissingDependencies( final MergeSorter mergeSorter, final CodeReviewCommit toMerge) throws IntegrationException { try { return !mergeSorter.sort(Collections.singleton(toMerge)).contains(toMerge); } catch (IOException e) { throw new IntegrationException("Branch head sorting failed", e); } }
public List<CodeReviewCommit> reduceToMinimalMerge( MergeSorter mergeSorter, Collection<CodeReviewCommit> toSort) throws IntegrationException { List<CodeReviewCommit> result = new ArrayList<>(); try { result.addAll(mergeSorter.sort(toSort)); } catch (IOException e) { throw new IntegrationException("Branch head sorting failed", e); } Collections.sort(result, CodeReviewCommit.ORDER); return result; }