1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-09-21 17:56:19 +02:00

Merge pull request #1178 from dmach/fix-osc-sr-list-all

rq list --all: Avoid conflict with the --state option
This commit is contained in:
Dirk Mueller 2022-10-21 10:42:11 +02:00 committed by GitHub
commit cc0bb5ac7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2169,7 +2169,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
help='all states. Same as\'-s all\'') help='all states. Same as\'-s all\'')
@cmdln.option('-f', '--force', action='store_true', @cmdln.option('-f', '--force', action='store_true',
help='enforce state change, can be used to ignore open reviews') help='enforce state change, can be used to ignore open reviews')
@cmdln.option('-s', '--state', default='new,review', @cmdln.option('-s', '--state',
help='only list requests in one of the comma separated given states (new/review/accepted/revoked/declined) or "all" [default="new,review"]') help='only list requests in one of the comma separated given states (new/review/accepted/revoked/declined) or "all" [default="new,review"]')
@cmdln.option('-D', '--days', metavar='DAYS', @cmdln.option('-D', '--days', metavar='DAYS',
help='only list requests in state "new" or changed in the last DAYS.') help='only list requests in state "new" or changed in the last DAYS.')
@ -2300,6 +2300,14 @@ Please submit there instead, or use --nodevelproject to force direct submission.
raise oscerr.WrongOptions('Sorry, the options \'--interactive\' and ' raise oscerr.WrongOptions('Sorry, the options \'--interactive\' and '
'\'--non-interactive\' are mutually exclusive') '\'--non-interactive\' are mutually exclusive')
if opts.all:
state_list = ["all"]
else:
if not opts.state:
opts.state = "new,review"
state_list = opts.state.split(",")
state_list = [i for i in state_list if i.strip()]
if not args: if not args:
args = ['list'] args = ['list']
opts.mine = 1 opts.mine = 1
@ -2420,17 +2428,11 @@ Please submit there instead, or use --nodevelproject to force direct submission.
states = ('new', 'accepted', 'revoked', 'declined', 'review', 'superseded') states = ('new', 'accepted', 'revoked', 'declined', 'review', 'superseded')
who = '' who = ''
if cmd == 'approvenew': if cmd == 'approvenew':
states = ('new') states = ('new',)
results = get_request_collection(apiurl, project=project, package=package, states=['new']) results = get_request_collection(apiurl, project=project, package=package, states=['new'])
else:
state_list = opts.state.split(',')
if state_list == ['']:
state_list = ()
if opts.all:
state_list = ['all']
else: else:
for s in state_list: for s in state_list:
if s not in states and not s == 'all': if s != 'all' and s not in states:
raise oscerr.WrongArgs('Unknown state \'%s\', try one of %s' % (s, ','.join(states))) raise oscerr.WrongArgs('Unknown state \'%s\', try one of %s' % (s, ','.join(states)))
if opts.mine: if opts.mine:
who = conf.get_apiurl_usr(apiurl) who = conf.get_apiurl_usr(apiurl)