How do I contribute comments or code changes to a code review?

Contribute to a code review by adding comments to the review, adding comments to specific lines within the review's files, or making edits to the review's files.

Commenting on a review

  1. Visit the review's page.

  2. Comments tab on Reviews page Click Comments to view the review's comments tab.

  3. Comment area for a review Add your comment in the provided text area.

  4. Post button for Comments Click Post.

Commenting on a specific line in a file

  1. Visit the review's page.

  2. Files tab on Reviews page Click Files to view the review's file tab.

  3. Click a line you would like to comment on. The comment text area appears.

  4. Comment area in a diff Add your comment in the provided text area.

  5. Post button for Comments Click Post.

Editing files in a review

  1. Get a local copy of the review's files.

    Note

    If you are using Git Fusion, follow the steps in the next section

  2. Edit the files as required.

  3. Prepare a changelist with the edited files and include #review-1234 within the changelist's description (separated from other text with whitespace, or on a separate line), where 1234 is the review's identifier.

    Warning

    If you use an invalid review identifier, it will appear that nothing happens. Swarm is currently unable to notify you of this situation.

  4. Depending on the model of code review you are using, you would:

    1. Shelve the files (for pre-commit).

    2. Submit the files (for post-commit).

Edit files in a review with Git Fusion

Important

You can only update Git Fusion-initiated reviews using Git Fusion.

In the following example, the current local task branch is task1, the target branch is master, the review id is 1234, the Git Fusion hostname is gfserver, and the remote repo name is p4gf_repo.

  1. Fetch the review's head version:

    $ git fetch --prune origin
    From gfserver:p4gf_repo
     * [new_branch]      review/master/1234 -> origin/review/master/1234
     x [deleted]         (none)     -> origin/review/master/new
    

    The --prune option lets the local Git repo delete the unwanted review/master/new reference created by the initial git push origin task1:review/master/new command.

  2. Check out the review's head version:

    $ git checkout review/master/1234
    
  3. Edit the files as required.

  4. Add the edited files to the index of files, in preparation for the next commit.

    There are several ways to do this. For example, to add all modified files to the index, run:

    $ git add -A
    
  5. Commit the files in Git:

    $ git commit -m "made some changes"
    
  6. Push the Git changes to the review:

    $ git push origin review/master/1234
    

    Note

    If you get review feedback that is better expressed as a Git rebase and cleaned up history, you can make your changes and push them as a new review.

    You cannot clean up history and then push your changes to the same review.

Tip

For more information on Git Fusion, see the Git Fusion Guide