Browse Source

Add support for the projects search term

Gerrit now supports searching for changes with a specific project prefix
using the projects term. Mimic that behaviour.

Change-Id: I564098a12a0b5f39a3aeb113f1534af9b11a6430
Refer: https://review.openstack.org/Documentation/user-search.html#projects
changes/91/391991/1
K Jonathan Harker 5 years ago
parent
commit
95b796cab3
2 changed files with 6 additions and 0 deletions
  1. +5
    -0
      gertty/search/parser.py
  2. +1
    -0
      gertty/search/tokenizer.py

+ 5
- 0
gertty/search/parser.py View File

@ -83,6 +83,7 @@ def SearchParser():
| reviewer_term
| commit_term
| project_term
| projects_term
| project_key_term
| branch_term
| topic_term
@ -178,6 +179,10 @@ def SearchParser():
else:
p[0] = gertty.db.project_table.c.name == p[2]
def p_projects_term(p):
'''projects_term : OP_PROJECTS string'''
p[0] = gertty.db.project_table.c.name.like('%s%%' % p[2])
def p_project_key_term(p):
'''project_key_term : OP_PROJECT_KEY NUMBER'''
p[0] = gertty.db.change_table.c.project_key == p[2]


+ 1
- 0
gertty/search/tokenizer.py View File

@ -25,6 +25,7 @@ operators = {
#'OP_REVIEWERIN', # needs local group membership
'commit': 'OP_COMMIT',
'project': 'OP_PROJECT',
'projects': 'OP_PROJECTS',
'_project_key': 'OP_PROJECT_KEY', # internal gertty use only
'branch': 'OP_BRANCH',
'topic': 'OP_TOPIC',


Loading…
Cancel
Save