Package org.eclipse.jgit.api
Class RevertCommand
- java.lang.Object
-
- org.eclipse.jgit.api.GitCommand<RevCommit>
-
- org.eclipse.jgit.api.RevertCommand
-
public class RevertCommand extends GitCommand<RevCommit>
A class used to execute arevertcommand. It has setters for all supported options and arguments of this command and acall()method to finally execute the command. Each instance of this class should only be used for one invocation of the command (means: one call tocall())- See Also:
- Git documentation about revert
-
-
Field Summary
-
Fields inherited from class org.eclipse.jgit.api.GitCommand
repo
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRevertCommand(Repository repo)Constructor for RevertCommand.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RevCommitcall()MergeResultgetFailingResult()Get the result of a merge failureList<Ref>getRevertedRefs()Get the list of successfully revertedRef's.List<String>getUnmergedPaths()Get unmerged pathsRevertCommandinclude(String name, AnyObjectId commit)Include a commit to be revertedRevertCommandinclude(AnyObjectId commit)Include a commit to be revertedRevertCommandinclude(Ref commit)Include aRefto a commit to be revertedRevertCommandsetOurCommitName(String ourCommitName)Set the name to be used in the "OURS" place for conflict markersRevertCommandsetProgressMonitor(ProgressMonitor monitor)The progress monitor associated with the revert operation.RevertCommandsetStrategy(MergeStrategy strategy)Set the merge strategy to use for this revert command-
Methods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
-
-
-
Constructor Detail
-
RevertCommand
protected RevertCommand(Repository repo)
Constructor for RevertCommand.
- Parameters:
repo- theRepository
-
-
Method Detail
-
call
public RevCommit call() throws NoMessageException, UnmergedPathsException, ConcurrentRefUpdateException, WrongRepositoryStateException, GitAPIException
Execute the command
Executes the
revertcommand with all the options and parameters collected by the setter methods (e.g.include(Ref)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:
callin interfaceCallable<RevCommit>- Specified by:
callin classGitCommand<RevCommit>- Throws:
NoMessageExceptionUnmergedPathsExceptionConcurrentRefUpdateExceptionWrongRepositoryStateExceptionGitAPIException
-
include
public RevertCommand include(Ref commit)
Include aRefto a commit to be reverted- Parameters:
commit- a reference to a commit to be reverted into the current head- Returns:
this
-
include
public RevertCommand include(AnyObjectId commit)
Include a commit to be reverted- Parameters:
commit- the Id of a commit to be reverted into the current head- Returns:
this
-
include
public RevertCommand include(String name, AnyObjectId commit)
Include a commit to be reverted- Parameters:
name- name of aRefreferring to the commitcommit- the Id of a commit which is reverted into the current head- Returns:
this
-
setOurCommitName
public RevertCommand setOurCommitName(String ourCommitName)
Set the name to be used in the "OURS" place for conflict markers- Parameters:
ourCommitName- the name that should be used in the "OURS" place for conflict markers- Returns:
this
-
getRevertedRefs
public List<Ref> getRevertedRefs()
Get the list of successfully revertedRef's.- Returns:
- the list of successfully reverted
Ref's. Nevernullbut maybe an empty list if no commit was successfully cherry-picked
-
getFailingResult
public MergeResult getFailingResult()
Get the result of a merge failure- Returns:
- the result of a merge failure,
nullif no merge failure occurred during the revert
-
getUnmergedPaths
public List<String> getUnmergedPaths()
Get unmerged paths- Returns:
- the unmerged paths, will be null if no merge conflicts
-
setStrategy
public RevertCommand setStrategy(MergeStrategy strategy)
Set the merge strategy to use for this revert command- Parameters:
strategy- The merge strategy to use for this revert command.- Returns:
this- Since:
- 3.4
-
setProgressMonitor
public RevertCommand setProgressMonitor(ProgressMonitor monitor)
The progress monitor associated with the revert operation. By default, this is set toNullProgressMonitor- Parameters:
monitor- aProgressMonitor- Returns:
this- Since:
- 4.11
- See Also:
NullProgressMonitor
-
-