1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-08-28 09:00:46 +02:00

copypac: Fix downgrading a package to an old revision

This commit is contained in:
2023-01-26 10:27:36 +01:00
parent faf1223ed9
commit 208dbdf6d1
2 changed files with 10 additions and 2 deletions

View File

@@ -5959,8 +5959,10 @@ def copy_pac(
or by the server, in a single api call.
"""
if (src_apiurl, src_project, src_package) == (dst_apiurl, dst_project, dst_package):
# copypac is also used to expand sources, let's allow that
if not expand:
# special cases when source and target can be the same:
# * 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.")
if not (src_apiurl == dst_apiurl and src_project == dst_project