Node:Query expressions, Next:Example queries, Previous:Formatting query-pr output, Up:query-pr
Query expressions are used to select specific PRs based on their field
contents. The general form is
fieldname|"value" operator fieldname|"value" [booleanop ...]
value is a literal string or regular expression; it must be surrounded by double quotes, otherwise it is interpreted as a fieldname.
fieldname is the name of a field in the PR.
operator is one of:
The equality of two values depends on what type of data is stored in the
field(s) being queried. For example, when querying a field containing
integer values, literal strings are interpreted as integers. The query
Number == "0123"
is identical to
Number == "123"
as the leading zero is ignored. If the values were treated as strings
instead of integers, then the two comparisons would return different
booleanop is either
| (logical or), or
and). The query expression
Category="baz" | Responsible="blee"
selects all PRs with a Category field of
baz or a Responsible
The not operator
! may be used to negate a test:
searches for PRs where the category is not equal to the regular expression foo.
Parentheses may be used to force a particular interpretation of the
!(Category="foo" & Submitter-Id="blaz")
skips PRs where the Category field is equal to
foo and the
Submitter-Id field is equal to
blaz. Parentheses may be nested
to any arbitrary depth.
Fieldnames can be specified in several ways. The simplest and most
obvious is just a name:
which checks the value of the category field for the value foo.
A fieldname qualifier may be prepended to the name of the field; a colon
is used to separate the qualifier from the name. To refer directly to a
builtin field name:
In this case,
Number is interpreted as the builtin name of the
check. (This is useful if the fields have been renamed. For further
discussion of builtin field names, see The
To scan all fields of a particular type, the fieldtype qualifier
This searches all text fields for the regular expression
Note that it is not required that the right-hand side of the expression
be a literal string. To query all PRs where the PR has been modified
since it was closed, the expression
Last-Modified != Closed-Date
will work; for each PR, it compares the value of its Last-Modified field
against its Closed-Date field, and returns those PRs where the values
differ. However, this query will also return all PRs with empty
Last-Modified or Closed-Date fields. To further narrow the search:
Last-Modified != Closed-Date & Last-Modified != "" & Closed-Date != ""
In general, comparing fields of two different types (an integer field against a date field, for example) will probably not do what you want.
Also, a field specifier may be followed by the name of a subfield in
State[type] != "closed"
builtin:State[type] != "closed"
Subfields are further discussed in The