mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-11 16:36:14 +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 == '':
|
if opts.state == '':
|
||||||
opts.state = 'all'
|
opts.state = 'all'
|
||||||
|
|
||||||
if opts.state == '':
|
if opts.state == '' and subcmd != 'review':
|
||||||
opts.state = 'declined,new,review'
|
opts.state = 'declined,new,review'
|
||||||
|
|
||||||
if args[0] == 'help':
|
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'])
|
results = get_request_list(apiurl, project, package, '', ['new'])
|
||||||
else:
|
else:
|
||||||
state_list = opts.state.split(',')
|
state_list = opts.state.split(',')
|
||||||
|
if state_list == ['']:
|
||||||
|
state_list = ()
|
||||||
if opts.all:
|
if opts.all:
|
||||||
state_list = ['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:
|
else:
|
||||||
for s in state_list:
|
for s in state_list:
|
||||||
if not s in states and not s == 'all':
|
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)
|
print('error: cannot interpolate \'%s\' in \'%s\'' % (e.args[0], tmpl_name), file=sys.stderr)
|
||||||
return ''
|
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...
|
# this is so ugly...
|
||||||
def build_by(xpath, val):
|
def build_by(xpath, val):
|
||||||
if 'all' in states:
|
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)
|
s_xp = xpath_join(s_xp, '@state=\'%s\'' % state, inner=True)
|
||||||
val = val.strip('[').strip(']')
|
val = val.strip('[').strip(']')
|
||||||
return xpath_join(xpath, 'review[%s and (%s)]' % (val, s_xp), op='and')
|
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 ''
|
return ''
|
||||||
|
|
||||||
xpath = ''
|
xpath = ''
|
||||||
xpath = xpath_join(xpath, 'state/@name=\'review\'', inner=True)
|
if states == ():
|
||||||
if not 'all' in states:
|
# default: requests which are still open and have reviews in "new" state
|
||||||
for state in states:
|
xpath = xpath_join('', 'state/@name=\'review\'', op='and')
|
||||||
xpath = xpath_join(xpath, 'review/@state=\'%s\'' % state, inner=True)
|
xpath = xpath_join(xpath, 'review/@state=\'new\'', op='and')
|
||||||
if byuser or bygroup or bypackage or byproject:
|
|
||||||
# discard constructed xpath...
|
|
||||||
xpath = xpath_join('', 'state/@name=\'review\'', inner=True)
|
|
||||||
if byuser:
|
if byuser:
|
||||||
xpath = build_by(xpath, '@by_user=\'%s\'' % byuser)
|
xpath = build_by(xpath, '@by_user=\'%s\'' % byuser)
|
||||||
if bygroup:
|
if bygroup:
|
||||||
|
Loading…
Reference in New Issue
Block a user