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