public void logPushResult(Iterable<PushResult> results, Repository repository, boolean verbose) throws IOException { String local = repository.getDirectory().getCanonicalPath(); for (PushResult result : results) { Map<String, RemoteRefUpdate> map = new TreeMap<>(); for (RemoteRefUpdate update : result.getRemoteUpdates()) { if (verbose || update.getStatus() != RemoteRefUpdate.Status.UP_TO_DATE) { map.put(update.getSrcRef(), update); } } if (map.size() > 0) { LOG.info(String.format("Pushed from %s to %s:", local, result.getURI())); for (RemoteRefUpdate update : map.values()) { LOG.info(String.format(" - %s (%s)", update.getSrcRef(), update.getStatus())); } } else { LOG.info(String.format("Pushed from %s to %s - no reference was updated", local, result.getURI())); } } }
@Override public void logPushResult(Iterable<PushResult> results, Repository repository, boolean verbose) throws IOException { String local = repository.getDirectory().getCanonicalPath(); for (PushResult result : results) { Map<String, RemoteRefUpdate> map = new TreeMap<>(); for (RemoteRefUpdate update : result.getRemoteUpdates()) { if (verbose || update.getStatus() != RemoteRefUpdate.Status.UP_TO_DATE) { map.put(update.getSrcRef(), update); } } if (map.size() > 0) { Activator.log(LogService.LOG_INFO, String.format("Pushed from %s to %s:", local, result.getURI())); for (RemoteRefUpdate update : map.values()) { Activator.log(LogService.LOG_INFO, String.format(" - %s (%s)", update.getSrcRef(), update.getStatus())); } } else { Activator.log(LogService.LOG_INFO, String.format("Pushed from %s to %s - no reference was updated", local, result.getURI())); } } }
@Override public void logPushResult(Iterable<PushResult> results, Repository repository, boolean verbose) throws IOException { String local = repository.getDirectory().getCanonicalPath(); for (PushResult result : results) { Map<String, RemoteRefUpdate> map = new TreeMap<>(); for (RemoteRefUpdate update : result.getRemoteUpdates()) { if (verbose || update.getStatus() != RemoteRefUpdate.Status.UP_TO_DATE) { map.put(update.getSrcRef(), update); } } if (map.size() > 0) { Activator.log(LogService.LOG_INFO, String.format("Pushed from %s to %s:", local, result.getURI())); for (RemoteRefUpdate update : map.values()) { Activator.log(LogService.LOG_INFO, String.format(" - %s (%s)", update.getSrcRef(), update.getStatus())); } } else { Activator.log(LogService.LOG_INFO, String.format("Pushed from %s to %s - no reference was updated", local, result.getURI())); } } }
protected RevCommit commitThenPush(Git git, String branch, CommitCommand commit) throws Exception { RevCommit answer = commit.call(); 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; }
protected RevCommit commitThenPush(Git git, CommitCommand commit) throws Exception { RevCommit answer = commit.call(); 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; }
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); } 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; }
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); } 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; }
for (PushResult result : results) { if (LOG.isDebugEnabled()) { LOG.debug("Pushed " + result.getMessages() + " " + result.getURI() + " branch: " + branch + " updates: " + toString(result.getRemoteUpdates()));
@Override protected void run() throws Exception { Git git = new Git(db); PushCommand push = git.push(); push.setDryRun(dryRun); push.setForce(force); push.setProgressMonitor(new TextProgressMonitor()); push.setReceivePack(receivePack); push.setRefSpecs(refSpecs); if (all) push.setPushAll(); if (tags) push.setPushTags(); push.setRemote(remote); push.setThin(thin); push.setTimeout(timeout); Iterable<PushResult> results = push.call(); for (PushResult result : results) { ObjectReader reader = db.newObjectReader(); try { printPushResult(reader, result.getURI(), result); } finally { reader.release(); } } }