예제 #1
0
try:
    with open(FILE_CONTRIBUTIONS, "r") as fh:
        contributions = json.load(fh)

except Exception:
    contributions = {}

# Read or create set with commits already counted
try:
    with open(FILE_CONTRIBUTIONS_COMMITS, "r") as fh:
        checked_commits = set(json.load(fh))

except Exception:
    checked_commits = set()

for branch in repo.get_branches():
    # Ignore branches from `IGNORE_BRANCHES` list
    if branch.name in IGNORE_BRANCHES:
        print("Skipping branch: {}".format(branch.name))
        continue

    print("Reading branch: {}".format(branch.name))

    for commit in repo.get_commits(branch.name,
                                   since=READ_SINCE,
                                   until=READ_UNTIL):

        message = commit.commit.message.strip().lower()

        # Ignore commits with messages starting with `merge` or
        # ending with `(#digits)` (considered to be pull request)`