Genericize the change list and add inter-change links
Make the change list display not only changes for a project, but any arbitrary set of changes represented by a query. This will enable searching, inter-change linking, and custom dashboards. The search syntax is extremly basic at the moment, but will be extended to attempt to match the Gerrit webui search syntax as closely as possible. Use the new feature to implement a new kind of commentlink that matches on Iabcdef style change-ids to "search" for matching changes. Change-Id: Icbcb166962fd96718ab56eb4118fc5ea43a4ba8b
This commit is contained in:
@@ -43,6 +43,17 @@ class LinkReplacement(object):
|
||||
lambda link:app.openURL(self.url.format(**data)))
|
||||
return link
|
||||
|
||||
class SearchReplacement(object):
|
||||
def __init__(self, config):
|
||||
self.query = config['query']
|
||||
self.text = config['text']
|
||||
|
||||
def replace(self, app, data):
|
||||
link = mywid.Link(self.text.format(**data), 'link', 'focused-link')
|
||||
urwid.connect_signal(link, 'selected',
|
||||
lambda link:app.search(self.query.format(**data)))
|
||||
return link
|
||||
|
||||
class CommentLink(object):
|
||||
def __init__(self, config):
|
||||
self.match = re.compile(config['match'], re.M)
|
||||
@@ -52,6 +63,8 @@ class CommentLink(object):
|
||||
self.replacements.append(TextReplacement(r['text']))
|
||||
if 'link' in r:
|
||||
self.replacements.append(LinkReplacement(r['link']))
|
||||
if 'search' in r:
|
||||
self.replacements.append(SearchReplacement(r['search']))
|
||||
|
||||
def run(self, app, chunks):
|
||||
ret = []
|
||||
|
||||
Reference in New Issue
Block a user