mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-02 09:46:16 +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
|
0.132
|
||||||
-
|
- rdelete and undelete command requesting now a comment
|
||||||
#
|
#
|
||||||
# Features which requires OBS 2.3
|
# 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)
|
print_request_list(apiurl, devloc, srcpkg)
|
||||||
|
|
||||||
|
|
||||||
|
@cmdln.option('-m', '--message', metavar='TEXT',
|
||||||
|
help='specify log message TEXT')
|
||||||
def do_undelete(self, subcmd, opts, *args):
|
def do_undelete(self, subcmd, opts, *args):
|
||||||
"""${cmd_name}: Restores a deleted project or package on the server.
|
"""${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:
|
if len(args) < 1:
|
||||||
raise oscerr.WrongArgs('Missing argument.')
|
raise oscerr.WrongArgs('Missing argument.')
|
||||||
|
|
||||||
|
msg = ''
|
||||||
|
if opts.message:
|
||||||
|
msg = opts.message
|
||||||
|
else:
|
||||||
|
msg = edit_message()
|
||||||
|
|
||||||
apiurl = self.get_api_url()
|
apiurl = self.get_api_url()
|
||||||
prj = args[0]
|
prj = args[0]
|
||||||
pkgs = args[1:]
|
pkgs = args[1:]
|
||||||
|
|
||||||
if pkgs:
|
if pkgs:
|
||||||
for pkg in pkgs:
|
for pkg in pkgs:
|
||||||
undelete_package(apiurl, prj, pkg)
|
undelete_package(apiurl, prj, pkg, msg)
|
||||||
else:
|
else:
|
||||||
undelete_project(apiurl, prj)
|
undelete_project(apiurl, prj, msg)
|
||||||
|
|
||||||
|
|
||||||
@cmdln.option('-r', '--recursive', action='store_true',
|
@cmdln.option('-r', '--recursive', action='store_true',
|
||||||
help='deletes a project with packages inside')
|
help='deletes a project with packages inside')
|
||||||
@cmdln.option('-f', '--force', action='store_true',
|
@cmdln.option('-f', '--force', action='store_true',
|
||||||
help='deletes a project where other depends on')
|
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):
|
def do_rdelete(self, subcmd, opts, *args):
|
||||||
"""${cmd_name}: Delete a project or packages on the server.
|
"""${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()
|
apiurl = self.get_api_url()
|
||||||
prj = args[0]
|
prj = args[0]
|
||||||
|
|
||||||
|
msg = ''
|
||||||
|
if opts.message:
|
||||||
|
msg = opts.message
|
||||||
|
else:
|
||||||
|
msg = edit_message()
|
||||||
|
|
||||||
# empty arguments result in recursive project delete ...
|
# empty arguments result in recursive project delete ...
|
||||||
if not len(prj):
|
if not len(prj):
|
||||||
raise oscerr.WrongArgs('Project argument is empty')
|
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\'.'
|
'Or just use \'--force\'.'
|
||||||
sys.exit(1)
|
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:
|
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. ' \
|
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.'
|
'packages use the \'--with-packages\' switch.'
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
delete_project(apiurl, prj, opts.force)
|
delete_project(apiurl, prj, opts.force, msg)
|
||||||
|
|
||||||
@cmdln.hide(1)
|
@cmdln.hide(1)
|
||||||
def do_deletepac(self, subcmd, opts, *args):
|
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.'
|
return 'Done.'
|
||||||
|
|
||||||
|
|
||||||
def undelete_package(apiurl, prj, pac):
|
def undelete_package(apiurl, prj, pac, msg=None):
|
||||||
u = makeurl(apiurl, ['source', prj, pac], query={'comment': 'undeleted via osc', 'cmd': 'undelete'})
|
query={'cmd': 'undelete'}
|
||||||
|
if msg:
|
||||||
|
query['comment'] = msg
|
||||||
|
else:
|
||||||
|
query['comment'] = 'undeleted via osc'
|
||||||
|
u = makeurl(apiurl, ['source', prj, pac], query)
|
||||||
http_POST(u)
|
http_POST(u)
|
||||||
|
|
||||||
def undelete_project(apiurl, prj):
|
def undelete_project(apiurl, prj, msg=None):
|
||||||
u = makeurl(apiurl, ['source', prj], query={'comment': 'undeleted via osc', 'cmd': 'undelete'})
|
query={'cmd': 'undelete'}
|
||||||
|
if msg:
|
||||||
|
query['comment'] = msg
|
||||||
|
else:
|
||||||
|
query['comment'] = 'undeleted via osc'
|
||||||
|
u = makeurl(apiurl, ['source', prj], query)
|
||||||
http_POST(u)
|
http_POST(u)
|
||||||
|
|
||||||
|
|
||||||
def delete_package(apiurl, prj, pac, force=False):
|
def delete_package(apiurl, prj, pac, force=False, msg=None):
|
||||||
query = {}
|
query = {}
|
||||||
if force:
|
if force:
|
||||||
query['force'] = "1"
|
query['force'] = "1"
|
||||||
u = makeurl(apiurl, ['source', prj, pac], query)
|
u = makeurl(apiurl, ['source', prj, pac], query)
|
||||||
http_DELETE(u)
|
http_DELETE(u)
|
||||||
|
|
||||||
def delete_project(apiurl, prj, force=False):
|
def delete_project(apiurl, prj, force=False, msg=None):
|
||||||
query = {}
|
query = {}
|
||||||
if force:
|
if force:
|
||||||
query['force'] = "1"
|
query['force'] = "1"
|
||||||
|
if msg:
|
||||||
|
query['comment'] = msg
|
||||||
u = makeurl(apiurl, ['source', prj], query)
|
u = makeurl(apiurl, ['source', prj], query)
|
||||||
http_DELETE(u)
|
http_DELETE(u)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user