mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-26 01:46:13 +01:00
copypac: Fix downgrading a package to an old revision
This commit is contained in:
parent
faf1223ed9
commit
208dbdf6d1
@ -18,6 +18,12 @@ Scenario: Run `osc copypac <project>/<package> <target-project>/<target-package>
|
|||||||
Then the exit code is 0
|
Then the exit code is 0
|
||||||
|
|
||||||
|
|
||||||
|
@destructive
|
||||||
|
Scenario: Run `osc copypac <project>/<package> <project>/<package> --keep-link --revision`
|
||||||
|
When I execute osc with args "copypac test:factory/test-pkgA test:factory/test-pkgA --keep-link --revision=1"
|
||||||
|
Then the exit code is 0
|
||||||
|
|
||||||
|
|
||||||
Scenario: Run `osc copypac` where the source and target are the same
|
Scenario: Run `osc copypac` where the source and target are the same
|
||||||
When I execute osc with args "copypac test:factory/test-pkgA test:factory"
|
When I execute osc with args "copypac test:factory/test-pkgA test:factory"
|
||||||
Then the exit code is 1
|
Then the exit code is 1
|
||||||
|
@ -5959,8 +5959,10 @@ def copy_pac(
|
|||||||
or by the server, in a single api call.
|
or by the server, in a single api call.
|
||||||
"""
|
"""
|
||||||
if (src_apiurl, src_project, src_package) == (dst_apiurl, dst_project, dst_package):
|
if (src_apiurl, src_project, src_package) == (dst_apiurl, dst_project, dst_package):
|
||||||
# copypac is also used to expand sources, let's allow that
|
# special cases when source and target can be the same:
|
||||||
if not expand:
|
# * expanding sources
|
||||||
|
# * downgrading package to an old revision
|
||||||
|
if not any([expand, revision]):
|
||||||
raise oscerr.OscValueError("Cannot copy package. Source and target are the same.")
|
raise oscerr.OscValueError("Cannot copy package. Source and target are the same.")
|
||||||
|
|
||||||
if not (src_apiurl == dst_apiurl and src_project == dst_project
|
if not (src_apiurl == dst_apiurl and src_project == dst_project
|
||||||
|
Loading…
Reference in New Issue
Block a user