mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-04 10:36:17 +01:00
Extend submitreq list with new optional parameter -M. When given, it will limit the list to the user's own requests.
This commit is contained in:
parent
68152d9faf
commit
f97f287ce7
1
NEWS
1
NEWS
@ -24,6 +24,7 @@
|
||||
* -r|--repo to specify a repository(repositories)
|
||||
* -a|--arch to specify a architexure(s)
|
||||
* --xml for xml output (makes results_meta obsolete)
|
||||
- submitreq list -M shows open SRs created by the user.
|
||||
|
||||
0.117:
|
||||
- support checkout of single package via "osc co PACKAGE" when local dir is project
|
||||
|
@ -482,6 +482,8 @@ class Osc(cmdln.Cmdln):
|
||||
help='only list requests in one of the comma separated given states [default=new]')
|
||||
@cmdln.option('-b', '--brief', action='store_true', default=False,
|
||||
help='print output in list view as list subcommand')
|
||||
@cmdln.option('-M', '--mine', action='store_true',
|
||||
help='only show requests created by yourself')
|
||||
@cmdln.alias("sr")
|
||||
@cmdln.alias("submitrequest")
|
||||
def do_submitreq(self, subcmd, opts, *args):
|
||||
@ -526,7 +528,7 @@ class Osc(cmdln.Cmdln):
|
||||
osc submitreq create [-m TEXT]
|
||||
osc submitreq create [-m TEXT] DESTPRJ [DESTPKG]
|
||||
osc submitreq create [-m TEXT] SOURCEPRJ SOURCEPKG DESTPRJ [DESTPKG]
|
||||
osc submitreq list [PRJ [PKG]]
|
||||
osc submitreq list [-M] [PRJ [PKG]]
|
||||
osc submitreq log ID
|
||||
osc submitreq show [-d] [-b] ID
|
||||
osc submitreq accept [-m TEXT] ID
|
||||
@ -603,12 +605,13 @@ class Osc(cmdln.Cmdln):
|
||||
if len(args) > 0:
|
||||
project = args[0]
|
||||
else:
|
||||
project = store_read_project(os.curdir)
|
||||
apiurl = store_read_apiurl(os.curdir)
|
||||
try:
|
||||
package = store_read_package(os.curdir)
|
||||
except oscerr.NoWorkingCopy:
|
||||
pass
|
||||
if not opts.mine:
|
||||
project = store_read_project(os.curdir)
|
||||
apiurl = store_read_apiurl(os.curdir)
|
||||
try:
|
||||
package = store_read_package(os.curdir)
|
||||
except oscerr.NoWorkingCopy:
|
||||
pass
|
||||
|
||||
if len(args) > 1:
|
||||
package = args[1]
|
||||
@ -661,9 +664,10 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
# list
|
||||
elif cmd == 'list':
|
||||
state_list = opts.state.split(',')
|
||||
|
||||
who = conf.get_apiurl_usr(apiurl) if opts.mine else ''
|
||||
|
||||
results = get_submit_request_list(apiurl,
|
||||
project, package, state_list)
|
||||
project, package, who, state_list)
|
||||
|
||||
results.sort(reverse=True)
|
||||
|
||||
|
16
osc/core.py
16
osc/core.py
@ -2067,12 +2067,20 @@ def change_submit_request_state(apiurl, reqid, newstate, message=''):
|
||||
return f.read()
|
||||
|
||||
|
||||
def get_submit_request_list(apiurl, project, package, req_state=('new',)):
|
||||
match = 'submit/target/@project=\'%s\'' % quote_plus(project)
|
||||
def get_submit_request_list(apiurl, project, package, req_who, req_state=('new',) ):
|
||||
match = ''
|
||||
if project:
|
||||
if len(match): match += '%20and%20'
|
||||
match += 'submit/target/@project=\'%s\'' % quote_plus(project)
|
||||
if package:
|
||||
match += '%20and%20' + 'submit/target/@package=\'%s\'' % quote_plus(package)
|
||||
if len(match): match += '%20and%20'
|
||||
match += 'submit/target/@package=\'%s\'' % quote_plus(package)
|
||||
for state in req_state:
|
||||
match += '%20and%20' + 'state/@name=\'%s\'' % quote_plus(state)
|
||||
if len(match): match += '%20and%20'
|
||||
match += 'state/@name=\'%s\'' % quote_plus(state)
|
||||
if req_who:
|
||||
if len(match): match += '%20and%20'
|
||||
match += 'state/@who=\'%s\'' % quote_plus(req_who)
|
||||
|
||||
u = makeurl(apiurl, ['search', 'request'], ['match=%s' % match])
|
||||
f = http_GET(u)
|
||||
|
Loading…
Reference in New Issue
Block a user