mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-14 01:26:23 +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
|
return
|
||||||
supersede_existing = False
|
supersede_existing = False
|
||||||
reqs = []
|
reqs = []
|
||||||
if not opts.supersede and not opts.yes:
|
if not opts.supersede:
|
||||||
(supersede_existing, reqs) = check_existing_requests(apiurl,
|
(supersede_existing, reqs) = check_existing_requests(apiurl,
|
||||||
src_project,
|
src_project,
|
||||||
src_package,
|
src_package,
|
||||||
dst_project,
|
dst_project,
|
||||||
dst_package)
|
dst_package,
|
||||||
|
not opts.yes)
|
||||||
if not supersede_existing:
|
if not supersede_existing:
|
||||||
(supersede_existing, reqs) = check_existing_maintenance_requests(apiurl,
|
(supersede_existing, reqs) = check_existing_maintenance_requests(apiurl,
|
||||||
src_project,
|
src_project,
|
||||||
[src_package],
|
[src_package],
|
||||||
dst_project, None)
|
dst_project, None,
|
||||||
|
not opts.yes)
|
||||||
if not opts.message:
|
if not opts.message:
|
||||||
difflines = []
|
difflines = []
|
||||||
doappend = False
|
doappend = False
|
||||||
|
@ -4445,11 +4445,13 @@ def get_request_log(apiurl, reqid):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
def check_existing_requests(apiurl, src_project, src_package, dst_project,
|
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,
|
reqs = get_exact_request_list(apiurl, src_project, dst_project,
|
||||||
src_package, dst_package,
|
src_package, dst_package,
|
||||||
req_type='submit',
|
req_type='submit',
|
||||||
req_state=['new', 'review', 'declined'])
|
req_state=['new', 'review', 'declined'])
|
||||||
|
if not ask:
|
||||||
|
return True, reqs
|
||||||
repl = ''
|
repl = ''
|
||||||
if reqs:
|
if reqs:
|
||||||
print('There are already the following submit request: %s.' % \
|
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
|
return repl == 'y', reqs
|
||||||
|
|
||||||
def check_existing_maintenance_requests(apiurl, src_project, src_packages, dst_project,
|
def check_existing_maintenance_requests(apiurl, src_project, src_packages, dst_project,
|
||||||
release_project):
|
release_project, ask=True):
|
||||||
reqs = []
|
reqs = []
|
||||||
for src_package in src_packages:
|
for src_package in src_packages:
|
||||||
reqs += get_exact_request_list(apiurl, src_project, dst_project,
|
reqs += get_exact_request_list(apiurl, src_project, dst_project,
|
||||||
src_package, None,
|
src_package, None,
|
||||||
req_type='maintenance_incident',
|
req_type='maintenance_incident',
|
||||||
req_state=['new', 'review', 'declined'])
|
req_state=['new', 'review', 'declined'])
|
||||||
|
if not ask:
|
||||||
|
return True, reqs
|
||||||
repl = ''
|
repl = ''
|
||||||
if reqs:
|
if reqs:
|
||||||
print('There are already the following maintenance incident request: %s.' % \
|
print('There are already the following maintenance incident request: %s.' % \
|
||||||
|
Loading…
Reference in New Issue
Block a user