(commit_list: CommitList, category)
| 451 | |
| 452 | |
| 453 | def to_markdown(commit_list: CommitList, category): |
| 454 | def cleanup_title(commit): |
| 455 | match = re.match(r"(.*) \(#\d+\)", commit.title) |
| 456 | if match is None: |
| 457 | return commit.title |
| 458 | return match.group(1) |
| 459 | |
| 460 | merge_mapping = defaultdict(list) |
| 461 | for commit in commit_list.commits: |
| 462 | if commit.merge_into: |
| 463 | merge_mapping[commit.merge_into].append(commit) |
| 464 | |
| 465 | cdc = get_commit_data_cache() |
| 466 | lines = [f"\n## {category}\n"] |
| 467 | for topic in topics: |
| 468 | lines.append(f"### {topic}\n") |
| 469 | commits = commit_list.filter(category=category, topic=topic) |
| 470 | if "_" in topic: |
| 471 | commits.extend( |
| 472 | commit_list.filter(category=category, topic=topic.replace("_", " ")) |
| 473 | ) |
| 474 | if " " in topic: |
| 475 | commits.extend( |
| 476 | commit_list.filter(category=category, topic=topic.replace(" ", "_")) |
| 477 | ) |
| 478 | for commit in commits: |
| 479 | if commit.merge_into: |
| 480 | continue |
| 481 | all_related_commits = merge_mapping[commit.commit_hash] + [commit] |
| 482 | commit_list_md = ", ".join( |
| 483 | get_hash_or_pr_url(c) for c in all_related_commits |
| 484 | ) |
| 485 | result = f"- {cleanup_title(commit)} ({commit_list_md})\n" |
| 486 | lines.append(result) |
| 487 | return lines |
| 488 | |
| 489 | |
| 490 | def get_markdown_header(category): |
no test coverage detected
searching dependent graphs…