From c859fc5430cdabc63cb52a134435431e62ea973d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Wed, 16 Mar 2011 10:20:38 +0100 Subject: [PATCH] - allow to force the storage of project meta data (to ignore depending repositories for example) --- NEWS | 1 + osc/commandline.py | 4 ++++ osc/core.py | 11 ++++++++--- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index cb2085ad..94e4eb12 100644 --- a/NEWS +++ b/NEWS @@ -25,6 +25,7 @@ - add force option to accept requests in review state. - add "maintenancerequest" command to request a maintenance incident from maintenance team - add "releaserequest" command run a maintenance update release process (for maintenance team only) + - allow to force the storage of project meta data (to ignore depending repositories for example) 0.130 - new "revert" command to restore the original working copy file (without diff --git a/osc/commandline.py b/osc/commandline.py index c079977a..d5651968 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -492,6 +492,8 @@ class Osc(cmdln.Cmdln): help='include defined attribute defaults') @cmdln.option('--attribute-project', action='store_true', help='include project values, if missing in packages ') + @cmdln.option('-f', '--force', action='store_true', + help='force the save operation, allows to ignores some errors like depending repositories. For prj meta only.') @cmdln.option('-F', '--file', metavar='FILE', help='read metadata from FILE, instead of opening an editor. ' '\'-\' denotes standard input. ') @@ -645,6 +647,7 @@ class Osc(cmdln.Cmdln): if cmd == 'prj': edit_meta(metatype='prj', edit=True, + force=opts.force, path_args=quote_plus(project), apiurl=apiurl, template_args=({ @@ -707,6 +710,7 @@ class Osc(cmdln.Cmdln): edit_meta(metatype='prj', data=f, edit=opts.edit, + force=opts.force, apiurl=apiurl, path_args=quote_plus(project)) elif cmd == 'pkg': diff --git a/osc/core.py b/osc/core.py index 92fd7603..86862f64 100644 --- a/osc/core.py +++ b/osc/core.py @@ -3214,7 +3214,7 @@ def meta_exists(metatype, raise e return data -def make_meta_url(metatype, path_args=None, apiurl=None): +def make_meta_url(metatype, path_args=None, apiurl=None, force=False): global metatypes if not apiurl: @@ -3226,7 +3226,11 @@ def make_meta_url(metatype, path_args=None, apiurl=None): if path_args: path = path % path_args - return makeurl(apiurl, [path]) + query = {} + if force: + query = { 'force': '1' } + + return makeurl(apiurl, [path], query) def edit_meta(metatype, @@ -3234,6 +3238,7 @@ def edit_meta(metatype, data=None, template_args=None, edit=False, + force=False, change_is_required=False, apiurl=None): @@ -3251,7 +3256,7 @@ def edit_meta(metatype, if edit: change_is_required = True - url = make_meta_url(metatype, path_args, apiurl) + url = make_meta_url(metatype, path_args, apiurl, force) f=metafile(url, data, change_is_required, metatypes[metatype]['file_ext']) if edit: