Remove ReviewDb args from ApprovalsUtil
There was one call to a direct ReviewDb method, which is now a no-op and can be removed. Change-Id: Ifd70ca8515e0bd0eb5b0521ac2d14fa214fc1a5f
This commit is contained in:
@@ -38,7 +38,6 @@ import com.google.gerrit.reviewdb.client.LabelId;
|
||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
import com.google.gerrit.reviewdb.client.PatchSetApproval;
|
||||
import com.google.gerrit.reviewdb.client.PatchSetInfo;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.notedb.ChangeNotes;
|
||||
import com.google.gerrit.server.notedb.ChangeUpdate;
|
||||
import com.google.gerrit.server.notedb.ReviewerStateInternal;
|
||||
@@ -143,7 +142,6 @@ public class ApprovalsUtil {
|
||||
}
|
||||
|
||||
public List<PatchSetApproval> addReviewers(
|
||||
ReviewDb db,
|
||||
ChangeUpdate update,
|
||||
LabelTypes labelTypes,
|
||||
Change change,
|
||||
@@ -153,7 +151,6 @@ public class ApprovalsUtil {
|
||||
Collection<Account.Id> existingReviewers)
|
||||
throws OrmException {
|
||||
return addReviewers(
|
||||
db,
|
||||
update,
|
||||
labelTypes,
|
||||
change,
|
||||
@@ -165,7 +162,6 @@ public class ApprovalsUtil {
|
||||
}
|
||||
|
||||
public List<PatchSetApproval> addReviewers(
|
||||
ReviewDb db,
|
||||
ChangeNotes notes,
|
||||
ChangeUpdate update,
|
||||
LabelTypes labelTypes,
|
||||
@@ -184,11 +180,10 @@ public class ApprovalsUtil {
|
||||
}
|
||||
}
|
||||
return addReviewers(
|
||||
db, update, labelTypes, change, psId, null, null, wantReviewers, existingReviewers);
|
||||
update, labelTypes, change, psId, null, null, wantReviewers, existingReviewers);
|
||||
}
|
||||
|
||||
private List<PatchSetApproval> addReviewers(
|
||||
ReviewDb db,
|
||||
ChangeUpdate update,
|
||||
LabelTypes labelTypes,
|
||||
Change change,
|
||||
@@ -225,7 +220,6 @@ public class ApprovalsUtil {
|
||||
new PatchSetApproval.Key(psId, account, labelId), (short) 0, update.getWhen()));
|
||||
update.putReviewer(account, REVIEWER);
|
||||
}
|
||||
db.patchSetApprovals().upsert(cells);
|
||||
return Collections.unmodifiableList(cells);
|
||||
}
|
||||
|
||||
@@ -274,7 +268,6 @@ public class ApprovalsUtil {
|
||||
/**
|
||||
* Adds approvals to ChangeUpdate for a new patch set, and writes to NoteDb.
|
||||
*
|
||||
* @param db review database.
|
||||
* @param update change update.
|
||||
* @param labelTypes label types for the containing project.
|
||||
* @param ps patch set being approved.
|
||||
@@ -284,7 +277,6 @@ public class ApprovalsUtil {
|
||||
* @throws OrmException
|
||||
*/
|
||||
public Iterable<PatchSetApproval> addApprovalsForNewPatchSet(
|
||||
ReviewDb db,
|
||||
ChangeUpdate update,
|
||||
LabelTypes labelTypes,
|
||||
PatchSet ps,
|
||||
|
@@ -176,7 +176,6 @@ public class AddReviewersOp implements BatchUpdateOp {
|
||||
} else {
|
||||
addedReviewers =
|
||||
approvalsUtil.addReviewers(
|
||||
ctx.getDb(),
|
||||
ctx.getNotes(),
|
||||
ctx.getUpdate(change.currentPatchSetId()),
|
||||
projectCache.checkedGet(change.getProject()).getLabelTypes(change.getDest()),
|
||||
|
@@ -45,7 +45,6 @@ import com.google.gerrit.reviewdb.client.ChangeMessage;
|
||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
import com.google.gerrit.reviewdb.client.PatchSetApproval;
|
||||
import com.google.gerrit.reviewdb.client.PatchSetInfo;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.ApprovalsUtil;
|
||||
import com.google.gerrit.server.ChangeMessagesUtil;
|
||||
import com.google.gerrit.server.PatchSetUtil;
|
||||
@@ -389,7 +388,6 @@ public class ChangeInserter implements InsertChangeOp {
|
||||
throws RestApiException, OrmException, IOException, PermissionBackendException,
|
||||
ConfigInvalidException {
|
||||
change = ctx.getChange(); // Use defensive copy created by ChangeControl.
|
||||
ReviewDb db = ctx.getDb();
|
||||
patchSetInfo =
|
||||
patchSetInfoFactory.get(ctx.getRevWalk(), ctx.getRevWalk().parseCommit(commitId), psId);
|
||||
ctx.getChange().setCurrentPatchSet(patchSetInfo);
|
||||
@@ -434,7 +432,7 @@ public class ChangeInserter implements InsertChangeOp {
|
||||
|
||||
LabelTypes labelTypes = projectState.getLabelTypes();
|
||||
approvalsUtil.addApprovalsForNewPatchSet(
|
||||
db, update, labelTypes, patchSet, ctx.getUser(), approvals);
|
||||
update, labelTypes, patchSet, ctx.getUser(), approvals);
|
||||
|
||||
// Check if approvals are changing in with this update. If so, add current user to reviewers.
|
||||
// Note that this is done separately as addReviewers is filtering out the change owner as
|
||||
|
@@ -312,7 +312,7 @@ public class ReplaceOp implements BatchUpdateOp {
|
||||
update.setPsDescription(psDescription);
|
||||
MailRecipients fromFooters = getRecipientsFromFooters(accountResolver, commit.getFooterLines());
|
||||
approvalsUtil.addApprovalsForNewPatchSet(
|
||||
ctx.getDb(), update, projectState.getLabelTypes(), newPatchSet, ctx.getUser(), approvals);
|
||||
update, projectState.getLabelTypes(), newPatchSet, ctx.getUser(), approvals);
|
||||
|
||||
reviewerAdditions =
|
||||
reviewerAdder.prepare(
|
||||
|
Reference in New Issue
Block a user