mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-26 09:56:13 +01:00
Supersede existing requests if --yes is passed to "osc sr"
This basically reverts commit b2b59ca
, because the old code performed
a "no" instead of a "yes" (see also the discussion in
https://github.com/openSUSE/osc/pull/269).
Fixes: #343 ("'osc sr --yes ...' doesn't supersede existing requests
as promised")
This commit is contained in:
parent
aea395a7e7
commit
760d4d65d7
@ -1359,17 +1359,19 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
return
|
||||
supersede_existing = False
|
||||
reqs = []
|
||||
if not opts.supersede and not opts.yes:
|
||||
if not opts.supersede:
|
||||
(supersede_existing, reqs) = check_existing_requests(apiurl,
|
||||
src_project,
|
||||
src_package,
|
||||
dst_project,
|
||||
dst_package)
|
||||
dst_package,
|
||||
not opts.yes)
|
||||
if not supersede_existing:
|
||||
(supersede_existing, reqs) = check_existing_maintenance_requests(apiurl,
|
||||
src_project,
|
||||
[src_package],
|
||||
dst_project, None)
|
||||
dst_project, None,
|
||||
not opts.yes)
|
||||
if not opts.message:
|
||||
difflines = []
|
||||
doappend = False
|
||||
|
@ -4445,11 +4445,13 @@ def get_request_log(apiurl, reqid):
|
||||
return data
|
||||
|
||||
def check_existing_requests(apiurl, src_project, src_package, dst_project,
|
||||
dst_package):
|
||||
dst_package, ask=True):
|
||||
reqs = get_exact_request_list(apiurl, src_project, dst_project,
|
||||
src_package, dst_package,
|
||||
req_type='submit',
|
||||
req_state=['new', 'review', 'declined'])
|
||||
if not ask:
|
||||
return True, reqs
|
||||
repl = ''
|
||||
if reqs:
|
||||
print('There are already the following submit request: %s.' % \
|
||||
@ -4464,13 +4466,15 @@ def check_existing_requests(apiurl, src_project, src_package, dst_project,
|
||||
return repl == 'y', reqs
|
||||
|
||||
def check_existing_maintenance_requests(apiurl, src_project, src_packages, dst_project,
|
||||
release_project):
|
||||
release_project, ask=True):
|
||||
reqs = []
|
||||
for src_package in src_packages:
|
||||
reqs += get_exact_request_list(apiurl, src_project, dst_project,
|
||||
src_package, None,
|
||||
req_type='maintenance_incident',
|
||||
req_state=['new', 'review', 'declined'])
|
||||
if not ask:
|
||||
return True, reqs
|
||||
repl = ''
|
||||
if reqs:
|
||||
print('There are already the following maintenance incident request: %s.' % \
|
||||
|
Loading…
Reference in New Issue
Block a user