Class ApprovalCopier
- java.lang.Object
-
- com.google.gerrit.server.approval.ApprovalCopier
-
public class ApprovalCopier extends Object
Computes copied approvals for a given patch set.Approvals are copied if:
- the approval on the previous patch set matches the copy condition of its label
- the approval is not overridden by a current approval on the patch set
Callers should store the copied approvals in NoteDb when a new patch set is created.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ApprovalCopier.Result
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.common.collect.ImmutableList<PatchSet.Id>
forApproval(ChangeNotes changeNotes, PatchSet sourcePatchSet, Account.Id approverId, String label, short approvalValue)
Returns all follow-up patch sets of the given patch set to which the given approval is copyable.ApprovalCopier.Result
forPatchSet(ChangeNotes notes, PatchSet ps, org.eclipse.jgit.revwalk.RevWalk rw, org.eclipse.jgit.lib.Config repoConfig)
Returns all copied approvals that apply to the given patch set.
-
-
-
Method Detail
-
forPatchSet
public ApprovalCopier.Result forPatchSet(ChangeNotes notes, PatchSet ps, org.eclipse.jgit.revwalk.RevWalk rw, org.eclipse.jgit.lib.Config repoConfig)
Returns all copied approvals that apply to the given patch set.Approvals are copied if:
- the approval on the previous patch set matches the copy condition of its label
- the approval is not overridden by a current approval on the patch set
-
forApproval
public com.google.common.collect.ImmutableList<PatchSet.Id> forApproval(ChangeNotes changeNotes, PatchSet sourcePatchSet, Account.Id approverId, String label, short approvalValue) throws IOException
Returns all follow-up patch sets of the given patch set to which the given approval is copyable.An approval is considered as copyable to a follow-up patch set if it matches the copy rules of the label and it is copyable to all intermediate follow-up patch sets as well.
The returned follow-up patch sets are returned in the order of their patch set IDs.
Note: This method only checks the copy rules to detect if the approval is copyable. There are other factors, not checked here, that can prevent the copying of the approval to the returned follow-up patch sets (e.g. if they already have a matching non-copy approval that prevents the copying).
- Parameters:
changeNotes
- the change notessourcePatchSet
- the patch set on which the approval was appliedapproverId
- the account ID of the user that applied the approvallabel
- the label of the approval that was appliedapprovalValue
- the value of the approval that was applied- Returns:
- the follow-up patch sets to which the approval is copyable, ordered by patch set ID
- Throws:
IOException
-
-