Package com.google.gerrit.server.git
Class NotesBranchUtil
java.lang.Object
com.google.gerrit.server.git.NotesBranchUtil
A utility class for updating a notes branch with automatic merge of note trees.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionNotesBranchUtil
(org.eclipse.jgit.lib.PersonIdent gerritIdent, GitReferenceUpdated gitRefUpdated, Project.NameKey project, org.eclipse.jgit.lib.Repository db, org.eclipse.jgit.lib.ObjectInserter inserter) -
Method Summary
Modifier and TypeMethodDescriptionfinal void
commitAllNotes
(org.eclipse.jgit.notes.NoteMap notes, String notesBranch, org.eclipse.jgit.lib.PersonIdent commitAuthor, String commitMessage) Create a new commit in thenotesBranch
by updating existing or creating new notes from thenotes
map.final org.eclipse.jgit.notes.NoteMap
commitNewNotes
(org.eclipse.jgit.notes.NoteMap notes, String notesBranch, org.eclipse.jgit.lib.PersonIdent commitAuthor, String commitMessage) Create a new commit in thenotesBranch
by creating not yet existing notes from thenotes
map.
-
Constructor Details
-
NotesBranchUtil
@Inject public NotesBranchUtil(org.eclipse.jgit.lib.PersonIdent gerritIdent, GitReferenceUpdated gitRefUpdated, Project.NameKey project, org.eclipse.jgit.lib.Repository db, org.eclipse.jgit.lib.ObjectInserter inserter)
-
-
Method Details
-
commitAllNotes
public final void commitAllNotes(org.eclipse.jgit.notes.NoteMap notes, String notesBranch, org.eclipse.jgit.lib.PersonIdent commitAuthor, String commitMessage) throws IOException Create a new commit in thenotesBranch
by updating existing or creating new notes from thenotes
map.Does not retry in the case of lock failure; callers may use
RetryHelper
.- Parameters:
notes
- map of notesnotesBranch
- notes branch to updatecommitAuthor
- author of the commit in the notes branchcommitMessage
- for the commit in the notes branch- Throws:
com.google.gerrit.git.LockFailureException
- if committing the notes failed due to a lock failure on the notes branchIOException
- if committing the notes failed for any other reason
-
commitNewNotes
public final org.eclipse.jgit.notes.NoteMap commitNewNotes(org.eclipse.jgit.notes.NoteMap notes, String notesBranch, org.eclipse.jgit.lib.PersonIdent commitAuthor, String commitMessage) throws IOException Create a new commit in thenotesBranch
by creating not yet existing notes from thenotes
map. The notes from thenotes
map which already exist in the note-tree of the tip of thenotesBranch
will not be updated.Does not retry in the case of lock failure; callers may use
RetryHelper
.- Parameters:
notes
- map of notesnotesBranch
- notes branch to updatecommitAuthor
- author of the commit in the notes branchcommitMessage
- for the commit in the notes branch- Returns:
- map with those notes from the
notes
that were newly created - Throws:
com.google.gerrit.git.LockFailureException
- if committing the notes failed due to a lock failure on the notes branchIOException
- if committing the notes failed for any other reason
-