1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-24 17:16:12 +01:00

- fix search of requests "I" created. fixes obs#1002

This is using the request collection api call now instead of xpath query.
More searches should be adapted similar most likely.

"osc my sr" is not a good name for this since it is not limited to
submit actions. But "osc my rq" is used for incoming requests.
This commit is contained in:
Adrian Schröter 2015-07-29 11:05:05 +02:00
parent 083f23f77b
commit f7cfe4cdc8
3 changed files with 25 additions and 2 deletions

1
NEWS
View File

@ -1,4 +1,5 @@
0.153
- "my sr" is using the server side request collection to get right results
OBS 2.7 only:
- add "addchannels" and "enablechannel" commands
- support new package instances on branching when using -N parameter

View File

@ -6539,7 +6539,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
osc ${cmd_name} rq
# list requests, excluding project 'foo' and 'bar'
osc ${cmd_name} rq --exclude-project foo,bar
# list submitrequests I made
# list requests I made
osc ${cmd_name} sr
${cmd_usage}
@ -6593,7 +6593,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
elif type in args_prj:
what = {'project': ''}
elif type in args_sr:
requests = get_request_list(apiurl, req_who=user, exclude_target_projects=exclude_projects)
requests = get_request_collection(apiurl, 'creator', req_who=user)
for r in sorted(requests):
print(r.list_view(), '\n')
return

View File

@ -4133,6 +4133,28 @@ def get_review_list(apiurl, project='', package='', byuser='', bygroup='', bypro
requests.append(r)
return requests
# this function uses the logic in the api which is faster and more exact then the xpath search
def get_request_collection(apiurl, role=None, req_who=None, req_states=('new', 'review', 'declined')):
query={ "view" : "collection" }
if role:
query["roles"] = role
if req_who:
query["user"] = req_who
query["states"] = ",".join(req_states)
u = makeurl(apiurl, ['request'], query)
f = http_GET(u)
res = ET.parse(f).getroot()
requests = []
for root in res.findall('request'):
r = Request()
r.read(root)
requests.append(r)
return requests
def get_exact_request_list(apiurl, src_project, dst_project, src_package=None, dst_package=None, req_who=None, req_state=('new', 'review', 'declined'), req_type=None):
xpath = ''
if not 'all' in req_state: