mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-23 13:31:48 +01:00
- support source cleanup on maintenance incidient requests
This commit is contained in:
parent
d2592fdd25
commit
eac124f9f6
@ -2577,6 +2577,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
help='Use this attribute to find default maintenance project (default is OBS:MaintenanceProject)')
|
||||
@cmdln.option('-m', '--message', metavar='TEXT',
|
||||
help='specify message TEXT')
|
||||
@cmdln.option('--no-cleanup', action='store_true',
|
||||
help='do not remove source project on accept')
|
||||
def do_maintenancerequest(self, subcmd, opts, *args):
|
||||
"""${cmd_name}: Create a request for starting a maintenance incident.
|
||||
|
||||
@ -2598,7 +2600,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
if opts.attribute:
|
||||
maintenance_attribute = opts.attribute
|
||||
|
||||
source_project = target_project = None
|
||||
source_project = target_project = opt_sourceupdate = None
|
||||
if not opts.no_cleanup:
|
||||
opt_sourceupdate = 'cleanup'
|
||||
|
||||
if len(args) > 2:
|
||||
raise oscerr.WrongArgs('Too many arguments.')
|
||||
@ -2625,7 +2629,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
if not opts.message:
|
||||
opts.message = edit_message()
|
||||
|
||||
r = create_maintenance_request(apiurl, source_project, target_project, opts.message)
|
||||
r = create_maintenance_request(apiurl, source_project, target_project, opt_sourceupdate, opts.message)
|
||||
print r.reqid
|
||||
|
||||
|
||||
|
@ -2192,7 +2192,7 @@ class Action:
|
||||
'add_role': ('tgt_project', 'tgt_package', 'person_name', 'person_role', 'group_name', 'group_role'),
|
||||
'set_bugowner': ('tgt_project', 'tgt_package', 'person_name'), # obsoleted by add_role
|
||||
'maintenance_release': ('src_project', 'src_package', 'src_rev', 'tgt_project', 'tgt_package', 'person_name'),
|
||||
'maintenance_incident': ('src_project', 'tgt_project', 'person_name'),
|
||||
'maintenance_incident': ('src_project', 'tgt_project', 'person_name', 'opt_sourceupdate'),
|
||||
'delete': ('tgt_project', 'tgt_package'),
|
||||
'change_devel': ('src_project', 'src_package', 'tgt_project', 'tgt_package')}
|
||||
# attribute prefix to element name map (only needed for abbreviated attributes)
|
||||
@ -2396,6 +2396,9 @@ class Request:
|
||||
elif action.type == 'maintenance_incident':
|
||||
d['source'] = '%s ->' % action.src_project
|
||||
d['target'] = action.tgt_project
|
||||
srcupdate = ' '
|
||||
if action.opt_sourceupdate and show_srcupdate:
|
||||
srcupdate = '(%s)' % action.opt_sourceupdate
|
||||
elif action.type == 'maintenance_release':
|
||||
d['source'] = '%s ->' % prj_pkg_join(action.src_project, action.src_package)
|
||||
d['target'] = prj_pkg_join(action.tgt_project, action.tgt_package)
|
||||
@ -3411,10 +3414,10 @@ def create_release_request(apiurl, src_project, message=''):
|
||||
return r
|
||||
|
||||
# create a maintenance incident per request
|
||||
def create_maintenance_request(apiurl, src_project, tgt_project, message=''):
|
||||
def create_maintenance_request(apiurl, src_project, tgt_project, opt_sourceupdate, message=''):
|
||||
import cgi
|
||||
r = Request()
|
||||
r.add_action('maintenance_incident', src_project=src_project, tgt_project=tgt_project)
|
||||
r.add_action('maintenance_incident', src_project=src_project, tgt_project=tgt_project, opt_sourceupdate = opt_sourceupdate)
|
||||
# XXX: clarify why we need the unicode(...) stuff
|
||||
r.description = cgi.escape(unicode(message, 'utf8'))
|
||||
r.create(apiurl)
|
||||
|
Loading…
Reference in New Issue
Block a user