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.PatchSet; | ||||||
| import com.google.gerrit.reviewdb.client.PatchSetApproval; | import com.google.gerrit.reviewdb.client.PatchSetApproval; | ||||||
| import com.google.gerrit.reviewdb.client.PatchSetInfo; | 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.ChangeNotes; | ||||||
| import com.google.gerrit.server.notedb.ChangeUpdate; | import com.google.gerrit.server.notedb.ChangeUpdate; | ||||||
| import com.google.gerrit.server.notedb.ReviewerStateInternal; | import com.google.gerrit.server.notedb.ReviewerStateInternal; | ||||||
| @@ -143,7 +142,6 @@ public class ApprovalsUtil { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   public List<PatchSetApproval> addReviewers( |   public List<PatchSetApproval> addReviewers( | ||||||
|       ReviewDb db, |  | ||||||
|       ChangeUpdate update, |       ChangeUpdate update, | ||||||
|       LabelTypes labelTypes, |       LabelTypes labelTypes, | ||||||
|       Change change, |       Change change, | ||||||
| @@ -153,7 +151,6 @@ public class ApprovalsUtil { | |||||||
|       Collection<Account.Id> existingReviewers) |       Collection<Account.Id> existingReviewers) | ||||||
|       throws OrmException { |       throws OrmException { | ||||||
|     return addReviewers( |     return addReviewers( | ||||||
|         db, |  | ||||||
|         update, |         update, | ||||||
|         labelTypes, |         labelTypes, | ||||||
|         change, |         change, | ||||||
| @@ -165,7 +162,6 @@ public class ApprovalsUtil { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   public List<PatchSetApproval> addReviewers( |   public List<PatchSetApproval> addReviewers( | ||||||
|       ReviewDb db, |  | ||||||
|       ChangeNotes notes, |       ChangeNotes notes, | ||||||
|       ChangeUpdate update, |       ChangeUpdate update, | ||||||
|       LabelTypes labelTypes, |       LabelTypes labelTypes, | ||||||
| @@ -184,11 +180,10 @@ public class ApprovalsUtil { | |||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     return addReviewers( |     return addReviewers( | ||||||
|         db, update, labelTypes, change, psId, null, null, wantReviewers, existingReviewers); |         update, labelTypes, change, psId, null, null, wantReviewers, existingReviewers); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   private List<PatchSetApproval> addReviewers( |   private List<PatchSetApproval> addReviewers( | ||||||
|       ReviewDb db, |  | ||||||
|       ChangeUpdate update, |       ChangeUpdate update, | ||||||
|       LabelTypes labelTypes, |       LabelTypes labelTypes, | ||||||
|       Change change, |       Change change, | ||||||
| @@ -225,7 +220,6 @@ public class ApprovalsUtil { | |||||||
|               new PatchSetApproval.Key(psId, account, labelId), (short) 0, update.getWhen())); |               new PatchSetApproval.Key(psId, account, labelId), (short) 0, update.getWhen())); | ||||||
|       update.putReviewer(account, REVIEWER); |       update.putReviewer(account, REVIEWER); | ||||||
|     } |     } | ||||||
|     db.patchSetApprovals().upsert(cells); |  | ||||||
|     return Collections.unmodifiableList(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. |    * Adds approvals to ChangeUpdate for a new patch set, and writes to NoteDb. | ||||||
|    * |    * | ||||||
|    * @param db review database. |  | ||||||
|    * @param update change update. |    * @param update change update. | ||||||
|    * @param labelTypes label types for the containing project. |    * @param labelTypes label types for the containing project. | ||||||
|    * @param ps patch set being approved. |    * @param ps patch set being approved. | ||||||
| @@ -284,7 +277,6 @@ public class ApprovalsUtil { | |||||||
|    * @throws OrmException |    * @throws OrmException | ||||||
|    */ |    */ | ||||||
|   public Iterable<PatchSetApproval> addApprovalsForNewPatchSet( |   public Iterable<PatchSetApproval> addApprovalsForNewPatchSet( | ||||||
|       ReviewDb db, |  | ||||||
|       ChangeUpdate update, |       ChangeUpdate update, | ||||||
|       LabelTypes labelTypes, |       LabelTypes labelTypes, | ||||||
|       PatchSet ps, |       PatchSet ps, | ||||||
|   | |||||||
| @@ -176,7 +176,6 @@ public class AddReviewersOp implements BatchUpdateOp { | |||||||
|       } else { |       } else { | ||||||
|         addedReviewers = |         addedReviewers = | ||||||
|             approvalsUtil.addReviewers( |             approvalsUtil.addReviewers( | ||||||
|                 ctx.getDb(), |  | ||||||
|                 ctx.getNotes(), |                 ctx.getNotes(), | ||||||
|                 ctx.getUpdate(change.currentPatchSetId()), |                 ctx.getUpdate(change.currentPatchSetId()), | ||||||
|                 projectCache.checkedGet(change.getProject()).getLabelTypes(change.getDest()), |                 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.PatchSet; | ||||||
| import com.google.gerrit.reviewdb.client.PatchSetApproval; | import com.google.gerrit.reviewdb.client.PatchSetApproval; | ||||||
| import com.google.gerrit.reviewdb.client.PatchSetInfo; | 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.ApprovalsUtil; | ||||||
| import com.google.gerrit.server.ChangeMessagesUtil; | import com.google.gerrit.server.ChangeMessagesUtil; | ||||||
| import com.google.gerrit.server.PatchSetUtil; | import com.google.gerrit.server.PatchSetUtil; | ||||||
| @@ -389,7 +388,6 @@ public class ChangeInserter implements InsertChangeOp { | |||||||
|       throws RestApiException, OrmException, IOException, PermissionBackendException, |       throws RestApiException, OrmException, IOException, PermissionBackendException, | ||||||
|           ConfigInvalidException { |           ConfigInvalidException { | ||||||
|     change = ctx.getChange(); // Use defensive copy created by ChangeControl. |     change = ctx.getChange(); // Use defensive copy created by ChangeControl. | ||||||
|     ReviewDb db = ctx.getDb(); |  | ||||||
|     patchSetInfo = |     patchSetInfo = | ||||||
|         patchSetInfoFactory.get(ctx.getRevWalk(), ctx.getRevWalk().parseCommit(commitId), psId); |         patchSetInfoFactory.get(ctx.getRevWalk(), ctx.getRevWalk().parseCommit(commitId), psId); | ||||||
|     ctx.getChange().setCurrentPatchSet(patchSetInfo); |     ctx.getChange().setCurrentPatchSet(patchSetInfo); | ||||||
| @@ -434,7 +432,7 @@ public class ChangeInserter implements InsertChangeOp { | |||||||
|  |  | ||||||
|     LabelTypes labelTypes = projectState.getLabelTypes(); |     LabelTypes labelTypes = projectState.getLabelTypes(); | ||||||
|     approvalsUtil.addApprovalsForNewPatchSet( |     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. |     // 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 |     // 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); |     update.setPsDescription(psDescription); | ||||||
|     MailRecipients fromFooters = getRecipientsFromFooters(accountResolver, commit.getFooterLines()); |     MailRecipients fromFooters = getRecipientsFromFooters(accountResolver, commit.getFooterLines()); | ||||||
|     approvalsUtil.addApprovalsForNewPatchSet( |     approvalsUtil.addApprovalsForNewPatchSet( | ||||||
|         ctx.getDb(), update, projectState.getLabelTypes(), newPatchSet, ctx.getUser(), approvals); |         update, projectState.getLabelTypes(), newPatchSet, ctx.getUser(), approvals); | ||||||
|  |  | ||||||
|     reviewerAdditions = |     reviewerAdditions = | ||||||
|         reviewerAdder.prepare( |         reviewerAdder.prepare( | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Dave Borowitz
					Dave Borowitz