Implement post-commit review request support for GitLab

Review Request #6872 — Created Feb. 1, 2015 and submitted — Latest diff uploaded

Information

Review Board
master
79f4156...

Reviewers

Add post-commit review request support GitLab

In /r/new/, you can manually view or add review requests for changes already being pushed to remote repository, which is called 'post-commit'. But Reviewboard previously does not support GitLab for this functionality. This project is to add the 'post-commit' review request support for GitLab.

With this implementation, users can retrieve GitLab hosting service information to do 'post-commit' review request operations. Specifically, we can get branches, commits belong to the particular branch, and changes have been made in commits from repositories on GitLab.

There are three general steps are involved. First, we send an API request to GitLab then retrieve a list of branches. Second, we send another API request to get a list of commits with specified branch. After that, when the user clicks on one commit from the page, we send a HTTP request instead of using GitLab API url format to get the diff.

The reason we don't use GitLab API request url to retrieve the diff is the returned value is not what we expect and there are no indices in it. The url format we are using is https://gitlab.com/<user-name>/<project-name>/commit/<revision>.diff

  • Tested on local server, ran as expected.
    -- Created a test GitLab repository, successfully fetched branches and commits information in /r/new.
    -- New page of commits are displayed normally after scrolling down, pagination is working correctly.
    -- Commit diffs can be viewed by clicking commits in the GitLab repository.
  • Unit tests passed.
    -- test_get_branches()
    -- test_get_commits()
    -- test_get_change()