Skip to content

Commit 54cc6ee

Browse files
Adding creq release functionality
to become to construct a multi action release request on CLI. Also reporting created request id when using creq command.
1 parent d8bfd45 commit 54cc6ee

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

osc/commandline.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2632,6 +2632,20 @@ def _changedevel_request(self, args, opts):
26322632

26332633
return actionxml
26342634

2635+
def _release_request(self, args, opts):
2636+
if len(args) != 4:
2637+
raise oscerr.WrongArgs('Wrong number of arguments for release' + str(len(args)))
2638+
2639+
project = self._process_project_name(args[0])
2640+
package = args[1]
2641+
target_project = args[2]
2642+
target_repository = args[3]
2643+
2644+
actionxml = """ <action type="release"> <source project="%s" package="%s" /> <target project="%s" repository="%s" /> </action> """ % \
2645+
(project, package, target_project, target_repository)
2646+
2647+
return actionxml
2648+
26352649
def _add_me(self, args, opts):
26362650
if len(args) > 3:
26372651
raise oscerr.WrongArgs('Too many arguments.')
@@ -2754,7 +2768,7 @@ def _set_bugowner(self, args, opts):
27542768
@cmdln.alias("creq")
27552769
def do_createrequest(self, subcmd, opts, *args):
27562770
"""
2757-
Create multiple requests with a single command
2771+
Create a request with multiple actions
27582772
27592773
usage:
27602774
osc creq [OPTIONS] [
@@ -2765,9 +2779,10 @@ def do_createrequest(self, subcmd, opts, *args):
27652779
-a add_group GROUP ROLE PROJECT [PACKAGE]
27662780
-a add_role USER ROLE PROJECT [PACKAGE]
27672781
-a set_bugowner USER PROJECT [PACKAGE]
2782+
-a release PROJECT PACKAGE TARGET_PROJECT TARGET_REPOSITORY
27682783
]
27692784
2770-
Option -m works for all types of request, the rest work only for submit.
2785+
Option -m works for all types of request actions, the rest work only for submit.
27712786
27722787
Example:
27732788
osc creq -a submit -a delete home:someone:branches:openSUSE:Tools -a change_devel openSUSE:Tools osc home:someone:branches:openSUSE:Tools -m ok
@@ -2804,6 +2819,8 @@ def do_createrequest(self, subcmd, opts, *args):
28042819
actionsxml += self._delete_request(args, opts)
28052820
elif action == 'change_devel':
28062821
actionsxml += self._changedevel_request(args, opts)
2822+
elif action == 'release':
2823+
actionsxml += self._release_request(args, opts)
28072824
elif action == 'add_me':
28082825
actionsxml += self._add_me(args, opts)
28092826
elif action == 'add_group':
@@ -2827,6 +2844,7 @@ def do_createrequest(self, subcmd, opts, *args):
28272844

28282845
root = ET.parse(f).getroot()
28292846
rid = root.get('id')
2847+
print(f"Request {rid} created")
28302848
for srid in supersede:
28312849
change_request_state(apiurl, srid, 'superseded',
28322850
f'superseded by {rid}', rid)

0 commit comments

Comments
 (0)