MergeTip: Clarify what null means

CherryPick was using a null MergeTip instance where the other
strategies were creating a non-null instance whose current tip was set
to null. Fix the documentation (and CherryPick), explicitly mentioning
a null tip as referring to a branch that is unborn at the start of the
merge operation.

Change-Id: Ie3b5e9e2ae3a9fb62827a10f0577d708fb14a8cc
This commit is contained in:
Dave Borowitz
2015-02-17 16:15:39 -08:00
parent 5d9fc0ce21
commit d89a1cccae
2 changed files with 27 additions and 13 deletions

View File

@@ -66,13 +66,12 @@ public class CherryPick extends SubmitStrategy {
@Override
protected MergeTip _run(CodeReviewCommit branchTip,
Collection<CodeReviewCommit> toMerge) throws MergeException {
MergeTip mergeTip = branchTip != null
? new MergeTip(branchTip, toMerge) : null;
MergeTip mergeTip = new MergeTip(branchTip, toMerge);
List<CodeReviewCommit> sorted = CodeReviewCommit.ORDER.sortedCopy(toMerge);
while (!sorted.isEmpty()) {
CodeReviewCommit n = sorted.remove(0);
try {
if (mergeTip == null) {
if (mergeTip.getCurrentTip() == null) {
mergeTip = cherryPickUnbornRoot(n);
} else if (n.getParentCount() == 0) {
cherryPickRootOntoBranch(n);