I'm trying to do a csv file with all informations about merge requests merged between two tags. I'm trying to get this kind of information for each merge request:
UID; ID; TITLE OF MR; REPOSITORIES; STATUS; MILESTONE; ASSIGNED; CREATION-DATE; MERGED-DATE; LABEL; URL.
For now I have a command that get all merge requests merged between two tags with some informations and put it in csv file:
git log --merges --first-parent master --pretty=format:"%aD;%an;%H;%s;%b" TagA..TagB --shortstat >> MRList.csv
How can I get the other informations? I saw in the git log api only options in my command but I can't find others.
Thank you for your help !
I've written a small Python script to do this. Usage:
git log --pretty="format:%H" <start>..<end> | python collect.py
Script:
#!/usr/bin/env python
import sys
import requests
endpoint = 'https://gitlab.com'
project_id = '4242'
mrs = set()
for line in sys.stdin:
hash = line.rstrip('\n')
r = requests.get(endpoint + '/api/v4/projects/' + project_id + '/repository/commits/' + hash + '/merge_requests')
r.raise_for_status()
for mr in r.json():
if mr['state'] != 'merged':
continue
if mr['id'] in mrs:
continue
mrs.add(mr['id'])
print('!{} {} ({})'.format(mr['iid'], mr['title'], mr['web_url']), flush=True)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With