blob: b62f693e7b545af93b71ae9698f6fb2c6ca093c8 [file] [log] [blame] [view]
Skyler Kaufman44436912011-04-07 15:11:52 -07001<!--
2 Copyright 2010 The Android Open Source Project
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15-->
16
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070017# Repo command reference #
18
19Repo usage takes the following form:
20
21 repo COMMAND OPTIONS
22
23Optional elements are shown in brackets [ ]. Once Repo is installed, you can get information about any command by running
24
25 repo help COMMAND
26
27Many commands take a project list as an argument. You can specify project-list as a list of names or a list of paths to local source directories for the projects:
28
29 repo sync [PROJECT0 PROJECT1 ... PROJECTN]
30 repo sync [/PATH/TO/PROJECT0 ... /PATH/TO/PROJECTN]
31
32[TOC]
33
34## init ##
35
36 $ repo init -u URL [OPTIONS]
37
38Installs Repo in the current directory. This creates a `.repo/` directory that contains Git repositories for the Repo source code and the standard Android manifest files. The `.repo/` directory also contains `manifest.xml`, which is a symlink to the selected manifest in the `.repo/manifests/` directory.
39
40Options:
41
Jean-Baptiste Querud00ebae2012-05-14 08:08:16 -070042* `-u`: specify a URL from which to retrieve a manifest repository. The common manifest can be found at `https://android.googlesource.com/platform/manifest`
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070043
44* `-m`: select a manifest file within the repository. If no manifest name is selected, the default is default.xml.
45
46* `-b`: specify a revision, i.e., a particular manifest-branch.
47
48*Note: For all remaining Repo commands, the current working directory must either be the parent directory of `.repo/` or a subdirectory of the parent directory.*
49
50
51## sync ##
52
53 repo sync [PROJECT_LIST]
54
55Downloads new changes and updates the working files in your local environment. If you run `repo sync` without any arguments, it will synchronize the files for all the projects.
56
57When you run `repo sync`, this is what happens:
58
59- If the project has never been synchronized, then `repo sync` is equivalent to `git clone`. All branches in the remote repository are copied to the local project directory.
60
61- If the project has already been synchronized once, then `repo sync` is equivalent to:
62
63 git remote update
64 git rebase origin/BRANCH
65
66 where `BRANCH` 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.
67
68- If the git rebase operation results in merge conflicts, you will need to use the normal Git commands (for example, `git rebase --continue`) to resolve the conflicts.
69
70After a successful `repo sync`, the code in specified projects will be up to date with the code in the remote repository.
71
72Options:
73
74* `-d`: 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.
75
76* `-s`: sync to a known good build as specified by the manifest-server element in the current manifest.
77
78* `-f`: proceed with syncing other projects even if a project fails to sync.
79
80
81## upload ##
82
83 repo upload [PROJECT_LIST]
84
85For 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.
86
Jean-Baptiste Queru0e3ee322012-01-11 05:42:17 -080087After you select one or more branches, all commits on the selected branches
88are transmitted to Gerrit over an HTTPS connection. You will need to
89configure an HTTPS password to enable upload authorization. Visit the
90[Password Generator](https://android-review.googlesource.com/new-password)
91to generate a new username/password pair to use over HTTPS.
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070092
Jean-Baptiste Queru0e3ee322012-01-11 05:42:17 -080093When Gerrit receives the object data over its server, it will turn each
94commit into a change so that reviewers can comment on each commit
95individually. To combine several "checkpoint" commits together into a
96single commit, use git rebase -i before you run repo upload.
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070097
98If you run repo upload without any arguments, it will search all the projects for changes to upload.
99
100To make edits to changes after they have been uploaded, you should use a tool like `git rebase -i` or `git commit --amend` to update your local commits. After your edits are complete:
101
102- Make sure the updated branch is the currently checked out branch.
103
104- Use `repo upload --replace PROJECT` to open the change matching editor.
105
106- For each commit in the series, enter the Gerrit change ID inside the brackets:
107
108 # Replacing from branch foo
109 [ 3021 ] 35f2596c Refactor part of GetUploadableBranches to lookup one specific...
110 [ 2829 ] ec18b4ba Update proto client to support patch set replacments
111 [ 3022 ] c99883fe Teach 'repo upload --replace' how to add replacement patch se...
112 # Insert change numbers in the brackets to add a new patch set.
113 # To create a new change record, leave the brackets empty.
114
115After the upload is complete the changes will have an additional Patch Set.
116
117
118## diff ##
119
120 repo diff [PROJECT_LIST]
121
122Shows outstanding changes between commit and working tree using `git diff`.
123
124
125## download ##
126
127 repo download TARGET CHANGE
128
129Downloads the specified change from the review system and makes it available in your project's local working directory.
130
Jean-Baptiste Queru0e3ee322012-01-11 05:42:17 -0800131For example, to download [change 23823](https://android-review.googlesource.com/23823) into your platform/frameworks/base directory:
Skyler Kaufman991ae4d2011-04-07 12:30:41 -0700132
Jean-Baptiste Queru0e3ee322012-01-11 05:42:17 -0800133 $ repo download platform/build 23823
Skyler Kaufman991ae4d2011-04-07 12:30:41 -0700134
135A `repo sync` should effectively remove any commits retrieved via `repo download`. Or, you can check out the remote branch; e.g., `git checkout m/master`.
136
Jean-Baptiste Queru0e3ee322012-01-11 05:42:17 -0800137*Note: There is a slight mirroring lag between when a change is visible on
138the web in [Gerrit](https://android-review.googlesource.com/) and when
139`repo download` will be able to find it for all users, because of replication
140delays to all servers worldwide.
Skyler Kaufman991ae4d2011-04-07 12:30:41 -0700141
142
143## forall ##
144
145 repo forall [PROJECT_LIST] -c COMMAND
146
147Executes the given shell command in each project. The following additional environment variables are made available by `repo forall`:
148
149* `REPO_PROJECT` is set to the unique name of the project.
150
151* `REPO_PATH` is the path relative to the root of the client.
152
153* `REPO_REMOTE` is the name of the remote sstem from the manifest.
154
155* `REPO_LREV` 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.
156
157* `REPO_RREV` is the name of the revision from the manifest, exactly as written in the manifest.
158
159Options:
160
161* `-c`: command and arguments to execute. The command is evaluated through `/bin/sh` and any arguments after it are passed through as shell positional parameters.
162
163* `-p`: 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.
164
165* `-v`: show messages the command writes to stderr.
166
167
168## prune ##
169
170 repo prune [PROJECT_LIST]
171
172Prunes (deletes) topics that are already merged.
173
174
175## start ##
176
177 repo start BRANCH_NAME [PROJECT_LIST]
178
179Begins a new branch for development, starting from the revision specified in the manifest.
180
181The `BRANCH_NAME` 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.
182
183The `PROJECT_LIST` specifies which projects will participate in this topic branch.
184
185*Note: "." is a useful shorthand for the project in the current working directory.*
186
187
188## status ##
189
190 repo status [PROJECT_LIST]
191
192Compares 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.
193
194To see the status for only the current branch, run `repo status`. The status information will be listed by project. For each file in the project, a two-letter code is used:
195
196In the first column, an uppercase letter indicates how the staging area differs from the last committed state.
197
198letter | meaning | description
199-------|----------------|-------------------------
200- | no change | same in HEAD and index
201A | added | not in HEAD, in index
202M | modified | in HEAD, modified in index
203D | deleted | in HEAD, not in index
204R | renamed | not in HEAD, path changed in index
205C | copied | not in HEAD, copied from another in index
206T | mode changed | same content in HEAD and index, mode changed
207U | unmerged | conflict between HEAD and index; resolution required
208
209In the second column, a lowercase letter indicates how the working directory differs from the index.
210
211letter | meaning | description
212-------|----------------|----------------------------
213- | new/unknown | not in index, in work tree
214m | modified | in index, in work tree, modified
215d | deleted | in index, not in work tree
216
217