1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 22:56:15 +01:00

undelete: Migrate to pop_project_package_from_args()

INCOMPATIBLE CHANGE:
It is no longer possible to specify multiple packages at once,
because it was inconsistent with the rest of osc.
Call osc in a cycle to undelete multiple packages instead.
This commit is contained in:
Daniel Mach 2023-01-02 15:49:58 +01:00
parent 55fd77650d
commit be2c33d86f
2 changed files with 32 additions and 18 deletions

View File

@ -0,0 +1,20 @@
Feature: `osc undelete` command
# common steps for all scenarios
Background:
Given I set working directory to "{context.osc.temp}"
@destructive
Scenario: Run `osc undelete <project>/<package>`
Given I execute osc with args "rdelete test:factory/test-pkgA -m 'why:delete'"
When I execute osc with args "undelete test:factory/test-pkgA -m 'why:undelete'"
Then the exit code is 0
@destructive
Scenario: Run `osc undelete <project>`
Given I execute osc with args "rdelete test:factory --recursive -m 'why:delete'"
When I execute osc with args "undelete test:factory -m 'why:undelete'"
Then the exit code is 0

View File

@ -3775,28 +3775,22 @@ Please submit there instead, or use --nodevelproject to force direct submission.
usage:
osc undelete PROJECT
osc undelete PROJECT PACKAGE [PACKAGE ...]
osc undelete PROJECT PACKAGE
"""
args = slash_split(args)
if len(args) < 1:
raise oscerr.WrongArgs('Missing argument.')
msg = ''
if opts.message:
msg = opts.message
else:
msg = edit_message()
apiurl = self.get_api_url()
prj = self._process_project_name(args[0])
pkgs = args[1:]
if pkgs:
for pkg in pkgs:
undelete_package(apiurl, prj, pkg, msg)
args = list(args)
project, package = pop_project_package_from_args(
args, package_is_optional=True
)
ensure_no_remaining_args(args)
msg = opts.message or edit_message()
if package:
undelete_package(apiurl, project, package, msg)
else:
undelete_project(apiurl, prj, msg)
undelete_project(apiurl, project, msg)
@cmdln.option('-r', '--recursive', action='store_true',
help='deletes a project with packages inside')