mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 06:46:15 +01:00
- rdelte and undelete operate with history comment now
This commit is contained in:
parent
593acbb843
commit
8dd0d9f8e3
2
NEWS
2
NEWS
@ -1,5 +1,5 @@
|
||||
0.132
|
||||
-
|
||||
- rdelete and undelete command requesting now a comment
|
||||
#
|
||||
# Features which requires OBS 2.3
|
||||
#
|
||||
|
@ -2767,6 +2767,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
print_request_list(apiurl, devloc, srcpkg)
|
||||
|
||||
|
||||
@cmdln.option('-m', '--message', metavar='TEXT',
|
||||
help='specify log message TEXT')
|
||||
def do_undelete(self, subcmd, opts, *args):
|
||||
"""${cmd_name}: Restores a deleted project or package on the server.
|
||||
|
||||
@ -2784,21 +2786,29 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
if len(args) < 1:
|
||||
raise oscerr.WrongArgs('Missing argument.')
|
||||
|
||||
msg = ''
|
||||
if opts.message:
|
||||
msg = opts.message
|
||||
else:
|
||||
msg = edit_message()
|
||||
|
||||
apiurl = self.get_api_url()
|
||||
prj = args[0]
|
||||
pkgs = args[1:]
|
||||
|
||||
if pkgs:
|
||||
for pkg in pkgs:
|
||||
undelete_package(apiurl, prj, pkg)
|
||||
undelete_package(apiurl, prj, pkg, msg)
|
||||
else:
|
||||
undelete_project(apiurl, prj)
|
||||
undelete_project(apiurl, prj, msg)
|
||||
|
||||
|
||||
@cmdln.option('-r', '--recursive', action='store_true',
|
||||
help='deletes a project with packages inside')
|
||||
@cmdln.option('-f', '--force', action='store_true',
|
||||
help='deletes a project where other depends on')
|
||||
@cmdln.option('-m', '--message', metavar='TEXT',
|
||||
help='specify log message TEXT')
|
||||
def do_rdelete(self, subcmd, opts, *args):
|
||||
"""${cmd_name}: Delete a project or packages on the server.
|
||||
|
||||
@ -2823,6 +2833,12 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
apiurl = self.get_api_url()
|
||||
prj = args[0]
|
||||
|
||||
msg = ''
|
||||
if opts.message:
|
||||
msg = opts.message
|
||||
else:
|
||||
msg = edit_message()
|
||||
|
||||
# empty arguments result in recursive project delete ...
|
||||
if not len(prj):
|
||||
raise oscerr.WrongArgs('Project argument is empty')
|
||||
@ -2842,7 +2858,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
'Or just use \'--force\'.'
|
||||
sys.exit(1)
|
||||
|
||||
delete_package(apiurl, prj, pkg, opts.force)
|
||||
delete_package(apiurl, prj, pkg, opts.force, msg)
|
||||
|
||||
elif (not opts.recursive) and len(meta_get_packagelist(apiurl, prj)) >= 1:
|
||||
print >>sys.stderr, 'Project contains packages. It must be empty before deleting it. ' \
|
||||
@ -2850,7 +2866,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
'packages use the \'--with-packages\' switch.'
|
||||
sys.exit(1)
|
||||
else:
|
||||
delete_project(apiurl, prj, opts.force)
|
||||
delete_project(apiurl, prj, opts.force, msg)
|
||||
|
||||
@cmdln.hide(1)
|
||||
def do_deletepac(self, subcmd, opts, *args):
|
||||
|
24
osc/core.py
24
osc/core.py
@ -4533,26 +4533,38 @@ 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', 'cmd': 'undelete'})
|
||||
def undelete_package(apiurl, prj, pac, msg=None):
|
||||
query={'cmd': 'undelete'}
|
||||
if msg:
|
||||
query['comment'] = msg
|
||||
else:
|
||||
query['comment'] = 'undeleted via osc'
|
||||
u = makeurl(apiurl, ['source', prj, pac], query)
|
||||
http_POST(u)
|
||||
|
||||
def undelete_project(apiurl, prj):
|
||||
u = makeurl(apiurl, ['source', prj], query={'comment': 'undeleted via osc', 'cmd': 'undelete'})
|
||||
def undelete_project(apiurl, prj, msg=None):
|
||||
query={'cmd': 'undelete'}
|
||||
if msg:
|
||||
query['comment'] = msg
|
||||
else:
|
||||
query['comment'] = 'undeleted via osc'
|
||||
u = makeurl(apiurl, ['source', prj], query)
|
||||
http_POST(u)
|
||||
|
||||
|
||||
def delete_package(apiurl, prj, pac, force=False):
|
||||
def delete_package(apiurl, prj, pac, force=False, msg=None):
|
||||
query = {}
|
||||
if force:
|
||||
query['force'] = "1"
|
||||
u = makeurl(apiurl, ['source', prj, pac], query)
|
||||
http_DELETE(u)
|
||||
|
||||
def delete_project(apiurl, prj, force=False):
|
||||
def delete_project(apiurl, prj, force=False, msg=None):
|
||||
query = {}
|
||||
if force:
|
||||
query['force'] = "1"
|
||||
if msg:
|
||||
query['comment'] = msg
|
||||
u = makeurl(apiurl, ['source', prj], query)
|
||||
http_DELETE(u)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user