本文整理汇总了Java中org.eclipse.egit.github.core.PullRequest类的典型用法代码示例。如果您正苦于以下问题:Java PullRequest类的具体用法?Java PullRequest怎么用?Java PullRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PullRequest类属于org.eclipse.egit.github.core包,在下文中一共展示了PullRequest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getPullRequestUser
import org.eclipse.egit.github.core.PullRequest; //导入依赖的package包/类
private User getPullRequestUser(RepositoryAware payload) {
if (payload instanceof RepositoryIssueCommentPayload) {
Issue issue = ((RepositoryIssueCommentPayload) payload).getIssue();
if (issue != null && issue.getPullRequest() != null) {
return issue.getUser();
}
}
PullRequest pullRequest = getPullRequest(payload);
if (pullRequest != null && pullRequest.getUser() != null) {
return pullRequest.getUser();
}
throw new IllegalStateException("Cannot determine User from payload");
}
开发者ID:pivotalsoftware,项目名称:pivotal-cla,代码行数:17,代码来源:GitHubHooksController.java
示例2: getShaForPullRequest
import org.eclipse.egit.github.core.PullRequest; //导入依赖的package包/类
@SneakyThrows
public String getShaForPullRequest(PullRequestStatus commitStatus) {
String repositoryId = commitStatus.getRepoId();
int pullRequestId = commitStatus.getPullRequestId();
String currentUserGitHubLogin = commitStatus.getGitHubUsername();
String accessToken = commitStatus.getAccessToken();
if (accessToken == null) {
return null;
}
GitHubClient client = createClient(accessToken);
RepositoryId id = RepositoryId.createFromId(repositoryId);
PullRequestService service = new PullRequestService(client);
PullRequest pullRequest = service.getPullRequest(id, pullRequestId);
String githubLoginForContributor = pullRequest.getUser().getLogin();
if(commitStatus.isAdmin()) {
commitStatus.setGitHubUsername(githubLoginForContributor);
}else if (!githubLoginForContributor.equals(currentUserGitHubLogin)) {
return null;
}
return pullRequest.getHead().getSha();
}
开发者ID:pivotalsoftware,项目名称:pivotal-cla,代码行数:25,代码来源:MylynGitHubApi.java
示例3: findPullRequest
import org.eclipse.egit.github.core.PullRequest; //导入依赖的package包/类
@Override
@SneakyThrows
public Optional<PullRequest> findPullRequest(String repoId, int pullRequestId, String accessToken) {
GitHubClient client = createClient(accessToken);
PullRequestService service = new PullRequestService(client);
try {
return Optional.ofNullable(service.getPullRequest(RepositoryId.createFromId(repoId), pullRequestId));
}
catch (RequestException e) {
if(e.getStatus() == HttpStatus.NOT_FOUND.value()){
return Optional.empty();
}
throw e;
}
}
开发者ID:pivotalsoftware,项目名称:pivotal-cla,代码行数:20,代码来源:MylynGitHubApi.java
示例4: testPullRequestFilesProducer
import org.eclipse.egit.github.core.PullRequest; //导入依赖的package包/类
@Test
public void testPullRequestFilesProducer() throws Exception {
PullRequest pullRequest = pullRequestService.addPullRequest("testPullRequestFilesProducer");
latestPullRequestNumber = pullRequest.getNumber();
CommitFile file = new CommitFile();
file.setFilename("testfile");
List<CommitFile> commitFiles = new ArrayList<CommitFile>();
commitFiles.add(file);
pullRequestService.setFiles(latestPullRequestNumber, commitFiles);
Endpoint filesProducerEndpoint = getMandatoryEndpoint("direct:validPullRequest");
Exchange exchange = filesProducerEndpoint.createExchange();
Exchange resp = template.send(filesProducerEndpoint, exchange);
assertEquals(resp.getOut().getBody(), commitFiles);
}
开发者ID:HydAu,项目名称:Camel,代码行数:20,代码来源:PullRequestFilesProducerTest.java
示例5: testPullRequestCommentProducer
import org.eclipse.egit.github.core.PullRequest; //导入依赖的package包/类
@Test
public void testPullRequestCommentProducer() throws Exception {
PullRequest pullRequest = pullRequestService.addPullRequest("testPullRequestCommentProducer");
latestPullRequestId = pullRequest.getId();
Endpoint commentProducerEndpoint = getMandatoryEndpoint("direct:validPullRequest");
Exchange exchange = commentProducerEndpoint.createExchange();
String commentText = "Pushed this comment at " + new Date();
exchange.getIn().setBody(commentText);
template.send(commentProducerEndpoint, exchange);
Thread.sleep(1 * 1000);
// Verify that the mock pull request service received this comment.
List<CommitComment> commitComments = pullRequestService.getComments(null, (int) pullRequest.getId());
assertEquals(1, commitComments.size());
CommitComment commitComment = commitComments.get(0);
assertEquals("Commit IDs did not match ", Long.toString(pullRequest.getId()), commitComment.getCommitId());
assertEquals("Comment text did not match ", commentText, commitComment.getBodyText());
}
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:PullRequestCommentProducerTest.java
示例6: savePullRequest
import org.eclipse.egit.github.core.PullRequest; //导入依赖的package包/类
@Override
public void savePullRequest(PullRequest pullRequest)
{
if (pullRequest == null || processedPullRequests.contains(pullRequest.getId()))
{
return;
}
processedPullRequests.add(pullRequest.getId());
Progress progress = synchronizer.getProgress(repository.getId());
GitHubPullRequestSynchronizeMessage message = new GitHubPullRequestSynchronizeMessage(progress, progress.getAuditLogId(),
isSoftSync, repository, pullRequest.getNumber(), webHookSync);
messagingService.publish(
messagingService.get(GitHubPullRequestSynchronizeMessage.class, GitHubPullRequestSynchronizeMessageConsumer.ADDRESS),
message, synchronizationTags);
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:19,代码来源:GitHubEventContextImpl.java
示例7: commentPullRequest
import org.eclipse.egit.github.core.PullRequest; //导入依赖的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
示例8: createPullsRequest
import org.eclipse.egit.github.core.PullRequest; //导入依赖的package包/类
protected PagedRequest<PullRequest> createPullsRequest(final IRepositoryIdProvider provider, final String state, final String sort, final String direction, final int start, final int size)
{
PagedRequest<PullRequest> request = createPullsRequest(provider, state, start, size);
if (sort != null && direction != null)
{
Map<String, String> params = new HashMap<String, String>(request.getParams());
if (sort != null)
{
params.put(SORT, sort);
}
if (direction != null)
{
params.put(DIRECTION, direction);
}
request.setParams(params);
}
return request;
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:22,代码来源:CustomPullRequestService.java
示例9: processPullRequestComments
import org.eclipse.egit.github.core.PullRequest; //导入依赖的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
示例10: processPullRequestReviewComments
import org.eclipse.egit.github.core.PullRequest; //导入依赖的package包/类
/**
* Processes review comments of a Pull Request.
*/
private void processPullRequestReviewComments(Repository repository, PullRequest remotePullRequest,
RepositoryPullRequestMapping localPullRequest, Map<String, Participant> participantIndex)
{
updateCommentsCount(remotePullRequest, localPullRequest);
PullRequestService pullRequestService = gitHubClientProvider.getPullRequestService(repository);
RepositoryId repositoryId = RepositoryId.createFromUrl(repository.getRepositoryUrl());
List<CommitComment> pullRequestReviewComments;
try
{
pullRequestReviewComments = pullRequestService.getComments(repositoryId, remotePullRequest.getNumber());
}
catch (IOException e)
{
throw new RuntimeException(e);
}
remotePullRequest.setReviewComments(Math.max(remotePullRequest.getReviewComments(), pullRequestReviewComments.size()));
for (CommitComment comment : pullRequestReviewComments)
{
addParticipant(participantIndex, comment.getUser(), Participant.ROLE_PARTICIPANT);
}
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:28,代码来源:GitHubPullRequestProcessor.java
示例11: nullProcessedPRsAreHandledGracefully
import org.eclipse.egit.github.core.PullRequest; //导入依赖的package包/类
@Test
public void nullProcessedPRsAreHandledGracefully() throws IOException
{
final Long[] prIds = new Long[] {1L, 2L, 3L};
final PageIterator<PullRequest> prIterator = mockPageIterator(ImmutableList.copyOf(prIds));
when(gitHubPullRequestService.pagePullRequests(any(IRepositoryIdProvider.class), eq(STATE_ALL), eq(SORT_UPDATED), eq(DIRECTION_DESC), eq(DEFAULT_PAGE), eq(DEFAULT_PAGELEN)))
.thenReturn(prIterator);
when(gitHubPullRequestProcessor.processPullRequestIfNeeded(eq(repository), any(PullRequest.class))).thenReturn(true);
testedClass.onReceive(message, mockPayload(true, DEFAULT_PAGE, DEFAULT_PAGELEN, null));
verify(gitHubPullRequestProcessor, times(3)).processPullRequestIfNeeded(eq(repository), any(PullRequest.class));
// next msg is fired
verify(messagingService).publish(any(MessageAddress.class), matchMessageWithProcessedPrIds(prIds), any(String[].class));
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:17,代码来源:GitHubPullRequestPageMessageConsumerTest.java
示例12: createUpdatedRequest
import org.eclipse.egit.github.core.PullRequest; //导入依赖的package包/类
/**
* Overrides parent's method to change the number of items per page. This allow the update process
* to stop earlier once it encounters the first item whose updatedAt time is before lastIssueCheckTime
*
* @param repoId the repository to make the request for
* @return a list of pull requests
*/
@Override
protected PagedRequest<PullRequest> createUpdatedRequest(IRepositoryIdProvider repoId) {
PagedRequest<PullRequest> request = new PagedRequest<>(1, 30);
String path = SEGMENT_REPOS + "/" + repoId.generateId() + apiSuffix;
request.setUri(path);
request.setResponseContentType(CONTENT_TYPE_JSON);
request.setParams(createUpdatedPullRequestsParams());
request.setType(new TypeToken<PullRequest>() {
}.getType());
request.setArrayType(new TypeToken<ArrayList<PullRequest>>() {
}.getType());
return request;
}
开发者ID:HubTurbo,项目名称:HubTurbo,代码行数:23,代码来源:PullRequestUpdateService.java
示例13: getUpdatedItems
import org.eclipse.egit.github.core.PullRequest; //导入依赖的package包/类
/**
* Overrides the parent's method to remove ETags checking step and use the specialized
* method get
*
* @param repoId the repository to get the items from
* @return
*/
@Override
public ArrayList<PullRequest> getUpdatedItems(IRepositoryIdProvider repoId) {
if (updatedItems != null) {
return updatedItems;
}
ArrayList<PullRequest> result = new ArrayList<>();
String resourceDesc = repoId.generateId() + apiSuffix;
logger.info(String.format("Updating %s", resourceDesc));
try {
PagedRequest<PullRequest> request = createUpdatedRequest(repoId);
result = new ArrayList<>(getPagedItems(resourceDesc, new PageIterator<>(request, client)));
} catch (IOException e) {
logger.error(e.getLocalizedMessage(), e);
return result;
}
updatedItems = result;
return result;
}
开发者ID:HubTurbo,项目名称:HubTurbo,代码行数:29,代码来源:PullRequestUpdateService.java
示例14: getPagedItems
import org.eclipse.egit.github.core.PullRequest; //导入依赖的package包/类
/**
* Overrides parent's method to stop getting items if some items in a page has
* updatedAt time before the lastIssueCheckTime
*
* @param resourceDesc
* @param iterator the paged request to iterate through
* @return
* @throws IOException
*/
@Override
protected List<PullRequest> getPagedItems(String resourceDesc, PageIterator<PullRequest> iterator)
throws IOException {
List<PullRequest> elements = new ArrayList<>();
int page = 0;
try {
while (iterator.hasNext()) {
Collection<PullRequest> newPullRequests = iterator.next();
int numAddedItems = addItemsUpdatedSince(elements, newPullRequests, lastIssueCheckTime);
logger.info(resourceDesc + " | page " + (page++) + ": " + numAddedItems + " items");
if (numAddedItems < newPullRequests.size()) {
break;
}
}
} catch (NoSuchPageException pageException) {
throw pageException.getCause();
}
return elements;
}
开发者ID:HubTurbo,项目名称:HubTurbo,代码行数:33,代码来源:PullRequestUpdateService.java
示例15: combineWithPullRequests
import org.eclipse.egit.github.core.PullRequest; //导入依赖的package包/类
/**
* Updates data for issues with corresponding pull requests. Original list of
* issues and original issue instances are not mutated
*
* @param issues
* @param pullRequests
* @return a new list of issues
*/
public static List<TurboIssue> combineWithPullRequests(List<TurboIssue> issues,
List<PullRequest> pullRequests) {
List<TurboIssue> issuesCopy = new ArrayList<>(issues);
for (PullRequest pullRequest : pullRequests) {
int id = pullRequest.getNumber();
Optional<Integer> corresponding = findIssueWithId(issuesCopy, id);
if (corresponding.isPresent()) {
TurboIssue issue = issuesCopy.get(corresponding.get());
issuesCopy.set(corresponding.get(), issue.combineWithPullRequest(pullRequest));
} else {
String errorMsg = "No corresponding issue for pull request " + pullRequest;
logger.error(errorMsg);
}
}
return issuesCopy;
}
开发者ID:HubTurbo,项目名称:HubTurbo,代码行数:28,代码来源:TurboIssue.java
示例16: combineWithPullRequest
import org.eclipse.egit.github.core.PullRequest; //导入依赖的package包/类
/**
* Combines data from a corresponding pull request with data in this issue
* This method returns a new combined issue and does not mutate this issue
*
* @param pullRequest
* @return new new combined issue
*/
public TurboIssue combineWithPullRequest(PullRequest pullRequest) {
TurboIssue newIssue = new TurboIssue(this);
if (pullRequest.getUpdatedAt() == null) {
return newIssue;
}
LocalDateTime pullRequestUpdatedAt = Utility.dateToLocalDateTime(pullRequest.getUpdatedAt());
if (pullRequestUpdatedAt.isBefore(newIssue.getUpdatedAt())) {
return newIssue;
}
newIssue.setUpdatedAt(pullRequestUpdatedAt);
return newIssue;
}
开发者ID:HubTurbo,项目名称:HubTurbo,代码行数:23,代码来源:TurboIssue.java
示例17: toIssue
import org.eclipse.egit.github.core.PullRequest; //导入依赖的package包/类
/**
* Convert {@link PullRequest} model {@link Issue} model
*
* @param pullRequest
* @return issue
*/
public static Issue toIssue(final PullRequest pullRequest) {
if (pullRequest == null)
return null;
Issue issue = new Issue();
issue.setAssignee(pullRequest.getAssignee());
issue.setBody(pullRequest.getBody());
issue.setBodyHtml(pullRequest.getBodyHtml());
issue.setBodyText(pullRequest.getBodyText());
issue.setClosedAt(pullRequest.getClosedAt());
issue.setComments(pullRequest.getComments());
issue.setCreatedAt(pullRequest.getCreatedAt());
issue.setHtmlUrl(pullRequest.getHtmlUrl());
issue.setId(pullRequest.getId());
issue.setMilestone(pullRequest.getMilestone());
issue.setNumber(pullRequest.getNumber());
issue.setPullRequest(pullRequest);
issue.setState(pullRequest.getState());
issue.setTitle(pullRequest.getTitle());
issue.setUpdatedAt(pullRequest.getUpdatedAt());
issue.setUrl(pullRequest.getUrl());
issue.setUser(pullRequest.getUser());
return issue;
}
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:31,代码来源:IssueUtils.java
示例18: createPullsRequest
import org.eclipse.egit.github.core.PullRequest; //导入依赖的package包/类
/**
* Create paged request for fetching pull requests
*
* @param provider
* @param state
* @param start
* @param size
* @return paged request
*/
protected PagedRequest<PullRequest> createPullsRequest(
IRepositoryIdProvider provider, String state, int start, int size) {
final String id = getId(provider);
StringBuilder uri = new StringBuilder(SEGMENT_REPOS);
uri.append('/').append(id);
uri.append(SEGMENT_PULLS);
PagedRequest<PullRequest> request = createPagedRequest(start, size);
request.setUri(uri);
if (state != null)
request.setParams(Collections.singletonMap(
IssueService.FILTER_STATE, state));
request.setType(new TypeToken<List<PullRequest>>() {
}.getType());
return request;
}
开发者ID:tsangiotis,项目名称:JekyllForAndroid,代码行数:26,代码来源:PullRequestService.java
示例19: createPrMap
import org.eclipse.egit.github.core.PullRequest; //导入依赖的package包/类
private Map<String, String> createPrMap(PullRequest request) {
Map<String, String> params = new HashMap<String, String>();
if (request != null) {
String title = request.getTitle();
if (title != null)
params.put(PR_TITLE, title);
String body = request.getBody();
if (body != null)
params.put(PR_BODY, body);
PullRequestMarker baseMarker = request.getBase();
if (baseMarker != null) {
String base = baseMarker.getLabel();
if (base != null)
params.put(PR_BASE, base);
}
PullRequestMarker headMarker = request.getHead();
if (headMarker != null) {
String head = headMarker.getLabel();
if (head != null)
params.put(PR_HEAD, head);
}
}
return params;
}
开发者ID:tsangiotis,项目名称:JekyllForAndroid,代码行数:25,代码来源:PullRequestService.java
示例20: getPullRequestSha
import org.eclipse.egit.github.core.PullRequest; //导入依赖的package包/类
private String getPullRequestSha(RepositoryId repoId, PullRequest pullRequest) {
if (pullRequest.getHead() != null) {
return pullRequest.getHead().getSha();
}
return gitHubApi
.getShaForPullRequest(PullRequestId.of(repoId, pullRequest.getNumber()));
}
开发者ID:pivotalsoftware,项目名称:pivotal-cla,代码行数:10,代码来源:GitHubHooksController.java
注:本文中的org.eclipse.egit.github.core.PullRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论