Shawn O. Pearce | 3e54819 | 2008-11-04 11:19:36 -0800 | [diff] [blame] | 1 | repo Manifest Format |
| 2 | ==================== |
| 3 | |
| 4 | A repo manifest describes the structure of a repo client; that is |
| 5 | the directories that are visible and where they should be obtained |
| 6 | from with git. |
| 7 | |
| 8 | The basic structure of a manifest is a bare Git repository holding |
| 9 | a single 'default.xml' XML file in the top level directory. |
| 10 | |
| 11 | Manifests are inherently version controlled, since they are kept |
| 12 | within a Git repository. Updates to manifests are automatically |
| 13 | obtained by clients during `repo sync`. |
| 14 | |
| 15 | |
| 16 | XML File Format |
| 17 | --------------- |
| 18 | |
| 19 | A manifest XML file (e.g. 'default.xml') roughly conforms to the |
| 20 | following DTD: |
| 21 | |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 22 | <!DOCTYPE manifest [ |
Doug Anderson | 2b8db3c | 2010-11-01 15:08:06 -0700 | [diff] [blame] | 23 | <!ELEMENT manifest (notice?, |
| 24 | remote*, |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 25 | default?, |
Nico Sallembien | a1bfd2c | 2010-04-06 10:40:01 -0700 | [diff] [blame] | 26 | manifest-server?, |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 27 | remove-project*, |
Doug Anderson | 37282b4 | 2011-03-04 11:54:18 -0800 | [diff] [blame] | 28 | project*, |
| 29 | repo-hooks?)> |
Chirayu Desai | d5a5b19 | 2013-11-21 19:15:30 +0530 | [diff] [blame] | 30 | |
Doug Anderson | 2b8db3c | 2010-11-01 15:08:06 -0700 | [diff] [blame] | 31 | <!ELEMENT notice (#PCDATA)> |
Chirayu Desai | d5a5b19 | 2013-11-21 19:15:30 +0530 | [diff] [blame] | 32 | |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 33 | <!ELEMENT remote (EMPTY)> |
| 34 | <!ATTLIST remote name ID #REQUIRED> |
Yestin Sun | b292b98 | 2012-07-02 07:32:50 -0700 | [diff] [blame] | 35 | <!ATTLIST remote alias CDATA #IMPLIED> |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 36 | <!ATTLIST remote fetch CDATA #REQUIRED> |
| 37 | <!ATTLIST remote review CDATA #IMPLIED> |
Chirayu Desai | d5a5b19 | 2013-11-21 19:15:30 +0530 | [diff] [blame] | 38 | |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 39 | <!ELEMENT default (EMPTY)> |
Bryan Jacobs | f609f91 | 2013-05-06 13:36:24 -0400 | [diff] [blame] | 40 | <!ATTLIST default remote IDREF #IMPLIED> |
| 41 | <!ATTLIST default revision CDATA #IMPLIED> |
| 42 | <!ATTLIST default dest-branch CDATA #IMPLIED> |
| 43 | <!ATTLIST default sync-j CDATA #IMPLIED> |
| 44 | <!ATTLIST default sync-c CDATA #IMPLIED> |
| 45 | <!ATTLIST default sync-s CDATA #IMPLIED> |
Nico Sallembien | a1bfd2c | 2010-04-06 10:40:01 -0700 | [diff] [blame] | 46 | |
| 47 | <!ELEMENT manifest-server (EMPTY)> |
| 48 | <!ATTLIST url CDATA #REQUIRED> |
Chirayu Desai | d5a5b19 | 2013-11-21 19:15:30 +0530 | [diff] [blame] | 49 | |
Che-Liang Chiou | b2bd91c | 2012-01-11 11:28:42 +0800 | [diff] [blame] | 50 | <!ELEMENT project (annotation?, |
| 51 | project*)> |
Bryan Jacobs | f609f91 | 2013-05-06 13:36:24 -0400 | [diff] [blame] | 52 | <!ATTLIST project name CDATA #REQUIRED> |
| 53 | <!ATTLIST project path CDATA #IMPLIED> |
| 54 | <!ATTLIST project remote IDREF #IMPLIED> |
| 55 | <!ATTLIST project revision CDATA #IMPLIED> |
| 56 | <!ATTLIST project dest-branch CDATA #IMPLIED> |
| 57 | <!ATTLIST project groups CDATA #IMPLIED> |
| 58 | <!ATTLIST project sync-c CDATA #IMPLIED> |
| 59 | <!ATTLIST project sync-s CDATA #IMPLIED> |
David Pursehouse | 4e46520 | 2012-11-27 22:20:10 +0900 | [diff] [blame] | 60 | <!ATTLIST project upstream CDATA #IMPLIED> |
David Pursehouse | ede7f12 | 2012-11-27 22:25:30 +0900 | [diff] [blame] | 61 | <!ATTLIST project clone-depth CDATA #IMPLIED> |
Scott Fan | db83b1b | 2013-02-28 09:34:14 +0800 | [diff] [blame] | 62 | <!ATTLIST project force-path CDATA #IMPLIED> |
James W. Mills | 24c1308 | 2012-04-12 15:04:13 -0500 | [diff] [blame] | 63 | |
| 64 | <!ELEMENT annotation (EMPTY)> |
| 65 | <!ATTLIST annotation name CDATA #REQUIRED> |
| 66 | <!ATTLIST annotation value CDATA #REQUIRED> |
| 67 | <!ATTLIST annotation keep CDATA "true"> |
Chirayu Desai | d5a5b19 | 2013-11-21 19:15:30 +0530 | [diff] [blame] | 68 | |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 69 | <!ELEMENT remove-project (EMPTY)> |
| 70 | <!ATTLIST remove-project name CDATA #REQUIRED> |
Doug Anderson | 37282b4 | 2011-03-04 11:54:18 -0800 | [diff] [blame] | 71 | |
| 72 | <!ELEMENT repo-hooks (EMPTY)> |
| 73 | <!ATTLIST repo-hooks in-project CDATA #REQUIRED> |
| 74 | <!ATTLIST repo-hooks enabled-list CDATA #REQUIRED> |
Brian Harring | 2644874 | 2011-04-28 05:04:41 -0700 | [diff] [blame] | 75 | |
| 76 | <!ELEMENT include (EMPTY)> |
| 77 | <!ATTLIST include name CDATA #REQUIRED> |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 78 | ]> |
Shawn O. Pearce | 3e54819 | 2008-11-04 11:19:36 -0800 | [diff] [blame] | 79 | |
| 80 | A description of the elements and their attributes follows. |
| 81 | |
| 82 | |
| 83 | Element manifest |
| 84 | ---------------- |
| 85 | |
| 86 | The root element of the file. |
| 87 | |
| 88 | |
| 89 | Element remote |
| 90 | -------------- |
| 91 | |
| 92 | One or more remote elements may be specified. Each remote element |
| 93 | specifies a Git URL shared by one or more projects and (optionally) |
| 94 | the Gerrit review server those projects upload changes through. |
| 95 | |
| 96 | Attribute `name`: A short name unique to this manifest file. The |
| 97 | name specified here is used as the remote name in each project's |
| 98 | .git/config, and is therefore automatically available to commands |
| 99 | like `git fetch`, `git remote`, `git pull` and `git push`. |
| 100 | |
Yestin Sun | b292b98 | 2012-07-02 07:32:50 -0700 | [diff] [blame] | 101 | Attribute `alias`: The alias, if specified, is used to override |
| 102 | `name` to be set as the remote name in each project's .git/config. |
| 103 | Its value can be duplicated while attribute `name` has to be unique |
| 104 | in the manifest file. This helps each project to be able to have |
| 105 | same remote name which actually points to different remote url. |
| 106 | |
Shawn O. Pearce | 3e54819 | 2008-11-04 11:19:36 -0800 | [diff] [blame] | 107 | Attribute `fetch`: The Git URL prefix for all projects which use |
| 108 | this remote. Each project's name is appended to this prefix to |
| 109 | form the actual URL used to clone the project. |
| 110 | |
| 111 | Attribute `review`: Hostname of the Gerrit server where reviews |
| 112 | are uploaded to by `repo upload`. This attribute is optional; |
| 113 | if not specified then `repo upload` will not function. |
| 114 | |
Shawn O. Pearce | 3e54819 | 2008-11-04 11:19:36 -0800 | [diff] [blame] | 115 | Element default |
| 116 | --------------- |
| 117 | |
| 118 | At most one default element may be specified. Its remote and |
| 119 | revision attributes are used when a project element does not |
| 120 | specify its own remote or revision attribute. |
| 121 | |
| 122 | Attribute `remote`: Name of a previously defined remote element. |
| 123 | Project elements lacking a remote attribute of their own will use |
| 124 | this remote. |
| 125 | |
| 126 | Attribute `revision`: Name of a Git branch (e.g. `master` or |
| 127 | `refs/heads/master`). Project elements lacking their own |
| 128 | revision attribute will use this revision. |
| 129 | |
Bryan Jacobs | f609f91 | 2013-05-06 13:36:24 -0400 | [diff] [blame] | 130 | Attribute `dest-branch`: Name of a Git branch (e.g. `master`). |
| 131 | Project elements not setting their own `dest-branch` will inherit |
| 132 | this value. If this value is not set, projects will use `revision` |
| 133 | by default instead. |
| 134 | |
David Pursehouse | 4e46520 | 2012-11-27 22:20:10 +0900 | [diff] [blame] | 135 | Attribute `sync_j`: Number of parallel jobs to use when synching. |
| 136 | |
| 137 | Attribute `sync_c`: Set to true to only sync the given Git |
| 138 | branch (specified in the `revision` attribute) rather than the |
| 139 | whole ref space. Project elements lacking a sync_c element of |
| 140 | their own will use this value. |
| 141 | |
| 142 | Attribute `sync_s`: Set to true to also sync sub-projects. |
| 143 | |
Shawn O. Pearce | 3e54819 | 2008-11-04 11:19:36 -0800 | [diff] [blame] | 144 | |
Nico Sallembien | a1bfd2c | 2010-04-06 10:40:01 -0700 | [diff] [blame] | 145 | Element manifest-server |
| 146 | ----------------------- |
| 147 | |
| 148 | At most one manifest-server may be specified. The url attribute |
| 149 | is used to specify the URL of a manifest server, which is an |
David Pursehouse | 9a27d01 | 2012-08-21 14:23:49 +0900 | [diff] [blame] | 150 | XML RPC service. |
Nico Sallembien | a1bfd2c | 2010-04-06 10:40:01 -0700 | [diff] [blame] | 151 | |
David Pursehouse | 9a27d01 | 2012-08-21 14:23:49 +0900 | [diff] [blame] | 152 | The manifest server should implement the following RPC methods: |
Nico Sallembien | a1bfd2c | 2010-04-06 10:40:01 -0700 | [diff] [blame] | 153 | |
| 154 | GetApprovedManifest(branch, target) |
| 155 | |
David Pursehouse | 9a27d01 | 2012-08-21 14:23:49 +0900 | [diff] [blame] | 156 | Return a manifest in which each project is pegged to a known good revision |
| 157 | for the current branch and target. |
| 158 | |
Nico Sallembien | a1bfd2c | 2010-04-06 10:40:01 -0700 | [diff] [blame] | 159 | The target to use is defined by environment variables TARGET_PRODUCT |
| 160 | and TARGET_BUILD_VARIANT. These variables are used to create a string |
| 161 | of the form $TARGET_PRODUCT-$TARGET_BUILD_VARIANT, e.g. passion-userdebug. |
| 162 | If one of those variables or both are not present, the program will call |
David Pursehouse | daa851f | 2012-08-21 13:52:18 +0900 | [diff] [blame] | 163 | GetApprovedManifest without the target parameter and the manifest server |
Nico Sallembien | a1bfd2c | 2010-04-06 10:40:01 -0700 | [diff] [blame] | 164 | should choose a reasonable default target. |
| 165 | |
David Pursehouse | 9a27d01 | 2012-08-21 14:23:49 +0900 | [diff] [blame] | 166 | GetManifest(tag) |
| 167 | |
| 168 | Return a manifest in which each project is pegged to the revision at |
| 169 | the specified tag. |
| 170 | |
Nico Sallembien | a1bfd2c | 2010-04-06 10:40:01 -0700 | [diff] [blame] | 171 | |
Shawn O. Pearce | 3e54819 | 2008-11-04 11:19:36 -0800 | [diff] [blame] | 172 | Element project |
| 173 | --------------- |
| 174 | |
| 175 | One or more project elements may be specified. Each element |
| 176 | describes a single Git repository to be cloned into the repo |
Che-Liang Chiou | b2bd91c | 2012-01-11 11:28:42 +0800 | [diff] [blame] | 177 | client workspace. You may specify Git-submodules by creating a |
| 178 | nested project. Git-submodules will be automatically |
| 179 | recognized and inherit their parent's attributes, but those |
| 180 | may be overridden by an explicitly specified project element. |
Shawn O. Pearce | 3e54819 | 2008-11-04 11:19:36 -0800 | [diff] [blame] | 181 | |
| 182 | Attribute `name`: A unique name for this project. The project's |
| 183 | name is appended onto its remote's fetch URL to generate the actual |
| 184 | URL to configure the Git remote with. The URL gets formed as: |
| 185 | |
| 186 | ${remote_fetch}/${project_name}.git |
| 187 | |
| 188 | where ${remote_fetch} is the remote's fetch attribute and |
| 189 | ${project_name} is the project's name attribute. The suffix ".git" |
David Pursehouse | daa851f | 2012-08-21 13:52:18 +0900 | [diff] [blame] | 190 | is always appended as repo assumes the upstream is a forest of |
Che-Liang Chiou | b2bd91c | 2012-01-11 11:28:42 +0800 | [diff] [blame] | 191 | bare Git repositories. If the project has a parent element, its |
| 192 | name will be prefixed by the parent's. |
Shawn O. Pearce | 3e54819 | 2008-11-04 11:19:36 -0800 | [diff] [blame] | 193 | |
| 194 | The project name must match the name Gerrit knows, if Gerrit is |
| 195 | being used for code reviews. |
| 196 | |
| 197 | Attribute `path`: An optional path relative to the top directory |
| 198 | of the repo client where the Git working directory for this project |
| 199 | should be placed. If not supplied the project name is used. |
Che-Liang Chiou | b2bd91c | 2012-01-11 11:28:42 +0800 | [diff] [blame] | 200 | If the project has a parent element, its path will be prefixed |
| 201 | by the parent's. |
Shawn O. Pearce | 3e54819 | 2008-11-04 11:19:36 -0800 | [diff] [blame] | 202 | |
| 203 | Attribute `remote`: Name of a previously defined remote element. |
| 204 | If not supplied the remote given by the default element is used. |
| 205 | |
| 206 | Attribute `revision`: Name of the Git branch the manifest wants |
| 207 | to track for this project. Names can be relative to refs/heads |
| 208 | (e.g. just "master") or absolute (e.g. "refs/heads/master"). |
| 209 | Tags and/or explicit SHA-1s should work in theory, but have not |
| 210 | been extensively tested. If not supplied the revision given by |
| 211 | the default element is used. |
| 212 | |
Bryan Jacobs | f609f91 | 2013-05-06 13:36:24 -0400 | [diff] [blame] | 213 | Attribute `dest-branch`: Name of a Git branch (e.g. `master`). |
| 214 | When using `repo upload`, changes will be submitted for code |
| 215 | review on this branch. If unspecified both here and in the |
| 216 | default element, `revision` is used instead. |
| 217 | |
Colin Cross | 5acde75 | 2012-03-28 20:15:45 -0700 | [diff] [blame] | 218 | Attribute `groups`: List of groups to which this project belongs, |
Conley Owens | 971de8e | 2012-04-16 10:36:08 -0700 | [diff] [blame] | 219 | whitespace or comma separated. All projects belong to the group |
Conley Owens | bb1b5f5 | 2012-08-13 13:11:18 -0700 | [diff] [blame] | 220 | "all", and each project automatically belongs to a group of |
| 221 | its name:`name` and path:`path`. E.g. for |
Brian Harring | 7da1314 | 2012-06-15 02:24:20 -0700 | [diff] [blame] | 222 | <project name="monkeys" path="barrel-of"/>, that project |
| 223 | definition is implicitly in the following manifest groups: |
Conley Owens | bb1b5f5 | 2012-08-13 13:11:18 -0700 | [diff] [blame] | 224 | default, name:monkeys, and path:barrel-of. If you place a project in the |
| 225 | group "notdefault", it will not be automatically downloaded by repo. |
Che-Liang Chiou | b2bd91c | 2012-01-11 11:28:42 +0800 | [diff] [blame] | 226 | If the project has a parent element, the `name` and `path` here |
| 227 | are the prefixed ones. |
Colin Cross | 5acde75 | 2012-03-28 20:15:45 -0700 | [diff] [blame] | 228 | |
David Pursehouse | 4e46520 | 2012-11-27 22:20:10 +0900 | [diff] [blame] | 229 | Attribute `sync_c`: Set to true to only sync the given Git |
| 230 | branch (specified in the `revision` attribute) rather than the |
| 231 | whole ref space. |
| 232 | |
| 233 | Attribute `sync_s`: Set to true to also sync sub-projects. |
| 234 | |
| 235 | Attribute `upstream`: Name of the Git branch in which a sha1 |
| 236 | can be found. Used when syncing a revision locked manifest in |
| 237 | -c mode to avoid having to sync the entire ref space. |
| 238 | |
David Pursehouse | ede7f12 | 2012-11-27 22:25:30 +0900 | [diff] [blame] | 239 | Attribute `clone-depth`: Set the depth to use when fetching this |
| 240 | project. If specified, this value will override any value given |
| 241 | to repo init with the --depth option on the command line. |
| 242 | |
Scott Fan | db83b1b | 2013-02-28 09:34:14 +0800 | [diff] [blame] | 243 | Attribute `force-path`: Set to true to force this project to create the |
| 244 | local mirror repository according to its `path` attribute (if supplied) |
| 245 | rather than the `name` attribute. This attribute only applies to the |
| 246 | local mirrors syncing, it will be ignored when syncing the projects in a |
| 247 | client working directory. |
| 248 | |
James W. Mills | 24c1308 | 2012-04-12 15:04:13 -0500 | [diff] [blame] | 249 | Element annotation |
| 250 | ------------------ |
| 251 | |
| 252 | Zero or more annotation elements may be specified as children of a |
| 253 | project element. Each element describes a name-value pair that will be |
| 254 | exported into each project's environment during a 'forall' command, |
| 255 | prefixed with REPO__. In addition, there is an optional attribute |
| 256 | "keep" which accepts the case insensitive values "true" (default) or |
| 257 | "false". This attribute determines whether or not the annotation will |
| 258 | be kept when exported with the manifest subcommand. |
| 259 | |
Shawn O. Pearce | 03eaf07 | 2008-11-20 11:42:22 -0800 | [diff] [blame] | 260 | Element remove-project |
| 261 | ---------------------- |
| 262 | |
| 263 | Deletes the named project from the internal manifest table, possibly |
| 264 | allowing a subsequent project element in the same manifest file to |
| 265 | replace the project with a different source. |
| 266 | |
David Pursehouse | b1525bf | 2012-11-14 08:51:38 +0900 | [diff] [blame] | 267 | This element is mostly useful in a local manifest file, where |
Shawn O. Pearce | 03eaf07 | 2008-11-20 11:42:22 -0800 | [diff] [blame] | 268 | the user can remove a project, and possibly replace it with their |
| 269 | own definition. |
| 270 | |
Brian Harring | 2644874 | 2011-04-28 05:04:41 -0700 | [diff] [blame] | 271 | Element include |
| 272 | --------------- |
| 273 | |
| 274 | This element provides the capability of including another manifest |
| 275 | file into the originating manifest. Normal rules apply for the |
David Pursehouse | 9f3406e | 2012-11-14 08:52:25 +0900 | [diff] [blame] | 276 | target manifest to include - it must be a usable manifest on its own. |
Brian Harring | 2644874 | 2011-04-28 05:04:41 -0700 | [diff] [blame] | 277 | |
David Pursehouse | 9f3406e | 2012-11-14 08:52:25 +0900 | [diff] [blame] | 278 | Attribute `name`: the manifest to include, specified relative to |
| 279 | the manifest repository's root. |
Brian Harring | 2644874 | 2011-04-28 05:04:41 -0700 | [diff] [blame] | 280 | |
Shawn O. Pearce | 03eaf07 | 2008-11-20 11:42:22 -0800 | [diff] [blame] | 281 | |
David Pursehouse | 2d5a0df | 2012-11-13 02:50:36 +0900 | [diff] [blame] | 282 | Local Manifests |
| 283 | =============== |
Shawn O. Pearce | 70cd4ab | 2008-11-06 08:48:44 -0800 | [diff] [blame] | 284 | |
David Pursehouse | 2d5a0df | 2012-11-13 02:50:36 +0900 | [diff] [blame] | 285 | Additional remotes and projects may be added through local manifest |
| 286 | files stored in `$TOP_DIR/.repo/local_manifests/*.xml`. |
Shawn O. Pearce | 70cd4ab | 2008-11-06 08:48:44 -0800 | [diff] [blame] | 287 | |
| 288 | For example: |
| 289 | |
David Pursehouse | 2d5a0df | 2012-11-13 02:50:36 +0900 | [diff] [blame] | 290 | $ ls .repo/local_manifests |
| 291 | local_manifest.xml |
| 292 | another_local_manifest.xml |
| 293 | |
| 294 | $ cat .repo/local_manifests/local_manifest.xml |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 295 | <?xml version="1.0" encoding="UTF-8"?> |
| 296 | <manifest> |
| 297 | <project path="manifest" |
| 298 | name="tools/manifest" /> |
| 299 | <project path="platform-manifest" |
| 300 | name="platform/manifest" /> |
| 301 | </manifest> |
Shawn O. Pearce | 70cd4ab | 2008-11-06 08:48:44 -0800 | [diff] [blame] | 302 | |
David Pursehouse | 2d5a0df | 2012-11-13 02:50:36 +0900 | [diff] [blame] | 303 | Users may add projects to the local manifest(s) prior to a `repo sync` |
Shawn O. Pearce | 70cd4ab | 2008-11-06 08:48:44 -0800 | [diff] [blame] | 304 | invocation, instructing repo to automatically download and manage |
| 305 | these extra projects. |
David Pursehouse | 2d5a0df | 2012-11-13 02:50:36 +0900 | [diff] [blame] | 306 | |
David Pursehouse | 52f1e5d | 2012-11-14 04:53:24 +0900 | [diff] [blame] | 307 | Manifest files stored in `$TOP_DIR/.repo/local_manifests/*.xml` will |
| 308 | be loaded in alphabetical order. |
| 309 | |
David Pursehouse | 2d5a0df | 2012-11-13 02:50:36 +0900 | [diff] [blame] | 310 | Additional remotes and projects may also be added through a local |
David Pursehouse | 5566ae5 | 2012-11-13 03:04:18 +0900 | [diff] [blame] | 311 | manifest, stored in `$TOP_DIR/.repo/local_manifest.xml`. This method |
| 312 | is deprecated in favor of using multiple manifest files as mentioned |
| 313 | above. |
David Pursehouse | 52f1e5d | 2012-11-14 04:53:24 +0900 | [diff] [blame] | 314 | |
| 315 | If `$TOP_DIR/.repo/local_manifest.xml` exists, it will be loaded before |
| 316 | any manifest files stored in `$TOP_DIR/.repo/local_manifests/*.xml`. |