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:
parent
3af97625d4
commit
52e27750e4
3
NEWS
3
NEWS
@ -1,3 +1,6 @@
|
|||||||
|
0.137
|
||||||
|
- support delete requests for repositories.
|
||||||
|
|
||||||
0.136
|
0.136
|
||||||
- prefer TLS v1.1 or v1.2 if available
|
- 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)
|
- declined is considered to be an open state (that is "osc rq list" also shows declined requests)
|
||||||
|
@ -1635,6 +1635,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
@cmdln.option('-m', '--message', metavar='TEXT',
|
@cmdln.option('-m', '--message', metavar='TEXT',
|
||||||
help='specify message TEXT')
|
help='specify message TEXT')
|
||||||
|
@cmdln.option('-r', '--repository', metavar='TEXT',
|
||||||
|
help='specify message TEXT')
|
||||||
@cmdln.alias("dr")
|
@cmdln.alias("dr")
|
||||||
@cmdln.alias("dropreq")
|
@cmdln.alias("dropreq")
|
||||||
@cmdln.alias("droprequest")
|
@cmdln.alias("droprequest")
|
||||||
@ -1645,6 +1647,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
usage:
|
usage:
|
||||||
osc deletereq [-m TEXT] # works in checked out project/package
|
osc deletereq [-m TEXT] # works in checked out project/package
|
||||||
osc deletereq [-m TEXT] PROJECT [PACKAGE]
|
osc deletereq [-m TEXT] PROJECT [PACKAGE]
|
||||||
|
osc deletereq [-m TEXT] PROJECT [--repository REPOSITORY]
|
||||||
${cmd_option_list}
|
${cmd_option_list}
|
||||||
"""
|
"""
|
||||||
import cgi
|
import cgi
|
||||||
@ -1653,6 +1656,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
project = None
|
project = None
|
||||||
package = None
|
package = None
|
||||||
|
repository = None
|
||||||
|
|
||||||
if len(args) > 2:
|
if len(args) > 2:
|
||||||
raise oscerr.WrongArgs('Too many arguments.')
|
raise oscerr.WrongArgs('Too many arguments.')
|
||||||
@ -1669,6 +1673,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
else:
|
else:
|
||||||
raise oscerr.WrongArgs('Please specify at least a project.')
|
raise oscerr.WrongArgs('Please specify at least a project.')
|
||||||
|
|
||||||
|
if opts.repository:
|
||||||
|
repository = opts.repository
|
||||||
|
|
||||||
if not opts.message:
|
if not opts.message:
|
||||||
import textwrap
|
import textwrap
|
||||||
if package is not None:
|
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)
|
opts.message = edit_message(footer)
|
||||||
|
|
||||||
r = Request()
|
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.description = cgi.escape(opts.message)
|
||||||
r.create(self.get_api_url())
|
r.create(self.get_api_url())
|
||||||
print r.reqid
|
print r.reqid
|
||||||
|
10
osc/core.py
10
osc/core.py
@ -2218,7 +2218,7 @@ class Action:
|
|||||||
'set_bugowner': ('tgt_project', 'tgt_package', 'person_name'), # obsoleted by add_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_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'),
|
'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')}
|
'change_devel': ('src_project', 'src_package', 'tgt_project', 'tgt_package')}
|
||||||
# attribute prefix to element name map (only needed for abbreviated attributes)
|
# attribute prefix to element name map (only needed for abbreviated attributes)
|
||||||
prefix_to_elm = {'src': 'source', 'tgt': 'target', 'opt': 'options'}
|
prefix_to_elm = {'src': 'source', 'tgt': 'target', 'opt': 'options'}
|
||||||
@ -2406,9 +2406,11 @@ class Request:
|
|||||||
format an action depending on the action's type.
|
format an action depending on the action's type.
|
||||||
A dict which contains the formatted str's is returned.
|
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:
|
if not pkg:
|
||||||
return prj or ''
|
if not repository:
|
||||||
|
return prj or ''
|
||||||
|
return '%s(%s)' % (prj, repository)
|
||||||
return '%s/%s' % (prj, pkg)
|
return '%s/%s' % (prj, pkg)
|
||||||
|
|
||||||
d = {'type': '%s:' % action.type}
|
d = {'type': '%s:' % action.type}
|
||||||
@ -2450,7 +2452,7 @@ class Request:
|
|||||||
d['target'] = prj_pkg_join(action.tgt_project, action.tgt_package)
|
d['target'] = prj_pkg_join(action.tgt_project, action.tgt_package)
|
||||||
elif action.type == 'delete':
|
elif action.type == 'delete':
|
||||||
d['source'] = ''
|
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
|
return d
|
||||||
|
|
||||||
def list_view(self):
|
def list_view(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user