diff options
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java index 771798a50d..f45e39e069 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java @@ -60,8 +60,10 @@ import org.eclipse.jgit.errors.MissingObjectException; import org.eclipse.jgit.internal.JGitText; import org.eclipse.jgit.lib.AnyObjectId; import org.eclipse.jgit.lib.Constants; +import org.eclipse.jgit.lib.NullProgressMonitor; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectIdRef; +import org.eclipse.jgit.lib.ProgressMonitor; import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.Ref.Storage; import org.eclipse.jgit.lib.Repository; @@ -95,6 +97,8 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> { private boolean noCommit = false; + private ProgressMonitor monitor = NullProgressMonitor.INSTANCE; + /** * Constructor for CherryPickCommand * @@ -160,6 +164,7 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> { newHead.getTree(), repo.lockDirCache(), merger.getResultTreeId()); dco.setFailOnConflict(true); + dco.setProgressMonitor(monitor); dco.checkout(); if (!noCommit) newHead = new Git(getRepository()).commit() @@ -332,6 +337,24 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> { return this; } + /** + * The progress monitor associated with the cherry-pick operation. By + * default, this is set to <code>NullProgressMonitor</code> + * + * @see NullProgressMonitor + * @param monitor + * a {@link org.eclipse.jgit.lib.ProgressMonitor} + * @return {@code this} + * @since 4.11 + */ + public CherryPickCommand setProgressMonitor(ProgressMonitor monitor) { + if (monitor == null) { + monitor = NullProgressMonitor.INSTANCE; + } + this.monitor = monitor; + return this; + } + private String calculateOurName(Ref headRef) { if (ourCommitName != null) return ourCommitName; |