mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 22:56:15 +01:00
Merge pull request #1290 from hellcp-work/master
Fix creq command not working
This commit is contained in:
commit
c2b0898bbe
@ -2390,27 +2390,6 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
change_request_state(apiurl, opts.supersede, 'superseded',
|
change_request_state(apiurl, opts.supersede, 'superseded',
|
||||||
opts.message or '', result)
|
opts.message or '', result)
|
||||||
|
|
||||||
def _actionparser(self, opt_str, value, parser):
|
|
||||||
value = []
|
|
||||||
if not hasattr(parser.values, 'actiondata'):
|
|
||||||
setattr(parser.values, 'actiondata', [])
|
|
||||||
if parser.values.actions is None:
|
|
||||||
parser.values.actions = []
|
|
||||||
|
|
||||||
rargs = parser.rargs
|
|
||||||
while rargs:
|
|
||||||
arg = rargs[0]
|
|
||||||
if ((arg[:2] == "--" and len(arg) > 2) or
|
|
||||||
(arg[:1] == "-" and len(arg) > 1 and arg[1] != "-")):
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
value.append(arg)
|
|
||||||
del rargs[0]
|
|
||||||
|
|
||||||
parser.values.actions.append(value[0])
|
|
||||||
del value[0]
|
|
||||||
parser.values.actiondata.append(slash_split(value))
|
|
||||||
|
|
||||||
def _submit_request(self, args, opts, options_block):
|
def _submit_request(self, args, opts, options_block):
|
||||||
actionxml = ""
|
actionxml = ""
|
||||||
apiurl = self.get_api_url()
|
apiurl = self.get_api_url()
|
||||||
@ -2684,9 +2663,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
return actionxml
|
return actionxml
|
||||||
|
|
||||||
# TODO: fix ValueError: unknown action "callback"
|
@cmdln.option('-a', '--action', action='append', nargs='+', metavar=('ACTION', '[ARGS]'), dest='actions', default=[],
|
||||||
# @cmdln.option('-a', '--action', action='callback', callback = _actionparser, dest = 'actions',
|
help='specify action type of a request, can be : submit/delete/change_devel/add_role/set_bugowner')
|
||||||
# help='specify action type of a request, can be : submit/delete/change_devel/add_role/set_bugowner')
|
|
||||||
@cmdln.option('-m', '--message', metavar='TEXT',
|
@cmdln.option('-m', '--message', metavar='TEXT',
|
||||||
help='specify message TEXT')
|
help='specify message TEXT')
|
||||||
@cmdln.option('-r', '--revision', metavar='REV',
|
@cmdln.option('-r', '--revision', metavar='REV',
|
||||||
@ -2744,42 +2722,29 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
apiurl = self.get_api_url()
|
apiurl = self.get_api_url()
|
||||||
|
|
||||||
i = 0
|
|
||||||
actionsxml = ""
|
actionsxml = ""
|
||||||
supersede = set()
|
supersede = set()
|
||||||
for ai in opts.actions:
|
for actiondata in opts.actions:
|
||||||
if ai == 'submit':
|
action = actiondata[0]
|
||||||
args = opts.actiondata[i]
|
args = actiondata[1:]
|
||||||
i = i + 1
|
if action == 'submit':
|
||||||
actions, to_supersede = self._submit_request(args, opts, options_block)
|
actions, to_supersede = self._submit_request(args, opts, options_block)
|
||||||
actionsxml += actions
|
actionsxml += actions
|
||||||
supersede.update(to_supersede)
|
supersede.update(to_supersede)
|
||||||
elif ai == 'delete':
|
elif action == 'delete':
|
||||||
args = opts.actiondata[i]
|
|
||||||
actionsxml += self._delete_request(args, opts)
|
actionsxml += self._delete_request(args, opts)
|
||||||
i = i + 1
|
elif action == 'change_devel':
|
||||||
elif ai == 'change_devel':
|
|
||||||
args = opts.actiondata[i]
|
|
||||||
actionsxml += self._changedevel_request(args, opts)
|
actionsxml += self._changedevel_request(args, opts)
|
||||||
i = i + 1
|
elif action == 'add_me':
|
||||||
elif ai == 'add_me':
|
|
||||||
args = opts.actiondata[i]
|
|
||||||
actionsxml += self._add_me(args, opts)
|
actionsxml += self._add_me(args, opts)
|
||||||
i = i + 1
|
elif action == 'add_group':
|
||||||
elif ai == 'add_group':
|
|
||||||
args = opts.actiondata[i]
|
|
||||||
actionsxml += self._add_group(args, opts)
|
actionsxml += self._add_group(args, opts)
|
||||||
i = i + 1
|
elif action == 'add_role':
|
||||||
elif ai == 'add_role':
|
|
||||||
args = opts.actiondata[i]
|
|
||||||
actionsxml += self._add_user(args, opts)
|
actionsxml += self._add_user(args, opts)
|
||||||
i = i + 1
|
elif action == 'set_bugowner':
|
||||||
elif ai == 'set_bugowner':
|
|
||||||
args = opts.actiondata[i]
|
|
||||||
actionsxml += self._set_bugowner(args, opts)
|
actionsxml += self._set_bugowner(args, opts)
|
||||||
i = i + 1
|
|
||||||
else:
|
else:
|
||||||
raise oscerr.WrongArgs('Unsupported action %s' % ai)
|
raise oscerr.WrongArgs(f"Unsupported action {action}")
|
||||||
if actionsxml == "":
|
if actionsxml == "":
|
||||||
sys.exit('No actions need to be taken.')
|
sys.exit('No actions need to be taken.')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user