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

osc branch: add --nodevelproject

This commit is contained in:
Dr. Peter Poeml 2008-06-03 13:16:55 +00:00
parent 98090f8b09
commit 7641ed0c8c
2 changed files with 22 additions and 4 deletions

View File

@ -670,6 +670,9 @@ class Osc(cmdln.Cmdln):
print r
@cmdln.option('--nodevelproject', action='store_true',
help='do not follow a defined devel project ' \
'(primary project where a package is developed)')
def do_branch(self, subcmd, opts, prj, pkg):
"""${cmd_name}: Branch a package
@ -684,9 +687,20 @@ class Osc(cmdln.Cmdln):
${cmd_option_list}
"""
r = branch_pkg(conf.config['apiurl'], prj, pkg)
r = branch_pkg(conf.config['apiurl'], prj, pkg, nodevelproject=opts.nodevelproject)
print 'A working copy of the branched package can be checked out with\n' \
expected = 'home:%s:branches:%s' % (conf.config['user'], prj)
if r != expected:
devloc = r.split('branches:')[1]
print '\nNote: The branch has been created of a different project,\n' \
' %s,\n' \
' which is the primary location of where development for\n' \
' that package takes place.\n' \
' That\'s also where you would normally make changes against.\n' \
' A direct branch of the specified package can be forced\n' \
' with the --nodevelproject option.\n' % devloc
print 'A working copy of the branched package can be checked out with:\n' \
'osc checkout --expand-link %s %s' \
% (r, pkg)

View File

@ -2333,15 +2333,19 @@ 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):
def branch_pkg(apiurl, src_project, src_package, nodevelproject=False):
"""
Branch a package (via API call)
"""
query = { 'cmd': 'branch' }
if nodevelproject:
query['nodevelproject'] = '1'
u = makeurl(conf.config['apiurl'],
['source', src_project, src_package],
query='cmd=branch')
query=query)
f = http_POST(u)
r = f.read()
#print r
r = r.split('targetproject">')[1]
r = r.split('</data>')[0]
return r