public class FetchCommand extends TransportCommand<FetchCommand,FetchResult>
Fetch
command. It has setters for all
supported options and arguments of this command and a call()
method
to finally execute the command.Modifier and Type | Class and Description |
---|---|
static interface |
FetchCommand.Callback
Callback for status of fetch operation.
|
credentialsProvider, timeout, transportConfigCallback
repo
Modifier | Constructor and Description |
---|---|
protected |
FetchCommand(Repository repo) |
Modifier and Type | Method and Description |
---|---|
FetchResult |
call()
Executes the
fetch command with all the options and parameters
collected by the setter methods of this class. |
ProgressMonitor |
getProgressMonitor() |
List<RefSpec> |
getRefSpecs() |
String |
getRemote() |
int |
getTimeout() |
boolean |
isCheckFetchedObjects() |
boolean |
isDryRun() |
boolean |
isRemoveDeletedRefs() |
boolean |
isThin() |
FetchCommand |
setCallback(FetchCommand.Callback callback)
Register a progress callback.
|
FetchCommand |
setCheckFetchedObjects(boolean checkFetchedObjects)
If set to true, objects received will be checked for validity
|
FetchCommand |
setDryRun(boolean dryRun)
Sets whether the fetch operation should be a dry run
|
FetchCommand |
setProgressMonitor(ProgressMonitor monitor)
The progress monitor associated with the fetch operation.
|
FetchCommand |
setRecurseSubmodules(SubmoduleConfig.FetchRecurseSubmodulesMode recurse)
Set the mode to be used for recursing into submodules.
|
FetchCommand |
setRefSpecs(List<RefSpec> specs)
The ref specs to be used in the fetch operation
|
FetchCommand |
setRefSpecs(RefSpec... specs)
The ref specs to be used in the fetch operation
|
FetchCommand |
setRefSpecs(String... specs)
The ref specs to be used in the fetch operation
|
FetchCommand |
setRemote(String remote)
The remote (uri or name) used for the fetch operation.
|
FetchCommand |
setRemoveDeletedRefs(boolean removeDeletedRefs)
If set to true, refs are removed which no longer exist in the source
|
FetchCommand |
setTagOpt(TagOpt tagOpt)
Sets the specification of annotated tag behavior during fetch
|
FetchCommand |
setThin(boolean thin)
Sets the thin-pack preference for fetch operation.
|
configure, configure, self, setCredentialsProvider, setTimeout, setTransportConfigCallback
checkCallable, getRepository, setCallable
protected FetchCommand(Repository repo)
repo
- public FetchResult call() throws GitAPIException, InvalidRemoteException, TransportException
fetch
command with all the options and parameters
collected by the setter methods of this class. Each instance of this
class should only be used for one invocation of the command (means: one
call to call()
)call
in interface Callable<FetchResult>
call
in class GitCommand<FetchResult>
FetchResult
object representing the successful fetch
resultInvalidRemoteException
- when called with an invalid remote uriTransportException
- when an error occurs during transportGitAPIException
- or subclass thereof when an error occurspublic FetchCommand setRecurseSubmodules(@Nullable SubmoduleConfig.FetchRecurseSubmodulesMode recurse)
recurse
- corresponds to the
--recurse-submodules/--no-recurse-submodules options. If
null
use the value of the
submodule.name.fetchRecurseSubmodules
option
configured per submodule. If not specified there, use the
value of the fetch.recurseSubmodules
option configured
in git config. If not configured in either, "on-demand" is the
built-in default.this
public FetchCommand setRemote(String remote)
Constants.DEFAULT_REMOTE_NAME
will
be used.remote
- this
Constants.DEFAULT_REMOTE_NAME
public String getRemote()
public int getTimeout()
public boolean isCheckFetchedObjects()
public FetchCommand setCheckFetchedObjects(boolean checkFetchedObjects)
checkFetchedObjects
- this
public boolean isRemoveDeletedRefs()
public FetchCommand setRemoveDeletedRefs(boolean removeDeletedRefs)
removeDeletedRefs
- this
public ProgressMonitor getProgressMonitor()
public FetchCommand setProgressMonitor(ProgressMonitor monitor)
NullProgressMonitor
monitor
- this
NullProgressMonitor
public FetchCommand setRefSpecs(String... specs)
specs
- this
public FetchCommand setRefSpecs(RefSpec... specs)
specs
- this
public FetchCommand setRefSpecs(List<RefSpec> specs)
specs
- this
public boolean isDryRun()
public FetchCommand setDryRun(boolean dryRun)
dryRun
- this
public boolean isThin()
public FetchCommand setThin(boolean thin)
thin
- this
public FetchCommand setTagOpt(TagOpt tagOpt)
tagOpt
- this
public FetchCommand setCallback(FetchCommand.Callback callback)
callback
- the callbackthis
Copyright © 2017 Eclipse JGit Project. All rights reserved.