Allow {} to be used for quoting in query expressions

This makes it a little easier to query for group names that contain
a space over SSH:

  ssh srv gerrit query " 'status:open NOT reviewerin:{Developer Group}' "

Change-Id: I7c81c752236c85d4ed5bd3ed7ad79486b3336510
This commit is contained in:
Shawn O. Pearce
2012-11-30 11:20:37 -08:00
parent c3657e0b10
commit 757df06505
3 changed files with 25 additions and 5 deletions

View File

@@ -37,10 +37,14 @@ results beyond the limit, the 'resume_sortkey:' operator can be used
to resume the query at the change that follows the last change of
the prior result set.
Non-option arguments to this command are joined with spaces and then
parsed as a query. This simplifies calling conventions over SSH
by permitting operators to appear in different arguments without
multiple levels of quoting required.
Non-option arguments to this command are joined with spaces and
then parsed as a query. This simplifies calling conventions over
SSH by permitting operators to appear in different arguments.
Query operators may quote values using matched curly braches
(e.g. `reviewerin:{Developer Group}`) to sidestep issues with 2
levels of shell quoting (caller shell invoking SSH, and the SSH
command line parser in the server).
OPTIONS
-------

View File

@@ -23,6 +23,7 @@ matches the search, the change will be presented instead of a list.
|Open changes in Foo | status:open project:Foo
|=================================================
Basic Change Search
-------------------
@@ -109,7 +110,6 @@ matches project names by regular expression. The
link:http://www.brics.dk/automaton/[dk.brics.automaton
library] is used for evaluation of such patterns.
[[branch]]
branch:'BRANCH'::
+
@@ -271,6 +271,17 @@ status:abandoned::
Change has been abandoned.
Argument Quoting
----------------
Operator values that are not bare words (roughly A-Z, a-z, 0-9, @,
hypen, dot and underscore) must be quoted for the query parser.
Quoting is accepted as either double quotes
(e.g. `message:"the value"`) or as matched
curly braces (e.g. `message:{the value}`).
Boolean Operators
-----------------
@@ -427,6 +438,7 @@ set by the pagination system as the user navigates through results
of a query. Including either value in a web query may lead to
unpredictable results.
GERRIT
------
Part of link:index.html[Gerrit Code Review]

View File

@@ -155,6 +155,10 @@ EXACT_PHRASE
String s = $text;
setText(s.substring(1, s.length() - 1));
}
| '{' ( ~('{'|'}') )* '}' {
String s = $text;
setText(s.substring(1, s.length() - 1));
}
;
SINGLE_WORD