本文整理汇总了Java中org.kohsuke.github.GHPullRequestReviewComment类的典型用法代码示例。如果您正苦于以下问题:Java GHPullRequestReviewComment类的具体用法?Java GHPullRequestReviewComment怎么用?Java GHPullRequestReviewComment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GHPullRequestReviewComment类属于org.kohsuke.github包,在下文中一共展示了GHPullRequestReviewComment类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createOrUpdateReviewComment
import org.kohsuke.github.GHPullRequestReviewComment; //导入依赖的package包/类
public void createOrUpdateReviewComment(InputFile inputFile, Integer line, String body) {
String fullpath = getPath(inputFile);
Integer lineInPatch = patchPositionMappingByFile.get(fullpath).get(line);
try {
if (existingReviewCommentsByLocationByFile.containsKey(fullpath) && existingReviewCommentsByLocationByFile.get(fullpath).containsKey(lineInPatch)) {
GHPullRequestReviewComment existingReview = existingReviewCommentsByLocationByFile.get(fullpath).get(lineInPatch);
if (!existingReview.getBody().equals(body)) {
existingReview.update(body);
}
reviewCommentToBeDeletedById.remove(existingReview.getId());
} else {
pr.createReviewComment(body, pr.getHead().getSha(), fullpath, lineInPatch);
}
} catch (IOException e) {
throw new IllegalStateException("Unable to create or update review comment in file " + fullpath + " at line " + line, e);
}
}
示例2: loadExistingReviewComments
import org.kohsuke.github.GHPullRequestReviewComment; //导入依赖的package包/类
/**
* Load all previous comments made by provided github account.
*/
private void loadExistingReviewComments() throws IOException {
for (GHPullRequestReviewComment comment : pr.listReviewComments()) {
if (!myself.equals(comment.getUser().getLogin())) {
// Ignore comments from other users
continue;
}
if (!existingReviewCommentsByLocationByFile.containsKey(comment.getPath())) {
existingReviewCommentsByLocationByFile.put(comment.getPath(), new HashMap<Integer, GHPullRequestReviewComment>());
}
// By default all previous comments will be marked for deletion
reviewCommentToBeDeletedById.put(comment.getId(), comment);
existingReviewCommentsByLocationByFile.get(comment.getPath()).put(comment.getPosition(), comment);
}
}
示例3: deleteOutdatedComments
import org.kohsuke.github.GHPullRequestReviewComment; //导入依赖的package包/类
public void deleteOutdatedComments() {
for (GHPullRequestReviewComment reviewToDelete : reviewCommentToBeDeletedById.values()) {
try {
reviewToDelete.delete();
} catch (IOException e) {
throw new IllegalStateException("Unable to delete review comment with id " + reviewToDelete.getId(), e);
}
}
}
示例4: makeComment
import org.kohsuke.github.GHPullRequestReviewComment; //导入依赖的package包/类
private void makeComment(final PagedIterable<GHPullRequestReviewComment> allReviewComments, final PrintStream logger, final GHPullRequest pullRequest, final LineComment comment) throws IOException {
final GHPullRequestReviewComment existingComment = Iterables.find(allReviewComments, new Predicate<GHPullRequestReviewComment>() {
@Override
public boolean apply(final GHPullRequestReviewComment reviewComment) {
return comment.isSameAs(reviewComment);
}
}, null);
if (existingComment == null) {
logger.println("Commenting on " + comment.line.getLineNo() + " at Pos: " + comment.line.getPos());
pullRequest.createReviewComment(comment.comment, pullRequest.getHead().getSha(), comment.fileName, comment.line.getPos());
}
}
示例5: isSameAs
import org.kohsuke.github.GHPullRequestReviewComment; //导入依赖的package包/类
public boolean isSameAs(final GHPullRequestReviewComment reviewComment) {
return reviewComment.getPosition() == this.line.getPos()
&& this.comment.equals(reviewComment.getBody())
&& this.fileName.equals(reviewComment.getPath());
}