List of usage examples for org.eclipse.jgit.transport PushResult getURI
public URIish getURI()
From source file:git_manager.tool.GitOperations.java
License:Open Source License
public void pushToRemote() { if (uName == null || pass == null || remote == null) { System.out.println("Push cancelled"); return;//from w ww .j ava 2 s . c om } if (uName.equals("") || pass.equals("") || remote.equals("")) { if (uName.equals("")) System.out.println("Please enter a valid username"); if (pass.equals("")) System.out.println("Please enter a valid password"); if (remote.equals("")) System.out.println("Please enter a valid online repository address"); uName = pass = remote = null; return; } if (!remote.endsWith(".git")) { remote = remote + ".git"; } storeRemote(); // Get TransportException when project is >1Mb // TODO: Fix this: // https://groups.google.com/forum/#!topic/bitbucket-users/OUsa8sb_Ti4 CredentialsProvider cp = new UsernamePasswordCredentialsProvider(uName, pass); Iterable<PushResult> pc; try { pc = git.push().setRemote(remote).setCredentialsProvider(cp).call(); for (PushResult pushResult : pc) { System.out.println(pushResult.getURI()); } System.out.println("Push Complete"); } catch (InvalidRemoteException e) { e.printStackTrace(); } catch (TransportException e) { // System.out // .println("Please use a project of size <1MB when pushing (will be resolved soon)..."); e.printStackTrace(); } catch (GitAPIException e) { e.printStackTrace(); } finally { uName = null; remote = null; pass = null; } }
From source file:io.fabric8.collector.git.GitHelpers.java
License:Apache License
public static RevCommit doCommitAndPush(Git git, String message, UserDetails userDetails, PersonIdent author, String branch, String origin, boolean pushOnCommit) throws GitAPIException { CommitCommand commit = git.commit().setAll(true).setMessage(message); if (author != null) { commit = commit.setAuthor(author); }//from w w w . j av a2s . c om RevCommit answer = commit.call(); if (LOG.isDebugEnabled()) { LOG.debug("Committed " + answer.getId() + " " + answer.getFullMessage()); } if (pushOnCommit) { PushCommand push = git.push(); configureCommand(push, userDetails); Iterable<PushResult> results = push.setRemote(origin).call(); for (PushResult result : results) { if (LOG.isDebugEnabled()) { LOG.debug("Pushed " + result.getMessages() + " " + result.getURI() + " branch: " + branch + " updates: " + toString(result.getRemoteUpdates())); } } } return answer; }
From source file:io.fabric8.forge.rest.git.RepositoryResource.java
License:Apache License
protected RevCommit commitThenPush(Git git, CommitCommand commit) throws Exception { RevCommit answer = commit.call();/*from w w w. ja v a 2s. c om*/ if (LOG.isDebugEnabled()) { LOG.debug("Committed " + answer.getId() + " " + answer.getFullMessage()); } if (isPushOnCommit()) { Iterable<PushResult> results = doPush(git); for (PushResult result : results) { if (LOG.isDebugEnabled()) { LOG.debug("Pushed " + result.getMessages() + " " + result.getURI() + " branch: " + branch + " updates: " + toString(result.getRemoteUpdates())); } } } return answer; }
From source file:io.fabric8.forge.rest.main.GitCommandCompletePostProcessor.java
License:Apache License
protected RevCommit doCommitAndPush(Git git, String message, CredentialsProvider credentials, PersonIdent author, String remote, String branch, String origin) throws IOException, GitAPIException { CommitCommand commit = git.commit().setAll(true).setMessage(message); if (author != null) { commit = commit.setAuthor(author); }/*from www. j a va 2 s . c o m*/ RevCommit answer = commit.call(); if (LOG.isDebugEnabled()) { LOG.debug("Committed " + answer.getId() + " " + answer.getFullMessage()); } if (isPushOnCommit()) { Iterable<PushResult> results = git.push().setCredentialsProvider(credentials).setRemote(origin).call(); for (PushResult result : results) { if (LOG.isDebugEnabled()) { LOG.debug("Pushed " + result.getMessages() + " " + result.getURI() + " branch: " + branch + " updates: " + GitHelpers.toString(result.getRemoteUpdates())); } } } return answer; }
From source file:io.hawt.git.GitFacadeSupport.java
License:Apache License
protected RevCommit commitThenPush(Git git, String branch, CommitCommand commit) throws Exception { RevCommit answer = commit.call();/*from w ww. j a v a 2 s .com*/ if (LOG.isDebugEnabled()) { LOG.debug("Committed " + answer.getId() + " " + answer.getFullMessage()); } if (isPushOnCommit()) { Iterable<PushResult> results = doPush(git); for (PushResult result : results) { if (LOG.isDebugEnabled()) { LOG.debug("Pushed " + result.getMessages() + " " + result.getURI() + " branch: " + branch + " updates: " + toString(result.getRemoteUpdates())); } } } return answer; }
From source file:org.jboss.forge.rest.main.GitCommandCompletePostProcessor.java
License:Apache License
protected RevCommit doCommitAndPush(Git git, String message, CredentialsProvider credentials, PersonIdent author, String remote, String branch) throws IOException, GitAPIException { CommitCommand commit = git.commit().setAll(true).setMessage(message); if (author != null) { commit = commit.setAuthor(author); }//from w w w . j a va2s . c o m RevCommit answer = commit.call(); if (LOG.isDebugEnabled()) { LOG.debug("Committed " + answer.getId() + " " + answer.getFullMessage()); } if (isPushOnCommit()) { Iterable<PushResult> results = git.push().setCredentialsProvider(credentials).setRemote(remote).call(); for (PushResult result : results) { if (LOG.isDebugEnabled()) { LOG.debug("Pushed " + result.getMessages() + " " + result.getURI() + " branch: " + branch + " updates: " + GitHelpers.toString(result.getRemoteUpdates())); } } } return answer; }