public class MergeCommand extends GitCommand<MergeResult>
Merge
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 |
MergeCommand(Repository repo) |
Modifier and Type | Method and Description |
---|---|
MergeResult |
call()
Executes the
Merge command with all the options and parameters
collected by the setter methods (e.g. |
MergeCommand |
include(AnyObjectId commit) |
MergeCommand |
include(Ref commit) |
MergeCommand |
include(java.lang.String name,
AnyObjectId commit) |
MergeCommand |
setSquash(boolean squash)
If
true , will prepare the next commit in working tree and
index as if a real merge happened, but do not make the commit or move the
HEAD. |
MergeCommand |
setStrategy(MergeStrategy mergeStrategy) |
checkCallable, getRepository, setCallable
protected MergeCommand(Repository repo)
repo
- public MergeResult call() throws GitAPIException, NoHeadException, ConcurrentRefUpdateException, CheckoutConflictException, InvalidMergeHeadsException, WrongRepositoryStateException, NoMessageException
Merge
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<MergeResult>
call
in class GitCommand<MergeResult>
GitAPIException
- or subclass thereof when an error occursNoHeadException
ConcurrentRefUpdateException
CheckoutConflictException
InvalidMergeHeadsException
WrongRepositoryStateException
NoMessageException
public MergeCommand setStrategy(MergeStrategy mergeStrategy)
mergeStrategy
- the MergeStrategy
to be usedthis
public MergeCommand include(Ref commit)
commit
- a reference to a commit which is merged with the current headthis
public MergeCommand include(AnyObjectId commit)
commit
- the Id of a commit which is merged with the current headthis
public MergeCommand include(java.lang.String name, AnyObjectId commit)
name
- a name given to the commitcommit
- the Id of a commit which is merged with the current headthis
public MergeCommand setSquash(boolean squash)
true
, will prepare the next commit in working tree and
index as if a real merge happened, but do not make the commit or move the
HEAD. Otherwise, perform the merge and commit the result.
In case the merge was successful but this flag was set to
true
a MergeResult
with status
MergeResult.MergeStatus.MERGED_SQUASHED
or
MergeResult.MergeStatus.FAST_FORWARD_SQUASHED
is returned.
squash
- whether to squash commits or notthis
Copyright © 2012. All Rights Reserved.