1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-11-26 22:49:49 +01:00

Add '--timeline' option to 'git-obs pr get'

This commit is contained in:
2025-07-24 13:26:21 +02:00
parent 3eda1b53b3
commit 4dadca5c16
6 changed files with 483 additions and 0 deletions

View File

@@ -22,6 +22,11 @@ class PullRequestGetCommand(osc.commandline_git.GitObsCommand):
action="store_true",
help="Show patches associated with the pull requests",
)
self.add_argument(
"--timeline",
action="store_true",
help="Show timelines of the pull requests",
)
def run(self, args):
from osc import gitea_api
@@ -43,6 +48,18 @@ class PullRequestGetCommand(osc.commandline_git.GitObsCommand):
raise
print(pr_obj.to_human_readable_string())
if args.timeline:
print()
print(tty.colorize("Timeline:", "bold"))
timeline = gitea_api.IssueTimelineEntry.list(self.gitea_conn, owner, repo, pull)
for entry in timeline:
text, body = entry.format()
if text is None:
continue
print(f"{gitea_api.dt_sanitize(entry.created_at)} {entry.user} {text}")
for line in (body or "").strip().splitlines():
print(f" | {line}")
if args.patch:
print("")
print(tty.colorize("Patch:", "bold"))