本文整理汇总了Java中org.eclipse.egit.github.core.Comment类的典型用法代码示例。如果您正苦于以下问题:Java Comment类的具体用法?Java Comment怎么用?Java Comment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Comment类属于org.eclipse.egit.github.core包,在下文中一共展示了Comment类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: editComment
import org.eclipse.egit.github.core.Comment; //导入依赖的package包/类
@Whitelisted
public IssueCommentGroovyObject editComment(final long commentId, final String body) {
Objects.requireNonNull(body, "body is a required argument");
Comment comment = new Comment();
comment.setId(commentId);
comment.setBody(body);
try {
return new IssueCommentGroovyObject(
issueService.editComment(base, comment),
base,
issueService);
} catch (final IOException e) {
throw new UncheckedIOException(e);
}
}
开发者ID:aaronjwhiteside,项目名称:pipeline-github,代码行数:17,代码来源:PullRequestGroovyObject.java
示例2: save
import org.eclipse.egit.github.core.Comment; //导入依赖的package包/类
@SneakyThrows
public void save(PullRequestStatus commitStatus) {
String repoId = commitStatus.getRepoId();
String accessToken = commitStatus.getAccessToken();
if (accessToken == null) {
return;
}
PullRequestId pullRequestId = PullRequestId.of(RepositoryId.createFromId(repoId), commitStatus.getPullRequestId());
boolean hasSignedCla = commitStatus.isSuccess();
GitHubClient client = createClient(accessToken);
String claUserLogin = getGitHubClaUserLogin();
List<Comment> comments = getComments(pullRequestId, getIssueService());
boolean obviousFix = isObviousFix(pullRequestId, comments, claUserLogin, commitStatus.getPullRequestBody());
ContextCommitStatus status = createCommitStatusIfNecessary(pullRequestId, commitStatus, hasSignedCla, obviousFix, client);
createOrUpdatePullRequestComment(pullRequestId, commitStatus, hasSignedCla, obviousFix, status, comments, claUserLogin);
}
开发者ID:pivotalsoftware,项目名称:pivotal-cla,代码行数:23,代码来源:MylynGitHubApi.java
示例3: isObviousFix
import org.eclipse.egit.github.core.Comment; //导入依赖的package包/类
/**
* Returns whether the pull-request is marked as obvious fix by having an issue/review comment stating it's an obvious fix.
* @param pullRequestId
* @param comments
* @param claUserLogin @return
* @param pullRequestBody
*/
private boolean isObviousFix(PullRequestId pullRequestId, List<Comment> comments, String claUserLogin, String pullRequestBody) {
if (hasObviousFix(pullRequestBody)) {
return true;
}
if (hasObviousFixComment(comments, claUserLogin)) {
return true;
}
if (hasObviousFixComment(getComments(pullRequestId, getPullRequestService()), claUserLogin)) {
return true;
}
return false;
}
开发者ID:pivotalsoftware,项目名称:pivotal-cla,代码行数:24,代码来源:MylynGitHubApi.java
示例4: createObviousFixCommentIfNecessary
import org.eclipse.egit.github.core.Comment; //导入依赖的package包/类
/**
* Add a "disarming" comment.
* @param pullRequestId
* @param userMentionMarkdown
* @param issues
* @param claUserComments
* @throws IOException
*/
private void createObviousFixCommentIfNecessary(PullRequestId pullRequestId, String userMentionMarkdown,
IssueService issues, List<Comment> claUserComments) throws IOException {
// only if not already present and if a comment says "please sign the CLA"
if (claUserComments.stream().anyMatch(c -> c.getBody().contains(PLEASE_SIGN))
&& !claUserComments.stream().anyMatch(c -> c.getBody().contains(OBVIOUS_FIX_CLA_NOT_REQUIRED))) {
if (claUserComments.stream().anyMatch(c -> c.getBody().contains(THANK_YOU))) {
return;
}
String claNotRequiredBody = String.format("%s %s", userMentionMarkdown, OBVIOUS_FIX_CLA_NOT_REQUIRED);
issues.createComment(pullRequestId.getRepositoryId(), pullRequestId.getId(), claNotRequiredBody);
}
}
开发者ID:pivotalsoftware,项目名称:pivotal-cla,代码行数:24,代码来源:MylynGitHubApi.java
示例5: process
import org.eclipse.egit.github.core.Comment; //导入依赖的package包/类
public void process(Exchange exchange) throws Exception {
Integer pullRequestNumber = exchange.getIn().getHeader("GitHubPullRequest", Integer.class);
Integer inResponseTo = exchange.getIn().getHeader("GitHubInResponseTo", Integer.class);
String text = exchange.getIn().getBody(String.class);
Comment response;
if (inResponseTo != null && inResponseTo > 0) {
response = pullRequestService.replyToComment(getRepository(), pullRequestNumber, inResponseTo, text);
} else {
// Otherwise, just comment on the pull request itself.
response = issueService.createComment(getRepository(), pullRequestNumber, text);
}
// support InOut
if (exchange.getPattern().isOutCapable()) {
// copy the header of in message to the out message
exchange.getOut().copyFrom(exchange.getIn());
exchange.getOut().setBody(response);
}
}
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:PullRequestCommentProducer.java
示例6: commentPullRequest
import org.eclipse.egit.github.core.Comment; //导入依赖的package包/类
/**
* Adds comment to provided pull request.
*
* @param owner of repository
* @param pullRequest pull request owner
* @param comment message
* @return created remote comment
*/
public Comment commentPullRequest(String owner, String repositoryName, PullRequest pullRequest, String comment)
{
RepositoryContext bySlug = repositoryBySlug.get(getSlug(owner, repositoryName));
IssueService issueService = new IssueService(getGitHubClient(owner));
try
{
return issueService.createComment(bySlug.repository,
pullRequest.getIssueUrl().substring(pullRequest.getIssueUrl().lastIndexOf('/') + 1), comment);
}
catch (IOException e)
{
throw new RuntimeException(e);
}
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:24,代码来源:GitHubTestSupport.java
示例7: processPullRequestComments
import org.eclipse.egit.github.core.Comment; //导入依赖的package包/类
/**
* Processes comments of a Pull Request.
*/
private void processPullRequestComments(Repository repository, PullRequest remotePullRequest,
RepositoryPullRequestMapping localPullRequest, Map<String, Participant> participantIndex)
{
updateCommentsCount(remotePullRequest, localPullRequest);
IssueService issueService = gitHubClientProvider.getIssueService(repository);
RepositoryId repositoryId = RepositoryId.createFromUrl(repository.getRepositoryUrl());
List<Comment> pullRequestComments;
try
{
pullRequestComments = issueService.getComments(repositoryId, remotePullRequest.getNumber());
}
catch (IOException e)
{
throw new RuntimeException(e);
}
remotePullRequest.setComments(Math.max(remotePullRequest.getComments(), pullRequestComments.size()));
for (Comment comment : pullRequestComments)
{
addParticipant(participantIndex, comment.getUser(), Participant.ROLE_PARTICIPANT);
}
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:28,代码来源:GitHubPullRequestProcessor.java
示例8: testNoParticipants
import org.eclipse.egit.github.core.Comment; //导入依赖的package包/类
@Test
public void testNoParticipants() throws IOException
{
when(issueService.getComments(any(IRepositoryIdProvider.class), anyInt())).thenReturn(Collections.<Comment>emptyList());
when(gitHubPullRequestService.getComments(any(IRepositoryIdProvider.class), anyInt())).thenReturn(Collections.<CommitComment>emptyList());
User user = mock(User.class);
when(user.getLogin()).thenReturn("user");
when(pullRequest.getUser()).thenReturn(user);
testedClass.processPullRequest(repository, pullRequest);
verify(pullRequestService).updatePullRequestParticipants(anyInt(), anyInt(), participantsIndexCaptor.capture());
assertEquals(participantsIndexCaptor.getValue().size(), 1);
Participant participant = participantsIndexCaptor.getValue().get("user");
assertParticipant(participant, "user");
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:17,代码来源:GitHubPullRequestProcessorTest.java
示例9: close
import org.eclipse.egit.github.core.Comment; //导入依赖的package包/类
@Override
public void close(String issueId) {
Validate.notNull(gitHubClient, "GitHub REST client must be specified.");
Comment comment = null;
try {
final Issue issue = getIssue(issueId);
issue.setState(IssueService.STATE_CLOSED);
comment =
this.issueService.createComment(this.gitHubGovernorConfiguration.getRepositoryUser(), this.gitHubGovernorConfiguration.getRepository(), issueId,
getClosingMessage());
this.issueService.editIssue(this.gitHubGovernorConfiguration.getRepositoryUser(), this.gitHubGovernorConfiguration.getRepository(), issue);
} catch (Exception e) {
if (comment != null) {
deleteComment(comment);
}
logger.warning(String.format("An exception has occured while closing the issue %s. Exception: %s", issueId, e.getMessage()));
}
}
开发者ID:arquillian,项目名称:arquillian-governor,代码行数:22,代码来源:GitHubGovernorClient.java
示例10: immutability
import org.eclipse.egit.github.core.Comment; //导入依赖的package包/类
@Test
public void immutability() {
List<TurboIssueEvent> events = stubEvents();
List<Comment> comments = stubComments();
IssueMetadata metadata = IssueMetadata.intermediate(events, comments, "", "");
assertEquals(3, metadata.getEvents().size());
assertEquals(3, metadata.getComments().size());
events.addAll(stubEvents());
comments.addAll(stubComments());
assertEquals(3, metadata.getEvents().size());
assertEquals(3, metadata.getComments().size());
metadata.getEvents().addAll(stubEvents());
metadata.getComments().addAll(stubComments());
assertEquals(3, metadata.getEvents().size());
assertEquals(3, metadata.getComments().size());
}
开发者ID:HubTurbo,项目名称:HubTurbo,代码行数:22,代码来源:IssueMetadataTests.java
示例11: onActivityResult
import org.eclipse.egit.github.core.Comment; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (RESULT_OK == resultCode && COMMENT_CREATE == requestCode
&& data != null) {
Comment comment = (Comment) data
.getSerializableExtra(EXTRA_COMMENT);
if (comments != null) {
comments.add(comment);
gist.setComments(gist.getComments() + 1);
updateList(gist, comments);
} else
refreshGist();
return;
}
super.onActivityResult(requestCode, resultCode, data);
}
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:18,代码来源:GistFragment.java
示例12: run
import org.eclipse.egit.github.core.Comment; //导入依赖的package包/类
@Override
public FullGist run(Account account) throws Exception {
Gist gist = store.refreshGist(id);
List<Comment> comments;
if (gist.getComments() > 0)
comments = service.getComments(id);
else
comments = Collections.emptyList();
for (Comment comment : comments) {
String formatted = HtmlUtils.format(comment.getBodyHtml())
.toString();
comment.setBodyHtml(formatted);
imageGetter.encode(comment, formatted);
}
return new FullGist(gist, service.isStarred(id), comments);
}
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:17,代码来源:RefreshGistTask.java
示例13: run
import org.eclipse.egit.github.core.Comment; //导入依赖的package包/类
@Override
public FullIssue run(Account account) throws Exception {
Issue issue = store.refreshIssue(repositoryId, issueNumber);
bodyImageGetter.encode(issue.getId(), issue.getBodyHtml());
List<Comment> comments;
if (issue.getComments() > 0)
comments = service.getComments(repositoryId, issueNumber);
else
comments = Collections.emptyList();
for (Comment comment : comments) {
String formatted = HtmlUtils.format(comment.getBodyHtml())
.toString();
comment.setBodyHtml(formatted);
commentImageGetter.encode(comment.getId(), formatted);
}
return new FullIssue(issue, comments);
}
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:18,代码来源:RefreshIssueTask.java
示例14: getComments
import org.eclipse.egit.github.core.Comment; //导入依赖的package包/类
/**
* Get an issue's comments
*
* @param repository
* @param issueNumber
* @return list of comments
* @throws IOException
*/
private List<Comment> getComments(String repoId, String issueNumber)
throws IOException {
if (issueNumber == null)
throw new IllegalArgumentException("Issue number cannot be null"); //$NON-NLS-1$
if (issueNumber.length() == 0)
throw new IllegalArgumentException("Issue number cannot be empty"); //$NON-NLS-1$
StringBuilder uri = new StringBuilder(SEGMENT_REPOS);
uri.append('/').append(repoId);
uri.append(SEGMENT_ISSUES);
uri.append('/').append(issueNumber);
uri.append(SEGMENT_COMMENTS);
PagedRequest<Comment> request = createPagedRequest();
request.setUri(uri);
request.setType(new TypeToken<List<Comment>>() {
}.getType());
return getAll(request);
}
开发者ID:tsangiotis,项目名称:JekyllForAndroid,代码行数:27,代码来源:IssueService.java
示例15: createComment
import org.eclipse.egit.github.core.Comment; //导入依赖的package包/类
/**
* Create comment on specified issue number
*
* @param repoId
* @param issueNumber
* @param comment
* @return created issue
* @throws IOException
*/
private Comment createComment(String repoId, String issueNumber,
String comment) throws IOException {
if (issueNumber == null)
throw new IllegalArgumentException("Issue number cannot be null"); //$NON-NLS-1$
if (issueNumber.length() == 0)
throw new IllegalArgumentException("Issue number cannot be empty"); //$NON-NLS-1$
StringBuilder uri = new StringBuilder(SEGMENT_REPOS);
uri.append('/').append(repoId);
uri.append(SEGMENT_ISSUES);
uri.append('/').append(issueNumber);
uri.append(SEGMENT_COMMENTS);
Map<String, String> params = new HashMap<String, String>(1, 1);
params.put(FIELD_BODY, comment);
return client.post(uri.toString(), params, Comment.class);
}
开发者ID:tsangiotis,项目名称:JekyllForAndroid,代码行数:28,代码来源:IssueService.java
示例16: setBody
import org.eclipse.egit.github.core.Comment; //导入依赖的package包/类
private void setBody(final String body) {
Comment edit = new Comment();
edit.setId(comment.getId());
edit.setBody(body);
try {
comment = issueService.editComment(base, edit);
} catch (final IOException e) {
throw new UncheckedIOException(e);
}
}
开发者ID:aaronjwhiteside,项目名称:pipeline-github,代码行数:11,代码来源:IssueCommentGroovyObject.java
示例17: hasObviousFixComment
import org.eclipse.egit.github.core.Comment; //导入依赖的package包/类
private boolean hasObviousFixComment(Collection<? extends Comment> comments, String claUserLogin) {
Optional<? extends Comment> obviousFixComment = comments.stream() //
.filter(comment -> comment.getUser() != null && !claUserLogin.equals(comment.getUser().getLogin())) //
.filter(comment -> hasObviousFix(comment.getBody())) //
.findFirst();
return obviousFixComment.isPresent();
}
开发者ID:pivotalsoftware,项目名称:pivotal-cla,代码行数:10,代码来源:MylynGitHubApi.java
示例18: getPullRequestComment
import org.eclipse.egit.github.core.Comment; //导入依赖的package包/类
/**
* Returns comment with a given id
*
* @param owner of repository
* @param repositoryName repository name
* @param commentId comment id
* @return remote comment
*/
public Comment getPullRequestComment(String owner, String repositoryName, long commentId)
{
RepositoryContext bySlug = repositoryBySlug.get(getSlug(owner, repositoryName));
IssueService issueService = new IssueService(getGitHubClient(owner));
try
{
return issueService.getComment(owner, bySlug.repository.getName(), commentId);
}
catch (IOException e)
{
throw new RuntimeException(e);
}
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:23,代码来源:GitHubTestSupport.java
示例19: run
import org.eclipse.egit.github.core.Comment; //导入依赖的package包/类
@Override
public void run() {
Map<Integer, IssueMetadata> result = new HashMap<>();
issuesToUpdate.forEach(issue -> {
String currEventsETag = issue.getMetadata().getEventsETag();
String currCommentsETag = issue.getMetadata().getCommentsETag();
int id = issue.getId();
ImmutablePair<List<TurboIssueEvent>, String> changes = repo.getUpdatedEvents(repoId, id, currEventsETag);
List<TurboIssueEvent> events = changes.getLeft();
String updatedEventsETag = changes.getRight();
List<Comment> comments = repo.getAllComments(repoId, issue);
IssueMetadata metadata = IssueMetadata.intermediate(events, comments, updatedEventsETag, currCommentsETag);
result.put(id, metadata);
});
logger.info(HTLog.format(repoId, "Downloaded " + result.entrySet().stream()
.map(entry -> "(" + entry.getValue().summarise() + ") " +
"for #" + entry.getKey())
.collect(Collectors.joining(", "))));
response.complete(result);
}
开发者ID:HubTurbo,项目名称:HubTurbo,代码行数:28,代码来源:DownloadMetadataTask.java
示例20: IssueMetadata
import org.eclipse.egit.github.core.Comment; //导入依赖的package包/类
/**
* Intermediate metadata constructor (no user provided, empty computed properties)
*/
private IssueMetadata(List<TurboIssueEvent> events, List<Comment> comments,
boolean isLatest, String eventsETag, String commentsETag) {
this.events = new ArrayList<>(events);
this.comments = new ArrayList<>(comments);
this.isLatest = isLatest;
this.eventsETag = eventsETag;
this.commentsETag = commentsETag;
this.user = "";
this.nonSelfUpdatedAt = LocalDateTime.ofEpochSecond(0, 0, ZoneOffset.ofHours(0));
this.nonSelfCommentCount = 0;
}
开发者ID:HubTurbo,项目名称:HubTurbo,代码行数:16,代码来源:IssueMetadata.java
注:本文中的org.eclipse.egit.github.core.Comment类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论