list & adi: share common stagingapi.ignore_format().
This commit is contained in:
parent
93fb950351
commit
22ec112225
@ -82,8 +82,9 @@ class AdiCommand:
|
||||
target_package = request.find('./action/target').get('package')
|
||||
line = '- {} {}{:<30}{}'.format(request_id, Fore.CYAN, target_package, Fore.RESET)
|
||||
|
||||
if request_id in self.requests_ignored:
|
||||
print(line + Fore.WHITE + '\n ignored: ' + str(self.requests_ignored[request_id]) + Fore.RESET)
|
||||
message = self.api.ignore_format(request_id)
|
||||
if message:
|
||||
print(line + '\n' + Fore.WHITE + message + Fore.RESET)
|
||||
continue
|
||||
|
||||
# Auto-superseding request in adi command
|
||||
@ -110,7 +111,6 @@ class AdiCommand:
|
||||
"""
|
||||
Perform the list command
|
||||
"""
|
||||
self.requests_ignored = self.api.get_ignored_requests()
|
||||
if len(packages):
|
||||
requests = set()
|
||||
if move:
|
||||
|
@ -1,4 +1,3 @@
|
||||
import textwrap
|
||||
from colorama import Fore
|
||||
from osc import oscerr
|
||||
from osclib.request_splitter import RequestSplitter
|
||||
@ -27,7 +26,6 @@ class ListCommand:
|
||||
|
||||
requests = self.api.get_open_requests()
|
||||
if not len(requests): return
|
||||
requests_ignored = self.api.get_ignored_requests()
|
||||
|
||||
splitter = RequestSplitter(self.api, requests, in_ring=True)
|
||||
splitter.filter_add('./action[@type="change_devel"]')
|
||||
@ -39,7 +37,6 @@ class ListCommand:
|
||||
splitter.split()
|
||||
|
||||
is_factory = self.api.project != 'openSUSE:Factory'
|
||||
ignore_indent = ' ' * (2 + len(requests[0].get('id')) + 1)
|
||||
for group in sorted(splitter.grouped.keys()):
|
||||
print Fore.YELLOW + group
|
||||
|
||||
@ -60,12 +57,9 @@ class ListCommand:
|
||||
if action.get('type') == 'delete':
|
||||
line += Fore.RED + ' (delete request)'
|
||||
|
||||
if request_id in requests_ignored:
|
||||
line += '\n' + Fore.WHITE + \
|
||||
textwrap.fill(str(requests_ignored[request_id]),
|
||||
initial_indent=ignore_indent,
|
||||
subsequent_indent=ignore_indent,
|
||||
break_long_words=False) + Fore.RESET
|
||||
message = self.api.ignore_format(request_id)
|
||||
if message:
|
||||
line += '\n' + Fore.WHITE + message + Fore.RESET
|
||||
|
||||
print ' ', line
|
||||
|
||||
|
@ -18,6 +18,7 @@ from cStringIO import StringIO
|
||||
from datetime import datetime
|
||||
import json
|
||||
import logging
|
||||
import textwrap
|
||||
import urllib2
|
||||
import time
|
||||
import re
|
||||
@ -1567,3 +1568,14 @@ class StagingAPI(object):
|
||||
['build', project, repo, arch, package, filename],
|
||||
{'view': 'fileinfo_ext'})
|
||||
return ET.parse(http_GET(url)).getroot()
|
||||
|
||||
def ignore_format(self, request_id):
|
||||
requests_ignored = self.get_ignored_requests()
|
||||
if request_id in requests_ignored:
|
||||
ignore_indent = ' ' * (2 + len(str(request_id)) + 1)
|
||||
return textwrap.fill(str(requests_ignored[request_id]),
|
||||
initial_indent=ignore_indent,
|
||||
subsequent_indent=ignore_indent,
|
||||
break_long_words=False)
|
||||
|
||||
return None
|
||||
|
Loading…
x
Reference in New Issue
Block a user