public class CommentsInNotesUtil
extends java.lang.Object
Constructor and Description |
---|
CommentsInNotesUtil(AccountCache accountCache,
org.eclipse.jgit.lib.PersonIdent serverIdent,
java.lang.String anonymousCowardName) |
Modifier and Type | Method and Description |
---|---|
byte[] |
buildNote(java.util.List<com.google.gerrit.reviewdb.client.PatchLineComment> comments)
Build a note that contains the metadata for and the contents of all of the
comments in the given list of comments.
|
static java.lang.String |
formatTime(org.eclipse.jgit.lib.PersonIdent ident,
java.sql.Timestamp t) |
static org.eclipse.jgit.notes.NoteMap |
parseCommentsFromNotes(org.eclipse.jgit.lib.Repository repo,
java.lang.String refName,
org.eclipse.jgit.revwalk.RevWalk walk,
com.google.gerrit.reviewdb.client.Change.Id changeId,
com.google.common.collect.Multimap<com.google.gerrit.reviewdb.client.RevId,com.google.gerrit.reviewdb.client.PatchLineComment> comments,
com.google.gerrit.reviewdb.client.PatchLineComment.Status status) |
static java.util.List<com.google.gerrit.reviewdb.client.PatchLineComment> |
parseNote(byte[] note,
com.google.gerrit.reviewdb.client.Change.Id changeId,
com.google.gerrit.reviewdb.client.PatchLineComment.Status status) |
void |
writeCommentsToNoteMap(org.eclipse.jgit.notes.NoteMap noteMap,
java.util.Map<com.google.gerrit.reviewdb.client.RevId,java.util.List<com.google.gerrit.reviewdb.client.PatchLineComment>> allComments,
org.eclipse.jgit.lib.ObjectInserter inserter)
Write comments for multiple revisions to a note map.
|
@Inject public CommentsInNotesUtil(AccountCache accountCache, org.eclipse.jgit.lib.PersonIdent serverIdent, java.lang.String anonymousCowardName)
public static org.eclipse.jgit.notes.NoteMap parseCommentsFromNotes(org.eclipse.jgit.lib.Repository repo, java.lang.String refName, org.eclipse.jgit.revwalk.RevWalk walk, com.google.gerrit.reviewdb.client.Change.Id changeId, com.google.common.collect.Multimap<com.google.gerrit.reviewdb.client.RevId,com.google.gerrit.reviewdb.client.PatchLineComment> comments, com.google.gerrit.reviewdb.client.PatchLineComment.Status status) throws java.io.IOException, org.eclipse.jgit.errors.ConfigInvalidException
java.io.IOException
org.eclipse.jgit.errors.ConfigInvalidException
public static java.util.List<com.google.gerrit.reviewdb.client.PatchLineComment> parseNote(byte[] note, com.google.gerrit.reviewdb.client.Change.Id changeId, com.google.gerrit.reviewdb.client.PatchLineComment.Status status) throws org.eclipse.jgit.errors.ConfigInvalidException
org.eclipse.jgit.errors.ConfigInvalidException
public static java.lang.String formatTime(org.eclipse.jgit.lib.PersonIdent ident, java.sql.Timestamp t)
public byte[] buildNote(java.util.List<com.google.gerrit.reviewdb.client.PatchLineComment> comments)
comments
- A list of the comments to be written to the returned note
byte array.
All of the comments in this list must have the same side and
must share the same PatchSet.Id.
This list must not be empty because we cannot build a note
for no comments.public void writeCommentsToNoteMap(org.eclipse.jgit.notes.NoteMap noteMap, java.util.Map<com.google.gerrit.reviewdb.client.RevId,java.util.List<com.google.gerrit.reviewdb.client.PatchLineComment>> allComments, org.eclipse.jgit.lib.ObjectInserter inserter) throws java.io.IOException
Mutates the map in-place. only notes for SHA-1s found as keys in the map are modified; all other notes are left untouched.
noteMap
- note map to modify.allComments
- map of revision to all comments for that revision;
callers are responsible for reading the original comments and applying
any changes. Differs from a multimap in that present-but-empty values
are significant, and indicate the note for that SHA-1 should be
deleted.inserter
- object inserter for writing notes.java.io.IOException
- if an error occurred.