From 704199f279ce67b77bfcf1def51524bb0574bb84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Wed, 4 May 2011 12:11:24 +0200 Subject: [PATCH] - support to create hidden project on "branch" and "createincident" commands --- NEWS | 2 ++ osc/commandline.py | 12 ++++++++++-- osc/core.py | 8 ++++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 66427b86..63a75b57 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,8 @@ # Features which requires OBS 2.3 # - new command "createincident" to create maintenance incidents without a request + - support to create hidden project on "branch" and "createincident" commands + - osc waits and updates package after checkin when a source service is used 0.131 - new command 'develproject' to print the devel project from the package meta. diff --git a/osc/commandline.py b/osc/commandline.py index fe89bbe6..e99b302b 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -2464,6 +2464,8 @@ Please submit there instead, or use --nodevelproject to force direct submission. @cmdln.option('-a', '--attribute', metavar='ATTRIBUTE', help='Use this attribute to find default maintenance project (default is OBS:MaintenanceProject)') + @cmdln.option('--noaccess', action='store_true', + help='Create a hidden project') @cmdln.option('-m', '--message', metavar='TEXT', help='specify message TEXT') def do_createincident(self, subcmd, opts, *args): @@ -2506,6 +2508,8 @@ Please submit there instead, or use --nodevelproject to force direct submission. print 'Using target project \'%s\'' % target_project query = { 'cmd': 'createmaintenanceincident' } + if opts.noaccess: + query["noaccess"] = 1 url = makeurl(apiurl, ['source', target_project], query=query) r = http_POST(url, data=opts.message) print ET.parse(r).getroot().get('code') @@ -2572,6 +2576,8 @@ Please submit there instead, or use --nodevelproject to force direct submission. '(\'osc bco\' is a shorthand for this option)' ) @cmdln.option('-a', '--attribute', metavar='ATTRIBUTE', help='Use this attribute to find affected packages (default is OBS:Maintained)') + @cmdln.option('--noaccess', action='store_true', + help='Create a hidden project') @cmdln.option('-u', '--update-project-attribute', metavar='UPDATE_ATTRIBUTE', help='Use this attribute to find update projects (default is OBS:UpdateProject) ') def do_mbranch(self, subcmd, opts, *args): @@ -2606,7 +2612,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. tproject = args[1] r = attribute_branch_pkg(apiurl, maintained_attribute, maintained_update_project_attribute, \ - package, tproject) + package, tproject, noaccess = opts.noaccess) if r is None: print >>sys.stderr, 'ERROR: Attribute branch call came not back with a project.' @@ -2640,6 +2646,8 @@ Please submit there instead, or use --nodevelproject to force direct submission. '(\'osc bco\' is a shorthand for this option)' ) @cmdln.option('-f', '--force', default=False, action="store_true", help='force branch, overwrite target') + @cmdln.option('--noaccess', action='store_true', + help='Create a hidden project') @cmdln.option('-m', '--message', metavar='TEXT', help='specify message TEXT') @cmdln.option('-r', '--revision', metavar='rev', @@ -2701,7 +2709,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. nodevelproject=opts.nodevelproject, rev=opts.revision, target_project=tproject, target_package=tpackage, return_existing=opts.checkout, msg=opts.message or '', - force=opts.force) + force=opts.force, noaccess=opts.noaccess) if exists: print >>sys.stderr, 'Using existing branch project: %s' % targetprj diff --git a/osc/core.py b/osc/core.py index 7587049c..c4849af2 100644 --- a/osc/core.py +++ b/osc/core.py @@ -4353,7 +4353,7 @@ def aggregate_pac(src_project, src_package, dst_project, dst_package, repo_map = print 'Done.' -def attribute_branch_pkg(apiurl, attribute, maintained_update_project_attribute, package, targetproject, return_existing=False, force=False): +def attribute_branch_pkg(apiurl, attribute, maintained_update_project_attribute, package, targetproject, return_existing=False, force=False, noaccess=False): """ Branch packages defined via attributes (via API call) """ @@ -4363,6 +4363,8 @@ def attribute_branch_pkg(apiurl, attribute, maintained_update_project_attribute, query['target_project'] = targetproject if force: query['force'] = "1" + if noaccess: + query['noaccess'] = "1" if package: query['package'] = package if maintained_update_project_attribute: @@ -4384,7 +4386,7 @@ def attribute_branch_pkg(apiurl, attribute, maintained_update_project_attribute, return r -def branch_pkg(apiurl, src_project, src_package, nodevelproject=False, rev=None, target_project=None, target_package=None, return_existing=False, msg='', force=False): +def branch_pkg(apiurl, src_project, src_package, nodevelproject=False, rev=None, target_project=None, target_package=None, return_existing=False, msg='', force=False, noaccess=False): """ Branch a package (via API call) """ @@ -4393,6 +4395,8 @@ def branch_pkg(apiurl, src_project, src_package, nodevelproject=False, rev=None, query['ignoredevel'] = '1' if force: query['force'] = '1' + if noaccess: + query['noaccess'] = '1' if rev: query['rev'] = rev if target_project: