Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding creq release functionality #1606

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions osc/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2632,6 +2632,20 @@ def _changedevel_request(self, args, opts):

return actionxml

def _release_request(self, args, opts):
if len(args) != 4:
raise oscerr.WrongArgs('Wrong number of arguments for release' + str(len(args)))

project = self._process_project_name(args[0])
package = args[1]
target_project = args[2]
target_repository = args[3]

actionxml = """ <action type="release"> <source project="%s" package="%s" /> <target project="%s" repository="%s" /> </action> """ % \
(project, package, target_project, target_repository)

return actionxml

def _add_me(self, args, opts):
if len(args) > 3:
raise oscerr.WrongArgs('Too many arguments.')
Expand Down Expand Up @@ -2754,7 +2768,7 @@ def _set_bugowner(self, args, opts):
@cmdln.alias("creq")
def do_createrequest(self, subcmd, opts, *args):
"""
Create multiple requests with a single command
Create a request with multiple actions

usage:
osc creq [OPTIONS] [
Expand All @@ -2765,9 +2779,10 @@ def do_createrequest(self, subcmd, opts, *args):
-a add_group GROUP ROLE PROJECT [PACKAGE]
-a add_role USER ROLE PROJECT [PACKAGE]
-a set_bugowner USER PROJECT [PACKAGE]
-a release PROJECT PACKAGE TARGET_PROJECT TARGET_REPOSITORY
]

Option -m works for all types of request, the rest work only for submit.
Option -m works for all types of request actions, the rest work only for submit.

Example:
osc creq -a submit -a delete home:someone:branches:openSUSE:Tools -a change_devel openSUSE:Tools osc home:someone:branches:openSUSE:Tools -m ok
Expand Down Expand Up @@ -2804,6 +2819,8 @@ def do_createrequest(self, subcmd, opts, *args):
actionsxml += self._delete_request(args, opts)
elif action == 'change_devel':
actionsxml += self._changedevel_request(args, opts)
elif action == 'release':
actionsxml += self._release_request(args, opts)
elif action == 'add_me':
actionsxml += self._add_me(args, opts)
elif action == 'add_group':
Expand All @@ -2827,6 +2844,7 @@ def do_createrequest(self, subcmd, opts, *args):

root = ET.parse(f).getroot()
rid = root.get('id')
print(f"Request {rid} created")
for srid in supersede:
change_request_state(apiurl, srid, 'superseded',
f'superseded by {rid}', rid)
Expand Down
Loading