Package org.eclipse.jgit.api
Class PullCommand
- java.lang.Object
-
- org.eclipse.jgit.api.GitCommand<T>
-
- org.eclipse.jgit.api.TransportCommand<PullCommand,PullResult>
-
- org.eclipse.jgit.api.PullCommand
-
- All Implemented Interfaces:
Callable<PullResult>
public class PullCommand extends TransportCommand<PullCommand,PullResult>
The Pull command- See Also:
- Git documentation about Pull
-
-
Field Summary
-
Fields inherited from class org.eclipse.jgit.api.TransportCommand
credentialsProvider, timeout, transportConfigCallback
-
Fields inherited from class org.eclipse.jgit.api.GitCommand
repo
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PullCommand(Repository repo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PullResult
call()
Executes thePull
command with all the options and parameters collected by the setter methods (e.g.String
getRemote()
String
getRemoteBranchName()
PullCommand
setProgressMonitor(ProgressMonitor monitor)
PullCommand
setRebase(boolean useRebase)
Set if rebase should be used after fetching.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)
-
Methods inherited from class org.eclipse.jgit.api.TransportCommand
configure, configure, self, setCredentialsProvider, setTimeout, setTransportConfigCallback
-
Methods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
-
-
-
Constructor Detail
-
PullCommand
protected PullCommand(Repository repo)
- Parameters:
repo
-
-
-
Method Detail
-
setProgressMonitor
public PullCommand setProgressMonitor(ProgressMonitor monitor)
- Parameters:
monitor
- a progress monitor- Returns:
- this instance
-
setRebase
public PullCommand setRebase(boolean useRebase)
Set if rebase should be used after fetching. If set to true, rebase is used instead of merge. This is equivalent to --rebase on the command line.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.
- Parameters:
useRebase
-- Returns:
this
-
call
public PullResult call() throws GitAPIException, WrongRepositoryStateException, InvalidConfigurationException, DetachedHeadException, InvalidRemoteException, CanceledException, RefNotFoundException, NoHeadException, TransportException
Executes thePull
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.- Specified by:
call
in interfaceCallable<PullResult>
- Specified by:
call
in classGitCommand<PullResult>
- Returns:
- the result of the pull
- Throws:
WrongRepositoryStateException
InvalidConfigurationException
DetachedHeadException
InvalidRemoteException
CanceledException
RefNotFoundException
NoHeadException
TransportException
GitAPIException
-
setRemote
public PullCommand setRemote(String remote)
The remote (uri or name) to be used for the pull operation. If no remote is set, the branch's configuration will be used. If the branch configuration is missing the default value ofConstants.DEFAULT_REMOTE_NAME
will be used.- Parameters:
remote
-- Returns:
this
- Since:
- 3.3
- See Also:
Constants.DEFAULT_REMOTE_NAME
-
setRemoteBranchName
public PullCommand setRemoteBranchName(String remoteBranchName)
The remote branch name to be used for the pull operation. If no remoteBranchName is set, the branch's configuration will be used. If the branch configuration is missing the remote branch with the same name as the current branch is used.- Parameters:
remoteBranchName
-- Returns:
this
- Since:
- 3.3
-
getRemote
public String getRemote()
- Returns:
- the remote used for the pull operation if it was set explicitly
- Since:
- 3.3
-
getRemoteBranchName
public String getRemoteBranchName()
- Returns:
- the remote branch name used for the pull operation if it was set explicitly
- Since:
- 3.3
-
setStrategy
public PullCommand setStrategy(MergeStrategy strategy)
- Parameters:
strategy
- The merge strategy to use during this pull operation.- Returns:
this
- Since:
- 3.4
-
-