public PullMinerV3(final IGitHubClient ghc) { super(); service = new PullRequestService(ghc); }
public PullRequestService getPullRequestService(String username, String password) throws IOException { return new PullRequestService(getGitHubClient(username, password)); }
public PullRequestFilesProducer(GitHubEndpoint endpoint) throws Exception { super(endpoint); Registry registry = endpoint.getCamelContext().getRegistry(); Object service = registry.lookupByName(GitHubConstants.GITHUB_PULL_REQUEST_SERVICE); if (service != null) { LOG.debug("Using PullRequestService found in registry {}", service.getClass().getCanonicalName()); pullRequestService = (PullRequestService) service; } else { pullRequestService = new PullRequestService(); } initService(pullRequestService); }
public PullRequestConsumer(GitHubEndpoint endpoint, Processor processor) throws Exception { super(endpoint, processor); Registry registry = endpoint.getCamelContext().getRegistry(); Object service = registry.lookupByName(GitHubConstants.GITHUB_PULL_REQUEST_SERVICE); if (service != null) { LOG.debug("Using PullRequestService found in registry {}", service.getClass().getCanonicalName()); pullRequestService = (PullRequestService) service; } else { pullRequestService = new PullRequestService(); } initService(pullRequestService); LOG.info("GitHub PullRequestConsumer: Indexing current pull requests..."); List<PullRequest> pullRequests = pullRequestService.getPullRequests(getRepository(), "open"); if (pullRequests.size() > 0) { lastOpenPullRequest = pullRequests.get(0).getNumber(); } }
public ClosePullRequestProducer(GitHubEndpoint endpoint) throws Exception { super(endpoint); Registry registry = endpoint.getCamelContext().getRegistry(); Object service = registry.lookupByName(GitHubConstants.GITHUB_PULL_REQUEST_SERVICE); if (service != null) { pullRequestService = (PullRequestService) service; } else { pullRequestService = new PullRequestService(); } initService(pullRequestService); }
/** * @inheritDoc */ @Override public PullRequest getPullRequestIfExists(String base, String head, String repository) { RepositoryService repositoryService = new RepositoryService(); org.eclipse.egit.github.core.Repository openmrs = null; boolean exists = false; try { openmrs = repositoryService.getRepository(OPENMRS_USER, repository); PullRequestService pullRequestService = new PullRequestService(); List<PullRequest> openPRs = pullRequestService.getPullRequests(openmrs, "open"); for(PullRequest openPR : openPRs){ if(matchPullRequest(base, head, openPR)){ return openPR; } } } catch (IOException e) { throw new RuntimeException("Failed to access remote repository data",e); } return null; }
public PullRequestCommentProducer(GitHubEndpoint endpoint) throws Exception { super(endpoint); Registry registry = endpoint.getCamelContext().getRegistry(); Object service = registry.lookupByName(GitHubConstants.GITHUB_PULL_REQUEST_SERVICE); if (service != null) { LOG.debug("Using PullRequestService found in registry {}", service.getClass().getCanonicalName()); pullRequestService = (PullRequestService) service; } else { pullRequestService = new PullRequestService(); } initService(pullRequestService); service = registry.lookupByName("githbIssueService"); if (service != null) { issueService = (IssueService) service; } else { issueService = new IssueService(); } initService(issueService); }
pullRequestService = (PullRequestService) service; } else { pullRequestService = new PullRequestService();
public GitHubCommentsProvider( ViolationsLogger violationsLogger, final ViolationCommentsToGitHubApi violationCommentsToGitHubApi) { this.violationsLogger = violationsLogger; final GitHubClient gitHubClient = createClient(violationCommentsToGitHubApi.getGitHubUrl()); if (violationCommentsToGitHubApi.getOAuth2Token() != null) { gitHubClient.setOAuth2Token(violationCommentsToGitHubApi.getOAuth2Token()); } else if (violationCommentsToGitHubApi.getUsername() != null && violationCommentsToGitHubApi.getPassword() != null) { gitHubClient.setCredentials( violationCommentsToGitHubApi.getUsername(), violationCommentsToGitHubApi.getPassword()); } repository = new RepositoryId( violationCommentsToGitHubApi.getRepositoryOwner(), violationCommentsToGitHubApi.getRepositoryName()); pullRequestService = new PullRequestService(gitHubClient); issueSerivce = new IssueService(gitHubClient); List<RepositoryCommit> commits = null; try { commits = pullRequestService.getCommits( repository, violationCommentsToGitHubApi.getPullRequestId()); } catch (final IOException e) { throw new RuntimeException(e); } pullRequestCommit = commits.get(commits.size() - 1).getSha(); this.violationCommentsToGitHubApi = violationCommentsToGitHubApi; }
/** * @inheritDoc */ @Override public PullRequest openPullRequest(GithubPrRequest request) { RepositoryService repositoryService = new RepositoryService(); repositoryService.getClient().setCredentials(request.getUsername(), request.getPassword()); org.eclipse.egit.github.core.Repository openmrs = null; try { openmrs = repositoryService.getRepository(OPENMRS_USER, request.getRepository()); } catch (IOException e) { throw new RuntimeException("Failed to get repository data", e); } PullRequestService pullRequestService = new PullRequestService(); pullRequestService.getClient().setCredentials(request.getUsername(), request.getPassword()); PullRequest pr = new org.eclipse.egit.github.core.PullRequest(); pr.setTitle(request.getTitle()); pr.setHead(new PullRequestMarker().setLabel(request.getHead())); pr.setBase(new PullRequestMarker().setLabel(request.getBase())); pr.setBody(request.getDescription()); try { return pullRequestService.createPullRequest(openmrs, pr); } catch (IOException e) { throw new RuntimeException("Failed to create pull request:"+pr, e); } }