blob: 57a93c9ef1f533bd28699b59128362be4fd91c79 [file] [log] [blame]
Robert Ly35f2fda2013-01-29 16:27:05 -08001page.title=Repo command reference
2@jd:body
3
4<!--
Clay Murphy0deea372015-01-23 12:12:48 -08005 Copyright 2014 The Android Open Source Project
Robert Ly35f2fda2013-01-29 16:27:05 -08006
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0
12
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18-->
19
20<div id="qv-wrapper">
21 <div id="qv">
22 <h2>In this document</h2>
23 <ol id="auto-toc">
24 </ol>
25 </div>
26</div>
27<p>Repo usage takes the following form: </p>
Clay Murphy0deea372015-01-23 12:12:48 -080028<pre><code>repo <em>&lt;COMMAND&gt;</em> <em>&lt;OPTIONS&gt;</em>
Robert Ly35f2fda2013-01-29 16:27:05 -080029</code></pre>
Clay Murphy0deea372015-01-23 12:12:48 -080030<p>Optional elements are shown in brackets [ ]. For example, many commands take
31a project list as an argument. You can specify project-list as a list of names
32or a list of paths to local source directories for the projects:</p>
33<pre><code>repo sync [<em>&lt;PROJECT0&gt;</em> <em>&lt;PROJECT1&gt;</em> <em>&lt;PROJECTN&gt;</em>]
34repo sync [<em>&lt;/PATH/TO/PROJECT0&gt;</em> ... <em>&lt;/PATH/TO/PROJECTN&gt;</em>]
Robert Ly35f2fda2013-01-29 16:27:05 -080035</code></pre>
Clay Murphy0deea372015-01-23 12:12:48 -080036
37<h2 id="help">help</h2>
38<p>Once Repo is installed, you can find the latest documentation starting with a summary of all commands by running:</p>
39<pre><code>repo help
40</code></pre>
41<p>You can get information about any command by running this within a Repo tree:</p>
42<pre><code>repo help <em>&lt;COMMAND&gt;</em>
Robert Ly35f2fda2013-01-29 16:27:05 -080043</code></pre>
44
45<h2 id="init">init</h2>
Clay Murphy0deea372015-01-23 12:12:48 -080046<pre><code>$ repo init -u <em>&lt;URL&gt;</em> [<em>&lt;OPTIONS&gt;</em>]
Robert Ly35f2fda2013-01-29 16:27:05 -080047</code></pre>
48<p>Installs Repo in the current directory. This creates a <code>.repo/</code> directory that contains Git repositories for the Repo source code and the standard Android manifest files. The <code>.repo/</code> directory also contains <code>manifest.xml</code>, which is a symlink to the selected manifest in the <code>.repo/manifests/</code> directory.</p>
49<p>Options:</p>
50<ul>
51<li>
52<p><code>-u</code>: specify a URL from which to retrieve a manifest repository. The common manifest can be found at <code>https://android.googlesource.com/platform/manifest</code></p>
53</li>
54<li>
55<p><code>-m</code>: select a manifest file within the repository. If no manifest name is selected, the default is default.xml. </p>
56</li>
57<li>
58<p><code>-b</code>: specify a revision, i.e., a particular manifest-branch.</p>
59</li>
60</ul>
61<p><em>Note: For all remaining Repo commands, the current working directory must either be the parent directory of <code>.repo/</code> or a subdirectory of the parent directory.</em></p>
62<h2 id="sync">sync</h2>
Clay Murphy0deea372015-01-23 12:12:48 -080063<pre><code>repo sync [<em>&lt;PROJECT_LIST&gt;</em>]
Robert Ly35f2fda2013-01-29 16:27:05 -080064</code></pre>
65<p>Downloads new changes and updates the working files in your local environment. If you run <code>repo sync</code> without any arguments, it will synchronize the files for all the projects.</p>
66<p>When you run <code>repo sync</code>, this is what happens:</p>
67<ul>
68<li>
69<p>If the project has never been synchronized, then <code>repo sync</code> is equivalent to <code>git clone</code>. All branches in the remote repository are copied to the local project directory.</p>
70</li>
71<li>
72<p>If the project has already been synchronized once, then <code>repo sync</code> is equivalent to:</p>
73<pre><code>git remote update
Clay Murphy0deea372015-01-23 12:12:48 -080074git rebase origin/<em>&lt;BRANCH&gt;</em>
Robert Ly35f2fda2013-01-29 16:27:05 -080075</code></pre>
Clay Murphy0deea372015-01-23 12:12:48 -080076<p>where <code><em>&lt;BRANCH&gt;</em></code> is the currently checked-out branch in the local project directory. If the local branch is not tracking a branch in the remote repository, then no synchronization will occur for the project.</p>
Robert Ly35f2fda2013-01-29 16:27:05 -080077</li>
78<li>
79<p>If the git rebase operation results in merge conflicts, you will need to use the normal Git commands (for example, <code>git rebase --continue</code>) to resolve the conflicts.</p>
80</li>
81</ul>
82<p>After a successful <code>repo sync</code>, the code in specified projects will be up to date with the code in the remote repository.</p>
83<p>Options:</p>
84<ul>
85<li>
86<p><code>-d</code>: switch specified projects back to the manifest revision. Helpful if the project is currently on a topic branch, but the manifest revision is temporarily needed.</p>
87</li>
88<li>
89<p><code>-s</code>: sync to a known good build as specified by the manifest-server element in the current manifest.</p>
90</li>
91<li>
92<p><code>-f</code>: proceed with syncing other projects even if a project fails to sync.</p>
93</li>
94</ul>
95<h2 id="upload">upload</h2>
Clay Murphy0deea372015-01-23 12:12:48 -080096<pre><code>repo upload [<em>&lt;PROJECT_LIST&gt;</em>]
Robert Ly35f2fda2013-01-29 16:27:05 -080097</code></pre>
98<p>For the specified projects, Repo compares the local branches to the remote branches updated during the last repo sync. Repo will prompt you to select one or more of the branches that have not yet been uploaded for review.</p>
99<p>After you select one or more branches, all commits on the selected branches
100are transmitted to Gerrit over an HTTPS connection. You will need to
101configure an HTTPS password to enable upload authorization. Visit the
102<a href="https://android-review.googlesource.com/new-password">Password Generator</a>
103to generate a new username/password pair to use over HTTPS.</p>
104<p>When Gerrit receives the object data over its server, it will turn each
105commit into a change so that reviewers can comment on each commit
106individually. To combine several "checkpoint" commits together into a
107single commit, use git rebase -i before you run repo upload.</p>
108<p>If you run repo upload without any arguments, it will search all the projects for changes to upload.</p>
109<p>To make edits to changes after they have been uploaded, you should use a tool like <code>git rebase -i</code> or <code>git commit --amend</code> to update your local commits. After your edits are complete:</p>
110<ul>
111<li>
112<p>Make sure the updated branch is the currently checked out branch.</p>
113</li>
114<li>
Robert Ly35f2fda2013-01-29 16:27:05 -0800115<p>For each commit in the series, enter the Gerrit change ID inside the brackets:</p>
116<pre><code># Replacing from branch foo
117[ 3021 ] 35f2596c Refactor part of GetUploadableBranches to lookup one specific...
118[ 2829 ] ec18b4ba Update proto client to support patch set replacments
Robert Ly35f2fda2013-01-29 16:27:05 -0800119# Insert change numbers in the brackets to add a new patch set.
120# To create a new change record, leave the brackets empty.
121</code></pre>
122</li>
123</ul>
124<p>After the upload is complete the changes will have an additional Patch Set.</p>
125<h2 id="diff">diff</h2>
Clay Murphy0deea372015-01-23 12:12:48 -0800126<pre><code>repo diff [<em>&lt;PROJECT_LIST&gt;</em>]
Robert Ly35f2fda2013-01-29 16:27:05 -0800127</code></pre>
128<p>Shows outstanding changes between commit and working tree using <code>git diff</code>. </p>
129<h2 id="download">download</h2>
Clay Murphy0deea372015-01-23 12:12:48 -0800130<pre><code>repo download <em>&lt;TARGET&gt;</em> <em>&lt;CHANGE&gt;</em>
Robert Ly35f2fda2013-01-29 16:27:05 -0800131</code></pre>
132<p>Downloads the specified change from the review system and makes it available in your project's local working directory.</p>
133<p>For example, to download <a href="https://android-review.googlesource.com/23823">change 23823</a> into your platform/frameworks/base directory:</p>
134<pre><code>$ repo download platform/build 23823
135</code></pre>
136<p>A <code>repo sync</code> should effectively remove any commits retrieved via <code>repo download</code>. Or, you can check out the remote branch; e.g., <code>git checkout m/master</code>.</p>
137<p>*Note: There is a slight mirroring lag between when a change is visible on
138the web in <a href="https://android-review.googlesource.com/">Gerrit</a> and when
139<code>repo download</code> will be able to find it for all users, because of replication
140delays to all servers worldwide.</p>
141<h2 id="forall">forall</h2>
Clay Murphy0deea372015-01-23 12:12:48 -0800142<pre><code>repo forall [<em>&lt;PROJECT_LIST&gt;</em>] -c <em>&lt;COMMAND&gt;</em>
Robert Ly35f2fda2013-01-29 16:27:05 -0800143</code></pre>
144<p>Executes the given shell command in each project. The following additional environment variables are made available by <code>repo forall</code>:</p>
145<ul>
146<li>
147<p><code>REPO_PROJECT</code> is set to the unique name of the project.</p>
148</li>
149<li>
150<p><code>REPO_PATH</code> is the path relative to the root of the client.</p>
151</li>
152<li>
Clay Murphy74a4dcc2014-09-09 16:26:00 -0700153<p><code>REPO_REMOTE</code> is the name of the remote system from the manifest.</p>
Robert Ly35f2fda2013-01-29 16:27:05 -0800154</li>
155<li>
156<p><code>REPO_LREV</code> is the name of the revision from the manifest, translated to a local tracking branch. Used if you need to pass the manifest revision to a locally executed git command.</p>
157</li>
158<li>
159<p><code>REPO_RREV</code> is the name of the revision from the manifest, exactly as written in the manifest.</p>
160</li>
161</ul>
162<p>Options:</p>
163<ul>
164<li>
165<p><code>-c</code>: command and arguments to execute. The command is evaluated through <code>/bin/sh</code> and any arguments after it are passed through as shell positional parameters.</p>
166</li>
167<li>
168<p><code>-p</code>: show project headers before output of the specified command. This is achieved by binding pipes to the command's stdin, stdout, and sterr streams, and piping all output into a continuous stream that is displayed in a single pager session.</p>
169</li>
170<li>
171<p><code>-v</code>: show messages the command writes to stderr. </p>
172</li>
173</ul>
174<h2 id="prune">prune</h2>
Clay Murphy0deea372015-01-23 12:12:48 -0800175<pre><code>repo prune [<em>&lt;PROJECT_LIST&gt;</em>]
Robert Ly35f2fda2013-01-29 16:27:05 -0800176</code></pre>
177<p>Prunes (deletes) topics that are already merged.</p>
178<h2 id="start">start</h2>
Clay Murphy0deea372015-01-23 12:12:48 -0800179<pre><code>repo start <em>&lt;BRANCH_NAME&gt;</em> [<em>&lt;PROJECT_LIST&gt;</em>]
Robert Ly35f2fda2013-01-29 16:27:05 -0800180</code></pre>
181<p>Begins a new branch for development, starting from the revision specified in the manifest.</p>
Clay Murphy0deea372015-01-23 12:12:48 -0800182<p>The <code><em>&lt;BRANCH_NAME&gt;</em></code> argument should provide a short description of the change you are trying to make to the projects.If you don't know, consider using the name default.</p>
183<p>The <code><em>&lt;PROJECT_LIST&gt;</em></code> specifies which projects will participate in this topic branch. </p>
Robert Ly35f2fda2013-01-29 16:27:05 -0800184<p><em>Note: "." is a useful shorthand for the project in the current working directory.</em></p>
185<h2 id="status">status</h2>
Clay Murphy0deea372015-01-23 12:12:48 -0800186<pre><code>repo status [<em>&lt;PROJECT_LIST&gt;</em>]
Robert Ly35f2fda2013-01-29 16:27:05 -0800187</code></pre>
188<p>Compares the working tree to the staging area (index) and the most recent commit on this branch (HEAD) in each project specified. Displays a summary line for each file where there is a difference between these three states.</p>
189<p>To see the status for only the current branch, run <code>repo status</code>. The status information will be listed by project. For each file in the project, a two-letter code is used:</p>
190<p>In the first column, an uppercase letter indicates how the staging area differs from the last committed state.</p>
191<table>
192<thead>
193<tr>
194<th>letter</th>
195<th>meaning</th>
196<th>description</th>
197</tr>
198</thead>
199<tbody>
200<tr>
201<td>-</td>
202<td>no change</td>
203<td>same in HEAD and index</td>
204</tr>
205<tr>
206<td>A</td>
207<td>added</td>
208<td>not in HEAD, in index</td>
209</tr>
210<tr>
211<td>M</td>
212<td>modified</td>
213<td>in HEAD, modified in index</td>
214</tr>
215<tr>
216<td>D</td>
217<td>deleted</td>
218<td>in HEAD, not in index</td>
219</tr>
220<tr>
221<td>R</td>
222<td>renamed</td>
223<td>not in HEAD, path changed in index</td>
224</tr>
225<tr>
226<td>C</td>
227<td>copied</td>
228<td>not in HEAD, copied from another in index</td>
229</tr>
230<tr>
231<td>T</td>
232<td>mode changed</td>
233<td>same content in HEAD and index, mode changed</td>
234</tr>
235<tr>
236<td>U</td>
237<td>unmerged</td>
238<td>conflict between HEAD and index; resolution required</td>
239</tr>
240</tbody>
241</table>
242<p>In the second column, a lowercase letter indicates how the working directory differs from the index.</p>
243<table>
244<thead>
245<tr>
246<th>letter</th>
247<th>meaning</th>
248<th>description</th>
249</tr>
250</thead>
251<tbody>
252<tr>
253<td>-</td>
254<td>new/unknown</td>
255<td>not in index, in work tree</td>
256</tr>
257<tr>
258<td>m</td>
259<td>modified</td>
260<td>in index, in work tree, modified</td>
261</tr>
262<tr>
263<td>d</td>
264<td>deleted</td>
265<td>in index, not in work tree</td>
266</tr>
267</tbody>
268</table>