blob: 26b20a7cb0080ec116c30d4adf9edb48799d72cb [file] [log] [blame]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001= gerrit ls-projects
Shawn O. Pearce4016a932009-05-28 15:12:40 -07002
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003== NAME
Shawn O. Pearce4016a932009-05-28 15:12:40 -07004gerrit ls-projects - List projects visible to caller
5
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006== SYNOPSIS
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08007--
Shawn O. Pearce47769242011-06-14 16:40:48 -07008'ssh' -p <port> <host> 'gerrit ls-projects'
9 [--show-branch <BRANCH> ...]
Edwin Kempin73b26982012-07-16 13:53:22 +020010 [--description | -d]
11 [--tree | -t]
Shawn O. Pearce47769242011-06-14 16:40:48 -070012 [--type {code | permissions | all}]
Edwin Kempin73b26982012-07-16 13:53:22 +020013 [--format {text | json | json_compact}]
14 [--all]
15 [--limit <N>]
Edwin Kempinf0c70422012-08-24 15:34:20 +020016 [--has-acl-for GROUP]
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080017--
Shawn O. Pearce4016a932009-05-28 15:12:40 -070018
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080019== DESCRIPTION
Shawn O. Pearce4016a932009-05-28 15:12:40 -070020Displays the list of project names, one per line, that the
21calling user account has been granted 'READ' access to.
22
23If the caller is a member of the privileged 'Administrators'
24group, all projects are listed.
25
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080026== ACCESS
Shawn O. Pearcea0418982012-04-05 09:10:02 -070027Any user who has configured an SSH key, or by an user over HTTP.
Shawn O. Pearce4016a932009-05-28 15:12:40 -070028
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080029== SCRIPTING
Shawn O. Pearce4016a932009-05-28 15:12:40 -070030This command is intended to be used in scripts.
31
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080032== OPTIONS
Shawn O. Pearce47769242011-06-14 16:40:48 -070033--show-branch::
34-b::
Anatol Pomazau37395692011-05-24 06:50:38 -070035 Branch for which the command will display the sha of each project.
Shawn O. Pearce47769242011-06-14 16:40:48 -070036 The command may have multiple --show-branch parameters, in this case
Anatol Pomazau37395692011-05-24 06:50:38 -070037 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. Pearce47769242011-06-14 16:40:48 -070039 exist then stub (40 `-` symbols) is shown.
Anatol Pomazau37395692011-05-24 06:50:38 -070040 If the user does not have access to any branch in the project then the
41 whole project is not shown.
Nico Sallembien0d6312d2010-03-15 14:48:44 -070042
Gustaf Lundh87cea022011-09-01 15:56:59 +020043--description::
Edwin Kempin73b26982012-07-16 13:53:22 +020044-d::
Gustaf Lundh87cea022011-09-01 15:56:59 +020045 Allows listing of projects together with their respective
46 description.
Edwin Kempin9ad27612011-11-21 10:59:25 +010047+
Magnus Bäck21f533a2012-03-22 09:55:03 -040048For text format output, all non-printable characters (ASCII value 31 or
49less) are escaped according to the conventions used in languages like C,
50Python, and Perl, employing standard sequences like `\n` and `\t`, and
51`\xNN` for all others. In shell scripts, the `printf` command can be
52used to unescape the output.
Gustaf Lundh87cea022011-09-01 15:56:59 +020053
Shawn O. Pearce47769242011-06-14 16:40:48 -070054--tree::
55-t::
lincoln5bfabe52010-05-31 16:23:53 -030056 Displays project inheritance in a tree-like format.
57 This option does not work together with the show-branch option.
58
Shawn O. Pearce7fdf53e2011-06-14 14:52:59 -070059--type::
Shawn O. Pearce47769242011-06-14 16:40:48 -070060 Display only projects of the specified type. If not
61 specified, defaults to `code`. Supported types:
Shawn O. Pearce7b825b32012-04-05 09:10:41 -070062+
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 Kempinf179be22011-09-22 14:34:02 +020068
Shawn O. Pearceec9efd72012-04-04 20:44:39 -070069--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 Kempinf179be22011-09-22 14:34:02 +020078--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. Pearce7fdf53e2011-06-14 14:52:59 -070085
Shawn O. Pearce5cd05772012-04-07 13:47:18 -070086--limit::
87 Cap the number of results to the first N matches.
88
Edwin Kempinf0c70422012-08-24 15:34:20 +020089--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+
94With this option you can find out on which projects a group is used.
95
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080096== HTTP
Shawn O. Pearcea0418982012-04-05 09:10:02 -070097This command is also available over HTTP, as `/projects/` for
98anonymous access and `/a/projects/` for authenticated access.
Shawn O. Pearce5cd05772012-04-07 13:47:18 -070099Named options are available as query parameters. Results can
100be limited to projects matching a prefix by supplying the prefix
101as part of the URL, for example `/projects/external/` lists only
102projects whose name start with the string `external/`.
Shawn O. Pearcea0418982012-04-05 09:10:02 -0700103
Shawn O. Pearceec9efd72012-04-04 20:44:39 -0700104Over HTTP the `json_compact` output format is assumed if the client
105explicitly asks for JSON using HTTP header `Accept: application/json`.
106When any JSON output format is used on HTTP, readers must skip the
107first line produced. The first line is a garbage JSON string crafted
108to prevent a browser from executing the response in a script tag.
109
110Output will be gzip compressed if `Accept-Encoding: gzip` was used
111by the client in the request headers.
112
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800113== EXAMPLES
Shawn O. Pearce4016a932009-05-28 15:12:40 -0700114
115List visible projects:
116=====
117 $ ssh -p 29418 review.example.com gerrit ls-projects
Shawn O. Pearce5cd05772012-04-07 13:47:18 -0700118 platform/manifest
Shawn O. Pearce4016a932009-05-28 15:12:40 -0700119 tools/gerrit
120 tools/gwtorm
Shawn O. Pearcea0418982012-04-05 09:10:02 -0700121
122 $ curl http://review.example.com/projects/
Shawn O. Pearce5cd05772012-04-07 13:47:18 -0700123 platform/manifest
124 tools/gerrit
125 tools/gwtorm
126
127 $ curl http://review.example.com/projects/tools/
Shawn O. Pearcea0418982012-04-05 09:10:02 -0700128 tools/gerrit
129 tools/gwtorm
Shawn O. Pearce4016a932009-05-28 15:12:40 -0700130=====
131
132Clone 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' Wang61698b12013-12-20 12:55:51 -0800141== SEE ALSO
Shawn O. Pearce4016a932009-05-28 15:12:40 -0700142
143* link:access-control.html[Access Controls]
Shawn O. Pearce5500e692009-05-28 15:55:01 -0700144
145GERRIT
146------
147Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700148
149SEARCHBOX
150---------