Helix Core is now P4 and Helix Swarm is now P4 Code Review. Learn more >>

Documentation | 2025.2

# Activities

This section describes the major activities that affect code reviews, including starting a review, updating a review, and fetching a review's files.

## Start a review

If your P4 Server is configured as a commit-edge deployment, and your normal connection is to an edge server, P4 Code Review refuses to start reviews for shelved changes that have not been promoted to the commit server.

Within P4 Code Review, this means that the Request Review button does not appear for unpromoted shelved changes. Outside of P4 Code Review, attempts to start reviews for unpromoted shelved changelists appear to do nothing. Ask your P4 Server administrator for assistance if you cannot start a review.

An administrator of the P4 Server can automatically promote shelved changes to the commit server by setting the configurable `dm.shelve.promote` to `1`.

If your changelist only contains a stream spec and its location in the P4 Server is not associated with a P4 Code Review project, the review that you create will not have any default reviewers or workflow rules. To associate the review with a project so that it has default reviewers and obeys the project workflow rules, include a file change from the project path in the changelist when you create the review.

1. Use the P4 command-line (P4) or a client to create the shelved or committed changelist.
2. Start a code review by using one of the following approaches:

### Use P4 Code Review:

1. Use P4 Code Review to view a shelved or submitted changelist.

To view a shelved or submitted changelist, use a Quick URL. For example, if your change is 54321, visit the URL:`https://myswarm.url/54321`.

2. Click the Request Review button to request a review of that changelist.

Requesting a review on a shelved changelist uses the pre-commit model and requesting a review on a submitted changelist uses the post-commit model.

The Request Review button is disabled for changelists with a file count greater than the limit set for max_changelist_files in the `SWARM_ROOT/data/config.php` file. This is to prevent out of memory errors within P4 Code Review. For more information on changing this file count limit, see Changelist files limit

### Use P4 command-line (P4):

When you are about to shelve or submit files:

1. Include `#review` within your changelist (separated from other text with whitespace, or on a separate line).

   Once the review begins, P4 Code Review replaces `#review` with `#review-12345`, where `12345` is the review's identifier.

   The `#review` keyword is customizable. For details, see Review keyword.

2. At this time, you can add reviewers to the code review by using @mention for users, and @@mention for groups in the changelist description for each desired reviewer.

If your `@mention` or `@@mention` includes an asterisk (`*`) before the userid or groupid, for example `@*userid`, that user or all of the group members become required reviewers. If your `@@mention` includes an exclamation mark (`!`) before the groupid, for example `@@!groupid`, the members of that group become required reviewers but only one member of the group is required to vote. See Required reviewers for details.

3. Complete your shelve or submit operation.

If you shelve a changelist and subsequently edit the description to include `#review`, a review is not started. You must re-shelve the files after adding `#review`.

You can also start a review with P4V, P4 for Visual Studio, and P4 for Eclipse. See below for details:

- P4V: see the P4 Code Review integration features section of the P4 Visual Client (P4V) Documentation.
- P4VS: see the Managing files chapter of the P4VS User Guide.
- P4Eclipse: see the Reviewing changes chapter of the P4Eclipse User Guide.

If you are using P4V and its P4 Code Review integration, and you encounter the error `Host requires authentication`, ask your P4 Server administrator for assistance. See P4V Authentication for details.

## Update a review

To update a code review, use one of the following approaches:

- For a pre-commit review that you authored:

  1. Edit the files
  2. Shelve the files

  You can repeat these steps as many times as necessary.

  If you want to stop P4 Code Review from updating the review until you have completed your changes, add the work-in-progress tag (#wip by default) to the changelist description. For information on using the work-in-progress tag, see Work-in-progress tag.

- For a post-commit review, or a review where you are not the author:

  1. Fetch the review's files into a new changelist
  2. Edit the files
  3. Update the changelist's description to include `#review-12345` (separated from other text with whitespace, or on a separate line)
  4. Shelve the changelist's files

  Once these steps are complete, further updates involve editing the files, and then shelving the changelist's files.

  If you use an invalid review identifier, it will appear that nothing happens. P4 Code Review is currently unable to notify you of this situation. If the review has not been correctly updated, use the Add Change button in the review heading to add the changelist to the review, see Add a changelist to a review.

## Fetch a review's files

First, determine the changelist containing the review's files:

1. Visit the review's page.

2. The current review version's changelist appears in the file list heading:

   In this example, the changelist is `697707`. You use the identified changelist in place of shelved changelist below.

3. Decide whether you will use P4 command-line (P4) or P4V to fetch the files, and follow the instructions in the appropriate section below.

### Using P4 command-line (P4)

1. For a shelved changelist, use a command-line shell and type:

       $ p4 unshelve -s shelved changelist

2. For a committed changelist, use a command-line shell and type:

       $ p4 sync @committed changelist

Your client's view mappings need to include the changelist's path.

### Using P4V

For a shelved changelist:

1. Select Search > Go To.
2. Change the select box to Pending Changelist.
3. Type in the shelved changelist number and click OK.
4. Select the files in the Shelved Files area.
5. Right-click and select Unshelve.
6. Click Unshelve.

For a committed changelist:

1. Select Search > Go To.
2. Change the select box to Submitted Changelist.
3. Type in the submitted changelist number and click OK.
4. Select the files in the Files area.
5. Right-click and select Get this Revision.
6. Click Close.

## Deleting shelves

If you have a number of unused shelves, you can delete them if you want to tidy up your workspace.

By default, when you delete files from a shelved changelist, the files are not removed from the associated review.

However, P4 Code Review can be configured to remove files from a review when they are deleted from an associated shelf, see Process shelf file delete when.

Do not use the P4 Code Review user that is configured in the P4 Code Review configuration file when deleting shelves, or deleting files from shelves. The P4 Code Review logic processes the shelve-delete trigger event, if the event is invoked by the P4 Code Review user it is rejected. The delete operations will fail.

To delete a shelf from a changelist without removing the shelved files from the associated review, use P4 command-line (P4) or P4V to delete the entire shelf in one operation as described below. This enables you to delete a shelved changelist in your workspace without affecting the associated review even if P4 Code Review is configured to remove files from a review when they are deleted from a shelf.

### Using P4 command-line (P4)

To delete a shelved changelist without removing the files from the associated review:

1. Use a command-line shell and type:

$ p4 shelve -d -c changelist

Do not delete the files from the shelf individually. Deleting the entire shelf ensures that files are not removed from an associated review even if P4 Code Review is configured to do so.

2. The shelved files are deleted from the pending changelist.

### Using P4V

To delete a shelved changelist without removing the files from the associated review:

1. In P4V, right-click on the pending changelist.
2. Select Delete Shelved Files.

Do not delete the files from the shelf individually. Deleting the entire shelf ensures that files are not removed from an associated review even if P4 Code Review is configured to do so.

3. The shelved files are deleted from the pending changelist.

## Edit reviewers

A review author can edit the reviewers for a review by using the Reviewers Edit button in the review page Information panel. Reviewers are able to join or leave reviews, or to change whether their vote is required or optional.

If the review includes content that is part of a project or branch with Retain default reviewers enabled, the following restrictions apply to the review:

- The voting option for a retained default reviewer can only be changed to a stricter level, you cannot reduce the voting level.
- Retained default reviewers cannot be removed from the review.

Additionally, the following individuals can edit reviewers:

- Users with admin or super privileges.
- If the review is moderated, the moderators.
- If the review is part of a project, but not moderated, all project members.
- If the review is not part of a project, any authenticated user.

To edit reviewers on a review:

1. Go to the review.

2. From the review Information panel, click the Reviewers list Edit button.

The Manage reviewers dialog is displayed.

3. Click the Users tab to edit a user or the Groups tab edit a group. This field auto-suggests users, and groups within P4 Server

   as you type (up to a combined limit of 25 entries).

4. Change the voting requirements of a user or group:

   1. Click the dropdown arrow to the right of the user or group you want to change.

   2. Select one of the following:

- Users: select whether their vote is Required or Optional. A solid star means that their vote is required to approve a review, whereas the outlined star means that their vote is optional.
- Groups: select whether the group vote is Require all, Require one, or Optional. A solid star means that all group member votes are required to approve a review, a solid star with a 1 inside means at least one group member must vote up and no group members vote down to approve a review, and the outlined star means that the group vote is optional.

5. Add a user or group to a review:

   1. Click the Add user or Add group dropdown icon to display a list of users or groups:

   2. Start typing the user or group name, the list is filtered as you type.

   3. Click on the user or group to add to the review.

   4. Click + to add them as a reviewer.

   5. Set the reviewer type from the dropdown to the right of the user or group.

6. Remove a user or group from a review:

   1. Click the dropdown icon to the right of the user or group to be removed.

   2. Select Remove from the review from the dropdown menu.

7. To close the Manage reviewers dialog, click X.

Your search for returned results