private NonNoteEntry mergeNonNotes(NonNoteEntry baseList, NonNoteEntry oursList, NonNoteEntry theirsList) throws IOException { if (baseList == null && oursList == null && theirsList == null) return null; ObjectId baseId = write(baseList); ObjectId oursId = write(oursList); ObjectId theirsId = write(theirsList); inserter.flush(); Merger m = nonNotesMergeStrategy.newMerger(db, true); if (m instanceof ThreeWayMerger) ((ThreeWayMerger) m).setBase(baseId); if (!m.merge(oursId, theirsId)) throw new NotesMergeConflictException(baseList, oursList, theirsList); ObjectId resultTreeId = m.getResultTreeId(); AbbreviatedObjectId none = AbbreviatedObjectId.fromString(""); //$NON-NLS-1$ return NoteParser.parse(none, resultTreeId, reader).nonNotes; }
private void canMerge(final Repository repo, final RevCommit commonAncestor, final RevCommit sourceCommitTree, final RevCommit targetCommitTree, final String sourceBranch, final String targetBranch) { try { ThreeWayMerger merger = MergeStrategy.RECURSIVE.newMerger(repo, true); merger.setBase(commonAncestor); boolean canMerge = merger.merge(sourceCommitTree, targetCommitTree); if (!canMerge) { throw new GitException(String.format("Cannot merge braches from <%s> to <%s>, merge conflicts", sourceBranch, targetBranch)); } } catch (IOException e) { throw new GitException(String.format("Cannot merge braches from <%s> to <%s>, merge conflicts", sourceBranch, targetBranch), e); } }
private NonNoteEntry mergeNonNotes(NonNoteEntry baseList, NonNoteEntry oursList, NonNoteEntry theirsList) throws IOException { if (baseList == null && oursList == null && theirsList == null) return null; ObjectId baseId = write(baseList); ObjectId oursId = write(oursList); ObjectId theirsId = write(theirsList); inserter.flush(); Merger m = nonNotesMergeStrategy.newMerger(db, true); if (m instanceof ThreeWayMerger) ((ThreeWayMerger) m).setBase(baseId); if (!m.merge(oursId, theirsId)) throw new NotesMergeConflictException(baseList, oursList, theirsList); ObjectId resultTreeId = m.getResultTreeId(); AbbreviatedObjectId none = AbbreviatedObjectId.fromString(""); //$NON-NLS-1$ return NoteParser.parse(none, resultTreeId, reader).nonNotes; }
private NonNoteEntry mergeNonNotes(NonNoteEntry baseList, NonNoteEntry oursList, NonNoteEntry theirsList) throws IOException { if (baseList == null && oursList == null && theirsList == null) return null; ObjectId baseId = write(baseList); ObjectId oursId = write(oursList); ObjectId theirsId = write(theirsList); inserter.flush(); Merger m = nonNotesMergeStrategy.newMerger(db, true); if (m instanceof ThreeWayMerger) ((ThreeWayMerger) m).setBase(baseId); if (!m.merge(oursId, theirsId)) throw new NotesMergeConflictException(baseList, oursList, theirsList); ObjectId resultTreeId = m.getResultTreeId(); AbbreviatedObjectId none = AbbreviatedObjectId.fromString(""); //$NON-NLS-1$ return NoteParser.parse(none, resultTreeId, reader).nonNotes; }
merger.setBase(parent.getTree()); if (merger.merge(head, commit)) { if (AnyObjectId.equals(head.getTree(), merger.getResultTreeId()))
merger.setBase(parent.getTree()); if (merger.merge(head, commit)) { if (AnyObjectId.equals(head.getTree(), merger.getResultTreeId()))