Add and edit comments
Comments are the primary feedback mechanism in P4 Code Review.
On this page:
You can add comments to reviews, changelists, jobs, descriptions, files, and specific lines within files, and edit comments that you have created.
You can add comments to:
-
A changelist, review, or job
-
A review description
-
A changelist description
-
A file in a changelist or review
-
One or more lines in a file in a changelist or review
Add comments
You can add comments to reviews, changelists, jobs, files, and descriptions. The following sections describe the different locations where comments can be added.
Use AI to improve comments
You can use the AI Assistant to improve comment text before posting a comment.
The AI Assistant can:
-
Improve comment text
-
Summarize writing
-
Fix spelling and grammar
To use the AI Assistant:
Enter text in the comment box.
-
Click AI Assistant icon beneath the comment field.
-
Select an option.
-
Review the suggested text.
-
Click Accept to use the suggestion, or Discard to choose a different option.
The suggested text is added to the comment editor but is not posted automatically.
After accepting a suggestion, click Revert to restore the original text.
To learn more, seeAI Assistant for comments.
Comment on a changelist, review, or job
Use the Comments tab to add general feedback about a changelist, review, or job.
-
Open the changelist, review, or job.
-
Click Comments.
-
Enter your comment.
-
(Optional) Add an attachment.
-
Click Post.
(Alternatively, press Ctrl+Enter to post the comment).
Comment on a review description
Review descriptions and changelist descriptions can have their own discussion thread. Use description comments when your feedback applies to the description rather than the files being reviewed.
-
Open the review or changelist.
-
In the description area, click Comments (n) where (n) is the number of comments on the review description.
-
Click Add a comment.
-
Enter your comment.
-
Click Post.
To hide or display description comments, click Comments (n).
Comment on a changelist description
Add comments directly to a changelist description to discuss the purpose or details of the change.
-
Open the changelist or review.
-
In the description area, click Add a Comment or n Comments. (where (n) is the number of comments on the changelist description).
-
Enter your comment.
-
Click Post.
Comment on lines in a file
Use line comments to discuss specific code changes. You can comment on individual lines or a range of lines.
-
Open the Files tab.
-
Select a line or range of lines.
-
Click the comment icon.
-
Enter your comment.
-
(Optional) Select Flag as Task. To learn more about Tasks, see Comment tasks.
-
Click Post.
Comment on a file
Use file comments when your feedback applies to the entire file rather than a specific line or block of code.
-
Open the Files tab.
-
Expand the file.
-
Click Add a comment.
-
Enter your comment.
-
(Optional) Select Flag as Task. To learn more about Tasks, see Comment tasks.
-
Click Post.
Reply to a comment
You can reply to an existing comment to continue the discussion in a comment thread.
-
Click Reply beneath the comment.
-
Enter your reply.
-
Click Post.
Administrators can control comment reply behavior using the threading/max_depth setting. Setting max_depth to 0 disables replies. In the default flat comment view, reply depth is not limited. In the classic comment view, administrators can limit the maximum depth of comment threads. For details, see Comment threading.
After posting a comment or reply, you can share a direct link to it with other users. To learn more, see Share comments.
Add attachments to comments
You can attach files when creating a comment.
-
Drag and drop the file into the comment area.
-
Text must be included with an attachment.
-
Image attachments are previewed after the comment is posted.
If you cannot attach files to a comment, you may need to configure the settings in the P4 Code Review configuration. To learn more, see Comment attachments.
Image previews
For image attachments, P4 Code Review displays a blurred preview while the image thumbnail is being prepared. This behavior is expected and does not indicate a problem with the attachment. If image attachments remain blurred and no thumbnail is displayed, see Troubleshooting image previews.
The blurred preview is automatically replaced when the thumbnail becomes available.
Mention users and groups
You can reference users and groups in comments:
-
@user mentions a user.
-
@@group mentions a group.
Mentioned users are added to the review and receive notifications about future review activity.
To learn more, see Comment mentions.
Use Markdown
P4 Code Review supports Markdown in comments and review descriptions. Markdown is rendered when the comment is posted. Markdown support is limited to prevent raw HTML and JavaScript execution.
To learn more, see Markdown in comments and review descriptions
Edit comments
Before you begin
-
You can only edit comments that you created.
-
Editing a comment removes all existing reactions for that comment.
-
P4 Code Review does not keep earlier versions of edited comments.
Edit a comment
-
Click Edit comment.
-
Update the comment text.
-
Add or remove attachments as required.
-
Click Save.
If you remove the wrong attachment before saving, click Cancel to keep the original attachment.
What happens when a comment is edited?
When a comment is edited:
-
The comment is marked as (edited).
-
A notification is sent to users involved in the review, including the review author and reviewers. To learn more, see Comments notifications.
-
The user who edited the comment does not receive the notification.
Close a comment editor
To close an empty comment editor without saving, either:
-
Click outside the editor.
-
Press Esc.