verifyDirectories(u); } catch (URISyntaxException e) { throw new InvalidRemoteException( MessageFormat.format(JGitText.get().invalidURL, uri)); throw new InvalidRemoteException(MessageFormat.format( JGitText.get().invalidRemote, remote)); } catch (GitAPIException | RuntimeException e) {
@Override public List<Ref> getRemoteBranches(final Git repo) throws GitAPIException { List<Ref> results = new ArrayList<>(); try { FetchResult fetch = repo.fetch().setRemote(GIT_REMOTE_ORIGIN).call(); Collection<Ref> refs = fetch.getAdvertisedRefs(); for (Ref ref : refs) { if (ref.getName().startsWith(GIT_REFS_HEADS)) { results.add(ref); } } } catch (InvalidRemoteException e) { e.printStackTrace(); } return results; }
deleteDirectory(localDirectory); Throwable cause = e.getCause(); if (cause != null && cause instanceof org.eclipse.jgit.errors.NoRemoteRepositoryException) { BadRepositoryException bre = new BadRepositoryException(
e2.printStackTrace(); } catch (TransportException e2) { gitUrl = null;
throw new InvalidRemoteException(MessageFormat.format( JGitText.get().invalidRemote, remote)); } catch (NotSupportedException e) {
public void pullRepo() { try { git.pull().setRemote(REMOTE_NAME).setRemoteBranchName(MASTER_BRANCH).setRebase(false).call(); } catch (InvalidRemoteException e) { e.printStackTrace(); } catch (TransportException e) { e.printStackTrace(); } catch (GitAPIException e) { e.printStackTrace(); } }
throw new InvalidRemoteException(MessageFormat.format( JGitText.get().invalidRemote, remote), e); } catch (TransportException e) { e.getMessage(), e); } catch (URISyntaxException e) { throw new InvalidRemoteException(MessageFormat.format( JGitText.get().invalidRemote, remote)); } catch (NotSupportedException e) {
public void pullRepo(String uri, String branch) { try { setRemote(uri); git.pull().setRemote(REMOTE_NAME).setRemoteBranchName(branch).setRebase(false).call(); } catch (InvalidRemoteException e) { e.printStackTrace(); } catch (TransportException e) { e.printStackTrace(); } catch (GitAPIException e) { e.printStackTrace(); } }
throw new InvalidRemoteException(MessageFormat.format( JGitText.get().invalidRemote, remote)); } catch (TransportException e) {
public void initRepo() { if (exists()) { return; } try { Git.init().setDirectory(getRootDir()).setBare(false).call(); } catch (InvalidRemoteException e) { e.printStackTrace(); } catch (TransportException e) { e.printStackTrace(); } catch (GitAPIException e) { e.printStackTrace(); } }
verifyDirectories(u); } catch (URISyntaxException e) { throw new InvalidRemoteException( MessageFormat.format(JGitText.get().invalidURL, uri)); throw new InvalidRemoteException(MessageFormat.format( JGitText.get().invalidRemote, remote)); } catch (GitAPIException | RuntimeException e) {
public void pushRepo(String uri, GitUser user) { try { setRemote(uri); git.push().setRemote(REMOTE_NAME).setCredentialsProvider(new UsernamePasswordCredentialsProvider(user.getUsername(), user.getPassword())).call(); } catch (InvalidRemoteException e) { e.printStackTrace(); } catch (TransportException e) { e.printStackTrace(); } catch (GitAPIException e) { e.printStackTrace(); } }
throw new InvalidRemoteException(MessageFormat.format( JGitText.get().invalidRemote, remote)); } catch (NotSupportedException e) {
e.printStackTrace(); } catch (TransportException e) { e.printStackTrace();
throw new InvalidRemoteException(MessageFormat.format( JGitText.get().invalidRemote, remote)); } catch (NotSupportedException e) {
public void addAndCommit(String message, GitUser user) { try { git.add().addFilepattern(".").call(); git.commit().setMessage(message).setAuthor(user.getName(), user.getEmail()).setCommitter(user.getName(), user.getEmail()).setAll(true).call(); } catch (InvalidRemoteException e) { e.printStackTrace(); } catch (TransportException e) { e.printStackTrace(); } catch (GitAPIException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } }
repository.close(); throw new InvalidRemoteException(MessageFormat.format( JGitText.get().invalidRemote, remote));
public static void cloneRepo(String uri, File cloneTo) { Git result = null; try { result = Git.cloneRepository().setURI(uri).setDirectory(cloneTo) .setBranch(MASTER_BRANCH).setBare(false).setRemote(REMOTE_NAME) .setNoCheckout(false).setCloneAllBranches(false).setCloneSubmodules(false).call(); } catch (InvalidRemoteException e) { e.printStackTrace(); } catch (TransportException e) { e.printStackTrace(); } catch (GitAPIException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } finally { if (result != null) { result.close(); } } }
return result; } catch (NoRemoteRepositoryException e) { throw new InvalidRemoteException(MessageFormat.format( JGitText.get().invalidRemote, remote), e); } catch (TransportException e) { e.getMessage(), e); } catch (URISyntaxException e) { throw new InvalidRemoteException(MessageFormat.format( JGitText.get().invalidRemote, remote)); } catch (NotSupportedException e) {
public static void cloneRepo(String uri, File cloneTo, String branch) { Git result = null; try { result = Git.cloneRepository().setURI(uri).setDirectory(cloneTo) .setBranch(branch).setBare(false).setRemote(REMOTE_NAME) .setNoCheckout(false).setCloneAllBranches(false).setCloneSubmodules(false).call(); } catch (InvalidRemoteException e) { e.printStackTrace(); } catch (TransportException e) { e.printStackTrace(); } catch (GitAPIException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } finally { if (result != null) { result.close(); } } }