Shawn O. Pearce | 51d008d | 2010-07-16 18:34:31 -0700 | [diff] [blame] | 1 | Gerrit Code Review - Searching Changes |
| 2 | ====================================== |
| 3 | |
| 4 | Default Searches |
| 5 | ---------------- |
| 6 | |
| 7 | Most basic searches can be viewed by clicking on a link along the top |
| 8 | menu bar. The link will prefill the search box with a common search |
| 9 | query, execute it, and present the results. If exactly one change |
| 10 | matches the search, the change will be presented instead of a list. |
| 11 | |
| 12 | |
Karsten Dambekalns | a7f72a2 | 2011-03-25 14:21:59 +0100 | [diff] [blame] | 13 | [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 |
| 19 | |My > Dafts | has:draft |
| 20 | |My > Watched Changes | status:open is:watched |
| 21 | |My > Starred Changes | is:starred |
| 22 | |Open changes in Foo | status:open project:Foo |
| 23 | |================================================= |
Shawn O. Pearce | 51d008d | 2010-07-16 18:34:31 -0700 | [diff] [blame] | 24 | |
| 25 | Basic Change Search |
| 26 | ------------------- |
| 27 | |
| 28 | Similar to many popular search engines on the web, just enter some |
| 29 | text and let Gerrit figure out the meaning: |
| 30 | |
Karsten Dambekalns | a7f72a2 | 2011-03-25 14:21:59 +0100 | [diff] [blame] | 31 | [options="header"] |
| 32 | |============================================================= |
| 33 | |Description | Examples |
| 34 | |Legacy numerical id | 15183 |
| 35 | |Full or abbreviated Change-Id | Ic0ff33 |
| 36 | |Full or abbreviated commit SHA-1 | d81b32ef |
| 37 | |Email address | user@example.com |
| 38 | |Approval requirement | CodeReview>=+2, Verified=1 |
| 39 | |============================================================= |
Shawn O. Pearce | 51d008d | 2010-07-16 18:34:31 -0700 | [diff] [blame] | 40 | |
| 41 | |
| 42 | Search Operators |
| 43 | ---------------- |
| 44 | |
| 45 | Operators act as restrictions on the search. As more operators |
| 46 | are added to the same query string, they further restrict the |
| 47 | returned results. |
| 48 | |
Shawn O. Pearce | 51e058f6 | 2010-07-19 10:30:37 -0700 | [diff] [blame] | 49 | [[age]] |
| 50 | age:'AGE':: |
| 51 | + |
| 52 | Amount of time that has expired since the change was last updated |
| 53 | with a review comment or new patch set. The age must be specified |
| 54 | to include a unit suffix, for example `age:2d`: |
| 55 | + |
| 56 | * s, sec, second, seconds |
| 57 | * m, min, minute, minutes |
| 58 | * h, hr, hour, hours |
| 59 | * d, day, days |
| 60 | * w, week, weeks (`1 week` is treated as `7 days`) |
| 61 | * mon, month, months (`1 month` is treated as `30 days`) |
| 62 | * y, year, years (`1 year` is treated as `365 days`) |
| 63 | |
Shawn O. Pearce | 51d008d | 2010-07-16 18:34:31 -0700 | [diff] [blame] | 64 | [[change]] |
| 65 | change:'ID':: |
| 66 | + |
| 67 | Either a legacy numerical 'ID' such as 15183, or a newer style |
| 68 | Change-Id that was scraped out of the commit message. |
| 69 | |
| 70 | [[owner]] |
| 71 | owner:'USER':: |
| 72 | + |
| 73 | Changes originally submitted by 'USER'. |
| 74 | |
| 75 | [[reviewer]] |
| 76 | reviewer:'USER':: |
| 77 | + |
| 78 | Changes that have been, or need to be, reviewed by 'USER'. |
| 79 | |
| 80 | [[commit]] |
| 81 | commit:'SHA1':: |
| 82 | + |
| 83 | Changes where 'SHA1' is one of the patch sets of the change. |
| 84 | |
| 85 | [[project]] |
| 86 | project:'PROJECT':: |
| 87 | + |
Shawn O. Pearce | 082ed41 | 2010-08-28 12:38:32 -0700 | [diff] [blame] | 88 | Changes occuring in 'PROJECT'. If 'PROJECT' starts with `^` it |
| 89 | matches project names by regular expression. |
Shawn O. Pearce | 51d008d | 2010-07-16 18:34:31 -0700 | [diff] [blame] | 90 | |
| 91 | [[branch]] |
| 92 | branch:'BRANCH':: |
| 93 | + |
| 94 | Changes for 'BRANCH'. The branch name is the short name shown |
| 95 | in the web interface, without the traditional 'refs/heads/' |
| 96 | prefix. This operator is a shorthand for 'refs:'. Searching for |
| 97 | 'branch:master' really means 'ref:refs/heads/master', and searching |
| 98 | for 'branch:refs/heads/master' is the same as searching for |
| 99 | 'ref:refs/heads/refs/heads/master'. |
Shawn O. Pearce | 082ed41 | 2010-08-28 12:38:32 -0700 | [diff] [blame] | 100 | + |
| 101 | If 'BRANCH' starts with `^` it matches branch names by regular |
| 102 | expression patterns. |
Shawn O. Pearce | 51d008d | 2010-07-16 18:34:31 -0700 | [diff] [blame] | 103 | |
| 104 | [[topic]] |
| 105 | topic:'TOPIC':: |
| 106 | + |
| 107 | Changes whose designated topic at upload was 'TOPIC'. This is |
| 108 | often combined with 'branch:' and 'project:' operators to select |
| 109 | all related changes in a series. |
Shawn O. Pearce | 082ed41 | 2010-08-28 12:38:32 -0700 | [diff] [blame] | 110 | + |
| 111 | If 'TOPIC' starts with `^` it matches topic names by regular |
| 112 | expression patterns. |
Shawn O. Pearce | 51d008d | 2010-07-16 18:34:31 -0700 | [diff] [blame] | 113 | |
| 114 | [[ref]] |
| 115 | ref:'REF':: |
| 116 | + |
| 117 | Changes where the destination branch is exactly the given 'REF' |
| 118 | name. Since 'REF' is absolute from the top of the repository it |
| 119 | must start with 'refs/'. |
Shawn O. Pearce | 082ed41 | 2010-08-28 12:38:32 -0700 | [diff] [blame] | 120 | + |
| 121 | If 'REF' starts with `^` it matches reference names by regular |
| 122 | expression patterns. |
Shawn O. Pearce | 51d008d | 2010-07-16 18:34:31 -0700 | [diff] [blame] | 123 | |
Karsten Dambekalns | a7f72a2 | 2011-03-25 14:21:59 +0100 | [diff] [blame] | 124 | [[tr,bug]] |
Shawn O. Pearce | 51d008d | 2010-07-16 18:34:31 -0700 | [diff] [blame] | 125 | tr:'ID', bug:'ID':: |
| 126 | + |
| 127 | Search for changes whose commit message contains 'ID' and matched |
| 128 | one or more of the |
| 129 | link:config-gerrit.html#trackingid[trackingid sections] |
| 130 | in the server's configuration file. This is typically used to |
| 131 | search for changes that fix a bug or defect by the issue tracking |
| 132 | system's issue identifier. |
| 133 | |
| 134 | [[label]] |
| 135 | label:'VALUE':: |
| 136 | + |
| 137 | Matches changes where the approval score 'VALUE' has been set during |
| 138 | a review. See <<labels,labels>> below for more detail on the format |
| 139 | of the argument. |
| 140 | |
monica.dionisio | 70a7ca0 | 2010-08-25 14:46:13 -0300 | [diff] [blame] | 141 | [[message]] |
| 142 | message:'MESSAGE':: |
| 143 | + |
| 144 | Changes that matches 'MESSAGE' arbitrary string in body commit messages. |
| 145 | |
Shawn O. Pearce | 50756b9 | 2010-07-19 17:58:25 -0700 | [diff] [blame] | 146 | [[file]] |
Karsten Dambekalns | a7f72a2 | 2011-03-25 14:21:59 +0100 | [diff] [blame] | 147 | file:^'REGEX':: |
Shawn O. Pearce | 50756b9 | 2010-07-19 17:58:25 -0700 | [diff] [blame] | 148 | + |
| 149 | Matches any change where REGEX matches a file that was affected |
| 150 | by the change. The regular expression pattern must start with |
Karsten Dambekalns | a7f72a2 | 2011-03-25 14:21:59 +0100 | [diff] [blame] | 151 | `^`. For example, to match all XML files use `file:^.*\.xml$`. |
rafael.rabelosilva | aa5bca7 | 2010-08-26 11:04:53 +0200 | [diff] [blame] | 152 | + |
Karsten Dambekalns | a7f72a2 | 2011-03-25 14:21:59 +0100 | [diff] [blame] | 153 | The `^` required at the beginning of the regular expression not only |
rafael.rabelosilva | aa5bca7 | 2010-08-26 11:04:53 +0200 | [diff] [blame] | 154 | denotes a regular expression, but it also has the usual meaning of |
| 155 | anchoring the match to the start of the string. To match all Java |
| 156 | files, use `file:^.*\.java`. |
| 157 | + |
| 158 | The entire regular expression pattern, including the `\^` character, |
| 159 | should be double quoted when using more complex construction (like |
| 160 | ones using a bracket expression). For example, to match all XML |
| 161 | files named like 'name1.xml', 'name2.xml', and 'name3.xml' use |
| 162 | `\file:"\^name[1-3].xml"`. |
| 163 | + |
Shawn O. Pearce | 50756b9 | 2010-07-19 17:58:25 -0700 | [diff] [blame] | 164 | Currently this operator is only available on a watched project |
| 165 | and may not be used in the search bar. |
| 166 | |
Shawn O. Pearce | 51d008d | 2010-07-16 18:34:31 -0700 | [diff] [blame] | 167 | [[has]] |
| 168 | has:draft:: |
| 169 | + |
| 170 | True if there is a draft comment saved by the current user. |
| 171 | |
| 172 | has:star:: |
| 173 | + |
| 174 | Same as 'is:starred', true if the change has been starred by the |
| 175 | current user. |
| 176 | |
| 177 | [[is]] |
| 178 | is:starred:: |
| 179 | + |
| 180 | Same as 'has:star', true if the change has been starred by the |
| 181 | current user. |
| 182 | |
| 183 | is:watched:: |
| 184 | + |
| 185 | True if this change matches one of the current user's watch filters, |
| 186 | and thus is likely to notify the user when it updates. |
| 187 | |
| 188 | is:reviewed:: |
| 189 | + |
| 190 | True if there is at least one non-zero score on the change, in any |
| 191 | approval category, by any user. |
| 192 | |
| 193 | is:open:: |
| 194 | + |
| 195 | True if the change is other open or submitted, merge pending. |
| 196 | |
| 197 | is:closed:: |
| 198 | + |
| 199 | True if the change is either merged or abandoned. |
| 200 | |
| 201 | is:submitted, is:merged, is:abandoned:: |
| 202 | + |
| 203 | Same as <<status,status:'STATE'>>. |
| 204 | |
| 205 | [[status]] |
| 206 | status:open:: |
| 207 | + |
| 208 | True if the change state is other 'review in progress' or 'submitted, |
| 209 | merge pending'. |
| 210 | |
| 211 | status:reviewed:: |
| 212 | + |
| 213 | Same as 'is:reviewed', matches if there is at least one non-zero |
| 214 | score on the change, in any approval category, by any user. |
| 215 | |
| 216 | status:submitted:: |
| 217 | + |
| 218 | Change has been submitted, but is waiting for a dependency. |
| 219 | |
| 220 | status:closed:: |
| 221 | + |
| 222 | True if the change is either 'merged' or 'abandoned'. |
| 223 | |
| 224 | status:merged:: |
| 225 | + |
| 226 | Change has been merged into the branch. |
| 227 | |
| 228 | status:abandoned:: |
| 229 | + |
| 230 | Change has been abandoned by the change owner, or administrator. |
| 231 | |
| 232 | |
| 233 | Boolean Operators |
| 234 | ----------------- |
| 235 | |
| 236 | Unless otherwise specified, operators are joined using the `AND` |
| 237 | boolean operator, thereby restricting the search results. |
| 238 | |
| 239 | Parentheses can be used to force a particular precendence on complex |
| 240 | operator expressions, otherwise OR has higher precendence than AND. |
| 241 | |
| 242 | Negation |
| 243 | ~~~~~~~~ |
| 244 | Any operator can be negated by prefixing it with `-`, for example |
| 245 | `-is:starred` is the exact opposite of `is:starred` and will |
| 246 | therefore return changes that are *not* starred by the current user. |
| 247 | |
| 248 | The operator `NOT` (in all caps) is a synonym. |
| 249 | |
| 250 | AND |
| 251 | ~~~ |
| 252 | The boolean operator `AND` (in all caps) can be used to join two |
| 253 | other operators together. This results in a restriction of the |
| 254 | results, returning only changes that match both operators. |
| 255 | |
| 256 | OR |
| 257 | ~~ |
| 258 | The boolean operator `OR` (in all caps) can be used to find changes |
| 259 | that match either operator. This increases the nubmer of results |
| 260 | that are returned, as more changes are considered. |
| 261 | |
| 262 | |
| 263 | [[labels]] |
| 264 | Labels |
| 265 | ------ |
| 266 | Label operators can be used to match approval score given during |
| 267 | a code review. The specific set of supported labels depends on |
| 268 | the server configuration, however `CodeReview` and `Verified` |
| 269 | are the default labels provided out of the box. |
| 270 | |
| 271 | A label name is any of the following: |
| 272 | |
| 273 | * The category name. If the category name contains spaces, |
| 274 | it must be wrapped in double quotes. Example: `label:"Code Review"`. |
| 275 | |
| 276 | * The name, without spaces. This avoids needing to use double quotes |
| 277 | for the common category Code Review. Example: `label:CodeReview`. |
| 278 | |
| 279 | * The internal short name. Example: `label:CRVW`, or `label:VRIF`. |
| 280 | |
| 281 | * The one or two character abbreviation shown in the column header |
| 282 | of change list pages. Example: `label:R` or `label:V`. |
| 283 | |
| 284 | A label name must be followed by a score, or an operator and a score. |
| 285 | The easiest way to explain these are by example. |
| 286 | |
| 287 | `label:CodeReview=2`:: |
| 288 | `label:CodeReview=+2`:: |
| 289 | `label:CodeReview+2`:: |
| 290 | + |
| 291 | Matches changes where there is at least one \+2 score for Code Review. |
| 292 | The \+ prefix is optional for positive score values. If the + is used, |
| 293 | the = operator is optional. |
| 294 | |
| 295 | `label:CodeReview=-2`:: |
| 296 | `label:CodeReview-2`:: |
| 297 | + |
| 298 | Matches changes where there is at least one -2 score for Code Review. |
| 299 | Because the negative sign is required, the = operator is optional. |
| 300 | |
| 301 | `label:CodeReview=1`:: |
| 302 | + |
| 303 | Matches changes where there is at least one +1 score for Code Review. |
| 304 | Scores of +2 are not matched, even though they are higher. |
| 305 | |
| 306 | `label:CodeReview>=1`:: |
| 307 | + |
| 308 | Matches changes with either a +1, +2, or any higher score. |
| 309 | |
| 310 | `label:CodeReview<=-1`:: |
| 311 | + |
| 312 | Matches changes with either a -1, -2, or any lower score. |
| 313 | |
| 314 | `is:open CodeReview+2 Verified+1 -Verified-1 -CodeReview-2`:: |
| 315 | + |
| 316 | Matches changes that are ready to be submitted. |
| 317 | |
| 318 | `is:open (Verified-1 OR CodeReview-2)`:: |
| 319 | + |
| 320 | Changes that are blocked from submission due to a blocking score. |
| 321 | |
| 322 | |
| 323 | Magical Operators |
| 324 | ----------------- |
| 325 | |
| 326 | Most of these operators exist to support features of Gerrit Code |
| 327 | Review, and are not meant to be accessed by the average end-user. |
| 328 | However, they are recognized by the query parser, and may prove |
| 329 | useful in limited contexts to administrators or power-users. |
| 330 | |
| 331 | visibleto:'USER-or-GROUP':: |
| 332 | + |
| 333 | Matches changes that are visible to 'USER' or to anyone who is a |
| 334 | member of 'GROUP'. Here group names may be specified as either |
| 335 | an internal group name, or if LDAP is being used, an external LDAP |
| 336 | group name. The value may be wrapped in double quotes to include |
| 337 | spaces or other special characters. For example, to match an LDAP |
| 338 | group: `visibleto:"CN=Developers, DC=example, DC=com"`. |
| 339 | + |
| 340 | This operator may be useful to test access control rules, however a |
| 341 | change can only be matched if both the current user and the supplied |
| 342 | user or group can see it. This is due to the implicit 'is:visible' |
| 343 | clause that is always added by the server. |
| 344 | |
| 345 | is:visible:: |
| 346 | + |
| 347 | Magical internal flag to prove the current user has access to read |
| 348 | the change. This flag is always added to any query. |
| 349 | |
| 350 | starredby:'USER':: |
| 351 | + |
Edwin Kempin | 8de47ac | 2011-02-28 10:30:46 +0100 | [diff] [blame] | 352 | Matches changes that have been starred by 'USER'. |
Shawn O. Pearce | 51d008d | 2010-07-16 18:34:31 -0700 | [diff] [blame] | 353 | |
| 354 | watchedby:'USER':: |
| 355 | + |
| 356 | Matches changes that 'USER' has configured watch filters for. |
| 357 | |
| 358 | draftby:'USER':: |
| 359 | + |
| 360 | Matches changes that 'USER' has left unpublished drafts on. |
| 361 | Since the drafts are unpublished, it is not possible to see the |
| 362 | draft text, or even how many drafts there are. |
| 363 | |
| 364 | limit:'CNT':: |
| 365 | + |
| 366 | Limit the returned results to no more than 'CNT' records. This is |
| 367 | automatically set to the page size configured in the current user's |
| 368 | preferences. Including it in a web query may lead to unpredictable |
| 369 | results with regards to pagination. |
| 370 | |
Karsten Dambekalns | a7f72a2 | 2011-03-25 14:21:59 +0100 | [diff] [blame] | 371 | resume_sortkey:'KEY':: |
Shawn O. Pearce | 14760b7 | 2010-07-19 09:44:46 -0700 | [diff] [blame] | 372 | + |
| 373 | Positions the low level scan routine to start from 'KEY' and |
| 374 | continue through changes from this point. This is most often used |
| 375 | for paginating result sets. Including this in a web query may lead |
| 376 | to unpredictable results. |
| 377 | |
Karsten Dambekalns | a7f72a2 | 2011-03-25 14:21:59 +0100 | [diff] [blame] | 378 | sortkey_after:'KEY', sortkey_before:'KEY':: |
Shawn O. Pearce | 51d008d | 2010-07-16 18:34:31 -0700 | [diff] [blame] | 379 | + |
| 380 | Restart the low level scan routine from 'KEY'. This is automatically |
| 381 | set by the pagination system as the user navigates through results |
| 382 | of a query. Including either value in a web query may lead to |
| 383 | unpredictable results. |
| 384 | |
| 385 | GERRIT |
| 386 | ------ |
| 387 | Part of link:index.html[Gerrit Code Review] |