diff options
author | Kevin Smith <git@kismith.co.uk> | 2013-04-19 09:37:34 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2013-04-19 09:37:34 (GMT) |
commit | 271208c8690c22544102ae30d9bb4b5189fc91cc (patch) | |
tree | f179554b7fbfe830faded3d697ea3134c661010f /BuildTools/Copyright | |
parent | 603f4622bad15da3b800bab5277091904a47f972 (diff) | |
download | swift-271208c8690c22544102ae30d9bb4b5189fc91cc.zip swift-271208c8690c22544102ae30d9bb4b5189fc91cc.tar.bz2 |
Script for extracting contributors from commit log
Change-Id: I83281114f688a04c9763cd3a61c3f6bae99a87ba
Diffstat (limited to 'BuildTools/Copyright')
-rwxr-xr-x | BuildTools/Copyright/find-contribs.py | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/BuildTools/Copyright/find-contribs.py b/BuildTools/Copyright/find-contribs.py new file mode 100755 index 0000000..63c454e --- /dev/null +++ b/BuildTools/Copyright/find-contribs.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python + +import subprocess + +def print_log(full_log): + full_log_lines = full_log.split("\n") + + commits = [] + + commit_bit = "commit " + author_bit = "Author: " + date_bit = "Date: " + + commit = None + for line in full_log_lines: + + if line[0:len(commit_bit)] == commit_bit: + if commit: + commits.append(commit) + commit = {'text':''} + handled = False + for bit in [commit_bit, author_bit, date_bit]: + if line[0:len(bit)] == bit: + commit[bit] = line + handled = True + if not handled: + commit['text'] += line + + commits.append(commit) + + contributions = [] + + for commit in commits: + if not "git@kismith.co.uk" in commit[author_bit] and not "git@el-tramo.be" in commit[author_bit]: + contributions.append(commit) + + #print contributions + contributors = {} + for commit in contributions: + if not commit[author_bit] in contributors: + contributors[commit[author_bit]] = [] + contributors[commit[author_bit]].append(commit[commit_bit]) + + for contributor in contributors: + print contributor + " has contributed patches " + ", ".join([commit[len(commit_bit):] for commit in contributors[contributor]]) + +full_swiften_log = subprocess.check_output(["git", "log", "--", "Swiften"]) + +print "Contributors for Swiften/ subtree:\n" +print_log(full_swiften_log) + +full_all_log = subprocess.check_output(["git", "log"]) + +print "\n\n\n\n" + +print "Contributors for full tree:\n" +print_log(full_all_log) |