Correct some search problems
* correct the syntax in the example yaml file to use "change:" * an error caused it to attempt to sync by number when using a change id * define the change_id token with a function so that it is ordered in the lexer and takes precedence over strings Change-Id: Ic48193ffd0a16f84b83f7c045ab990699fd8c755
This commit is contained in:
parent
3d93f7a13a
commit
c8d68f9358
@ -29,7 +29,7 @@ commentlinks:
|
|||||||
replacements:
|
replacements:
|
||||||
- search:
|
- search:
|
||||||
text: "{id}"
|
text: "{id}"
|
||||||
query: "changeid:{id}"
|
query: "change:{id}"
|
||||||
|
|
||||||
# This is the query used for the list of changes when a project is
|
# This is the query used for the list of changes when a project is
|
||||||
# selected. The default is "status:open"; if you don't want to see
|
# selected. The default is "status:open"; if you don't want to see
|
||||||
|
@ -226,6 +226,7 @@ class App(object):
|
|||||||
try:
|
try:
|
||||||
number = int(number)
|
number = int(number)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
number = None
|
||||||
changeid = query.split(':')[1].strip()
|
changeid = query.split(':')[1].strip()
|
||||||
if not (number or changeid):
|
if not (number or changeid):
|
||||||
return
|
return
|
||||||
|
@ -51,7 +51,7 @@ class SearchReplacement(object):
|
|||||||
def replace(self, app, data):
|
def replace(self, app, data):
|
||||||
link = mywid.Link(self.text.format(**data), 'link', 'focused-link')
|
link = mywid.Link(self.text.format(**data), 'link', 'focused-link')
|
||||||
urwid.connect_signal(link, 'selected',
|
urwid.connect_signal(link, 'selected',
|
||||||
lambda link:app.search(self.query.format(**data)))
|
lambda link:app.doSearch(self.query.format(**data)))
|
||||||
return link
|
return link
|
||||||
|
|
||||||
class CommentLink(object):
|
class CommentLink(object):
|
||||||
|
@ -68,7 +68,6 @@ tokens = [
|
|||||||
] + operators.values()
|
] + operators.values()
|
||||||
|
|
||||||
def SearchTokenizer():
|
def SearchTokenizer():
|
||||||
t_CHANGE_ID = r'I[a-fA-F0-9]{7,40}'
|
|
||||||
t_LPAREN = r'\('
|
t_LPAREN = r'\('
|
||||||
t_RPAREN = r'\)'
|
t_RPAREN = r'\)'
|
||||||
t_NEG = r'!'
|
t_NEG = r'!'
|
||||||
@ -78,6 +77,10 @@ def SearchTokenizer():
|
|||||||
t.type = operators.get(t.value[:-1], 'OP')
|
t.type = operators.get(t.value[:-1], 'OP')
|
||||||
return t
|
return t
|
||||||
|
|
||||||
|
def t_CHANGE_ID(t):
|
||||||
|
r'I[a-fA-F0-9]{7,40}'
|
||||||
|
return t
|
||||||
|
|
||||||
def t_SSTRING(t):
|
def t_SSTRING(t):
|
||||||
r"'([^\\']+|\\'|\\\\)*'"
|
r"'([^\\']+|\\'|\\\\)*'"
|
||||||
t.value=t.value[1:-1].decode("string-escape")
|
t.value=t.value[1:-1].decode("string-escape")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user