1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-26 01:46:13 +01:00

add osc linktobranch command

This commit is contained in:
Adrian Schröter 2010-01-11 16:36:33 +01:00
parent 5af4250ffc
commit 2aa4700bca
3 changed files with 37 additions and 0 deletions

1
NEWS
View File

@ -7,6 +7,7 @@
#
- new config option 'submitrequest_on_accept_action' to specify a default action
if a submitrequest has been accepted
- add "osc linktobranch" command to convert a classic link to a branch package
0.124
- added 'osc bugowner' as a more intelligent version of 'osc maintainer -B'

View File

@ -1265,6 +1265,29 @@ Please submit there instead, or use --nodevelproject to force direct submission.
set_link_rev(apiurl, project, p, rev)
def do_linktobranch(self, subcmd, opts, *args):
"""${cmd_name}: Convert a package containing a classic link with patch to a branch
This command tells the server to convert a _link with or without a project.diff
to a branch. This is a full copy with a _link file pointing to the branched place.
usage:
osc linkpac PROJECT PACKAGE
${cmd_option_list}
"""
args = slash_split(args)
if not args or len(args) != 2:
raise oscerr.WrongArgs('Incorrect number of arguments.\n\n' \
+ self.get_cmd_help('linktobranch'))
project = args[0]
package = args[1]
link_to_branch(project, package)
@cmdln.option('-C', '--cicount', choices=['add', 'copy', 'local'],
help='cicount attribute in the link, known values are add, copy, and local, default in buildservice is currently add.')
@cmdln.option('-c', '--current', action='store_true',

View File

@ -3036,6 +3036,19 @@ def replace_pkg_meta(pkgmeta, new_name, new_prj, keep_maintainers = False,
root.remove(dp)
return ET.tostring(root)
def link_to_branch(project, package):
"""
convert a package with a _link + project.diff to a branch
"""
if '_link' in meta_get_filelist(conf.config['apiurl'], project, package):
# FIXME, verify that it is no branch already
u = makeurl(conf.config['apiurl'], ['source', project, package], 'cmd=linktobranch')
http_POST(u)
else:
e.osc_msg = 'no _link file inside project \'%s\' package \'%s\'' % (project, package)
raise
def link_pac(src_project, src_package, dst_project, dst_package, force, rev='', cicount='', disable_publish = False):
"""
create a linked package