Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 771
softvar Avatar asked Aug 26 '14 08:08

softvar


1 Answers

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
like image 110
Frol Avatar answered Oct 01 '22 09:10

Frol