public class ResetCommand extends GitCommand<Ref>
Reset 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 | Class and Description |
|---|---|
static class |
ResetCommand.ResetType
Kind of reset
|
| Modifier and Type | Field and Description |
|---|---|
private java.util.Collection<java.lang.String> |
filepaths |
private boolean |
isReflogDisabled |
private ResetCommand.ResetType |
mode |
private ProgressMonitor |
monitor |
private java.lang.String |
ref |
repo| Constructor and Description |
|---|
ResetCommand(Repository repo)
Constructor for ResetCommand.
|
| Modifier and Type | Method and Description |
|---|---|
ResetCommand |
addPath(java.lang.String path)
Repository relative path of file or directory to reset
|
Ref |
call() |
private void |
checkoutIndex(ObjectId commitTree) |
ResetCommand |
disableRefLog(boolean disable)
Whether to disable reflog
|
private java.lang.String |
getRefOrHEAD() |
boolean |
isReflogDisabled()
Whether reflog is disabled
|
private RevCommit |
parseCommit(ObjectId commitId) |
private void |
resetCherryPick() |
private void |
resetIndex(ObjectId commitTree) |
private void |
resetIndexForPaths(ObjectId commitTree) |
private void |
resetMerge() |
private void |
resetRevert() |
private ObjectId |
resolveRefToCommitId() |
ResetCommand |
setMode(ResetCommand.ResetType mode)
Set the reset mode
|
ResetCommand |
setProgressMonitor(ProgressMonitor monitor)
The progress monitor associated with the reset operation.
|
ResetCommand |
setRef(java.lang.String ref)
Set the name of the
Ref to reset to |
java.lang.String |
toString() |
checkCallable, getRepository, setCallableprivate java.lang.String ref
private ResetCommand.ResetType mode
private java.util.Collection<java.lang.String> filepaths
private boolean isReflogDisabled
private ProgressMonitor monitor
public ResetCommand(Repository repo)
Constructor for ResetCommand.
repo - the Repositorypublic Ref call() throws GitAPIException, CheckoutConflictException
Execute the command
Executes the Reset command. 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<Ref>call in class GitCommand<Ref>GitAPIExceptionCheckoutConflictExceptionprivate ObjectId resolveRefToCommitId()
public ResetCommand setRef(java.lang.String ref)
Ref to reset toref - the ref to reset to, defaults to HEAD if not specifiedpublic ResetCommand setMode(ResetCommand.ResetType mode)
mode - the mode of the reset commandpublic ResetCommand addPath(java.lang.String path)
path - repository-relative path of file/directory to reset (with
/ as separator)public ResetCommand disableRefLog(boolean disable)
disable - if true disables writing a reflog entry for this reset
commandpublic boolean isReflogDisabled()
true if writing reflog is disabled for this reset commandprivate java.lang.String getRefOrHEAD()
public ResetCommand setProgressMonitor(ProgressMonitor monitor)
NullProgressMonitormonitor - a ProgressMonitorthisNullProgressMonitorprivate void resetIndexForPaths(ObjectId commitTree)
private void resetIndex(ObjectId commitTree) throws java.io.IOException
java.io.IOExceptionprivate void checkoutIndex(ObjectId commitTree) throws java.io.IOException, GitAPIException
java.io.IOExceptionGitAPIExceptionprivate void resetMerge()
throws java.io.IOException
java.io.IOExceptionprivate void resetCherryPick()
throws java.io.IOException
java.io.IOExceptionprivate void resetRevert()
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.Object