softvar
softvar

Reputation: 18435

Get MR related data from Gitlab API

How to:

  1. Get all commits in a particular Merge Request.
  2. Get all users who committed in a particular Merge Request.
  3. No. of lines added/deleted/updated by a particular user in a Merge Request.

Can't find how to use Gitlab API(http://doc.gitlab.com/ce/api/) for getting all the above mentioned. Is there a way Gitlab API can help to get these directly or by introducing some sort of hack.

Upvotes: 6

Views: 1075

Answers (1)

Frol
Frol

Reputation: 136

For the first point, I think you are looking for this:

curl --header "PRIVATE-TOKEN: ****" "http://gitlab/api/v3/projects/:project_id:/merge_requests/:mr_id:/commits" 

the Second point can be found with the attribute author of

curl --header "PRIVATE-TOKEN: ****" "http://gitlab/api/v3/projects/:project_id:/merge_requests/:mr_id:

the last point is trickier, when you have the list of commit, you can get the diff

curl --header "PRIVATE-TOKEN: ****" "http://gitlab/api/v3/projects/:project_id:/repository/commits/:sha/diff

Upvotes: 1

Related Questions