mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-04 10:36:17 +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 log/rlog output formats (CSV and XML)
|
||||||
- new jobhistory/buildhistory output format (CSV)
|
- new jobhistory/buildhistory output format (CSV)
|
||||||
- new option to fetch buildlogs starting at given offset
|
- 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:
|
0.117:
|
||||||
- support checkout of single package via "osc co PACKAGE" when local dir is project
|
- 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.')
|
help='keep original maintainers. Default is remove all and replace with the one calling the script.')
|
||||||
@cmdln.option('-d', '--keep-develproject', action='store_true',
|
@cmdln.option('-d', '--keep-develproject', action='store_true',
|
||||||
help='keep develproject tag in the package metadata')
|
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',
|
@cmdln.option('-t', '--to-apiurl', metavar='URL',
|
||||||
help='URL of destination api server. Default is the source api server.')
|
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',
|
@cmdln.option('-e', '--expand', action='store_true',
|
||||||
help='if the source package is a link then copy the expanded version of the link')
|
help='if the source package is a link then copy the expanded version of the link')
|
||||||
def do_copypac(self, subcmd, opts, *args):
|
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:
|
if src_apiurl != dst_apiurl:
|
||||||
opts.client_side_copy = True
|
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,
|
r = copy_pac(src_apiurl, src_project, src_package,
|
||||||
dst_apiurl, dst_project, dst_package,
|
dst_apiurl, dst_project, dst_package,
|
||||||
client_side_copy=opts.client_side_copy,
|
client_side_copy=opts.client_side_copy,
|
||||||
keep_maintainers=opts.keep_maintainers,
|
keep_maintainers=opts.keep_maintainers,
|
||||||
keep_develproject=opts.keep_develproject,
|
keep_develproject=opts.keep_develproject,
|
||||||
expand=opts.expand)
|
expand=opts.expand,
|
||||||
|
revision=rev,
|
||||||
|
comment=comment)
|
||||||
print r
|
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,
|
client_side_copy = False,
|
||||||
keep_maintainers = False,
|
keep_maintainers = False,
|
||||||
keep_develproject = False,
|
keep_develproject = False,
|
||||||
expand = False):
|
expand = False,
|
||||||
|
revision = None,
|
||||||
|
comment = None):
|
||||||
"""
|
"""
|
||||||
Create a copy of a package.
|
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 }
|
query = {'cmd': 'copy', 'oproject': src_project, 'opackage': src_package }
|
||||||
if expand:
|
if expand:
|
||||||
query['expand'] = '1'
|
query['expand'] = '1'
|
||||||
|
if revision:
|
||||||
|
query['orev'] = revision
|
||||||
|
if comment:
|
||||||
|
query['comment'] = comment
|
||||||
u = makeurl(dst_apiurl, ['source', dst_project, dst_package], query=query)
|
u = makeurl(dst_apiurl, ['source', dst_project, dst_package], query=query)
|
||||||
f = http_POST(u)
|
f = http_POST(u)
|
||||||
return f.read()
|
return f.read()
|
||||||
@ -2628,10 +2634,11 @@ def copy_pac(src_apiurl, src_project, src_package,
|
|||||||
os.chdir(tmpdir)
|
os.chdir(tmpdir)
|
||||||
for n in meta_get_filelist(src_apiurl, src_project, src_package, expand=expand):
|
for n in meta_get_filelist(src_apiurl, src_project, src_package, expand=expand):
|
||||||
print ' ', n
|
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)])
|
u = makeurl(dst_apiurl, ['source', dst_project, dst_package, pathname2url(n)])
|
||||||
http_PUT(u, file = n)
|
http_PUT(u, file = n)
|
||||||
os.unlink(n)
|
os.unlink(n)
|
||||||
|
#FIXME: add comment when doing the final commit (and no commits for each file)
|
||||||
os.rmdir(tmpdir)
|
os.rmdir(tmpdir)
|
||||||
return 'Done.'
|
return 'Done.'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user