Added copyAllScoresIfNoChange

Covers the case when nothing has changed except the commit
of the rebased patch set. This is possible when a patch set is
rebased on target branch.

With this patch, when PS1 is rebased (without modification) to PS2
the Verified+1 and Code-Review+2 will be copied since PS1 and PS2 are
effectively the same change with different commits.

----- (B) ----- (B+M) ----- (B+M-M)
        \                       \
         ----- (PS1)             ----- (PS2)

Change-Id: I6a8ebd3c83ca6167cfc826267a057a871c752ff6
This commit is contained in:
Zalan Blenessy
2015-02-13 14:06:57 +01:00
committed by David Pursehouse
parent f62a233cc4
commit ae4768654e
9 changed files with 68 additions and 17 deletions

View File

@@ -16,6 +16,7 @@ package com.google.gerrit.server;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.gerrit.server.change.ChangeKind.NO_CODE_CHANGE;
import static com.google.gerrit.server.change.ChangeKind.NO_CHANGE;
import static com.google.gerrit.server.change.ChangeKind.TRIVIAL_REBASE;
import com.google.common.collect.HashBasedTable;
@@ -164,7 +165,8 @@ public class ApprovalCopier {
return true;
}
return (type.isCopyAllScoresOnTrivialRebase() && kind == TRIVIAL_REBASE)
|| (type.isCopyAllScoresIfNoCodeChange() && kind == NO_CODE_CHANGE);
|| (type.isCopyAllScoresIfNoCodeChange() && kind == NO_CODE_CHANGE)
|| (type.isCopyAllScoresIfNoChange() && kind == NO_CHANGE);
}
private static PatchSetApproval copy(PatchSetApproval src, PatchSet.Id psId) {