mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-11 07:06:16 +01:00
Merge pull request #1235 from dmach/fix-copypac-downgrade-to-revision
copypac: Fix downgrading a package to an old revision
This commit is contained in:
commit
71ce566b68
@ -18,6 +18,12 @@ Scenario: Run `osc copypac <project>/<package> <target-project>/<target-package>
|
||||
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
|
||||
When I execute osc with args "copypac test:factory/test-pkgA test:factory"
|
||||
Then the exit code is 1
|
||||
|
@ -3349,9 +3349,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
if opts.message:
|
||||
comment = opts.message
|
||||
else:
|
||||
if not rev:
|
||||
rev = show_upstream_rev(src_apiurl, src_project, src_package)
|
||||
comment = 'osc copypac from project:%s package:%s revision:%s' % (src_project, src_package, rev)
|
||||
src_rev = rev or show_upstream_rev(src_apiurl, src_project, src_package)
|
||||
comment = 'osc copypac from project:%s package:%s revision:%s' % (src_project, src_package, src_rev)
|
||||
if opts.keep_link:
|
||||
comment += ", using keep-link"
|
||||
if opts.expand:
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user