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:
@@ -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"))
|
||||
|
||||
Reference in New Issue
Block a user