Add setter for ProgressMonitor to DiffCommand
Change-Id: I34f8b77a461e165d7d624dbd9a6944feadc57b8e
This commit is contained in:
parent
8f742cdd10
commit
f78e52b645
|
@ -55,8 +55,10 @@
|
|||
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 List<DiffEntry> call() throws GitAPIException, IOException {
|
|||
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 DiffCommand setDestinationPrefix(String destinationPrefix) {
|
|||
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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue