List of usage examples for org.eclipse.jgit.notes NoteMerger merge
Note merge(Note base, Note ours, Note their, ObjectReader reader, ObjectInserter inserter)
throws NotesMergeConflictException, IOException;
From source file:com.google.appraise.eclipse.core.client.git.GitNoteWriter.java
License:Open Source License
private void add(T noteRecord) throws MissingObjectException, IncorrectObjectTypeException, IOException, RuntimeException { ObjectId noteContent = createNoteContent(noteRecord); if (ours.contains(reviewCommit)) { // merge the existing and the new note as if they are both new // means: base == null // there is not really a common ancestry for these two note revisions // use the same NoteMerger that is used from the NoteMapMerger NoteMerger noteMerger = new DefaultNoteMerger(); Note newNote = new Note(reviewCommit, noteContent); noteContent = noteMerger.merge(null, newNote, ours.getNote(reviewCommit), reader, inserter).getData(); }// w w w . ja v a 2 s.c om ours.set(reviewCommit, noteContent); }
From source file:com.google.gerrit.server.git.CreateCodeReviewNotes.java
License:Apache License
public void add(Change change, ObjectId commit) throws MissingObjectException, IncorrectObjectTypeException, IOException, CodeReviewNoteCreationException { if (!(commit instanceof RevCommit)) { commit = revWalk.parseCommit(commit); }//from ww w.j av a 2 s . c om RevCommit c = (RevCommit) commit; ObjectId noteContent = createNoteContent(change, c); if (ours.contains(c)) { // merge the existing and the new note as if they are both new // means: base == null // there is not really a common ancestry for these two note revisions // use the same NoteMerger that is used from the NoteMapMerger NoteMerger noteMerger = new ReviewNoteMerger(); Note newNote = new Note(c, noteContent); noteContent = noteMerger.merge(null, newNote, ours.getNote(c), reader, inserter).getData(); } ours.set(c, noteContent); }