public abstract class SubmitStrategy
extends java.lang.Object
A submit strategy for a certain SubmitType
defines how the submitted
commits should be merged.
Modifier and Type | Field and Description |
---|---|
protected com.google.gerrit.server.git.strategy.SubmitStrategy.Arguments |
args |
Modifier and Type | Method and Description |
---|---|
protected abstract MergeTip |
_run(CodeReviewCommit currentTip,
java.util.Collection<CodeReviewCommit> toMerge) |
abstract boolean |
dryRun(CodeReviewCommit mergeTip,
CodeReviewCommit toMerge)
Checks whether the given commit can be merged.
|
java.util.Map<com.google.gerrit.reviewdb.client.Change.Id,CodeReviewCommit> |
getNewCommits()
Returns all commits that have been newly created for the changes that are
getting merged.
|
org.eclipse.jgit.lib.PersonIdent |
getRefLogIdent()
Returns the identity that should be used for reflog entries when updating
the destination branch.
|
boolean |
retryOnLockFailure()
Returns whether a merge that failed with
RefUpdate.Result.LOCK_FAILURE should
be retried. |
MergeTip |
run(CodeReviewCommit currentTip,
java.util.Collection<CodeReviewCommit> toMerge)
Runs this submit strategy.
|
protected void |
setRefLogIdent(com.google.gerrit.reviewdb.client.PatchSetApproval submitApproval)
Set the ref log identity if it wasn't set yet.
|
protected final com.google.gerrit.server.git.strategy.SubmitStrategy.Arguments args
public final MergeTip run(CodeReviewCommit currentTip, java.util.Collection<CodeReviewCommit> toMerge) throws MergeException
If possible, the provided commits will be merged with this submit strategy.
currentTip
- the mergeTiptoMerge
- the list of submitted commits that should be merged using
this submit strategy. Implementations are responsible for ordering
of commits, and should not modify the input in place.MergeException
protected abstract MergeTip _run(CodeReviewCommit currentTip, java.util.Collection<CodeReviewCommit> toMerge) throws MergeException
MergeException
run(CodeReviewCommit, Collection)
public abstract boolean dryRun(CodeReviewCommit mergeTip, CodeReviewCommit toMerge) throws MergeException
mergeTip
- the merge tip.toMerge
- the commit that should be checked.true
if the given commit can be merged, otherwise
false
MergeException
public final org.eclipse.jgit.lib.PersonIdent getRefLogIdent()
The reflog identity may only be set during run(CodeReviewCommit,
Collection)
, and this method is invalid to call beforehand.
null
.public java.util.Map<com.google.gerrit.reviewdb.client.Change.Id,CodeReviewCommit> getNewCommits()
By default this method returns an empty map, but subclasses may override
this method to provide any newly created commits.
This method may only be called after run(CodeReviewCommit,
Collection)
.
public boolean retryOnLockFailure()
RefUpdate.Result.LOCK_FAILURE
should
be retried.
May be overridden by subclasses.
true
if a merge that failed with
RefUpdate.Result.LOCK_FAILURE
should be retried, otherwise
false
protected final void setRefLogIdent(com.google.gerrit.reviewdb.client.PatchSetApproval submitApproval)
submitApproval
- the approval that submitted the patch set