Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add withhistory, withbinaries and makeoriginolder to copypac #1104

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion osc/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2980,8 +2980,14 @@ def do_aggregatepac(self, subcmd, opts, *args):
help='URL of destination api server. Default is the source api server.')
@cmdln.option('-m', '--message', metavar='TEXT',
help='specify message TEXT')
@cmdln.option('-M', '--make-origin-older', action='store_true',
help='Make origin older, the source vrev is extended and target is guaranteed to be newer')
@cmdln.option('-e', '--expand', action='store_true',
help='if the source package is a link then copy the expanded version of the link')
@cmdln.option('-w', '--with-history', action='store_true',
help='copies sources with history on copy command')
@cmdln.option('-W', '--with-binaries', action='store_true',
help='copies also binaries on copy command')
def do_copypac(self, subcmd, opts, *args):
"""
Copy a package
Expand Down Expand Up @@ -3038,6 +3044,12 @@ def do_copypac(self, subcmd, opts, *args):
comment += ", using expand"
if opts.client_side_copy:
comment += ", using client side copy"
if opts.make_origin_older:
comment += ", making the origin older"
if opts.with_history:
comment += ", including history"
if opts.with_binaries:
comment += ", including binaries"

if src_project == dst_project and \
src_package == dst_package and \
Expand All @@ -3053,7 +3065,10 @@ def do_copypac(self, subcmd, opts, *args):
expand=opts.expand,
revision=rev,
comment=comment,
keep_link=opts.keep_link)
keep_link=opts.keep_link,
make_origin_older=opts.make_origin_older,
with_history=opts.with_history,
with_binaries=opts.with_binaries)
print(decode_it(r))


Expand Down
11 changes: 10 additions & 1 deletion osc/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -5463,7 +5463,10 @@ def copy_pac(src_apiurl, src_project, src_package,
revision = None,
comment = None,
force_meta_update = None,
keep_link = None):
keep_link=None,
make_origin_older=False,
with_history=False,
with_binaries=False):
"""
Create a copy of a package.

Expand Down Expand Up @@ -5501,6 +5504,12 @@ def copy_pac(src_apiurl, src_project, src_package,
query['orev'] = revision
if comment:
query['comment'] = comment
if make_origin_older:
query['makeoriginolder'] = '1'
if with_history:
query['withhistory'] = '1'
if with_binaries:
query['withbinaries'] = '1'
u = makeurl(dst_apiurl, ['source', dst_project, dst_package], query=query)
f = http_POST(u)
return f.read()
Expand Down