Last active
May 24, 2018 21:47
-
-
Save stefanv/353ded6353435bd84fa5e0ab4443e7d5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import subprocess | |
| import numpy as np | |
| res = subprocess.check_output(['git', 'shortlog', '-s', '-n', '--merges', | |
| '--first-parent', 'master', | |
| '--since="1 year ago"']) | |
| res = res.decode('utf-8').split('\n') | |
| res = [r for r in res if r.strip()] | |
| merges, authors = zip(*[r.split(maxsplit=1) for r in res]) | |
| merges = np.array(merges, dtype=int) | |
| merges = merges / merges[0] | |
| print("Merge ratios for the past year:\n") | |
| for m, a in zip(merges, authors): | |
| if str(m)[:4] != '0.00': | |
| print(f'{m:.2f} {a}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment