mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-24 00:56:15 +01:00
- maintenance request offers to supersede old, but still open requests
bnc#940731
This commit is contained in:
parent
7370950cab
commit
ba7e20bcd1
1
NEWS
1
NEWS
@ -1,5 +1,6 @@
|
||||
0.153
|
||||
- "my sr" is using the server side request collection to get right results
|
||||
- maintenance request offers to supersede old, but still open requests
|
||||
OBS 2.7 only:
|
||||
- add "addchannels" and "enablechannel" commands
|
||||
- support new package instances on branching when using -N parameter
|
||||
|
@ -1284,6 +1284,11 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
src_package,
|
||||
dst_project,
|
||||
dst_package)
|
||||
if not supersede_existing:
|
||||
(supersede_existing, reqs) = check_existing_maintenance_requests(apiurl,
|
||||
src_project,
|
||||
[src_package],
|
||||
dst_project, None)
|
||||
if not opts.message:
|
||||
difflines = []
|
||||
doappend = False
|
||||
@ -2989,6 +2994,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
help='specify incident number to merge in')
|
||||
@cmdln.option('--incident-project', metavar='INCIDENT_PROJECT',
|
||||
help='specify incident project to merge in')
|
||||
@cmdln.option('-s', '--supersede', metavar='SUPERSEDE',
|
||||
help='Superseding another request by this one')
|
||||
@cmdln.alias("mr")
|
||||
def do_maintenancerequest(self, subcmd, opts, *args):
|
||||
"""${cmd_name}: Create a request for starting a maintenance incident.
|
||||
@ -3055,9 +3062,27 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
if not opts.message:
|
||||
opts.message = edit_message()
|
||||
|
||||
supersede_existing = False
|
||||
reqs = []
|
||||
if not opts.supersede:
|
||||
(supersede_existing, reqs) = check_existing_maintenance_requests(apiurl,
|
||||
source_project,
|
||||
source_packages,
|
||||
target_project,
|
||||
None) # unspecified release project
|
||||
|
||||
r = create_maintenance_request(apiurl, source_project, source_packages, target_project, release_project, opt_sourceupdate, opts.message)
|
||||
print(r.reqid)
|
||||
|
||||
if supersede_existing:
|
||||
for req in reqs:
|
||||
change_request_state(apiurl, req.reqid, 'superseded',
|
||||
'superseded by %s' % r.reqid, r.reqid)
|
||||
|
||||
if opts.supersede:
|
||||
change_request_state(apiurl, opts.supersede, 'superseded',
|
||||
opts.message or '', r.reqid)
|
||||
|
||||
|
||||
@cmdln.option('-c', '--checkout', action='store_true',
|
||||
help='Checkout branched package afterwards ' \
|
||||
|
20
osc/core.py
20
osc/core.py
@ -4171,7 +4171,7 @@ def get_exact_request_list(apiurl, src_project, dst_project, src_package=None, d
|
||||
if src_package:
|
||||
xpath += " and source/@package='%s'" % src_package
|
||||
xpath += " and target/@project='%s'" % dst_project
|
||||
if src_project:
|
||||
if dst_package:
|
||||
xpath += " and target/@package='%s'" % dst_package
|
||||
xpath += "]"
|
||||
if req_type:
|
||||
@ -4300,6 +4300,24 @@ def check_existing_requests(apiurl, src_project, src_package, dst_project,
|
||||
raise oscerr.UserAbort()
|
||||
return repl == 'y', reqs
|
||||
|
||||
def check_existing_maintenance_requests(apiurl, src_project, src_packages, dst_project,
|
||||
release_project):
|
||||
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'])
|
||||
repl = ''
|
||||
if reqs:
|
||||
print('There are already the following maintenance incident request: %s.' % \
|
||||
', '.join([i.reqid for i in reqs]))
|
||||
repl = raw_input('Supersede the old requests? (y/n/c) ')
|
||||
if repl.lower() == 'c':
|
||||
print('Aborting', file=sys.stderr)
|
||||
raise oscerr.UserAbort()
|
||||
return repl == 'y', reqs
|
||||
|
||||
def get_group(apiurl, group):
|
||||
u = makeurl(apiurl, ['group', quote_plus(group)])
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user