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()
)repo
Modifier | Constructor and Description |
---|---|
protected |
CherryPickCommand(Repository repo)
Constructor for CherryPickCommand
|
Modifier and Type | Method and Description |
---|---|
CherryPickResult |
call() |
CherryPickCommand |
include(AnyObjectId commit)
Include a commit
|
CherryPickCommand |
include(Ref commit)
Include a reference to a commit
|
CherryPickCommand |
include(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(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(String prefix)
Set the prefix to use in the reflog.
|
CherryPickCommand |
setStrategy(MergeStrategy strategy)
Set the
MergeStrategy |
String |
toString() |
checkCallable, getRepository, setCallable
protected CherryPickCommand(Repository repo)
repo
- the Repository
public 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 Callable<CherryPickResult>
call
in class GitCommand<CherryPickResult>
GitAPIException
NoMessageException
UnmergedPathsException
ConcurrentRefUpdateException
WrongRepositoryStateException
NoHeadException
public CherryPickCommand include(Ref commit)
commit
- a reference to a commit which is cherry-picked to the current
headthis
public CherryPickCommand include(AnyObjectId commit)
commit
- the Id of a commit which is cherry-picked to the current headthis
public CherryPickCommand include(String name, AnyObjectId commit)
name
- a name given to the commitcommit
- the Id of a commit which is cherry-picked to the current headthis
public CherryPickCommand setOurCommitName(String ourCommitName)
ourCommitName
- the name that should be used in the "OURS" place for conflict
markersthis
public CherryPickCommand setReflogPrefix(String prefix)
This is primarily needed for implementing rebase in terms of cherry-picking
prefix
- including ":"this
public CherryPickCommand setStrategy(MergeStrategy strategy)
MergeStrategy
strategy
- The merge strategy to use during this Cherry-pick.this
public CherryPickCommand setMainlineParentNumber(int mainlineParentNumber)
mainlineParentNumber
- the (1-based) parent number to diff against. This allows
cherry-picking of merges.this
public 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)this
public CherryPickCommand setProgressMonitor(ProgressMonitor monitor)
NullProgressMonitor
monitor
- a ProgressMonitor
this
NullProgressMonitor
Copyright © 2020 Eclipse JGit Project. All rights reserved.