mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-23 05:26:16 +01:00
- do_request: also print comments when running "osc rq show <reqid>"
Fixes #171.
This commit is contained in:
parent
8f8dd91675
commit
dc32cde545
@ -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)
|
return request_interactive_review(apiurl, r, group=opts.group, ignore_reviews=ignore_reviews)
|
||||||
else:
|
else:
|
||||||
print(r)
|
print(r)
|
||||||
|
print_comments(apiurl, 'request', reqid)
|
||||||
if opts.source_buildstatus:
|
if opts.source_buildstatus:
|
||||||
sr_actions = r.get_actions('submit')
|
sr_actions = r.get_actions('submit')
|
||||||
if not sr_actions:
|
if not sr_actions:
|
||||||
|
23
osc/core.py
23
osc/core.py
@ -7155,4 +7155,27 @@ def which(name):
|
|||||||
return path
|
return path
|
||||||
return None
|
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
|
# vim: sw=4 et
|
||||||
|
Loading…
Reference in New Issue
Block a user