Responsibility
Initially, code reviews have no reviewers.
User and group default reviewers can be set for individual projects and project branches. Each time a new review is created in the project or project branch, the default reviewers will be added to the review. See default reviewers for details.
Users can show their interest in participating in a code review by clicking the Review actions button and selecting Join review, by voting on a review, or by commenting on a review or one of its files. Once a user shows such interest, they are added to the review's list of reviewers and share in the responsibility of performing the code review. Later on, reviewers can change whether their vote is required or optional, or leave a review (perhaps to prevent further notifications).
Looking at a review list can help you determine which reviews have likely not been started, using the No reviewers filter. Once a review has reviewers, it is considered to be active and appears in the review list with the state Has Reviewers
.
Review participation is advisory by default, and is used to inform your team that a code review is being conducted. The disposition of the review is reflected in the review's current state, the badges that may appear over each reviewer's avatar, and any comments reviewers might add.
Authors
The code review author is the user that created the review from a changelist.
As a code review author, you can:
-
Add users as reviewers by including an @mention for each optional reviewer and an @*mention for each required reviewer in the changelist description. See Links in descriptions and comments.
-
Add groups as reviewers by including @@mention for each optional group reviewer, @@*mention for each required reviewer group (all members required), and @@!mention for each required reviewer group (one vote required) in the changelist description. See Links in descriptions and comments.
-
Start a review by using P4V, P4 Code Review, or from the command line of P4D. See Start a code review.
-
Edit users and groups as reviewers by using the Edit Reviewers
button on the review page to add, remove, and edit existing reviewers. See Edit reviewers.
-
Add the work-in-progress tag (#wip by default) to a pending changelist so that you can update files in your changelist without updating the review or creating a new review until you are ready. See Work-in-progress tag
-
Add a changelist to your review, click the Add change button on the review and select the changelist you want to add to your review. See Add a changelist to a review.
-
Commit your review when it has been approved, click the Review state button on the review page and select Commit. See Change review state.
-
Delete your shelf when the review has been committed. See Deleting shelves.
Moderators
A project moderator is a user assigned to moderate reviews for a specific branch associated with a project.
When you add a moderator to a project branch, only the moderators can approve or reject reviews restriction is enabled for a project branch. See Project settings for details on adding moderators to project branches.
Changing the state of any review associated with a moderated branch is restricted as follows:
Only moderators can approve or reject reviews on the branch.
To add moderators to a branch:
-
Click the Manage moderators button.
-
Choose the Users or Groups tab.
-
If you selected Users, start typing a the name of a user. Suggested users on the P4 Server will appear automatically.
-
If you selected groups, then all of the members of that group will have the same moderator privileges for that project branch. Use this option if you wanted to add several users at once.
-
-
Click Add.
After you finish setting up the branch and save the project, reviews on this branch can only be approved or rejected by moderators.
Moderators can also transition a review to any other state. Below is a summary of branch moderator roles and review state rules.
Role | Allowed actions | Restrictions |
---|---|---|
Moderators |
Can move a review to any state. Can approve or reject reviews. Can prevent automatic approvals. |
None (unless |
Authors (not moderators) |
Can change state to:
Can attach committed changelists. |
Cannot approve or reject reviews. |
Authors (also moderators) |
Can change state to:
Can attach committed changelists. |
Cannot approve their own reviews if |
Project members |
Can change state to:
Can attach committed changelists. |
Cannot approve, reject, or archive reviews. |
Other users |
None |
Cannot change review states. |
All roles |
Can start a review. |
Cannot change state if it’s not in their allowed states (for example, can’t change from Rejected). |
Additional notes
-
Moderators can prevent automatic approvals. For more information about automatically approving reviews using workflow rules see Workflow rules.
-
By default, if a review spans multiple branches with different moderators, only one moderator from any branch needs to approve it. You can change this (via a global setting) to require one moderator per branch. If a moderator belongs to multiple branches, one approval counts for each. For instructions on how to configure moderator behavior, see Moderator behavior when a review spans multiple branches.
To delete a moderator, click the delete icon against their name.
Required reviewers
Reviews can optionally have required reviewers. When a review has required reviewers, the review cannot be approved until all required reviewers and required reviewer groups have up-voted the review. If the review is associated with a project that has assigned moderators, even the moderators cannot approve the review without up-votes from all required reviewers (but they can reject the review).
When a group is a required reviewer, it can be set to operate in one of two ways:
- Require all: all members of the group must up-vote the review to allow the review to be approved.
- Require one: at least one member of the group must up-vote the review to allow the review to be approved. If any member of the group down-votes the review, the review cannot be approved.
Required reviewers are expected to take greater care while performing a review than non-required reviewers, as their votes affect whether a review can be approved or not.
To edit the reviewers for a review and to change whether a reviewer is required or not, see Edit reviewers.
If a review involves a branch with assigned moderators, only a moderator can approve the review, even if all required reviewers have up-voted the review.
See Project settings for details on adding moderators to project branches.
Add yourself as a reviewer
-
Open the review you want to join.
-
Click the Review actions
button.
-
Select Join review from the dropdown menu. Alternatively, you can Vote Up or Vote Down the review.
Your name is added to the Reviewers list in the Information panel, and you are now a reviewer.
Remove yourself as a reviewer
You cannot leave the review if you are a retained default reviewer on the review or you are a member of a group that is a reviewer on the review
-
Log in, if you have not already done so.
-
Open the review you want to leave.
-
Click the Review actions
button.
-
Select Leave review from the dropdown menu.
Your name is removed from the Reviewers list in the Information panel, and you are no longer a reviewer.