public class CherryPickCommand extends GitCommand<CherryPickResult>
cherry-pick 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 java.lang.Integer |
mainlineParentNumber |
private ProgressMonitor |
monitor |
private boolean |
noCommit |
private java.lang.String |
ourCommitName |
private java.lang.String |
reflogPrefix |
private MergeStrategy |
strategy |
repo| Modifier | Constructor and Description |
|---|---|
protected |
CherryPickCommand(Repository repo)
Constructor for CherryPickCommand
|
| Modifier and Type | Method and Description |
|---|---|
private java.lang.String |
calculateOurName(Ref headRef) |
CherryPickResult |
call() |
private RevCommit |
getParentCommit(RevCommit srcCommit,
RevWalk revWalk) |
CherryPickCommand |
include(AnyObjectId commit)
Include a commit
|
CherryPickCommand |
include(Ref commit)
Include a reference to a commit
|
CherryPickCommand |
include(java.lang.String name,
AnyObjectId commit)
Include a commit
|
CherryPickCommand |
setMainlineParentNumber(int mainlineParentNumber)
Set the (1-based) parent number to diff against
|
CherryPickCommand |
setNoCommit(boolean noCommit)
Allows cherry-picking changes without committing them.
|
CherryPickCommand |
setOurCommitName(java.lang.String ourCommitName)
Set the name that should be used in the "OURS" place for conflict markers
|
CherryPickCommand |
setProgressMonitor(ProgressMonitor monitor)
The progress monitor associated with the cherry-pick operation.
|
CherryPickCommand |
setReflogPrefix(java.lang.String prefix)
Set the prefix to use in the reflog.
|
CherryPickCommand |
setStrategy(MergeStrategy strategy)
Set the
MergeStrategy |
java.lang.String |
toString() |
checkCallable, getRepository, setCallableprivate java.lang.String reflogPrefix
private java.util.List<Ref> commits
private java.lang.String ourCommitName
private MergeStrategy strategy
private java.lang.Integer mainlineParentNumber
private boolean noCommit
private ProgressMonitor monitor
protected CherryPickCommand(Repository repo)
repo - the Repositorypublic CherryPickResult call() throws GitAPIException, NoMessageException, UnmergedPathsException, ConcurrentRefUpdateException, WrongRepositoryStateException, NoHeadException
Execute the command
Executes the Cherry-Pick 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<CherryPickResult>call in class GitCommand<CherryPickResult>GitAPIExceptionNoMessageExceptionUnmergedPathsExceptionConcurrentRefUpdateExceptionWrongRepositoryStateExceptionNoHeadExceptionprivate RevCommit getParentCommit(RevCommit srcCommit, RevWalk revWalk) throws MultipleParentsNotAllowedException, MissingObjectException, java.io.IOException
MultipleParentsNotAllowedExceptionMissingObjectExceptionjava.io.IOExceptionpublic CherryPickCommand include(Ref commit)
commit - a reference to a commit which is cherry-picked to the current
headthispublic CherryPickCommand include(AnyObjectId commit)
commit - the Id of a commit which is cherry-picked to the current headthispublic CherryPickCommand include(java.lang.String name, AnyObjectId commit)
name - a name given to the commitcommit - the Id of a commit which is cherry-picked to the current headthispublic CherryPickCommand setOurCommitName(java.lang.String ourCommitName)
ourCommitName - the name that should be used in the "OURS" place for conflict
markersthispublic CherryPickCommand setReflogPrefix(java.lang.String prefix)
This is primarily needed for implementing rebase in terms of cherry-picking
prefix - including ":"thispublic CherryPickCommand setStrategy(MergeStrategy strategy)
MergeStrategystrategy - The merge strategy to use during this Cherry-pick.thispublic CherryPickCommand setMainlineParentNumber(int mainlineParentNumber)
mainlineParentNumber - the (1-based) parent number to diff against. This allows
cherry-picking of merges.thispublic CherryPickCommand setNoCommit(boolean noCommit)
NOTE: The behavior of cherry-pick is undefined if you pick multiple commits or if HEAD does not match the index state before cherry-picking.
noCommit - true to cherry-pick without committing, false to commit after
each pick (default)thispublic CherryPickCommand setProgressMonitor(ProgressMonitor monitor)
NullProgressMonitormonitor - a ProgressMonitorthisNullProgressMonitorprivate java.lang.String calculateOurName(Ref headRef)
public java.lang.String toString()
toString in class java.lang.Object