()
| 117 | |
| 118 | |
| 119 | def main(): |
| 120 | parser = argparse.ArgumentParser(description="Generate cherry-pick tracking markdown") |
| 121 | parser.add_argument("range", help="Git commit range, e.g. tag1..tag2") |
| 122 | parser.add_argument("-o", "--output", help="Output file (default: stdout)") |
| 123 | args = parser.parse_args() |
| 124 | |
| 125 | check_gh_cli() |
| 126 | |
| 127 | lines = git_log(args.range) |
| 128 | |
| 129 | commits = [] |
| 130 | for i, line in enumerate(lines): |
| 131 | sha, _, desc = line.partition(" ") |
| 132 | print(f" [{i + 1}/{len(lines)}] looking up {sha} {desc}", file=sys.stderr) |
| 133 | pr = get_pr_number(sha) |
| 134 | commits.append({"hash": sha, "desc": desc, "pr": pr}) |
| 135 | |
| 136 | if args.output: |
| 137 | with open(args.output, "w") as out: |
| 138 | format_plain(commits, args.range, out) |
| 139 | print(f"Wrote {len(commits)} commits to {args.output}", file=sys.stderr) |
| 140 | else: |
| 141 | format_plain(commits, args.range, sys.stdout) |
| 142 | |
| 143 | |
| 144 | if __name__ == "__main__": |
no test coverage detected