public class RevertCommand extends GitCommand<RevCommit>
revert
command. It has setters for all
supported options and arguments of this command and a call()
method
to finally execute the command. Each instance of this class should only be
used for one invocation of the command (means: one call to call()
)Modifier and Type | Field and Description |
---|---|
private java.util.List<Ref> |
commits |
private MergeResult |
failingResult |
private ProgressMonitor |
monitor |
private java.lang.String |
ourCommitName |
private java.util.List<Ref> |
revertedRefs |
private MergeStrategy |
strategy |
private java.util.List<java.lang.String> |
unmergedPaths |
repo
Modifier | Constructor and Description |
---|---|
protected |
RevertCommand(Repository repo)
Constructor for RevertCommand.
|
Modifier and Type | Method and Description |
---|---|
private java.lang.String |
calculateOurName(Ref headRef) |
RevCommit |
call() |
MergeResult |
getFailingResult()
Get the result of a merge failure
|
java.util.List<Ref> |
getRevertedRefs()
Get the list of successfully reverted
Ref 's. |
java.util.List<java.lang.String> |
getUnmergedPaths()
Get unmerged paths
|
RevertCommand |
include(AnyObjectId commit)
Include a commit to be reverted
|
RevertCommand |
include(Ref commit)
Include a
Ref to a commit to be reverted |
RevertCommand |
include(java.lang.String name,
AnyObjectId commit)
Include a commit to be reverted
|
RevertCommand |
setOurCommitName(java.lang.String ourCommitName)
Set the name to be used in the "OURS" place for conflict markers
|
RevertCommand |
setProgressMonitor(ProgressMonitor monitor)
The progress monitor associated with the revert operation.
|
RevertCommand |
setStrategy(MergeStrategy strategy)
Set the merge strategy to use for this revert command
|
checkCallable, getRepository, setCallable
private java.util.List<Ref> commits
private java.lang.String ourCommitName
private java.util.List<Ref> revertedRefs
private MergeResult failingResult
private java.util.List<java.lang.String> unmergedPaths
private MergeStrategy strategy
private ProgressMonitor monitor
protected RevertCommand(Repository repo)
Constructor for RevertCommand.
repo
- the Repository
public RevCommit call() throws NoMessageException, UnmergedPathsException, ConcurrentRefUpdateException, WrongRepositoryStateException, GitAPIException
Execute the command
Executes the revert
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.
call
in interface java.util.concurrent.Callable<RevCommit>
call
in class GitCommand<RevCommit>
NoMessageException
UnmergedPathsException
ConcurrentRefUpdateException
WrongRepositoryStateException
GitAPIException
public RevertCommand include(Ref commit)
Ref
to a commit to be revertedcommit
- a reference to a commit to be reverted into the current headthis
public RevertCommand include(AnyObjectId commit)
commit
- the Id of a commit to be reverted into the current headthis
public RevertCommand include(java.lang.String name, AnyObjectId commit)
name
- name of a Ref
referring to the commitcommit
- the Id of a commit which is reverted into the current headthis
public RevertCommand setOurCommitName(java.lang.String ourCommitName)
ourCommitName
- the name that should be used in the "OURS" place for conflict
markersthis
private java.lang.String calculateOurName(Ref headRef)
public java.util.List<Ref> getRevertedRefs()
Ref
's.Ref
's. Never null
but
maybe an empty list if no commit was successfully cherry-pickedpublic MergeResult getFailingResult()
null
if no merge
failure occurred during the revertpublic java.util.List<java.lang.String> getUnmergedPaths()
public RevertCommand setStrategy(MergeStrategy strategy)
strategy
- The merge strategy to use for this revert command.this
public RevertCommand setProgressMonitor(ProgressMonitor monitor)
NullProgressMonitor
monitor
- a ProgressMonitor
this
NullProgressMonitor