1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-09 22:36:14 +01:00

support undelete of project or package

This commit is contained in:
Adrian Schröter 2010-05-21 19:02:42 +02:00
parent 3de185cc38
commit da0c0f6b86
3 changed files with 36 additions and 1 deletions

1
NEWS
View File

@ -13,6 +13,7 @@
- add support for CBpreinstall/CBinstall
- support branch --force to override target
- support for "unresolvable" state of OBS 2.0
- support undelete of project or package
0.126
- added VM autosetup to osc. This requires appropriate OBS version and build script version.

View File

@ -1784,6 +1784,31 @@ Please submit there instead, or use --nodevelproject to force direct submission.
print_request_list(conf.config['apiurl'], devloc, args[1])
def do_undelete(self, subcmd, opts, *args):
"""${cmd_name}: Restores a deleted project or package on the server.
The server restores a package including the sources and meta configuration.
Binaries remain to be lost and will be rebuild.
usage:
osc undelete PROJECT
osc undelete PROJECT PACKAGE [PACKAGE ...]
${cmd_option_list}
"""
args = slash_split(args)
if len(args) < 1:
raise oscerr.WrongArgs('Missing argument.')
prj = args[0]
pkgs = args[1:]
if pkgs:
for pkg in pkgs:
undelete_package(conf.config['apiurl'], prj, pkg)
else:
undelete_project(conf.config['apiurl'], prj)
@cmdln.option('-f', '--force', action='store_true',
help='deletes a package or an empty project')

View File

@ -3526,11 +3526,19 @@ def copy_pac(src_apiurl, src_project, src_package,
return 'Done.'
def undelete_package(apiurl, prj, pac):
u = makeurl(apiurl, ['source', prj, pac], query={'comment': 'undeleted via osc'})
http_POST(u)
def undelete_project(apiurl, prj):
u = makeurl(apiurl, ['source', prj], query={'comment': 'undeleted via osc'})
http_POST(u)
def delete_package(apiurl, prj, pac):
u = makeurl(apiurl, ['source', prj, pac])
http_DELETE(u)
def delete_project(apiurl, prj):
u = makeurl(apiurl, ['source', prj])
http_DELETE(u)
@ -3540,6 +3548,7 @@ def delete_files(apiurl, prj, pac, files):
u = makeurl(apiurl, ['source', prj, pac, file], query={'comment': 'removed %s' % (file, )})
http_DELETE(u)
# old compat lib call
def get_platforms(apiurl):
return get_repositories(apiurl)