Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
find the intersections of committers to various git projects
# 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
You can’t perform that action at this time.