Instead of declining the by_project review, unselect the request and decline the group review. This way we avoid the OBS problem
30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
from colorama import Fore
|
|
|
|
|
|
class SupersedeCommand(object):
|
|
CODE_MAP = {
|
|
None: Fore.MAGENTA + 'superseded' + Fore.RESET,
|
|
True: Fore.RED + 'declined' + Fore.RESET,
|
|
False: Fore.WHITE + 'ignored' + Fore.RESET,
|
|
}
|
|
|
|
def __init__(self, api):
|
|
self.api = api
|
|
|
|
def perform(self, requests=None):
|
|
for stage_info, code, request in self.api.dispatch_open_requests(requests):
|
|
action = request.find('action')
|
|
target_package = action.find('target').get('package')
|
|
if code == 'unstage':
|
|
# Technically, the new request has not been staged, but superseded the old one.
|
|
code = None
|
|
verbage = self.CODE_MAP[code]
|
|
if code is not None:
|
|
verbage += ' in favor of'
|
|
print('request {} for {} {} {} in {}'.format(
|
|
request.get('id'),
|
|
Fore.CYAN + target_package + Fore.RESET,
|
|
verbage,
|
|
stage_info['rq_id'],
|
|
Fore.YELLOW + stage_info['prj'] + Fore.RESET))
|