def get_bucket_data(buckets, repo_name, date_bucket_fn, start, by_size=False, lines=False, closed=False): print(repo_name) pull_details = "all" if (by_size or lines) else "list" for pull in get_pulls(repo_name, state="all", pull_details=pull_details, org=True): # print("{0.id}: {0.combinedstate} {0.intext}".format(pull)) ignore_ref = "(^release$|^rc/)" if re.search(ignore_ref, pull.base_ref) or pull.title == "Update translations (autogenerated message)": #print("Ignoring pull #{0.number}: {0.title}".format(pull)) continue if by_size: size = " " + size_of_pull(pull) else: size = "" intext = pull.intext if lines: increment = lines_in_pull(pull) else: increment = 1 created = make_timezone_aware(pull.created_at) if created >= start: buckets[date_bucket_fn(created)]["opened " + intext + size] += increment if pull.combinedstate == "merged": merged = make_timezone_aware(pull.merged_at) if merged >= start: buckets[date_bucket_fn(merged)]["merged " + intext + size] += increment elif closed and pull.combinedstate == "closed": closed = make_timezone_aware(pull.closed_at) buckets[date_bucket_fn(closed)]["closed " + intext + size] += increment
def get_bucket_data(buckets, repo_name, date_bucket_fn, start, lines=False, internal=False): print(repo_name) pull_details = "all" if lines else "list" for pull in get_pulls(repo_name, state="all", pull_details=pull_details, org=True): # print("{0.id}: {0.combinedstate} {0.intext}".format(pull)) intext = pull.intext # internal or external # if internal is True, only want to look at "internal" PRs, and if # internal is False, only want to look at "external" PRs. if (internal and intext != 'internal') or (not internal and intext != 'external'): continue ignore_ref = "(^release$|^rc/)" if re.search(ignore_ref, pull.base_ref) or pull.title == "Update translations (autogenerated message)": # print("Ignoring pull #{0.number}: {0.title}".format(pull)) continue if lines: increment = lines_in_pull(pull) else: increment = 1 created = make_timezone_aware(pull.created_at) bucket_key = date_bucket_fn(created) if created >= start: buckets[bucket_key]["opened " + intext] += increment # Bucket based on its current state if pull.combinedstate == "merged": buckets[bucket_key]["merged " + intext] += increment elif pull.combinedstate == "closed": buckets[bucket_key]["closed " + intext] += increment else: # PR is still open print("Unresolved[{1}]: pull #{0.number}: {0.title}".format(pull, bucket_key)) buckets[bucket_key]["unresolved " + intext] += increment