Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndré Dietisheim2013-01-17 15:15:34 +0000
committerMatthias Sohn2013-03-20 23:56:42 +0000
commitb244ff5f00bcfdb17d0d294974834e6dbceadde2 (patch)
tree061580195c1a0aa5d7c37feb8ac2929e8fef20d1
parent5c4b5d3038457b02cc826eb2cd092027c66d327b (diff)
downloadegit-b244ff5f00bcfdb17d0d294974834e6dbceadde2.tar.gz
egit-b244ff5f00bcfdb17d0d294974834e6dbceadde2.tar.xz
egit-b244ff5f00bcfdb17d0d294974834e6dbceadde2.zip
Allow users to show server messages while pushing
Allow users to provide their OutputStream (via PushOperation#setOutputStream) so that jgit can write server messages to it (via SideBandInputStream) while they're getting in. Bug: 398387 JGit-Dependency: I670782784b38702d52bca98203909aca0496d1c0 Change-Id: I1b0f76dba3b2a3eb160ca453c60c6bcf75b5872b Signed-off-by: Andre Dietisheim <andre.dietisheim@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/op/PushOperation.java32
1 files changed, 24 insertions, 8 deletions
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/PushOperation.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/PushOperation.java
index c70836132c..19d9b6ce0d 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/PushOperation.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/PushOperation.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.egit.core.op;
+import java.io.OutputStream;
import java.lang.reflect.InvocationTargetException;
import java.net.URISyntaxException;
import java.util.Collection;
@@ -48,6 +49,8 @@ public class PushOperation {
private final int timeout;
+ private OutputStream out;
+
private PushOperationResult operationResult;
private CredentialsProvider credentialsProvider;
@@ -69,11 +72,7 @@ public class PushOperation {
public PushOperation(final Repository localDb,
final PushOperationSpecification specification,
final boolean dryRun, int timeout) {
- this.localDb = localDb;
- this.specification = specification;
- this.dryRun = dryRun;
- this.remoteName = null;
- this.timeout = timeout;
+ this(localDb, null, specification, dryRun, timeout);
}
/**
@@ -86,8 +85,14 @@ public class PushOperation {
*/
public PushOperation(final Repository localDb, final String remoteName,
final boolean dryRun, int timeout) {
+ this(localDb, remoteName, null, dryRun, timeout);
+ }
+
+ private PushOperation(final Repository localDb, final String remoteName,
+ PushOperationSpecification specification, final boolean dryRun,
+ int timeout) {
this.localDb = localDb;
- this.specification = null;
+ this.specification = specification;
this.dryRun = dryRun;
this.remoteName = remoteName;
this.timeout = timeout;
@@ -182,7 +187,7 @@ public class PushOperation {
transport.setTimeout(timeout);
if (credentialsProvider != null)
transport.setCredentialsProvider(credentialsProvider);
- PushResult result = transport.push(gitSubMonitor, refUpdates);
+ PushResult result = transport.push(gitSubMonitor, refUpdates, out);
operationResult.addOperationResult(result.getURI(), result);
specification.addURIRefUpdates(result.getURI(), result.getRemoteUpdates());
@@ -212,7 +217,8 @@ public class PushOperation {
Iterable<PushResult> results = git.push().setRemote(
remoteName).setDryRun(dryRun).setTimeout(timeout)
.setProgressMonitor(gitMonitor).setCredentialsProvider(
- credentialsProvider).call();
+credentialsProvider)
+ .setOutputStream(out).call();
for (PushResult result : results) {
operationResult.addOperationResult(result.getURI(), result);
}
@@ -259,4 +265,14 @@ public class PushOperation {
return null;
}
}
+
+ /**
+ * Sets the output stream this operation will write sideband messages to.
+ *
+ * @param out
+ * the outputstream to write to
+ */
+ public void setOutputStream(OutputStream out) {
+ this.out = out;
+ }
}

Back to the top