blob: bd91cddb43a91bf5f60bdd22b7bccecab4776c93 [file] [log] [blame]
Shawn O. Pearce51d008d2010-07-16 18:34:31 -07001Gerrit Code Review - Searching Changes
2======================================
3
Robin Rosenberg524a3032012-10-14 14:24:36 +02004Default Searches
Shawn O. Pearce51d008d2010-07-16 18:34:31 -07005----------------
6
7Most basic searches can be viewed by clicking on a link along the top
8menu bar. The link will prefill the search box with a common search
9query, execute it, and present the results. If exactly one change
10matches the search, the change will be presented instead of a list.
11
12
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +010013[options="header"]
14|=================================================
15|Description | Default Query
16|All > Open | status:open '(or is:open)'
17|All > Merged | status:merged
18|All > Abandoned | status:abandoned
Deniz Türkoglud6799b1d2012-05-10 11:20:56 -070019|My > Drafts | is:draft
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +010020|My > Watched Changes | status:open is:watched
21|My > Starred Changes | is:starred
Deniz Türkoglud6799b1d2012-05-10 11:20:56 -070022|My > Draft Comments | has:draft
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +010023|Open changes in Foo | status:open project:Foo
24|=================================================
Shawn O. Pearce51d008d2010-07-16 18:34:31 -070025
Shawn O. Pearce757df062012-11-30 11:20:37 -080026
Shawn O. Pearce51d008d2010-07-16 18:34:31 -070027Basic Change Search
28-------------------
29
30Similar to many popular search engines on the web, just enter some
31text and let Gerrit figure out the meaning:
32
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +010033[options="header"]
34|=============================================================
35|Description | Examples
36|Legacy numerical id | 15183
37|Full or abbreviated Change-Id | Ic0ff33
38|Full or abbreviated commit SHA-1 | d81b32ef
39|Email address | user@example.com
Dave Borowitz41f909f2013-02-05 15:34:18 -080040|Approval requirement | Code-Review>=+2, Verified=1
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +010041|=============================================================
Shawn O. Pearce51d008d2010-07-16 18:34:31 -070042
43
44Search Operators
45----------------
46
47Operators act as restrictions on the search. As more operators
48are added to the same query string, they further restrict the
monica.dionisio7dfa0d22010-08-27 11:46:33 -030049returned results. Search can also be performed by typing only a
50text with no operator. It will try to match a project name by
51substring.
52
53E.g. Searching for just "gerrit is:starred" will try to match a
54project name by "gerrit" as substring.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -070055
Shawn O. Pearce51e058f62010-07-19 10:30:37 -070056[[age]]
57age:'AGE'::
58+
59Amount of time that has expired since the change was last updated
60with a review comment or new patch set. The age must be specified
61to include a unit suffix, for example `age:2d`:
62+
63* s, sec, second, seconds
64* m, min, minute, minutes
65* h, hr, hour, hours
66* d, day, days
67* w, week, weeks (`1 week` is treated as `7 days`)
68* mon, month, months (`1 month` is treated as `30 days`)
69* y, year, years (`1 year` is treated as `365 days`)
70
Shawn O. Pearce51d008d2010-07-16 18:34:31 -070071[[change]]
72change:'ID'::
73+
74Either a legacy numerical 'ID' such as 15183, or a newer style
75Change-Id that was scraped out of the commit message.
76
77[[owner]]
78owner:'USER'::
79+
Shawn O. Pearce068a0d82012-04-07 14:59:11 -070080Changes originally submitted by 'USER'. The special case of
81`owner:self` will find changes owned by the caller.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -070082
Martin Fickbcb5b9b2011-01-13 13:16:20 -070083[[ownerin]]
84ownerin:'GROUP'::
85+
86Changes originally submitted by a user in 'GROUP'.
87
Shawn O. Pearce51d008d2010-07-16 18:34:31 -070088[[reviewer]]
89reviewer:'USER'::
90+
Shawn O. Pearce068a0d82012-04-07 14:59:11 -070091Changes that have been, or need to be, reviewed by 'USER'. The
92special case of `reviewer:self` will find changes where the caller
93has been added as a reviewer.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -070094
Martin Fickbcb5b9b2011-01-13 13:16:20 -070095[[reviewerin]]
96reviewerin:'GROUP'::
97+
98Changes that have been, or need to be, reviewed by a user in 'GROUP'.
99
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700100[[commit]]
101commit:'SHA1'::
102+
103Changes where 'SHA1' is one of the patch sets of the change.
104
105[[project]]
106project:'PROJECT'::
107+
Edwin Kempinf1acbb82011-09-15 12:49:42 +0200108Changes occurring in 'PROJECT'. If 'PROJECT' starts with `^` it
Magnus Bäcke5611832011-02-02 08:57:15 +0100109matches project names by regular expression. The
110link:http://www.brics.dk/automaton/[dk.brics.automaton
111library] is used for evaluation of such patterns.
112
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700113[[branch]]
114branch:'BRANCH'::
115+
Edwin Kempinad921cd2012-03-27 16:00:56 +0200116Changes for 'BRANCH'. The branch name is either the short name shown
117in the web interface or the full name of the destination branch with
118the traditional 'refs/heads/' prefix.
Shawn O. Pearce082ed412010-08-28 12:38:32 -0700119+
120If 'BRANCH' starts with `^` it matches branch names by regular
Magnus Bäcke5611832011-02-02 08:57:15 +0100121expression patterns. The
122link:http://www.brics.dk/automaton/[dk.brics.automaton
123library] is used for evaluation of such patterns.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700124
125[[topic]]
126topic:'TOPIC'::
127+
128Changes whose designated topic at upload was 'TOPIC'. This is
129often combined with 'branch:' and 'project:' operators to select
130all related changes in a series.
Shawn O. Pearce082ed412010-08-28 12:38:32 -0700131+
132If 'TOPIC' starts with `^` it matches topic names by regular
Magnus Bäcke5611832011-02-02 08:57:15 +0100133expression patterns. The
134link:http://www.brics.dk/automaton/[dk.brics.automaton
135library] is used for evaluation of such patterns.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700136
137[[ref]]
138ref:'REF'::
139+
140Changes where the destination branch is exactly the given 'REF'
141name. Since 'REF' is absolute from the top of the repository it
142must start with 'refs/'.
Shawn O. Pearce082ed412010-08-28 12:38:32 -0700143+
144If 'REF' starts with `^` it matches reference names by regular
Magnus Bäcke5611832011-02-02 08:57:15 +0100145expression patterns. The
146link:http://www.brics.dk/automaton/[dk.brics.automaton
147library] is used for evaluation of such patterns.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700148
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100149[[tr,bug]]
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700150tr:'ID', bug:'ID'::
151+
David Pursehouse221d4f62012-06-08 17:38:08 +0900152Search for changes whose commit message contains 'ID' and matches
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700153one or more of the
154link:config-gerrit.html#trackingid[trackingid sections]
155in the server's configuration file. This is typically used to
156search for changes that fix a bug or defect by the issue tracking
157system's issue identifier.
158
159[[label]]
160label:'VALUE'::
161+
162Matches changes where the approval score 'VALUE' has been set during
163a review. See <<labels,labels>> below for more detail on the format
164of the argument.
165
monica.dionisio70a7ca02010-08-25 14:46:13 -0300166[[message]]
167message:'MESSAGE'::
168+
David Pursehouse221d4f62012-06-08 17:38:08 +0900169Changes that match 'MESSAGE' arbitrary string in the commit message body.
monica.dionisio70a7ca02010-08-25 14:46:13 -0300170
Shawn Pearce3ffbd1b2013-09-13 14:11:07 -0700171[[comment]]
172comment:'TEXT'::
173+
174Changes that match 'TEXT' string in any comment left by a reviewer.
175
Shawn O. Pearce50756b92010-07-19 17:58:25 -0700176[[file]]
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100177file:^'REGEX'::
Shawn O. Pearce50756b92010-07-19 17:58:25 -0700178+
179Matches any change where REGEX matches a file that was affected
180by the change. The regular expression pattern must start with
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100181`^`. For example, to match all XML files use `file:^.*\.xml$`.
Magnus Bäcke5611832011-02-02 08:57:15 +0100182The link:http://www.brics.dk/automaton/[dk.brics.automaton
183library] is used for the evaluation of such patterns.
rafael.rabelosilvaaa5bca72010-08-26 11:04:53 +0200184+
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100185The `^` required at the beginning of the regular expression not only
rafael.rabelosilvaaa5bca72010-08-26 11:04:53 +0200186denotes a regular expression, but it also has the usual meaning of
187anchoring the match to the start of the string. To match all Java
188files, use `file:^.*\.java`.
189+
Edwin Kempincdb0e002011-09-08 14:23:30 +0200190The entire regular expression pattern, including the `^` character,
rafael.rabelosilvaaa5bca72010-08-26 11:04:53 +0200191should be double quoted when using more complex construction (like
192ones using a bracket expression). For example, to match all XML
193files named like 'name1.xml', 'name2.xml', and 'name3.xml' use
Edwin Kempincdb0e002011-09-08 14:23:30 +0200194`file:"^name[1-3].xml"`.
Shawn O. Pearce50756b92010-07-19 17:58:25 -0700195
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700196[[has]]
197has:draft::
198+
199True if there is a draft comment saved by the current user.
200
201has:star::
202+
203Same as 'is:starred', true if the change has been starred by the
204current user.
205
206[[is]]
207is:starred::
208+
209Same as 'has:star', true if the change has been starred by the
210current user.
211
212is:watched::
213+
214True if this change matches one of the current user's watch filters,
215and thus is likely to notify the user when it updates.
216
217is:reviewed::
218+
219True if there is at least one non-zero score on the change, in any
220approval category, by any user.
221
Shawn O. Pearce068a0d82012-04-07 14:59:11 -0700222is:owner::
223+
224True on any change where the current user is the change owner.
225Same as `owner:self`.
226
227is:reviewer::
228+
229True on any change where the current user is a reviewer.
230Same as `reviewer:self`.
231
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700232is:open::
233+
David Pursehouse221d4f62012-06-08 17:38:08 +0900234True if the change is either open or submitted, merge pending.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700235
Deniz Türkoglud6799b1d2012-05-10 11:20:56 -0700236is:draft::
237+
238True if the change is a draft.
239
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700240is:closed::
241+
242True if the change is either merged or abandoned.
243
244is:submitted, is:merged, is:abandoned::
245+
246Same as <<status,status:'STATE'>>.
247
248[[status]]
249status:open::
250+
David Pursehouse221d4f62012-06-08 17:38:08 +0900251True if the change state is either 'review in progress' or 'submitted,
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700252merge pending'.
253
254status:reviewed::
255+
256Same as 'is:reviewed', matches if there is at least one non-zero
257score on the change, in any approval category, by any user.
258
259status:submitted::
260+
261Change has been submitted, but is waiting for a dependency.
262
263status:closed::
264+
265True if the change is either 'merged' or 'abandoned'.
266
267status:merged::
268+
269Change has been merged into the branch.
270
271status:abandoned::
272+
Edwin Kempin4c903b82012-06-13 16:06:07 +0200273Change has been abandoned.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700274
275
Shawn O. Pearce757df062012-11-30 11:20:37 -0800276Argument Quoting
277----------------
278
279Operator values that are not bare words (roughly A-Z, a-z, 0-9, @,
David Pursehouse92463562013-06-24 10:16:28 +0900280hyphen, dot and underscore) must be quoted for the query parser.
Shawn O. Pearce757df062012-11-30 11:20:37 -0800281
282Quoting is accepted as either double quotes
283(e.g. `message:"the value"`) or as matched
284curly braces (e.g. `message:{the value}`).
285
286
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700287Boolean Operators
288-----------------
289
290Unless otherwise specified, operators are joined using the `AND`
291boolean operator, thereby restricting the search results.
292
David Pursehouse92463562013-06-24 10:16:28 +0900293Parentheses can be used to force a particular precedence on complex
294operator expressions, otherwise OR has higher precedence than AND.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700295
296Negation
297~~~~~~~~
298Any operator can be negated by prefixing it with `-`, for example
299`-is:starred` is the exact opposite of `is:starred` and will
300therefore return changes that are *not* starred by the current user.
301
302The operator `NOT` (in all caps) is a synonym.
303
304AND
305~~~
306The boolean operator `AND` (in all caps) can be used to join two
307other operators together. This results in a restriction of the
308results, returning only changes that match both operators.
309
310OR
311~~
312The boolean operator `OR` (in all caps) can be used to find changes
David Pursehouse92463562013-06-24 10:16:28 +0900313that match either operator. This increases the number of results
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700314that are returned, as more changes are considered.
315
316
317[[labels]]
318Labels
319------
David Pursehouse221d4f62012-06-08 17:38:08 +0900320Label operators can be used to match approval scores given during
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700321a code review. The specific set of supported labels depends on
Dave Borowitz41f909f2013-02-05 15:34:18 -0800322the server configuration, however `Code-Review` and `Verified`
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700323are the default labels provided out of the box.
324
325A label name is any of the following:
326
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800327* The label name. Example: `label:Code-Review`.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700328
329* The one or two character abbreviation shown in the column header
330 of change list pages. Example: `label:R` or `label:V`.
331
Craig Chapel9c6e5372013-02-13 10:14:08 -0700332* The label name followed by a ',' followed by a reviewer id or a
333 group id. To make it clear whether a user or group is being looked
334 for, precede the value by a user or group argument identifier
335 ('user=' or 'group='). If an LDAP group is being referenced make
336 sure to use 'ldap/<groupname>'.
337
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700338A label name must be followed by a score, or an operator and a score.
David Pursehouse221d4f62012-06-08 17:38:08 +0900339The easiest way to explain this is by example.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700340
Dave Borowitz41f909f2013-02-05 15:34:18 -0800341`label:Code-Review=2`::
342`label:Code-Review=+2`::
343`label:Code-Review+2`::
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700344+
Dave Borowitz41f909f2013-02-05 15:34:18 -0800345Matches changes where there is at least one +2 score for Code-Review.
Edwin Kempincdb0e002011-09-08 14:23:30 +0200346The + prefix is optional for positive score values. If the + is used,
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700347the = operator is optional.
348
Dave Borowitz41f909f2013-02-05 15:34:18 -0800349`label:Code-Review=-2`::
350`label:Code-Review-2`::
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700351+
Dave Borowitz41f909f2013-02-05 15:34:18 -0800352Matches changes where there is at least one -2 score for Code-Review.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700353Because the negative sign is required, the = operator is optional.
354
Dave Borowitz41f909f2013-02-05 15:34:18 -0800355`label:Code-Review=1`::
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700356+
Dave Borowitz41f909f2013-02-05 15:34:18 -0800357Matches changes where there is at least one +1 score for Code-Review.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700358Scores of +2 are not matched, even though they are higher.
359
Dave Borowitz41f909f2013-02-05 15:34:18 -0800360`label:Code-Review>=1`::
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700361+
362Matches changes with either a +1, +2, or any higher score.
363
Craig Chapel9c6e5372013-02-13 10:14:08 -0700364`label:CodeReview=+2,aname`::
365+
366Matches changes with a +2 code review where the reviewer or group is aname.
367
368`label:CodeReview=2,user=jsmith`::
369+
370Matches changes with a +2 code review where the reviewer is jsmith.
371
372`label:CodeReview=+1,group=ldap/linux.workflow`::
373+
374Matches changes with a +1 code review where the reviewer is in the
375ldap/linux.workflow group.
376
377`label:CodeReview<=-1`::
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700378+
379Matches changes with either a -1, -2, or any lower score.
380
David Pursehouse48933d32013-09-26 15:21:47 +0900381`is:open label:Code-Review+2 label:Verified+1 NOT label:Verified-1 NOT label:Code-Review-2`::
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700382+
383Matches changes that are ready to be submitted.
384
David Pursehouse48933d32013-09-26 15:21:47 +0900385`is:open (label:Verified-1 OR label:Code-Review-2)`::
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700386+
387Changes that are blocked from submission due to a blocking score.
388
389
390Magical Operators
391-----------------
392
393Most of these operators exist to support features of Gerrit Code
394Review, and are not meant to be accessed by the average end-user.
395However, they are recognized by the query parser, and may prove
396useful in limited contexts to administrators or power-users.
397
398visibleto:'USER-or-GROUP'::
399+
400Matches changes that are visible to 'USER' or to anyone who is a
401member of 'GROUP'. Here group names may be specified as either
402an internal group name, or if LDAP is being used, an external LDAP
403group name. The value may be wrapped in double quotes to include
404spaces or other special characters. For example, to match an LDAP
405group: `visibleto:"CN=Developers, DC=example, DC=com"`.
406+
407This operator may be useful to test access control rules, however a
408change can only be matched if both the current user and the supplied
409user or group can see it. This is due to the implicit 'is:visible'
410clause that is always added by the server.
411
412is:visible::
413+
414Magical internal flag to prove the current user has access to read
415the change. This flag is always added to any query.
416
417starredby:'USER'::
418+
Edwin Kempin8de47ac2011-02-28 10:30:46 +0100419Matches changes that have been starred by 'USER'.
Shawn O. Pearce068a0d82012-04-07 14:59:11 -0700420The special case `starredby:self` applies to the caller.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700421
422watchedby:'USER'::
423+
424Matches changes that 'USER' has configured watch filters for.
Shawn O. Pearce068a0d82012-04-07 14:59:11 -0700425The special case `watchedby:self` applies to the caller.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700426
427draftby:'USER'::
428+
David Pursehouse221d4f62012-06-08 17:38:08 +0900429Matches changes that 'USER' has left unpublished draft comments on.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700430Since the drafts are unpublished, it is not possible to see the
Shawn O. Pearce068a0d82012-04-07 14:59:11 -0700431draft text, or even how many drafts there are. The special case
432of `draftby:self` will find changes where the caller has created
433a draft comment.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700434
435limit:'CNT'::
436+
437Limit the returned results to no more than 'CNT' records. This is
438automatically set to the page size configured in the current user's
439preferences. Including it in a web query may lead to unpredictable
440results with regards to pagination.
441
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100442resume_sortkey:'KEY'::
Shawn O. Pearce14760b72010-07-19 09:44:46 -0700443+
444Positions the low level scan routine to start from 'KEY' and
445continue through changes from this point. This is most often used
446for paginating result sets. Including this in a web query may lead
447to unpredictable results.
448
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100449sortkey_after:'KEY', sortkey_before:'KEY'::
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700450+
451Restart the low level scan routine from 'KEY'. This is automatically
452set by the pagination system as the user navigates through results
453of a query. Including either value in a web query may lead to
454unpredictable results.
455
Shawn O. Pearce757df062012-11-30 11:20:37 -0800456
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700457GERRIT
458------
459Part of link:index.html[Gerrit Code Review]