Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1 | = gerrit ls-projects |
Shawn O. Pearce | 4016a93 | 2009-05-28 15:12:40 -0700 | [diff] [blame] | 2 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 3 | == NAME |
David Shevitz | e369eee | 2018-09-26 12:31:46 -0700 | [diff] [blame] | 4 | gerrit ls-projects - List projects visible to caller. |
Shawn O. Pearce | 4016a93 | 2009-05-28 15:12:40 -0700 | [diff] [blame] | 5 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 6 | == SYNOPSIS |
Michael Ochmann | e2d76a1 | 2016-06-23 17:07:37 +0200 | [diff] [blame] | 7 | [verse] |
Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 8 | -- |
Michael Ochmann | e2d76a1 | 2016-06-23 17:07:37 +0200 | [diff] [blame] | 9 | _ssh_ -p <port> <host> _gerrit ls-projects_ |
Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 10 | [--show-branch <BRANCH> ...] |
Edwin Kempin | 73b2698 | 2012-07-16 13:53:22 +0200 | [diff] [blame] | 11 | [--description | -d] |
| 12 | [--tree | -t] |
Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 13 | [--type {code | permissions | all}] |
Edwin Kempin | 73b2698 | 2012-07-16 13:53:22 +0200 | [diff] [blame] | 14 | [--format {text | json | json_compact}] |
| 15 | [--all] |
| 16 | [--limit <N>] |
Luca Milanesio | 85b4b3e | 2019-01-28 23:14:14 +0000 | [diff] [blame] | 17 | [--prefix | -p <prefix>] |
Edwin Kempin | f0c7042 | 2012-08-24 15:34:20 +0200 | [diff] [blame] | 18 | [--has-acl-for GROUP] |
Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 19 | -- |
Shawn O. Pearce | 4016a93 | 2009-05-28 15:12:40 -0700 | [diff] [blame] | 20 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 21 | == DESCRIPTION |
Shawn O. Pearce | 4016a93 | 2009-05-28 15:12:40 -0700 | [diff] [blame] | 22 | Displays the list of project names, one per line, that the |
| 23 | calling user account has been granted 'READ' access to. |
| 24 | |
| 25 | If the caller is a member of the privileged 'Administrators' |
| 26 | group, all projects are listed. |
| 27 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 28 | == ACCESS |
Gert van Dijk | dc4f8d1 | 2017-08-27 21:14:23 +0200 | [diff] [blame] | 29 | Any user who has SSH access to Gerrit. |
Shawn O. Pearce | 4016a93 | 2009-05-28 15:12:40 -0700 | [diff] [blame] | 30 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 31 | == SCRIPTING |
Shawn O. Pearce | 4016a93 | 2009-05-28 15:12:40 -0700 | [diff] [blame] | 32 | This command is intended to be used in scripts. |
| 33 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 34 | == OPTIONS |
Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 35 | --show-branch:: |
| 36 | -b:: |
Anatol Pomazau | 3739569 | 2011-05-24 06:50:38 -0700 | [diff] [blame] | 37 | Branch for which the command will display the sha of each project. |
Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 38 | The command may have multiple --show-branch parameters, in this case |
Anatol Pomazau | 3739569 | 2011-05-24 06:50:38 -0700 | [diff] [blame] | 39 | sha will be shown for each of the branches. |
| 40 | If the user does not have READ access to some branch or the branch does not |
Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 41 | exist then stub (40 `-` symbols) is shown. |
Anatol Pomazau | 3739569 | 2011-05-24 06:50:38 -0700 | [diff] [blame] | 42 | If the user does not have access to any branch in the project then the |
| 43 | whole project is not shown. |
Nico Sallembien | 0d6312d | 2010-03-15 14:48:44 -0700 | [diff] [blame] | 44 | |
Gustaf Lundh | 87cea02 | 2011-09-01 15:56:59 +0200 | [diff] [blame] | 45 | --description:: |
Edwin Kempin | 73b2698 | 2012-07-16 13:53:22 +0200 | [diff] [blame] | 46 | -d:: |
Gustaf Lundh | 87cea02 | 2011-09-01 15:56:59 +0200 | [diff] [blame] | 47 | Allows listing of projects together with their respective |
| 48 | description. |
Edwin Kempin | 9ad2761 | 2011-11-21 10:59:25 +0100 | [diff] [blame] | 49 | + |
Magnus Bäck | 21f533a | 2012-03-22 09:55:03 -0400 | [diff] [blame] | 50 | For text format output, all non-printable characters (ASCII value 31 or |
| 51 | less) are escaped according to the conventions used in languages like C, |
| 52 | Python, and Perl, employing standard sequences like `\n` and `\t`, and |
| 53 | `\xNN` for all others. In shell scripts, the `printf` command can be |
| 54 | used to unescape the output. |
Gustaf Lundh | 87cea02 | 2011-09-01 15:56:59 +0200 | [diff] [blame] | 55 | |
Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 56 | --tree:: |
| 57 | -t:: |
lincoln | 5bfabe5 | 2010-05-31 16:23:53 -0300 | [diff] [blame] | 58 | Displays project inheritance in a tree-like format. |
| 59 | This option does not work together with the show-branch option. |
| 60 | |
Shawn O. Pearce | 7fdf53e | 2011-06-14 14:52:59 -0700 | [diff] [blame] | 61 | --type:: |
Shawn O. Pearce | 4776924 | 2011-06-14 16:40:48 -0700 | [diff] [blame] | 62 | Display only projects of the specified type. If not |
Hugo Arès | 7e45a46 | 2016-03-02 14:11:05 -0500 | [diff] [blame] | 63 | specified, defaults to `all`. Supported types: |
Shawn O. Pearce | 7b825b3 | 2012-04-05 09:10:41 -0700 | [diff] [blame] | 64 | + |
| 65 | -- |
| 66 | `code`:: Any project likely to contain user files. |
| 67 | `permissions`:: Projects created with the `--permissions-only` flag. |
| 68 | `all`:: Any type of project. |
| 69 | -- |
Edwin Kempin | f179be2 | 2011-09-22 14:34:02 +0200 | [diff] [blame] | 70 | |
Shawn O. Pearce | ec9efd7 | 2012-04-04 20:44:39 -0700 | [diff] [blame] | 71 | --format:: |
| 72 | What output format to display the results in. |
| 73 | + |
| 74 | -- |
| 75 | `text`:: Simple text based format. |
| 76 | `json`:: Map of JSON objects describing each project. |
| 77 | `json_compact`:: Minimized JSON output. |
| 78 | -- |
| 79 | |
Edwin Kempin | f179be2 | 2011-09-22 14:34:02 +0200 | [diff] [blame] | 80 | --all:: |
| 81 | Display all projects that are accessible by the calling user |
| 82 | account. Besides the projects that the calling user account has |
| 83 | been granted 'READ' access to, this includes all projects that |
| 84 | are owned by the calling user account (even if for these projects |
| 85 | the 'READ' access right is not assigned to the calling user |
| 86 | account). |
Shawn O. Pearce | 7fdf53e | 2011-06-14 14:52:59 -0700 | [diff] [blame] | 87 | |
Shawn O. Pearce | 5cd0577 | 2012-04-07 13:47:18 -0700 | [diff] [blame] | 88 | --limit:: |
| 89 | Cap the number of results to the first N matches. |
| 90 | |
Luca Milanesio | 85b4b3e | 2019-01-28 23:14:14 +0000 | [diff] [blame] | 91 | --prefix:: |
| 92 | Limit the results to those projects that start with the specified prefix. |
| 93 | |
Edwin Kempin | f0c7042 | 2012-08-24 15:34:20 +0200 | [diff] [blame] | 94 | --has-acl-for:: |
| 95 | Display only projects on which access rights for this group are |
| 96 | directly assigned. Projects which only inherit access rights for |
| 97 | this group are not listed. |
| 98 | + |
| 99 | With this option you can find out on which projects a group is used. |
| 100 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 101 | == HTTP |
Shawn O. Pearce | a041898 | 2012-04-05 09:10:02 -0700 | [diff] [blame] | 102 | This command is also available over HTTP, as `/projects/` for |
| 103 | anonymous access and `/a/projects/` for authenticated access. |
Shawn O. Pearce | 5cd0577 | 2012-04-07 13:47:18 -0700 | [diff] [blame] | 104 | Named options are available as query parameters. Results can |
| 105 | be limited to projects matching a prefix by supplying the prefix |
| 106 | as part of the URL, for example `/projects/external/` lists only |
| 107 | projects whose name start with the string `external/`. |
Shawn O. Pearce | a041898 | 2012-04-05 09:10:02 -0700 | [diff] [blame] | 108 | |
Shawn O. Pearce | ec9efd7 | 2012-04-04 20:44:39 -0700 | [diff] [blame] | 109 | Over HTTP the `json_compact` output format is assumed if the client |
| 110 | explicitly asks for JSON using HTTP header `Accept: application/json`. |
| 111 | When any JSON output format is used on HTTP, readers must skip the |
| 112 | first line produced. The first line is a garbage JSON string crafted |
| 113 | to prevent a browser from executing the response in a script tag. |
| 114 | |
| 115 | Output will be gzip compressed if `Accept-Encoding: gzip` was used |
| 116 | by the client in the request headers. |
| 117 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 118 | == EXAMPLES |
Shawn O. Pearce | 4016a93 | 2009-05-28 15:12:40 -0700 | [diff] [blame] | 119 | |
| 120 | List visible projects: |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 121 | ---- |
David Shevitz | e369eee | 2018-09-26 12:31:46 -0700 | [diff] [blame] | 122 | $ ssh -p 29418 review.example.com gerrit ls-projects |
| 123 | platform/manifest |
| 124 | tools/gerrit |
| 125 | tools/gwtorm |
Shawn O. Pearce | a041898 | 2012-04-05 09:10:02 -0700 | [diff] [blame] | 126 | |
David Shevitz | e369eee | 2018-09-26 12:31:46 -0700 | [diff] [blame] | 127 | $ curl http://review.example.com/projects/ |
| 128 | platform/manifest |
| 129 | tools/gerrit |
| 130 | tools/gwtorm |
Shawn O. Pearce | 5cd0577 | 2012-04-07 13:47:18 -0700 | [diff] [blame] | 131 | |
David Shevitz | e369eee | 2018-09-26 12:31:46 -0700 | [diff] [blame] | 132 | $ curl http://review.example.com/projects/tools/ |
| 133 | tools/gerrit |
| 134 | tools/gwtorm |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 135 | ---- |
Shawn O. Pearce | 4016a93 | 2009-05-28 15:12:40 -0700 | [diff] [blame] | 136 | |
| 137 | Clone any project visible to the user: |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 138 | ---- |
David Shevitz | e369eee | 2018-09-26 12:31:46 -0700 | [diff] [blame] | 139 | for p in `ssh -p 29418 review.example.com gerrit ls-projects` |
| 140 | do |
| 141 | mkdir -p `dirname "$p"` |
| 142 | git clone --bare "ssh://review.example.com:29418/$p.git" "$p.git" |
| 143 | done |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 144 | ---- |
Shawn O. Pearce | 4016a93 | 2009-05-28 15:12:40 -0700 | [diff] [blame] | 145 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 146 | == SEE ALSO |
Shawn O. Pearce | 4016a93 | 2009-05-28 15:12:40 -0700 | [diff] [blame] | 147 | |
| 148 | * link:access-control.html[Access Controls] |
Shawn O. Pearce | 5500e69 | 2009-05-28 15:55:01 -0700 | [diff] [blame] | 149 | |
| 150 | GERRIT |
| 151 | ------ |
| 152 | Part of link:index.html[Gerrit Code Review] |
Yuxuan 'fishy' Wang | 99cb68d | 2013-10-31 17:26:00 -0700 | [diff] [blame] | 153 | |
| 154 | SEARCHBOX |
| 155 | --------- |