Package org.eclipse.jgit.api
Class RevertCommand
- java.lang.Object
-
- org.eclipse.jgit.api.GitCommand<RevCommit>
-
- org.eclipse.jgit.api.RevertCommand
-
- All Implemented Interfaces:
java.util.concurrent.Callable<RevCommit>
public class RevertCommand extends GitCommand<RevCommit>
A class used to execute arevert
command. 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 protected
RevertCommand(Repository repo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RevCommit
call()
Executes therevert
command with all the options and parameters collected by the setter methods (e.g.MergeResult
getFailingResult()
java.util.List<Ref>
getRevertedRefs()
java.util.List<java.lang.String>
getUnmergedPaths()
RevertCommand
include(java.lang.String name, AnyObjectId commit)
RevertCommand
include(AnyObjectId commit)
RevertCommand
include(Ref commit)
RevertCommand
setOurCommitName(java.lang.String ourCommitName)
RevertCommand
setStrategy(MergeStrategy strategy)
-
Methods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
-
-
-
Constructor Detail
-
RevertCommand
protected RevertCommand(Repository repo)
- Parameters:
repo
-
-
-
Method Detail
-
call
public RevCommit call() throws NoMessageException, UnmergedPathsException, ConcurrentRefUpdateException, WrongRepositoryStateException, GitAPIException
Executes therevert
command 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:
call
in interfacejava.util.concurrent.Callable<RevCommit>
- Specified by:
call
in classGitCommand<RevCommit>
- Returns:
- on success the
RevCommit
pointed to by the new HEAD is returned. If a failure occurred during revertnull
is returned. The list of successfully revertedRef
's can be obtained by callinggetRevertedRefs()
- Throws:
GitAPIException
WrongRepositoryStateException
ConcurrentRefUpdateException
UnmergedPathsException
NoMessageException
-
include
public RevertCommand include(Ref commit)
- Parameters:
commit
- a reference to a commit which is reverted into the current head- Returns:
this
-
include
public RevertCommand include(AnyObjectId commit)
- Parameters:
commit
- the Id of a commit which is reverted into the current head- Returns:
this
-
include
public RevertCommand include(java.lang.String name, AnyObjectId commit)
- Parameters:
name
- a name given to the commitcommit
- the Id of a commit which is reverted into the current head- Returns:
this
-
setOurCommitName
public RevertCommand setOurCommitName(java.lang.String ourCommitName)
- Parameters:
ourCommitName
- the name that should be used in the "OURS" place for conflict markers- Returns:
this
-
getRevertedRefs
public java.util.List<Ref> getRevertedRefs()
- Returns:
- the list of successfully reverted
Ref
's. Nevernull
but maybe an empty list if no commit was successfully cherry-picked
-
getFailingResult
public MergeResult getFailingResult()
- Returns:
- the result of the merge failure,
null
if no merge failure occurred during the revert
-
getUnmergedPaths
public java.util.List<java.lang.String> getUnmergedPaths()
- Returns:
- the unmerged paths, will be null if no merge conflicts
-
setStrategy
public RevertCommand setStrategy(MergeStrategy strategy)
- Parameters:
strategy
- The merge strategy to use during this revert command.- Returns:
this
- Since:
- 3.4
-
-