Code reviews in the desktop application

Create or interact with code reviews in your Unity Version Control desktop application so that you and your team can collaborate and review each other's work to approve changes before you check them in.

Code review window

The code review window opens automatically when you create a code review. To start a new code review, right-click on either a branch or a changeset, and select the corresponding option:

  • New code review for this changeset
  • New code review for this branch

To open an existing code review from the UVCS desktop application, select the Code reviews tab, and double-click on a code review.

The code review window has two tabs:

TabDescription
ConversationAllows you to edit the title, description, reviewers, and status of a code review. This tab also displays activity for your code review, and any comments.
Review changesAllows you to review changes and add comments. This tab also displays the diffs of the changes, and any comments.

Conversation tab

Use the Conversation tab of the code review window to set up, edit, monitor, and manage your code review.

Request reviewers

  1. Select Add description to give an overview or summary to your reviewers.
  2. In the Reviewers panel, select Add.
  3. Select any users or groups you want to add as reviewers.
  4. Select OK.

Note: You can edit the title, description, and reviewers of your code review at any time from the Conversation tab of the code review window.

Change the status of a code review

A reviewer can change the status of a code review on the Conversation tab:

  1. Select Mark review.
  2. Select one of the review statuses:
    StatusDescription
    Under reviewThe review is ongoing.
    Rework requiredThe reviewer is requesting changes.
    ReviewedThe code review is approved.
  3. Add a comment and select the Mark as button for the status you selected.

Review changes tab

Use the review changes tab to view the diffs of files and add or reply to any comments.

Branch review options

For a code review of a branch, there are two modes that you can change between when you review:

Review modeDescription
Review changeset by changesetView each individual changeset and the associated checkin comments, and add comments to the individual changesets. This helps the reviewer understand how and why changes were made.
Review entire branchReview the most recent version of the branch, with all changesets applied.

Any comments only display in the mode that they were added.

Diff options

In the Review changes tab, you have the following diff options:

Diff optionDescription
Text diffProvides a side-by-side text comparison of the changes in a file.
Semantic diffProvides a semantic outline which shows if items in the file were added, deleted, or changed.
Visual diffWith the semantic diff, the visual diff provides a representation of the changed objects. You have the following options: Hide unchanged, Show unchanged, and Group unchanged.

View existing comments

The Review comments summary panel at the bottom of the Review changes tab displays all the comments part of the code review. The panel is divided into three sections for each type of comment, and shows the comment, the status, and the owner of each comment.

Comment types

There are the following types of comment:

Comment typeDescription
Request a change (default)Select to indicate that a change in the code is necessary.
Ask a questionSelect to indicate that the comment needs an answer, but no initial change is necessary.
Regular commentDeselect both options to add a regular comment.

Note: The Comments section doesn’t show replies to regular comments. The other two sections do display replies.

A screenshot of the review comments summary panel. The panel is split into three sections for each type of comment. The change requested and question comment sections both have a status column, which both show the status as pending.

To navigate to the related comment, double-click on the comment.

Add new comments

  1. Add a new comment to a line:
  2. Hover over the line in the diff window.
  3. Select the + icon.
  4. In the comments panel, select the type of comment.
  5. Enter the comment and select Comment.

An example diff file, with the ninth line selected. The line shows a circular icon with the letter 'c' in it, that indicates that a change has been requested. To the right is the comment panel, which shows the two options for 'Request a change' or 'Ask a question', with the former option selected. There is an empty text field, with two buttons underneath that read 'Comment' and 'Cancel' respectively.

You can’t add a comment to the following types of file:

  • A file that belongs to a different repository.
  • An Xlink file.
  • An unsupported file type, such as an image or directory diff.

Apply requested changes

When someone requests a change in a code review, the request comment has an associated GUID.

A screenshot of a request change comment, with the GUID and copy symbol highlighted.

When you complete the requested change, you can automatically resolve the requested change comment:

  1. Copy the GUID from the change request comment.
  2. Make your changes to the file.
  3. In the Pending changes tab, enter a comment in the following format: [apply-change:{commentID}]
  4. Enter the rest of the comment as normal and select Check in.

You can also edit the comment of an existing changeset and add the [apply-change:{commentID}] text to resolve a code review change request.

Note: To apply the requested change in the command line, run the checkin command with the comment GUID: cm checkin FileName.cs -c="[apply-change:b3ab21d4] Apply requested changes"

When a comment is resolved, the Review comments summary panel changes the status of the comment to Done and displays a link to the linked changeset:

A screenshot of a change requested comment in the Review comments summary panel, with the status as 'Done, cs13'.