MCPcopy Create free account
hub / github.com/comaps/comaps / format_plain

Function format_plain

tools/python/cherry_picking_issue.py:62–108  ·  view source on GitHub ↗

Inline links without bullet points. Blank lines between multi-commit PR groups.

(commits, commit_range, out)

Source from the content-addressed store, hash-verified

60
61
62def format_plain(commits, commit_range, out):
63 """Inline links without bullet points. Blank lines between multi-commit PR groups."""
64 groups = OrderedDict()
65 for c in commits:
66 key = c["pr"] or f"_no_pr_{c['hash']}"
67 groups.setdefault(key, []).append(c)
68
69 first = True
70 prev_multi = False
71 print(f"`git log --oneline --reverse {commit_range}`", file=out)
72 print("", file=out)
73 print("**Not processed yet**", file=out)
74 print("", file=out)
75 for key, group in groups.items():
76 pr_number = group[0]["pr"]
77 is_multi = len(group) > 1
78 if not first and (prev_multi or is_multi):
79 print("", file=out)
80 if pr_number:
81 info = get_pr_info(pr_number)
82 title = info["title"] or group[0]["desc"]
83 if len(group) == 1:
84 c = group[0]
85 desc = c["desc"]
86 pr_link = f"[#{pr_number}]({BASE}/pull/{pr_number})"
87 if f"(#{pr_number})" in desc:
88 desc = desc.replace(f"(#{pr_number})", f"{pr_link}")
89 else:
90 desc += f" {pr_link}"
91 print(f"`{c['hash']}` {desc}", file=out)
92 else:
93 print(f"PR: {title} [#{pr_number}]({BASE}/pull/{pr_number})", file=out)
94 for c in group:
95 print(f"`{c['hash']}` {c['desc']}", file=out)
96 else:
97 for c in group:
98 clink = f"[↗]({BASE}/commit/{c['hash']})"
99 print(f"`{c['hash']}` {c['desc']} {clink}", file=out)
100 prev_multi = is_multi
101 first = False
102 for section in [
103 "Already done in Comaps",
104 "Blocked due to closed source map generator",
105 "Not wanted",
106 "Not relevant (OM internal)",
107 ]:
108 print(f"\n---\n**{section}**\n", file=out)
109
110
111def check_gh_cli():

Callers 1

mainFunction · 0.85

Calls 2

get_pr_infoFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected