本文整理了Java中org.kohsuke.github.GitHub.getRepository()
方法的一些代码示例,展示了GitHub.getRepository()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GitHub.getRepository()
方法的具体详情如下:
包路径:org.kohsuke.github.GitHub
类名称:GitHub
方法名:getRepository
[英]Gets the repository object from 'user/reponame' string that GitHub calls as "repository name"
[中]从GitHub称为“存储库名称”的“user/reponame”字符串中获取存储库对象
代码示例来源:origin: org.sonarsource.sonar-plugins.github/github-api
/**
* Repository where the change was made.
*/
public GHRepository getRepository() throws IOException {
return root.getRepository(repo.name);
}
代码示例来源:origin: kohsuke/github-api
/**
* Repository where the change was made.
*/
@SuppressFBWarnings(value = {"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" },
justification = "The field comes from JSON deserialization")
public GHRepository getRepository() throws IOException {
return root.getRepository(repo.name);
}
代码示例来源:origin: org.kohsuke/github-api
/**
* Repository where the change was made.
*/
@SuppressFBWarnings(value = {"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" },
justification = "The field comes from JSON deserialization")
public GHRepository getRepository() throws IOException {
return root.getRepository(repo.name);
}
代码示例来源:origin: kohsuke/github-api
@Override
/*package*/ GHCommit[] getItems(GitHub root) {
for (GHCommit commit : items) {
String repoName = getRepoName(commit.url);
try {
GHRepository repo = root.getRepository(repoName);
commit.wrapUp(repo);
} catch (IOException ioe) {}
}
return items;
}
}
代码示例来源:origin: org.kohsuke/github-api
@Override
/*package*/ GHCommit[] getItems(GitHub root) {
for (GHCommit commit : items) {
String repoName = getRepoName(commit.url);
try {
GHRepository repo = root.getRepository(repoName);
commit.wrapUp(repo);
} catch (IOException ioe) {}
}
return items;
}
}
代码示例来源:origin: kohsuke/github-api
/**
* Forked repositories have a 'source' attribute that specifies the ultimate source of the forking chain.
*
* @return
* {@link GHRepository} that points to the root repository where this repository is forked
* (indirectly or directly) from. Otherwise null.
* @see #getParent()
*/
public GHRepository getSource() throws IOException {
if (source == null) return null;
if (source.root == null)
source = root.getRepository(source.getFullName());
return source;
}
代码示例来源:origin: jenkinsci/github-plugin
@Override
protected GHRepository applyNullSafe(@Nonnull GitHub gitHub) {
try {
return gitHub.getRepository(format("%s/%s", repoName.getUserName(), repoName.getRepositoryName()));
} catch (IOException e) {
LOGGER.warn("Failed to obtain repository {}", this, e);
return null;
}
}
};
代码示例来源:origin: logzio/apollo
public Optional<String> getLatestCommitShaOnBranch(String githubRepo, String branchName) {
try {
return Optional.of(gitHub.getRepository(githubRepo).getBranch(branchName).getSHA1());
} catch (Exception e) {
logger.warn("Could not get latest commit on branch from Github!", e);
return Optional.empty();
}
}
代码示例来源:origin: salesforce/dockerfile-image-update
public static void addVersionStoreRepo(GitHub github, List<GHRepository> createdRepos, String storeName) throws IOException {
String login = github.getMyself().getLogin();
GHRepository storeRepo = github.getRepository(Paths.get(login, storeName).toString());
createdRepos.add(storeRepo);
}
}
代码示例来源:origin: lamarios/Homedash2
public Updater() {
ResourceBundle rs = ResourceBundle.getBundle("version");
currentVersion = new Version(rs.getString("version"));
try {
repository = GitHub.connectAnonymously().getRepository(REPO_NAME);
} catch (IOException e) {
e.printStackTrace();
}
}
代码示例来源:origin: ashwanthkumar/gocd-build-github-pull-requests
@Override
public void checkConnection(GitConfig gitConfig) {
try {
loginWith(gitConfig).getRepository(GHUtils.parseGithubUrl(gitConfig.getEffectiveUrl()));
} catch (Exception e) {
throw new RuntimeException(String.format("check connection failed. %s", e.getMessage()), e);
}
}
代码示例来源:origin: groupon/DotCi
protected GHRepository getGithubRepository(StaplerRequest request) throws IOException {
String repoName = request.getParameter("fullName");
GitHub github = getGitHub(request);
return github.getRepository(repoName);
}
代码示例来源:origin: com.java-adventures.smarkdown/smarkdown-location-github
private GHRepository openRepo(GitHubLocation location) throws IOException {
final GitHub github = location.open();
final GHRepository repo = github.getRepository(location.getRepoName());
return repo;
}
}
代码示例来源:origin: org.eclipse.che.selenium/che-selenium-core
public void setDefaultBranch(String branchName) throws IOException {
ghRepo.setDefaultBranch(branchName);
ghRepo = gitHub.getRepository(ghRepo.getFullName());
}
代码示例来源:origin: gocd-contrib/gocd-build-status-notifier
void updateCommitStatus(String revision, String pipelineStage, String trackbackURL, String repository, GHCommitState state,
String usernameToUse, String passwordToUse, String oauthAccessTokenToUse, String endPointToUse) throws Exception {
GitHub github = createGitHubClient(usernameToUse, passwordToUse, oauthAccessTokenToUse, endPointToUse);
GHRepository ghRepository = github.getRepository(repository);
ghRepository.createCommitStatus(revision, state, trackbackURL, "", pipelineStage);
}
代码示例来源:origin: groupon/DotCi
private synchronized GHRepository getRepository() {
if (this.repository == null) {
final String fullRepoName = new GitUrl(this.repoUrl).getFullRepoName();
try {
this.repository = getGithub().getRepository(fullRepoName);
} catch (final IOException e) {
throw new RuntimeException(e);
}
}
return this.repository;
}
代码示例来源:origin: LendingClub/mercator
public void scanRepository(String name) {
try {
scanRepository(getGitHubClient().getRepository(name));
} catch (IOException e) {
throw new MercatorException(e);
}
}
代码示例来源:origin: ashwanthkumar/gocd-build-github-pull-requests
private GHPullRequest pullRequestFrom(GitConfig gitConfig, int currentPullRequestID) throws IOException {
return loginWith(gitConfig)
.getRepository(GHUtils.parseGithubUrl(gitConfig.getEffectiveUrl()))
.getPullRequest(currentPullRequestID);
}
代码示例来源:origin: Karumi/Reddo
public GitHubRepository getRepository(String name) {
validateGitHubConfiguration();
validateRepositoryName(name);
GitHubRepository repository = null;
try {
GHRepository gitHubRepository = gitHub.getRepository(name);
repository = mapGhRepository(gitHubRepository);
} catch (IOException e) {
Log.e("Error retrieving repository " + name);
}
return repository;
}
代码示例来源:origin: Spirals-Team/repairnator
public String forkRepository(String repository, AbstractStep step) throws IOException {
GitHub gh = RepairnatorConfig.getInstance().getGithub();
showGitHubRateInformation(gh, step);
if (gh.getRateLimit().remaining > 10) {
GHRepository originalRepo = gh.getRepository(repository);
if (originalRepo != null) {
return originalRepo.fork().getUrl().toString();
}
}
return null;
}
内容来源于网络,如有侵权,请联系作者删除!