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

- add support for delete requests.

This commit is contained in:
Adrian Schröter 2012-11-13 13:20:09 +01:00
parent 3af97625d4
commit 52e27750e4
3 changed files with 17 additions and 5 deletions

3
NEWS
View File

@ -1,3 +1,6 @@
0.137
- support delete requests for repositories.
0.136
- prefer TLS v1.1 or v1.2 if available
- declined is considered to be an open state (that is "osc rq list" also shows declined requests)

View File

@ -1635,6 +1635,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
@cmdln.option('-m', '--message', metavar='TEXT',
help='specify message TEXT')
@cmdln.option('-r', '--repository', metavar='TEXT',
help='specify message TEXT')
@cmdln.alias("dr")
@cmdln.alias("dropreq")
@cmdln.alias("droprequest")
@ -1645,6 +1647,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
usage:
osc deletereq [-m TEXT] # works in checked out project/package
osc deletereq [-m TEXT] PROJECT [PACKAGE]
osc deletereq [-m TEXT] PROJECT [--repository REPOSITORY]
${cmd_option_list}
"""
import cgi
@ -1653,6 +1656,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
project = None
package = None
repository = None
if len(args) > 2:
raise oscerr.WrongArgs('Too many arguments.')
@ -1669,6 +1673,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
else:
raise oscerr.WrongArgs('Please specify at least a project.')
if opts.repository:
repository = opts.repository
if not opts.message:
import textwrap
if package is not None:
@ -1681,7 +1688,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
opts.message = edit_message(footer)
r = Request()
r.add_action('delete', tgt_project=project, tgt_package=package)
r.add_action('delete', tgt_project=project, tgt_package=package, tgt_repository=repository)
r.description = cgi.escape(opts.message)
r.create(self.get_api_url())
print r.reqid

View File

@ -2218,7 +2218,7 @@ class Action:
'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', 'src_package', 'src_rev', 'tgt_project', 'tgt_releaseproject', 'person_name', 'opt_sourceupdate'),
'delete': ('tgt_project', 'tgt_package'),
'delete': ('tgt_project', 'tgt_package', 'tgt_repository'),
'change_devel': ('src_project', 'src_package', 'tgt_project', 'tgt_package')}
# attribute prefix to element name map (only needed for abbreviated attributes)
prefix_to_elm = {'src': 'source', 'tgt': 'target', 'opt': 'options'}
@ -2406,9 +2406,11 @@ class Request:
format an action depending on the action's type.
A dict which contains the formatted str's is returned.
"""
def prj_pkg_join(prj, pkg):
def prj_pkg_join(prj, pkg, repository):
if not pkg:
return prj or ''
if not repository:
return prj or ''
return '%s(%s)' % (prj, repository)
return '%s/%s' % (prj, pkg)
d = {'type': '%s:' % action.type}
@ -2450,7 +2452,7 @@ class Request:
d['target'] = prj_pkg_join(action.tgt_project, action.tgt_package)
elif action.type == 'delete':
d['source'] = ''
d['target'] = prj_pkg_join(action.tgt_project, action.tgt_package)
d['target'] = prj_pkg_join(action.tgt_project, action.tgt_package, action.tgt_repository)
return d
def list_view(self):