Add setCredentialsProvider to PullCommand
Bug: 335703 Change-Id: Id9713a4849c772e030fca23dd64b993264f28366 Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
This commit is contained in:
parent
a880233d7f
commit
9fbda22392
|
@ -70,6 +70,7 @@
|
|||
import org.eclipse.jgit.lib.Ref;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
import org.eclipse.jgit.lib.RepositoryState;
|
||||
import org.eclipse.jgit.transport.CredentialsProvider;
|
||||
import org.eclipse.jgit.transport.FetchResult;
|
||||
|
||||
/**
|
||||
|
@ -85,6 +86,8 @@ public class PullCommand extends GitCommand<PullResult> {
|
|||
|
||||
private ProgressMonitor monitor = NullProgressMonitor.INSTANCE;
|
||||
|
||||
private CredentialsProvider credentialsProvider;
|
||||
|
||||
/**
|
||||
* @param repo
|
||||
*/
|
||||
|
@ -112,6 +115,18 @@ public PullCommand setProgressMonitor(ProgressMonitor monitor) {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param credentialsProvider
|
||||
* the {@link CredentialsProvider} to use
|
||||
* @return this instance
|
||||
*/
|
||||
public PullCommand setCredentialsProvider(
|
||||
CredentialsProvider credentialsProvider) {
|
||||
checkCallable();
|
||||
this.credentialsProvider = credentialsProvider;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the {@code Pull} command with all the options and parameters
|
||||
* collected by the setter methods (e.g.
|
||||
|
@ -206,6 +221,7 @@ public PullResult call() throws WrongRepositoryStateException,
|
|||
fetch.setRemote(remote);
|
||||
fetch.setProgressMonitor(monitor);
|
||||
fetch.setTimeout(this.timeout);
|
||||
fetch.setCredentialsProvider(credentialsProvider);
|
||||
|
||||
fetchRes = fetch.call();
|
||||
} else {
|
||||
|
@ -293,4 +309,5 @@ public PullResult call() throws WrongRepositoryStateException,
|
|||
monitor.endTask();
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue