mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-27 02:16:12 +01:00
- add osc branch command, using the branch API call to branch a package to
home:poeml:branches:PRJ/PKG
This commit is contained in:
parent
7e524fd442
commit
d8245f5f36
@ -603,6 +603,7 @@ class Osc(cmdln.Cmdln):
|
||||
return 1
|
||||
aggregate_pac(src_project, src_package, dst_project, dst_package)
|
||||
|
||||
|
||||
@cmdln.option('-c', '--client-side-copy', action='store_true',
|
||||
help='do a (slower) client-side copy')
|
||||
@cmdln.option('-k', '--keep-maintainers', action='store_true',
|
||||
@ -663,6 +664,29 @@ class Osc(cmdln.Cmdln):
|
||||
print r
|
||||
|
||||
|
||||
def do_branch(self, subcmd, opts, prj, pkg):
|
||||
"""${cmd_name}: Branch a package
|
||||
|
||||
Create a source link from a package of an existing project to a new
|
||||
subproject of the requesters home project (home:branches:)
|
||||
|
||||
The branched package will live in
|
||||
home:USERNAME:branches:PROJECT/PACKAGE
|
||||
|
||||
usage:
|
||||
osc branch SOURCEPRJ SOURCEPKG
|
||||
${cmd_option_list}
|
||||
"""
|
||||
|
||||
r = branch_pkg(conf.config['apiurl'], prj, pkg)
|
||||
if self.options.debug:
|
||||
print r
|
||||
|
||||
print 'A working copy of the branched package can be checked out with\n' \
|
||||
'osc checkout home:%s:branches:%s %s' \
|
||||
% (conf.config['user'], prj, pkg)
|
||||
|
||||
|
||||
def do_deletepac(self, subcmd, opts, project, *pkgs):
|
||||
"""${cmd_name}: Delete packages on the repository server
|
||||
|
||||
|
11
osc/core.py
11
osc/core.py
@ -2333,6 +2333,17 @@ def aggregate_pac(src_project, src_package, dst_project, dst_package):
|
||||
http_PUT(u, data=aggregate_template)
|
||||
print 'Done.'
|
||||
|
||||
def branch_pkg(apiurl, src_project, src_package):
|
||||
"""
|
||||
Branch a package (via API call)
|
||||
"""
|
||||
u = makeurl(conf.config['apiurl'],
|
||||
['source', src_project, src_package],
|
||||
query='cmd=branch')
|
||||
f = http_POST(u)
|
||||
return f.read()
|
||||
|
||||
|
||||
def copy_pac(src_apiurl, src_project, src_package,
|
||||
dst_apiurl, dst_project, dst_package,
|
||||
client_side_copy = False,
|
||||
|
Loading…
Reference in New Issue
Block a user