push.setDryRun(settings.valueOfIndex("dryRun").toBoolean()); push.setForce(settings.valueOfIndex("force").toBoolean());
@Override public Void invoke(File f, VirtualChannel channel) throws IOException, InterruptedException { org.eclipse.jgit.transport.CredentialsProvider provider = new UsernamePasswordCredentialsProvider(username, password); org.eclipse.jgit.api.Git git = org.eclipse.jgit.api.Git.open(new File(uri)); try { PushCommand pc = git.push().setRemote(targetUri) .setCredentialsProvider(provider) .setDryRun(true) .setPushTags(); pc.call(); } catch(GitAPIException e) { throw new IOException(e); } finally { if (git.getRepository() != null) { git.getRepository().close(); } } return null; } }
@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(); } } }