mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 06:46:15 +01:00
- make it possible to list by given review states
it used the state always for request and review state before, which makes no sense. makes the code a bit nicer as well hopefully as well
This commit is contained in:
parent
3adb160e0f
commit
3b6f7f1269
@ -2015,7 +2015,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
if opts.state == '':
|
||||
opts.state = 'all'
|
||||
|
||||
if opts.state == '':
|
||||
if opts.state == '' and subcmd != 'review':
|
||||
opts.state = 'declined,new,review'
|
||||
|
||||
if args[0] == 'help':
|
||||
@ -2115,13 +2115,10 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
results = get_request_list(apiurl, project, package, '', ['new'])
|
||||
else:
|
||||
state_list = opts.state.split(',')
|
||||
if state_list == ['']:
|
||||
state_list = ()
|
||||
if opts.all:
|
||||
state_list = ['all']
|
||||
if subcmd == 'review':
|
||||
# is there a special reason why we do not respect the passed states?
|
||||
state_list = ['new']
|
||||
elif opts.state == 'all':
|
||||
state_list = ['all']
|
||||
else:
|
||||
for s in state_list:
|
||||
if not s in states and not s == 'all':
|
||||
|
16
osc/core.py
16
osc/core.py
@ -3983,7 +3983,7 @@ def change_request_state_template(req, newstate):
|
||||
print('error: cannot interpolate \'%s\' in \'%s\'' % (e.args[0], tmpl_name), file=sys.stderr)
|
||||
return ''
|
||||
|
||||
def get_review_list(apiurl, project='', package='', byuser='', bygroup='', byproject='', bypackage='', states=('new')):
|
||||
def get_review_list(apiurl, project='', package='', byuser='', bygroup='', byproject='', bypackage='', states=()):
|
||||
# this is so ugly...
|
||||
def build_by(xpath, val):
|
||||
if 'all' in states:
|
||||
@ -3994,16 +3994,16 @@ def get_review_list(apiurl, project='', package='', byuser='', bygroup='', bypro
|
||||
s_xp = xpath_join(s_xp, '@state=\'%s\'' % state, inner=True)
|
||||
val = val.strip('[').strip(']')
|
||||
return xpath_join(xpath, 'review[%s and (%s)]' % (val, s_xp), op='and')
|
||||
else:
|
||||
# default case
|
||||
return xpath_join(xpath, 'review[%s and @state=\'new\']' % val, op='and')
|
||||
return ''
|
||||
|
||||
xpath = ''
|
||||
xpath = xpath_join(xpath, 'state/@name=\'review\'', inner=True)
|
||||
if not 'all' in states:
|
||||
for state in states:
|
||||
xpath = xpath_join(xpath, 'review/@state=\'%s\'' % state, inner=True)
|
||||
if byuser or bygroup or bypackage or byproject:
|
||||
# discard constructed xpath...
|
||||
xpath = xpath_join('', 'state/@name=\'review\'', inner=True)
|
||||
if states == ():
|
||||
# default: requests which are still open and have reviews in "new" state
|
||||
xpath = xpath_join('', 'state/@name=\'review\'', op='and')
|
||||
xpath = xpath_join(xpath, 'review/@state=\'new\'', op='and')
|
||||
if byuser:
|
||||
xpath = build_by(xpath, '@by_user=\'%s\'' % byuser)
|
||||
if bygroup:
|
||||
|
Loading…
Reference in New Issue
Block a user