Search in sources :

Example 6 with RobotComment

use of com.google.gerrit.reviewdb.client.RobotComment in project gerrit by GerritCodeReview.

the class CommentSender method appendComment.

/** No longer used except for Velocity. Remove this method when VTL support is removed. */
@Deprecated
private void appendComment(StringBuilder out, int contextLines, PatchFile currentFileData, Comment comment) {
    if (comment instanceof RobotComment) {
        RobotComment robotComment = (RobotComment) comment;
        out.append("Robot Comment from ").append(robotComment.robotId).append(" (run ID ").append(robotComment.robotRunId).append("):\n");
    }
    if (comment.range != null) {
        appendRangedComment(out, currentFileData, comment);
    } else {
        appendLineComment(out, contextLines, currentFileData, comment);
    }
}
Also used : RobotComment(com.google.gerrit.reviewdb.client.RobotComment)

Example 7 with RobotComment

use of com.google.gerrit.reviewdb.client.RobotComment in project gerrit by GerritCodeReview.

the class RobotCommentNotes method onLoad.

@Override
protected void onLoad(LoadHandle handle) throws IOException, ConfigInvalidException {
    metaId = handle.id();
    if (metaId == null) {
        loadDefaults();
        return;
    }
    metaId = metaId.copy();
    RevCommit tipCommit = handle.walk().parseCommit(metaId);
    ObjectReader reader = handle.walk().getObjectReader();
    revisionNoteMap = RevisionNoteMap.parseRobotComments(args.noteUtil, reader, NoteMap.read(reader, tipCommit));
    ListMultimap<RevId, RobotComment> cs = MultimapBuilder.hashKeys().arrayListValues().build();
    for (RobotCommentsRevisionNote rn : revisionNoteMap.revisionNotes.values()) {
        for (RobotComment c : rn.getComments()) {
            cs.put(new RevId(c.revId), c);
        }
    }
    comments = ImmutableListMultimap.copyOf(cs);
}
Also used : RobotComment(com.google.gerrit.reviewdb.client.RobotComment) ObjectReader(org.eclipse.jgit.lib.ObjectReader) RevId(com.google.gerrit.reviewdb.client.RevId) RevCommit(org.eclipse.jgit.revwalk.RevCommit)

Example 8 with RobotComment

use of com.google.gerrit.reviewdb.client.RobotComment in project gerrit by GerritCodeReview.

the class CommentsUtil method newRobotComment.

public RobotComment newRobotComment(ChangeContext ctx, String path, PatchSet.Id psId, short side, String message, String robotId, String robotRunId) {
    RobotComment c = new RobotComment(new Comment.Key(ChangeUtil.messageUuid(), path, psId.get()), ctx.getUser().getAccountId(), ctx.getWhen(), side, message, serverId, robotId, robotRunId);
    ctx.getUser().updateRealAccountId(c::setRealAuthor);
    return c;
}
Also used : PatchLineComment(com.google.gerrit.reviewdb.client.PatchLineComment) Comment(com.google.gerrit.reviewdb.client.Comment) RobotComment(com.google.gerrit.reviewdb.client.RobotComment) RobotComment(com.google.gerrit.reviewdb.client.RobotComment)

Aggregations

RobotComment (com.google.gerrit.reviewdb.client.RobotComment)8 IdString (com.google.gerrit.extensions.restapi.IdString)2 ResourceNotFoundException (com.google.gerrit.extensions.restapi.ResourceNotFoundException)2 Comment (com.google.gerrit.reviewdb.client.Comment)2 RevId (com.google.gerrit.reviewdb.client.RevId)2 ChangeNotes (com.google.gerrit.server.notedb.ChangeNotes)2 Map (java.util.Map)2 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)1 GerritConfig (com.google.gerrit.acceptance.GerritConfig)1 PushOneCommit (com.google.gerrit.acceptance.PushOneCommit)1 ReviewInput (com.google.gerrit.extensions.api.changes.ReviewInput)1 RobotCommentInput (com.google.gerrit.extensions.api.changes.ReviewInput.RobotCommentInput)1 FixSuggestion (com.google.gerrit.reviewdb.client.FixSuggestion)1 PatchLineComment (com.google.gerrit.reviewdb.client.PatchLineComment)1 ChangeData (com.google.gerrit.server.query.change.ChangeData)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 ObjectId (org.eclipse.jgit.lib.ObjectId)1 ObjectReader (org.eclipse.jgit.lib.ObjectReader)1 NoteMap (org.eclipse.jgit.notes.NoteMap)1