mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-11 16:36:14 +01:00
add option for deleterequests using auto-accept
This commit is contained in:
parent
359d5c5a84
commit
f202fbd111
1
NEWS
1
NEWS
@ -1,4 +1,5 @@
|
||||
0.143
|
||||
- add option to add a auto-accept in future for delete requests (handy for admins)
|
||||
|
||||
0.142
|
||||
- ppc64p7 build support
|
||||
|
@ -1740,6 +1740,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
help='specify message TEXT')
|
||||
@cmdln.option('-r', '--repository', metavar='TEXT',
|
||||
help='specify message TEXT')
|
||||
@cmdln.option('--accept-in-hours', metavar='TEXT',
|
||||
help='specify message time when request shall get accepted automatically. Only works with write permissions in target.')
|
||||
@cmdln.alias("dr")
|
||||
@cmdln.alias("dropreq")
|
||||
@cmdln.alias("droprequest")
|
||||
@ -1793,6 +1795,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
r = Request()
|
||||
r.add_action('delete', tgt_project=project, tgt_package=package, tgt_repository=repository)
|
||||
r.description = cgi.escape(opts.message)
|
||||
if opts.accept_in_hours:
|
||||
r.accept_at_in_hours(int(opts.accept_in_hours))
|
||||
r.create(self.get_api_url())
|
||||
print(r.reqid)
|
||||
|
||||
|
10
osc/core.py
10
osc/core.py
@ -2480,6 +2480,8 @@ class Request:
|
||||
ET.SubElement(root, 'title').text = self.title
|
||||
if self.description:
|
||||
ET.SubElement(root, 'description').text = self.description
|
||||
if self.accept_at:
|
||||
ET.SubElement(root, 'accept_at').text = self.accept_at
|
||||
return root
|
||||
|
||||
def to_str(self):
|
||||
@ -2488,6 +2490,14 @@ class Request:
|
||||
xmlindent(root)
|
||||
return ET.tostring(root, encoding=ET_ENCODING)
|
||||
|
||||
def accept_at_in_hours(self, hours):
|
||||
"""set auto accept_at time"""
|
||||
import datetime
|
||||
|
||||
now = datetime.datetime.utcnow()
|
||||
now = now + datetime.timedelta(hours=hours)
|
||||
self.accept_at = now.isoformat()
|
||||
|
||||
@staticmethod
|
||||
def format_review(review, show_srcupdate=False):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user