Fix errors in MergeOp when using CherryPick
Commit31050f2
adds a feature to make sure the Gerrit web UI is aware of the cherry-picked commit used as the final patch set in a change. However, we weren't including the submit approval on that last patch set, which caused a NPE when merging the change. For more discussion of this bug see http://groups.google.com/group/repo-discuss/browse_thread/thread/975c57d88806f903 Also with31050f2
, there was another bug that would cause review scores from all previous patch sets to show up on the final commit. For example, if Alice gave patch set 1 a +1 score and didn't give patch set 2 a score at all, her +1 would show up when patch set 2 is submitted and patch set 3 is generated by Gerrit. This bug is also now fixed. Signed-off-by: Brad Larson <bklarson@gmail.com> Change-Id: I492b588c31f6d81ce63e90967dfec5b823721ed4
This commit is contained in:
@@ -800,8 +800,9 @@ public class MergeOp {
|
||||
}
|
||||
|
||||
PatchSetApproval submitAudit = null;
|
||||
List<PatchSetApproval> approvalList = null;
|
||||
try {
|
||||
final List<PatchSetApproval> approvalList =
|
||||
approvalList =
|
||||
schema.patchSetApprovals().byPatchSet(n.patchsetId).toList();
|
||||
Collections.sort(approvalList, new Comparator<PatchSetApproval>() {
|
||||
public int compare(final PatchSetApproval a, final PatchSetApproval b) {
|
||||
@@ -915,10 +916,8 @@ public class MergeOp {
|
||||
}
|
||||
});
|
||||
|
||||
for (PatchSetApproval a : schema.patchSetApprovals().byChange(
|
||||
n.change.getId())) {
|
||||
// ApprovalCategory.SUBMIT is still in db but not relevant in git-store
|
||||
if (!ApprovalCategory.SUBMIT.equals(a.getCategoryId())) {
|
||||
if (approvalList != null) {
|
||||
for (PatchSetApproval a : approvalList) {
|
||||
schema.patchSetApprovals().insert(
|
||||
Collections.singleton(new PatchSetApproval(ps.getId(), a)));
|
||||
}
|
||||
|
Reference in New Issue
Block a user