Skip to content

Instantly share code, notes, and snippets.

@stefanv
Last active May 24, 2018 21:47
Show Gist options
  • Select an option

  • Save stefanv/353ded6353435bd84fa5e0ab4443e7d5 to your computer and use it in GitHub Desktop.

Select an option

Save stefanv/353ded6353435bd84fa5e0ab4443e7d5 to your computer and use it in GitHub Desktop.
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