Fix creating a new review request from the first committed change

Review Request #5321 — Created Jan. 24, 2014 and submitted

Review Board
reviewboard, students

Creating a new review request from committed change by selecting the first/root commit in a linked GitHub repository failed because the root commit has no parents. This raised a SCMError when trying to fetch the "compare two commits" API.

The fix is to check if "parent_revision" is empty before trying to fetch "compare two commits". If "parent_revision" is empty, it fetches the root commit itself.

  • Manually created new review requests for a root commit with 1 changed file and for multiple changed files, and verified that "View Diff" listed the expected changes (for both a private and a public GitHub repository).
  • Ran unit tests.
  1. This looks good to me. Thanks for your detailed change description :)

Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (7baff93). Thanks!