mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-12 23:56:13 +01:00
- new option for copypac
* -r to specify source revision * -m to specify a comment (and send default comment if not specified) mmeeks, jpr: this is for you :)
This commit is contained in:
parent
2c42287a98
commit
0648a8c555
3
NEWS
3
NEWS
@ -17,6 +17,9 @@
|
||||
- new log/rlog output formats (CSV and XML)
|
||||
- new jobhistory/buildhistory output format (CSV)
|
||||
- new option to fetch buildlogs starting at given offset
|
||||
- new option for copypac
|
||||
* -r to specify source revision
|
||||
* -m to specify a comment (and send default comment if not specified)
|
||||
|
||||
0.117:
|
||||
- support checkout of single package via "osc co PACKAGE" when local dir is project
|
||||
|
@ -872,8 +872,12 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
help='keep original maintainers. Default is remove all and replace with the one calling the script.')
|
||||
@cmdln.option('-d', '--keep-develproject', action='store_true',
|
||||
help='keep develproject tag in the package metadata')
|
||||
@cmdln.option('-r', '--revision', metavar='rev',
|
||||
help='link the specified revision.')
|
||||
@cmdln.option('-t', '--to-apiurl', metavar='URL',
|
||||
help='URL of destination api server. Default is the source api server.')
|
||||
@cmdln.option('-m', '--message', metavar='TEXT',
|
||||
help='specify message TEXT')
|
||||
@cmdln.option('-e', '--expand', action='store_true',
|
||||
help='if the source package is a link then copy the expanded version of the link')
|
||||
def do_copypac(self, subcmd, opts, *args):
|
||||
@ -923,12 +927,23 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
if src_apiurl != dst_apiurl:
|
||||
opts.client_side_copy = True
|
||||
|
||||
rev, dummy = parseRevisionOption(opts.revision)
|
||||
|
||||
if opts.message:
|
||||
comment=opts.comment
|
||||
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 )
|
||||
|
||||
r = copy_pac(src_apiurl, src_project, src_package,
|
||||
dst_apiurl, dst_project, dst_package,
|
||||
client_side_copy=opts.client_side_copy,
|
||||
keep_maintainers=opts.keep_maintainers,
|
||||
keep_develproject=opts.keep_develproject,
|
||||
expand=opts.expand)
|
||||
expand=opts.expand,
|
||||
revision=rev,
|
||||
comment=comment)
|
||||
print r
|
||||
|
||||
|
||||
|
11
osc/core.py
11
osc/core.py
@ -2594,7 +2594,9 @@ def copy_pac(src_apiurl, src_project, src_package,
|
||||
client_side_copy = False,
|
||||
keep_maintainers = False,
|
||||
keep_develproject = False,
|
||||
expand = False):
|
||||
expand = False,
|
||||
revision = None,
|
||||
comment = None):
|
||||
"""
|
||||
Create a copy of a package.
|
||||
|
||||
@ -2617,6 +2619,10 @@ def copy_pac(src_apiurl, src_project, src_package,
|
||||
query = {'cmd': 'copy', 'oproject': src_project, 'opackage': src_package }
|
||||
if expand:
|
||||
query['expand'] = '1'
|
||||
if revision:
|
||||
query['orev'] = revision
|
||||
if comment:
|
||||
query['comment'] = comment
|
||||
u = makeurl(dst_apiurl, ['source', dst_project, dst_package], query=query)
|
||||
f = http_POST(u)
|
||||
return f.read()
|
||||
@ -2628,10 +2634,11 @@ def copy_pac(src_apiurl, src_project, src_package,
|
||||
os.chdir(tmpdir)
|
||||
for n in meta_get_filelist(src_apiurl, src_project, src_package, expand=expand):
|
||||
print ' ', n
|
||||
get_source_file(src_apiurl, src_project, src_package, n, targetfilename=n)
|
||||
get_source_file(src_apiurl, src_project, src_package, n, targetfilename=n, revision=revision)
|
||||
u = makeurl(dst_apiurl, ['source', dst_project, dst_package, pathname2url(n)])
|
||||
http_PUT(u, file = n)
|
||||
os.unlink(n)
|
||||
#FIXME: add comment when doing the final commit (and no commits for each file)
|
||||
os.rmdir(tmpdir)
|
||||
return 'Done.'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user