diff --git a/osc/commandline.py b/osc/commandline.py index 69113270..4ab051b3 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -2290,6 +2290,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. return request_interactive_review(apiurl, r, group=opts.group, ignore_reviews=ignore_reviews) else: print(r) + print_comments(apiurl, 'request', reqid) if opts.source_buildstatus: sr_actions = r.get_actions('submit') if not sr_actions: diff --git a/osc/core.py b/osc/core.py index 1e5b6b97..0f8d79da 100644 --- a/osc/core.py +++ b/osc/core.py @@ -7155,4 +7155,27 @@ def which(name): return path return None + +def get_comments(apiurl, kind, name): + url = makeurl(apiurl, ['comments', kind, name]) + f = http_GET(url) + return ET.parse(f).getroot() + + +def print_comments(apiurl, kind, name): + def print_rec(comments, indent=''): + for comment in comments: + print(indent, end='') + print('On', comment.get('when'), comment.get('who'), 'wrote:') + text = indent + comment.text.replace('\r\n',' \n') + print(('\n' + indent).join(text.split('\n'))) + print() + print_rec([c for c in root if c.get('parent') == comment.get('id')], indent + ' ') + + root = get_comments(apiurl, kind, name) + comments = [c for c in root if c.get('parent') is None] + if comments: + print('\nComments:') + print_rec(comments) + # vim: sw=4 et