public class PullCommand extends TransportCommand<PullCommand,PullResult>
credentialsProvider, timeout, transportConfigCallback
repo
Modifier | Constructor and Description |
---|---|
protected |
PullCommand(Repository repo)
Constructor for PullCommand.
|
Modifier and Type | Method and Description |
---|---|
PullResult |
call() |
static BranchConfig.BranchRebaseMode |
getRebaseMode(String branchName,
Config config)
Reads the rebase mode to use for a pull command from the repository
configuration.
|
String |
getRemote()
Get the remote name used for pull operation
|
String |
getRemoteBranchName()
Get the remote branch name for the pull operation
|
PullCommand |
setFastForward(MergeCommand.FastForwardMode fastForwardMode)
Set the fast forward mode.
|
PullCommand |
setProgressMonitor(ProgressMonitor monitor)
Set progress monitor
|
PullCommand |
setRebase(boolean useRebase)
Set if rebase should be used after fetching.
|
PullCommand |
setRebase(BranchConfig.BranchRebaseMode rebaseMode)
Sets the
BranchConfig.BranchRebaseMode to
use after fetching. |
PullCommand |
setRecurseSubmodules(SubmoduleConfig.FetchRecurseSubmodulesMode recurse)
Set the mode to be used for recursing into submodules.
|
PullCommand |
setRemote(String remote)
The remote (uri or name) to be used for the pull operation.
|
PullCommand |
setRemoteBranchName(String remoteBranchName)
The remote branch name to be used for the pull operation.
|
PullCommand |
setStrategy(MergeStrategy strategy)
Set the @{code MergeStrategy}
|
PullCommand |
setTagOpt(TagOpt tagOpt)
Set the specification of annotated tag behavior during fetch
|
configure, configure, self, setCredentialsProvider, setTimeout, setTransportConfigCallback
checkCallable, getRepository, setCallable
protected PullCommand(Repository repo)
repo
- the Repository
public PullCommand setProgressMonitor(ProgressMonitor monitor)
monitor
- a progress monitorpublic PullCommand setRebase(boolean useRebase)
If set to false, merge is used after fetching, overriding the configuration file. This is equivalent to --no-rebase on the command line.
This setting overrides the settings in the configuration file. By default, the setting in the repository configuration file is used.
A branch can be configured to use rebase by default. See branch.[name].rebase and branch.autosetuprebase.
useRebase
- whether to use rebase after fetchingthis
public PullCommand setRebase(BranchConfig.BranchRebaseMode rebaseMode)
BranchConfig.BranchRebaseMode
to
use after fetching.
--rebase
on the command line: use rebase
instead of merge after fetching.--preserve-merges
on the command line: rebase
preserving local merge commits.--interactive
on the command line: use
interactive rebase.--no-rebase
: merge instead of rebasing.
null
branch.[name].rebase
or, if not set, pull.rebase
A branch can be configured to use rebase by default. See
branch.[name].rebase
, branch.autosetuprebase
, and
pull.rebase
.
rebaseMode
- the BranchConfig.BranchRebaseMode
to usethis
public PullResult call() throws GitAPIException, WrongRepositoryStateException, InvalidConfigurationException, InvalidRemoteException, CanceledException, RefNotFoundException, RefNotAdvertisedException, NoHeadException, TransportException
Execute the command
Execute the Pull
command with all the options and parameters
collected by the setter methods (e.g.
setProgressMonitor(ProgressMonitor)
) of this class. Each
instance of this class should only be used for one invocation of the
command. Don't call this method twice on an instance.
call
in interface Callable<PullResult>
call
in class GitCommand<PullResult>
GitAPIException
WrongRepositoryStateException
InvalidConfigurationException
InvalidRemoteException
CanceledException
RefNotFoundException
RefNotAdvertisedException
NoHeadException
TransportException
public PullCommand setRemote(String remote)
Constants.DEFAULT_REMOTE_NAME
will be used.remote
- name of the remote to pull fromthis
Constants.DEFAULT_REMOTE_NAME
public PullCommand setRemoteBranchName(String remoteBranchName)
remoteBranchName
- remote branch name to be used for pull operationthis
public String getRemote()
public String getRemoteBranchName()
public PullCommand setStrategy(MergeStrategy strategy)
strategy
- The merge strategy to use during this pull operation.this
public PullCommand setTagOpt(TagOpt tagOpt)
tagOpt
- the TagOpt
this
public PullCommand setFastForward(@Nullable MergeCommand.FastForwardMode fastForwardMode)
null
takes precedence over the
fast-forward mode configured in git config.fastForwardMode
- corresponds to the --ff/--no-ff/--ff-only options. If
null
use the value of pull.ff
configured in
git config. If pull.ff
is not configured fall back to
the value of merge.ff
. If merge.ff
is not
configured --ff is the built-in default.this
public PullCommand setRecurseSubmodules(@Nullable SubmoduleConfig.FetchRecurseSubmodulesMode recurse)
recurse
- the
SubmoduleConfig.FetchRecurseSubmodulesMode
to be used for recursing into submodulesthis
FetchCommand#setRecurseSubmodules(FetchRecurseSubmodulesMode)
public static BranchConfig.BranchRebaseMode getRebaseMode(String branchName, Config config)
branch.[branchName].rebase
, or,if not set, pull.rebase
.
If neither is set, yields
BranchConfig.BranchRebaseMode.NONE
.branchName
- name of the local branchconfig
- the Config
to read the value fromBranchConfig.BranchRebaseMode
Copyright © 2019 Eclipse JGit Project. All rights reserved.