CODEREVIEW
Manage code reviews with the Unity Version Control CLI.
Read time 6 minutesLast updated 6 days ago
Description
Creates, edits, or deletes code reviews, and manages their comments, reviewers, and review status.
Usage
Use the following syntax to create a code review:
cm codereview <spec> <title> [--status=<status_name>] [--assignee=<user_name>] [--users=<user_list>] [--groups=<group_list>] [--format=<str_format>] [--repository=<rep_spec>]
Use the following syntax to edit a code review:
cm codereview -e <id> [--status=<status_name>] [--assignee=<user_name>] [--title=<title>] [--repository=<rep_spec>]
Use the following syntax to delete one or more code reviews:
cm codereview -d <id> [ ...] [--repository=<rep_spec>]
Use the following syntax to add, reply to, edit, or delete review comments:
cm codereview comment add <review_id> | reply <guid> | edit <guid> | delete <guid> ...
Use the following syntax to add, remove, or list the reviewers of a code review:
cm codereview reviewer add | remove | list <review_id>
Use the following syntax to set your own review status, or ask reviewers to review again:
cm codereview review <review_id> --reviewed | --rework-required | --under-reviewcm codereview review <review_id> --re-request (--all | [--users=<list>] [--groups=<list>])
Options
Option / Argument | Description |
|---|---|
| -e | Edits the parameters of an existing code review. |
| -d | Deletes one or more existing code reviews. Use a whitespace to separate the code reviews IDs. |
| --status | Sets the new status of a code review. See Remarks for additional information. |
| A comma-separated list of users. When you create a code review, sets its reviewers. With |
| A comma-separated list of groups. Works the same way as |
| Used with |
| --assignee | Sets the new assignee of a code review. Can't be combined with |
| --format | Retrieves the output message in a specific format. See Remarks for additional information. |
| --repository | Sets the repository to be used as default. (Use 'cm help objectspec' to learn more about repository specs.) |
| Used with |
| Used with |
| Used with |
| Used with |
| Used with |
| The text of a comment. |
| Reads the text of a comment from the specified file. Use |
| Used with |
| Used with |
| Used with |
| spec | It can be either a changeset spec, a shelve spec or a branch spec. It will be the target of the new code review. (Use 'cm help objectspec' to learn more about changeset or branch specs.) |
| title | A text string to be used as title of the new code review. |
| id | The code review identification number. A GUID can be used as well. |
| review_id | The code review identification number. A GUID can be used as well. |
| guid | The GUID of a review comment. |
Help
Remarks
This command allows users to manage code reviews: create, edit, and delete code reviews for changesets or branches.
To create a new code review, a changeset/branch spec and a title are required. The initial status and assignee can be set, too. An ID (or GUID if requested) will be returned as a result.
To edit or delete an existing code review, the target code review ID (or GUID) is required. No messages are displayed if there are no errors.
The 'status parameter' must only be one of the following: "Under review" (default), "Reviewed", or "Rework required".
The 'repository' parameter is available to set the default working repository. This is useful when the user wants to manage reviews on a server different than the one associated to the current workspace, or when there is no current workspace at all.
Comments, reviewers, and review status
The , , and subcommands work on branch, changeset, and shelve reviews.
commentreviewerreviewcm crcm codereviewcomment addmkcomment deletermreviewer listlscomment add--path--linereplyeditdeleteTo set your own review status with , you must be a reviewer of the code review, a member of a reviewer group, or a server administrator.
reviewOutput format parameters (--format option)
This command accepts a format string to show the output.
The output parameters of this command are the following
Option / Argument | Description |
|---|---|
| {0} | id |
| {1} | guid |
Please note that the '--format' parameter only takes effect when creating a new code review.
Examples
cm codereview cs:1856@myrepo@myserver:8084 "My code review" --assignee=dummy
cm codereview br:/main/task001@myrepo@myserver:8084 "My code review" --status="Rework required" --assignee=newbie --format="{id} -> {guid}"
cm codereview 1367 -e --assignee=new_assignee
cm codereview -e 27658884-5dcc-49b7-b0ef-a5760ae740a3 --status=Reviewed
cm codereview -d 1367 --repository=myremoterepo@myremoteserver:18084
cm codereview 27658884-5dcc-49b7-b0ef-a5760ae740a3 -d
The following example creates a code review of branch , and sets its reviewers:
/main/task001cm cr br:/main/task001 "Login fixes" --users=maria --groups=leads
The following example changes the title of code review 1367:
cm cr -e 1367 --title="Fix the login crash"
The following example posts a change request on line 42 of in code review 1367:
/src/foo.cscm cr comment add 1367 -c="Rename this" --path=/src/foo.cs --line=42
The following example adds reviewers to code review 1367:
cm cr reviewer add 1367 --users=maria,me --groups=leads
The following example sets your review status to "Reviewed", with a comment:
cm cr review 1367 --reviewed -c="Looks good"
The following example asks every reviewer of code review 1367 to review again:
cm cr review 1367 --re-request --all