mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 22:56:15 +01:00
detachbranch: Migrate to pop_project_package_from_args()
This commit is contained in:
parent
f7d2d1592a
commit
d779eb936d
27
behave/features/detachbranch.feature
Normal file
27
behave/features/detachbranch.feature
Normal file
@ -0,0 +1,27 @@
|
||||
Feature: `osc detachbranch` command
|
||||
|
||||
|
||||
# common steps for all scenarios
|
||||
Background:
|
||||
Given I set working directory to "{context.osc.temp}"
|
||||
And I execute osc with args "linkpac test:factory/test-pkgA home:Admin"
|
||||
|
||||
|
||||
@destructive
|
||||
Scenario: Run `osc detachbranch <project> <package>`
|
||||
When I execute osc with args "detachbranch home:Admin test-pkgA"
|
||||
Then the exit code is 0
|
||||
|
||||
|
||||
@destructive
|
||||
Scenario: Run `osc detachbranch <project>`
|
||||
When I execute osc with args "detachbranch home:Admin"
|
||||
Then the exit code is 1
|
||||
|
||||
|
||||
@destructive
|
||||
Scenario: Run `osc detachbranch` from a package working copy
|
||||
Given I execute osc with args "co home:Admin/test-pkgA"
|
||||
And I set working directory to "{context.osc.temp}/home:Admin/test-pkgA"
|
||||
When I execute osc with args "detachbranch"
|
||||
Then the exit code is 0
|
@ -2974,21 +2974,16 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
does not exist anymore.
|
||||
|
||||
usage:
|
||||
osc detachbranch # can be used in package working copy
|
||||
osc detachbranch # from a package working copy
|
||||
osc detachbranch PROJECT PACKAGE
|
||||
"""
|
||||
args = slash_split(args)
|
||||
apiurl = self.get_api_url()
|
||||
if len(args) == 0:
|
||||
project = store_read_project(Path.cwd())
|
||||
package = store_read_package(Path.cwd())
|
||||
elif len(args) == 2:
|
||||
project = self._process_project_name(args[0])
|
||||
package = args[1]
|
||||
elif len(args) > 2:
|
||||
raise oscerr.WrongArgs('Too many arguments (required none or two)')
|
||||
else:
|
||||
raise oscerr.WrongArgs('Too few arguments (required none or two)')
|
||||
|
||||
args = list(args)
|
||||
project, package = pop_project_package_from_args(
|
||||
args, default_project=".", default_package=".", package_is_optional=False
|
||||
)
|
||||
ensure_no_remaining_args(args)
|
||||
|
||||
try:
|
||||
copy_pac(apiurl, project, package, apiurl, project, package, expand=True, comment=opts.message)
|
||||
|
Loading…
Reference in New Issue
Block a user