summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorTomasz Zarna2012-01-09 09:48:16 (EST)
committer Tomasz Zarna2012-01-09 09:48:16 (EST)
commitf78e52b645e0397f723f16e1199ffa3ee69e4350 (patch)
tree926240561ead3b0b9f3f719669953640532cfbe3
parent8f742cdd1005d0ddef3a826c277ba0b2983a4c2d (diff)
downloadjgit-f78e52b645e0397f723f16e1199ffa3ee69e4350.zip
jgit-f78e52b645e0397f723f16e1199ffa3ee69e4350.tar.gz
jgit-f78e52b645e0397f723f16e1199ffa3ee69e4350.tar.bz2
Add setter for ProgressMonitor to DiffCommandrefs/changes/34/4934/2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java
index 8143bc7..6c32e19 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java
@@ -55,8 +55,10 @@ import org.eclipse.jgit.api.errors.NoHeadException;
import org.eclipse.jgit.diff.DiffEntry;
import org.eclipse.jgit.diff.DiffFormatter;
import org.eclipse.jgit.dircache.DirCacheIterator;
+import org.eclipse.jgit.lib.NullProgressMonitor;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectReader;
+import org.eclipse.jgit.lib.ProgressMonitor;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.treewalk.AbstractTreeIterator;
import org.eclipse.jgit.treewalk.CanonicalTreeParser;
@@ -88,6 +90,8 @@ public class DiffCommand extends GitCommand<List<DiffEntry>> {
private String destinationPrefix;
+ private ProgressMonitor monitor = NullProgressMonitor.INSTANCE;
+
/**
* @param repo
*/
@@ -107,6 +111,7 @@ public class DiffCommand extends GitCommand<List<DiffEntry>> {
final DiffFormatter diffFmt = new DiffFormatter(
new BufferedOutputStream(out));
diffFmt.setRepository(repo);
+ diffFmt.setProgressMonitor(monitor);
try {
if (cached) {
if (oldTree == null) {
@@ -247,4 +252,19 @@ public class DiffCommand extends GitCommand<List<DiffEntry>> {
this.destinationPrefix = destinationPrefix;
return this;
}
+
+ /**
+ * The progress monitor associated with the diff operation. By default, this
+ * is set to <code>NullProgressMonitor</code>
+ *
+ * @see NullProgressMonitor
+ *
+ * @param monitor
+ * a progress monitor
+ * @return this instance
+ */
+ public DiffCommand setProgressMonitor(ProgressMonitor monitor) {
+ this.monitor = monitor;
+ return this;
+ }
} \ No newline at end of file