mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-27 02:16:12 +01:00
- do_request list:
* --mine + --user and --all + --state options are mutually exclusive * fixed "--all" and "--state all" options
This commit is contained in:
parent
585ab3564d
commit
e3c9e30ca0
@ -780,6 +780,13 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
|
||||
args = slash_split(args)
|
||||
|
||||
if opts.all and opts.state:
|
||||
raise oscerr.WrongOptions('Sorry, the options --all and --state ' \
|
||||
'are mutually exclusive.')
|
||||
if opts.mine and opts.user:
|
||||
raise oscerr.WrongOptions('Sorry, the options --user and --mine ' \
|
||||
'are mutually exclusive.')
|
||||
|
||||
# 'req' defaults to 'req list -M -s all'
|
||||
if not args:
|
||||
args = [ 'list' ]
|
||||
@ -837,17 +844,18 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
states = ('new', 'accepted', 'rejected', 'revoked', 'declined')
|
||||
state_list = opts.state.split(',')
|
||||
if opts.state == 'all':
|
||||
state_list = []
|
||||
state_list = ['all']
|
||||
else:
|
||||
for s in state_list:
|
||||
if not s in states:
|
||||
print >>sys.stderr, "Unknown state %s, try one of %s" % (s, ','.join(states))
|
||||
raise oscerr.WrongArgs('Unknown state \'%s\', try one of %s' % (s, ','.join(states)))
|
||||
who = ''
|
||||
if opts.mine:
|
||||
who = conf.get_apiurl_usr(apiurl)
|
||||
if opts.user:
|
||||
who = opts.user
|
||||
if opts.all:
|
||||
state_list = []
|
||||
state_list = ['all']
|
||||
|
||||
results = get_request_list(apiurl,
|
||||
project, package, who, state_list, opts.type)
|
||||
|
@ -2309,15 +2309,15 @@ def get_request_list(apiurl, project, package, req_who='', req_state=('new',), r
|
||||
requests = []
|
||||
|
||||
matches = []
|
||||
match=''
|
||||
m=''
|
||||
match = ''
|
||||
m = ''
|
||||
if "all" in req_state:
|
||||
req_state=('new', 'accepted', 'declined', 'revoked', 'rejected')
|
||||
for state in req_state:
|
||||
if len(m): m += '%20or%20'
|
||||
m += 'state/@name=\'%s\'' % quote_plus(state)
|
||||
if len(m): match += "(" + m + ")"
|
||||
m=''
|
||||
m = ''
|
||||
if req_who:
|
||||
if len(m): m += '%20and%20'
|
||||
m += 'state/@who=\'%s\'' % quote_plus(req_who)
|
||||
|
Loading…
Reference in New Issue
Block a user