Created
July 9, 2020 19:36
-
-
Save nickdesaulniers/5330eea6f46dea93e7766bb03311d474 to your computer and use it in GitHub Desktop.
find the intersections of committers to various git projects
This file contains 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
# python3 find.py linux llvm-project gcc binutils-gdb | |
import argparse | |
import pygit2 | |
def parse_args(): | |
parser = argparse.ArgumentParser(description="Find kernel toolchain devs") | |
parser.add_argument("kernel_dir", help="A git checkout of the Linux Kernel") | |
parser.add_argument("toolchain_dir", help="A git checkout of a toolchain", | |
nargs="+") | |
return parser.parse_args() | |
def find_author_set(git_dir): | |
print("Finding author set for ", git_dir) | |
repo = pygit2.Repository(git_dir) | |
last = repo[repo.head.target] | |
devs = set() | |
for commit in repo.walk(last.id): | |
author = "%s <%s>" % (commit.author.name, commit.author.email) | |
devs.add(author) | |
# break | |
return devs | |
def find(kernel_dir, toolchain_dirs): | |
kernel_devs = find_author_set(kernel_dir) | |
toolchains_devs = [find_author_set(toolchain_dir) for toolchain_dir in toolchain_dirs] | |
whole_set = set() | |
for toolchain_devs in toolchains_devs: | |
intersection = kernel_devs & toolchain_devs | |
whole_set &= intersection | |
print(len(intersection), intersection) | |
print(len(whole_set), whole_set) | |
if __name__ == "__main__": | |
args = parse_args() | |
print(args) | |
find(args.kernel_dir, args.toolchain_dir) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment