Java Code Examples for org.eclipse.egit.github.core.Repository#setName()
The following examples show how to use
org.eclipse.egit.github.core.Repository#setName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GithubApi.java From karamel with Apache License 2.0 | 6 votes |
/** * Create a repository for a given organization with a description * * @param org * @param repoName * @param description * @return RepoItem bean/json object * @throws KaramelException */ public synchronized static RepoItem createRepoForOrg(String org, String repoName, String description) throws KaramelException { try { OrganizationService os = new OrganizationService(client); RepositoryService rs = new RepositoryService(client); Repository r = new Repository(); r.setName(repoName); r.setOwner(os.getOrganization(org)); r.setDescription(description); rs.createRepository(org, r); cloneRepo(org, repoName); cachedRepos.remove(org); return new RepoItem(repoName, description, r.getSshUrl()); } catch (IOException ex) { throw new KaramelException("Problem creating the repository " + repoName + " for organization " + org + " : " + ex.getMessage()); } }
Example 2
Source File: GithubApi.java From karamel with Apache License 2.0 | 6 votes |
/** * Create a repository in a given github user's local account. * * @param repoName * @param description * @throws KaramelException */ public synchronized static void createRepoForUser(String repoName, String description) throws KaramelException { try { UserService us = new UserService(client); RepositoryService rs = new RepositoryService(client); Repository r = new Repository(); r.setName(repoName); r.setOwner(us.getUser()); r.setDescription(description); rs.createRepository(r); cloneRepo(getUser(), repoName); cachedRepos.remove(GithubApi.getUser()); } catch (IOException ex) { throw new KaramelException("Problem creating " + repoName + " for user " + ex.getMessage()); } }
Example 3
Source File: GitHubConnector.java From tool.accelerate.core with Apache License 2.0 | 6 votes |
/** * Creates a repository on GitHub and in a local temporary directory. This is a one time operation as * once it is created on GitHub and locally it cannot be recreated. */ public File createGitRepository(String repositoryName) throws IOException { RepositoryService service = new RepositoryService(); service.getClient().setOAuth2Token(oAuthToken); Repository repository = new Repository(); repository.setName(repositoryName); repository = service.createRepository(repository); repositoryLocation = repository.getHtmlUrl(); CloneCommand cloneCommand = Git.cloneRepository() .setURI(repository.getCloneUrl()) .setDirectory(localGitDirectory); addAuth(cloneCommand); try { localRepository = cloneCommand.call(); } catch (GitAPIException e) { throw new IOException("Error cloning to local file system", e); } return localGitDirectory; }