本文整理匯總了Java中org.kohsuke.github.GHRepository.delete方法的典型用法代碼示例。如果您正苦於以下問題:Java GHRepository.delete方法的具體用法?Java GHRepository.delete怎麽用?Java GHRepository.delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.kohsuke.github.GHRepository
的用法示例。
在下文中一共展示了GHRepository.delete方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: deleteRepository
import org.kohsuke.github.GHRepository; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
@Override
public void deleteRepository(final String repositoryName) throws IllegalArgumentException {
if (repositoryName == null) {
throw new IllegalArgumentException("repositoryName must be specified");
}
try {
final GHRepository repo = delegate.getRepository(repositoryName);
log.fine("Deleting repo at " + repo.gitHttpTransportUrl());
repo.delete();
} catch (final GHFileNotFoundException ghe) {
log.log(Level.SEVERE, "Error while deleting repository " + repositoryName, ghe);
throw new NoSuchRepositoryException("Could not remove repository "
+ repositoryName + " because it could not be found.");
} catch (final IOException ioe) {
log.log(Level.SEVERE, "Error while deleting repository " + repositoryName, ioe);
throw new RuntimeException("Could not remove " + repositoryName, ioe);
}
}
示例2: deleteRepository
import org.kohsuke.github.GHRepository; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
@Override
public void deleteRepository(final String repositoryName) throws IllegalArgumentException {
if (repositoryName == null) {
throw new IllegalArgumentException("repositoryName must be specified");
}
try {
final GHRepository repo = delegate.getRepository(repositoryName);
log.fine("Deleting repo at " + repo.gitHttpTransportUrl());
repo.delete();
} catch (final IOException ioe) {
log.log(Level.SEVERE, "Error while deleting repository " + repositoryName, ioe);
// Check for repo not found (this is how Kohsuke Java Client reports the error)
if (isRepoNotFound(ioe)) {
throw new NoSuchRepositoryException("Could not remove repository "
+ repositoryName + " because it could not be found.");
}
throw new RuntimeException("Could not remove " + repositoryName, ioe);
}
}
示例3: deleteRepository
import org.kohsuke.github.GHRepository; //導入方法依賴的package包/類
/**
* ɾ��ָ����repository
* @param strRepoName Ҫɾ����github����
* @return void
*/
public void deleteRepository(String strRepoName){
GitHub github;
GHRepository repo;
try {
System.out.println("Delete repo started!\t"+strRepoName);
github = GitHub.connectToEnterprise(getApiUrl(), getUserId(), getPassword());
repo = github.getRepository(strRepoName);
repo.delete();
System.out.println("Delete repo finished!");
} catch (IOException e) {
// TODO Auto-generated catch block
errHandle(e.getMessage());
}
bFinished = true;
}
示例4: removeRepo
import org.kohsuke.github.GHRepository; //導入方法依賴的package包/類
public synchronized static void removeRepo(String owner, String repoName) throws KaramelException {
try {
GitHub gitHub = GitHub.connectUsingPassword(GithubApi.getUser(), GithubApi.getPassword());
if (!gitHub.isCredentialValid()) {
throw new KaramelException("Invalid GitHub credentials");
}
GHRepository repo = null;
if (owner.compareToIgnoreCase(GithubApi.getUser()) != 0) {
GHOrganization org = gitHub.getOrganization(owner);
repo = org.getRepository(repoName);
} else {
repo = gitHub.getRepository(owner + "/" + repoName);
}
repo.delete();
} catch (IOException ex) {
throw new KaramelException("Problem authenticating with gihub-api when trying to remove a repository");
}
}
示例5: deleteRepos
import org.kohsuke.github.GHRepository; //導入方法依賴的package包/類
private void deleteRepos(List<String> lstReposToDelete) throws IOException {
GitHub github = GitHub.connect();
GHMyself me = github.getMyself();
PagedIterable<GHRepository> lstRepos = me.listRepositories();
int cntDeleted = 0;
for (GHRepository repo : lstRepos) {
String name = repo.getName();
if (lstReposToDelete.contains(name)) {
repo.delete();
cntDeleted++;
System.out.format("Deleted: %s\n", name);
}
}
System.out.format("That's %d repositories deleted!\n",
cntDeleted);
}
示例6: checkAndDelete
import org.kohsuke.github.GHRepository; //導入方法依賴的package包/類
private static Exception checkAndDelete(GHRepository repo) {
log.info("deleting {}", repo.getFullName());
try {
repo.delete();
} catch (Exception e) {
return e;
}
return null;
}
示例7: run
import org.kohsuke.github.GHRepository; //導入方法依賴的package包/類
private void run() throws IOException {
GitHub github = GitHub.connect();
Map<String, GHOrganization> orgs = github.getMyOrganizations();
System.out.println(orgs);
GHMyself me = github.getMyself();
PagedIterable<GHRepository> lstRepos = me.listRepositories();
// TODO:mgp: Figure out what I am missing here.
int counterSinceThereSeemsToBeNoSizeMethodOnPagedIterable = 0;
GHRepository repoToDelete = null;
PrintWriter outCloneList = new PrintWriter("clone_these.sh");
PrintWriter outRepoList = new PrintWriter("repo_list.txt");
for (GHRepository repo : lstRepos) {
String name = repo.getName();
Date pushedAt = repo.getPushedAt();
String readOnlyUrl = repo.getGitTransportUrl();
outRepoList.format("%s\n", name);
outCloneList.println(readOnlyUrl);
counterSinceThereSeemsToBeNoSizeMethodOnPagedIterable++;
if (name.equals("c-style")) {
repoToDelete = repo;
System.out.println("Well?");
}
}
outCloneList.close();
outRepoList.close();
System.out.format("That's %d repositories!\n",
counterSinceThereSeemsToBeNoSizeMethodOnPagedIterable);
if (null != repoToDelete) {
repoToDelete.delete();
}
}