Work with shelves and review files
Use review files and shelves to test changes, contribute updates, remove unwanted content, and recover from mistakes during the review process.
Fetch review files
Review files can be fetched into your workspace so that you can inspect, test, or modify the review content.
To learn more about review version selectors and version history, see:
Find the review changelist
Before fetching review files, identify the changelist associated with the review version you want to use.
-
Open the review.
-
Locate the changelist number associated with the review version. The changelist number can be found using the review version selector on the review page.
-
Use the changelist number when fetching or unshelving the review files.
Unshelve review files
For reviews that contain shelved content, use p4 unshelve to retrieve the files into your workspace.
p4 unshelve -s changelist
Replace changelist with the review changelist number.
After the files are unshelved, you can:
-
Review the changes locally.
-
Test the files.
-
Make additional changes.
-
Update the review with a new review version.
For committed review content, use a sync operation such as p4 sync to retrieve the file revisions contained in the review.
For example: p4 sync @changelist and replace changelist with the review changelist number.
To learn more about review versions and version history, see Review versions.
Delete shelves
After a review has been committed, you may want to remove shelves that are no longer required.
Before deleting a shelf, verify that:
-
The review has been completed.
-
The shelved files are no longer needed.
-
The review content has been committed or preserved elsewhere.
Deleting a shelf and removing files from a review are different actions. Deleting a shelf does not automatically remove files from an existing review.
Remove review files
P4 Code Review can remove files from a review when files are deleted from an associated shelved changelist. This behavior depends on your P4 Code Review configuration.
Typically:
-
Delete the file from the shelved changelist.
-
Reshelve the changelist.
-
P4 Code Review updates the review and removes the deleted file.
Review state and system configuration can affect whether file removal is processed. If file removal does not occur, contact your P4 Code Review administrator to verify the review configuration.
To learn more about review state behavior and review workflow requirements, see:
Revert review content
If a review contains changes that should be rolled back, you can revert the review content to match an earlier review version.
Instead, P4 Code Review creates a new review version that contains the content from the earlier version.
To learn more about review versions and version history, see:
To revert review content
-
Identify the review version you want to restore.
-
Locate the changelist associated with that version.
-
Unshelve the changelist files.
-
Create a new pending changelist and shelve the files.
-
Open the review.
-
Select Review actions > Add Change > Replace with pending changelist.
To learn more about replacing review content, see Replace review with a pending changelist.
-
Select a pending changelist by either:
-
Enter the pending changelist number directly in the @Change box
-
Filter by depot path and user.
-
Selecting a changelist from the list of recent changelists.
A changelist can only belong to one review. P4 Code Review rejects changelists that are already associated with another review. -
-
Click Select.
It is good practice to update the review description or add a comment explaining why the review content was reverted.
Repair an incorrectly updated review
If a review has been updated with the wrong changelist, you can rebuild the review using the correct changelists.
For example, a review might have been accidentally replaced with files from the wrong changelist using Replace with committed changelist.
For a worked example of repairing an incorrectly updated review, see Fix a review if it has been replaced with the wrong changelist.
To repair a review
-
Replace the incorrect review content with the correct changelist.
-
Re-add any missing changelists.
-
Update the review description or add a comment explaining the correction.
-
Verify that the review now contains the expected files and revisions.
If the review uses keyword-based workflows, you might also need to update the changelist keyword (for example, changing #review-12345 to #append-12345) before reshelving files.
To learn more about review keywords, append mode, and replace mode, see:
Next steps
-
Review process - To learn about keyword-based review processes and collaborative review scenarios.
-
Add changelists - To learn how append and replace operations affect review content.
-
Advanced concepts - To learn more about review versions and internal review behaviour.