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, transportConfigCallbackrepo| Modifier | Constructor and Description |
|---|---|
protected |
FetchCommand(Repository repo)
Constructor for FetchCommand.
|
| Modifier and Type | Method and Description |
|---|---|
FetchResult |
call() |
ProgressMonitor |
getProgressMonitor()
Get progress monitor
|
List<RefSpec> |
getRefSpecs()
Get list of
RefSpecs |
String |
getRemote()
Get the remote
|
int |
getTimeout()
Get timeout
|
boolean |
isCheckFetchedObjects()
Whether to check received objects for validity
|
boolean |
isDryRun()
Whether to do a dry run
|
boolean |
isForceUpdate()
Whether fetch --force option is enabled
|
boolean |
isRemoveDeletedRefs()
Whether to remove refs which no longer exist in the source
|
boolean |
isThin()
Get thin-pack preference
|
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 |
setForceUpdate(boolean force)
Set fetch --force option
|
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, setTransportConfigCallbackcheckCallable, getRepository, setCallableprotected FetchCommand(Repository repo)
repo - a Repository object.public FetchResult call() throws GitAPIException, InvalidRemoteException, TransportException
Execute the command
Execute the 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>GitAPIExceptionInvalidRemoteExceptionTransportExceptionpublic 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.thispublic FetchCommand setRemote(String remote)
Constants.DEFAULT_REMOTE_NAME will
be used.remote - name of a remotethisConstants.DEFAULT_REMOTE_NAMEpublic String getRemote()
public int getTimeout()
public boolean isCheckFetchedObjects()
public FetchCommand setCheckFetchedObjects(boolean checkFetchedObjects)
true, objects received will be checked for validitycheckFetchedObjects - whether to check objects for validitythispublic boolean isRemoveDeletedRefs()
public FetchCommand setRemoveDeletedRefs(boolean removeDeletedRefs)
true, refs are removed which no longer exist in the
sourceremoveDeletedRefs - whether to remove deleted Refsthispublic ProgressMonitor getProgressMonitor()
public FetchCommand setProgressMonitor(ProgressMonitor monitor)
NullProgressMonitormonitor - a ProgressMonitorthisNullProgressMonitorpublic FetchCommand setRefSpecs(String... specs)
specs - String representation of RefSpecsthispublic FetchCommand setRefSpecs(RefSpec... specs)
specs - one or multiple RefSpecsthispublic FetchCommand setRefSpecs(List<RefSpec> specs)
specs - list of RefSpecsthispublic boolean isDryRun()
public FetchCommand setDryRun(boolean dryRun)
dryRun - whether to do a dry runthispublic boolean isThin()
public FetchCommand setThin(boolean thin)
thin - the thin-pack preferencethispublic FetchCommand setTagOpt(TagOpt tagOpt)
tagOpt - the TagOptthispublic FetchCommand setCallback(FetchCommand.Callback callback)
callback - the callbackthispublic boolean isForceUpdate()
public FetchCommand setForceUpdate(boolean force)
force - whether to update refs affected by the fetch forcefullyCopyright © 2018 Eclipse JGit Project. All rights reserved.