Skip to content

Commit

Permalink
- allow to force the storage of project meta data (to ignore dependin…
Browse files Browse the repository at this point in the history
…g repositories for example)
  • Loading branch information
adrianschroeter committed Mar 16, 2011
1 parent 7fe43cb commit c859fc5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions osc/commandline.py
Expand Up @@ -492,6 +492,8 @@ def do_develproject(self, subcmd, opts, *args):
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. ')
Expand Down Expand Up @@ -645,6 +647,7 @@ def do_meta(self, subcmd, opts, *args):
if cmd == 'prj':
edit_meta(metatype='prj',
edit=True,
force=opts.force,
path_args=quote_plus(project),
apiurl=apiurl,
template_args=({
Expand Down Expand Up @@ -707,6 +710,7 @@ def do_meta(self, subcmd, opts, *args):
edit_meta(metatype='prj',
data=f,
edit=opts.edit,
force=opts.force,
apiurl=apiurl,
path_args=quote_plus(project))
elif cmd == 'pkg':
Expand Down
11 changes: 8 additions & 3 deletions osc/core.py
Expand Up @@ -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:
Expand All @@ -3226,14 +3226,19 @@ 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,
path_args=None,
data=None,
template_args=None,
edit=False,
force=False,
change_is_required=False,
apiurl=None):

Expand All @@ -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:
Expand Down

0 comments on commit c859fc5

Please sign in to comment.