Snippets

Dr Wolf Attività git

Created by Andrea Agili last modified
#!/usr/bin/python3

import os
from subprocess import Popen, PIPE
from itertools import groupby

cwd = os.getcwd()
log = []

p = Popen("git config --global user.email", shell=True, stdout=PIPE, encoding='utf8')
email = p.communicate()[0].strip()

for d in [d for d in os.listdir('.') if d[0] !='.' and os.path.isdir(cwd+os.path.sep+d)]:
  os.chdir(cwd+os.path.sep+d)
  p = Popen('git log --date=iso --pretty=format:"%ad%x09%ae" -n100 ', shell=True, stdout=PIPE, stderr=PIPE, encoding='utf8')
  log += [row[:10] + ' ' + d for row in p.communicate()[0].split('\n') if email in row]

log.sort()
log = log[::-1]

out = []
for k,g in groupby(log, lambda x: x[:10]):
  l = list(g)
  out.append("%s %s  %s" % (k,str(len(l)).rjust(3),' '.join(set([x[11:] for x in l]))))

print('\n'.join(out[:30]))

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.