mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-13 14:05:06 +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)
|
* -r|--repo to specify a repository(repositories)
|
||||||
* -a|--arch to specify a architexure(s)
|
* -a|--arch to specify a architexure(s)
|
||||||
* --xml for xml output (makes results_meta obsolete)
|
* --xml for xml output (makes results_meta obsolete)
|
||||||
|
- submitreq list -M shows open SRs created by the user.
|
||||||
|
|
||||||
0.117:
|
0.117:
|
||||||
- support checkout of single package via "osc co PACKAGE" when local dir is project
|
- 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]')
|
help='only list requests in one of the comma separated given states [default=new]')
|
||||||
@cmdln.option('-b', '--brief', action='store_true', default=False,
|
@cmdln.option('-b', '--brief', action='store_true', default=False,
|
||||||
help='print output in list view as list subcommand')
|
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("sr")
|
||||||
@cmdln.alias("submitrequest")
|
@cmdln.alias("submitrequest")
|
||||||
def do_submitreq(self, subcmd, opts, *args):
|
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]
|
||||||
osc submitreq create [-m TEXT] DESTPRJ [DESTPKG]
|
osc submitreq create [-m TEXT] DESTPRJ [DESTPKG]
|
||||||
osc submitreq create [-m TEXT] SOURCEPRJ SOURCEPKG 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 log ID
|
||||||
osc submitreq show [-d] [-b] ID
|
osc submitreq show [-d] [-b] ID
|
||||||
osc submitreq accept [-m TEXT] ID
|
osc submitreq accept [-m TEXT] ID
|
||||||
@ -603,6 +605,7 @@ class Osc(cmdln.Cmdln):
|
|||||||
if len(args) > 0:
|
if len(args) > 0:
|
||||||
project = args[0]
|
project = args[0]
|
||||||
else:
|
else:
|
||||||
|
if not opts.mine:
|
||||||
project = store_read_project(os.curdir)
|
project = store_read_project(os.curdir)
|
||||||
apiurl = store_read_apiurl(os.curdir)
|
apiurl = store_read_apiurl(os.curdir)
|
||||||
try:
|
try:
|
||||||
@ -661,9 +664,10 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
# list
|
# list
|
||||||
elif cmd == 'list':
|
elif cmd == 'list':
|
||||||
state_list = opts.state.split(',')
|
state_list = opts.state.split(',')
|
||||||
|
who = conf.get_apiurl_usr(apiurl) if opts.mine else ''
|
||||||
|
|
||||||
results = get_submit_request_list(apiurl,
|
results = get_submit_request_list(apiurl,
|
||||||
project, package, state_list)
|
project, package, who, state_list)
|
||||||
|
|
||||||
results.sort(reverse=True)
|
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()
|
return f.read()
|
||||||
|
|
||||||
|
|
||||||
def get_submit_request_list(apiurl, project, package, req_state=('new',)):
|
def get_submit_request_list(apiurl, project, package, req_who, req_state=('new',) ):
|
||||||
match = 'submit/target/@project=\'%s\'' % quote_plus(project)
|
match = ''
|
||||||
|
if project:
|
||||||
|
if len(match): match += '%20and%20'
|
||||||
|
match += 'submit/target/@project=\'%s\'' % quote_plus(project)
|
||||||
if package:
|
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:
|
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])
|
u = makeurl(apiurl, ['search', 'request'], ['match=%s' % match])
|
||||||
f = http_GET(u)
|
f = http_GET(u)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user