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