Mailinglist Archive: opensuse-buildservice (199 mails)

< Previous Next >
[opensuse-buildservice] Re: [PATCH] - add 'requestbugownership' command for setting the bugowner via request
Just as a side note, this is not the first example, but one of those commits
that made a total rewrite necessary. By quality, the last ones by Ludwig and
Vincent aren't any better either. Ideally, fixing sth. shouldn't be only about
adding lines but about re-factoring lines. Otherwise the next commiter might
be tempted to add his personal 'osc scratchmyback' command w/o communication
too.

@suse-tux: For the osc rewrite, I strongly urge you to enforce peer-reviews
for commits. Or even better, don't let anyone commit directly but let them
file merge requests, which can be reviewed and commented appropriatly.
Otherwise the new osc will end up exactly like the current one, as an
unmaintainable pile of crap code.

We also should think about adapting a similar policy for OBS code, but I fear
this would break quite some odd habbits...

On Wednesday 01 June 2011 09:28:33 OBS osc wrote:
From: Adrian Schröter <adrian@xxxxxxx>

---
NEWS | 1 +
osc/commandline.py | 24 +++++++++++++++++++-----
2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/NEWS b/NEWS
index f9bb6a6..3002937 100644
--- a/NEWS
+++ b/NEWS
@@ -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
#
diff --git a/osc/commandline.py b/osc/commandline.py
index 2090d7b..04c091f 100644
--- a/osc/commandline.py
+++ b/osc/commandline.py
@@ -1533,18 +1533,23 @@ Please submit there instead, or use
--nodevelproject to force direct submission.

@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}
"""
@@ -1570,14 +1575,23 @@ Please submit there instead, or use
--nodevelproject to force direct submission. 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

--
With kind regards,
Sascha Peilicke
SUSE Linux Products GmbH - GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer
Maxfeldstraße 5, 90409 Nuernberg, Germany - HRB 16746 (AG Nuernberg)
< Previous Next >