Skip to content

Commit

Permalink
- add 'requestbugownership' command for setting the bugowner via request
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianschroeter committed Jun 1, 2011
1 parent 75e1968 commit 946ac03
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
0.132
- rdelete and undelete command requesting now a comment
- add 'requestbugownership' command for setting the bugowner via request
#
# Features which requires OBS 2.3
#
Expand Down
24 changes: 19 additions & 5 deletions osc/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -1533,18 +1533,23 @@ def do_createrequest(self, subcmd, opts, *args):

@cmdln.option('-m', '--message', metavar='TEXT',
help='specify message TEXT')
@cmdln.option('-r', '--role', metavar='role', default='maintainer',
@cmdln.option('-r', '--role', metavar='role',
help='specify user role (default: maintainer)')
@cmdln.alias("reqbugownership")
@cmdln.alias("requestbugownership")
@cmdln.alias("reqmaintainership")
@cmdln.alias("reqms")
@cmdln.alias("reqbs")
def do_requestmaintainership(self, subcmd, opts, *args):
"""${cmd_name}: requests to add user as maintainer
"""${cmd_name}: requests to add user as maintainer or bugowner
usage:
osc requestmaintainership # for current user in checked out package
osc requestmaintainership USER # for specified user in checked out package
osc requestmaintainership PROJECT PACKAGE # for current user
osc requestmaintainership PROJECT PACKAGE USER # request for specified user
osc requestbugownership ... # accepts same parameters but uses bugowner role
${cmd_option_list}
"""
Expand All @@ -1570,14 +1575,23 @@ def do_requestmaintainership(self, subcmd, opts, *args):
else:
raise oscerr.WrongArgs('Wrong number of arguments.')

if not opts.role in ('maintainer', 'bugowner'):
role = 'maintainer'
if subcmd in ( 'reqbugownership', 'requestbugownership', 'reqbs' ):
role = 'bugowner'
if opts.role:
role = opts.role
if not role in ('maintainer', 'bugowner'):
raise oscerr.WrongOptions('invalid \'--role\': either specify \'maintainer\' or \'bugowner\'')
if not opts.message:
opts.message = edit_message()

r = Request()
r.add_action('add_role', tgt_project=project, tgt_package=package,
person_name=user, person_role=opts.role)
if role == 'bugowner':
r.add_action('set_bugowner', tgt_project=project, tgt_package=package,
person_name=user)
else:
r.add_action('add_role', tgt_project=project, tgt_package=package,
person_name=user, person_role=role)
r.description = cgi.escape(opts.message or '')
r.create(apiurl)
print r.reqid
Expand Down

0 comments on commit 946ac03

Please sign in to comment.