blob: cf48698d37c1fff03dc0a914b946b1183ce660d5 [file] [log] [blame] [view]
Shawn O. Pearce3e548192008-11-04 11:19:36 -08001repo Manifest Format
2====================
3
4A repo manifest describes the structure of a repo client; that is
5the directories that are visible and where they should be obtained
6from with git.
7
8The basic structure of a manifest is a bare Git repository holding
Mike Frysinger3891b752018-10-05 19:26:15 -04009a single `default.xml` XML file in the top level directory.
Shawn O. Pearce3e548192008-11-04 11:19:36 -080010
11Manifests are inherently version controlled, since they are kept
12within a Git repository. Updates to manifests are automatically
13obtained by clients during `repo sync`.
14
Mike Frysinger3891b752018-10-05 19:26:15 -040015[TOC]
16
Shawn O. Pearce3e548192008-11-04 11:19:36 -080017
18XML File Format
19---------------
20
Mike Frysinger3891b752018-10-05 19:26:15 -040021A manifest XML file (e.g. `default.xml`) roughly conforms to the
Shawn O. Pearce3e548192008-11-04 11:19:36 -080022following DTD:
23
Mike Frysinger3891b752018-10-05 19:26:15 -040024```xml
25<!DOCTYPE manifest [
26 <!ELEMENT manifest (notice?,
27 remote*,
28 default?,
29 manifest-server?,
30 remove-project*,
31 project*,
32 extend-project*,
33 repo-hooks?,
34 include*)>
Chirayu Desaid5a5b192013-11-21 19:15:30 +053035
Mike Frysinger3891b752018-10-05 19:26:15 -040036 <!ELEMENT notice (#PCDATA)>
Chirayu Desaid5a5b192013-11-21 19:15:30 +053037
Mike Frysinger3891b752018-10-05 19:26:15 -040038 <!ELEMENT remote EMPTY>
39 <!ATTLIST remote name ID #REQUIRED>
40 <!ATTLIST remote alias CDATA #IMPLIED>
41 <!ATTLIST remote fetch CDATA #REQUIRED>
42 <!ATTLIST remote pushurl CDATA #IMPLIED>
43 <!ATTLIST remote review CDATA #IMPLIED>
44 <!ATTLIST remote revision CDATA #IMPLIED>
Chirayu Desaid5a5b192013-11-21 19:15:30 +053045
Mike Frysinger3891b752018-10-05 19:26:15 -040046 <!ELEMENT default EMPTY>
47 <!ATTLIST default remote IDREF #IMPLIED>
48 <!ATTLIST default revision CDATA #IMPLIED>
49 <!ATTLIST default dest-branch CDATA #IMPLIED>
50 <!ATTLIST default upstream CDATA #IMPLIED>
51 <!ATTLIST default sync-j CDATA #IMPLIED>
52 <!ATTLIST default sync-c CDATA #IMPLIED>
53 <!ATTLIST default sync-s CDATA #IMPLIED>
54 <!ATTLIST default sync-tags CDATA #IMPLIED>
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -070055
Mike Frysinger3891b752018-10-05 19:26:15 -040056 <!ELEMENT manifest-server EMPTY>
57 <!ATTLIST manifest-server url CDATA #REQUIRED>
Chirayu Desaid5a5b192013-11-21 19:15:30 +053058
Mike Frysinger3891b752018-10-05 19:26:15 -040059 <!ELEMENT project (annotation*,
60 project*,
61 copyfile*,
62 linkfile*)>
63 <!ATTLIST project name CDATA #REQUIRED>
64 <!ATTLIST project path CDATA #IMPLIED>
65 <!ATTLIST project remote IDREF #IMPLIED>
66 <!ATTLIST project revision CDATA #IMPLIED>
67 <!ATTLIST project dest-branch CDATA #IMPLIED>
68 <!ATTLIST project groups CDATA #IMPLIED>
69 <!ATTLIST project sync-c CDATA #IMPLIED>
70 <!ATTLIST project sync-s CDATA #IMPLIED>
71 <!ATTLIST default sync-tags CDATA #IMPLIED>
72 <!ATTLIST project upstream CDATA #IMPLIED>
73 <!ATTLIST project clone-depth CDATA #IMPLIED>
74 <!ATTLIST project force-path CDATA #IMPLIED>
James W. Mills24c13082012-04-12 15:04:13 -050075
Mike Frysinger3891b752018-10-05 19:26:15 -040076 <!ELEMENT annotation EMPTY>
77 <!ATTLIST annotation name CDATA #REQUIRED>
78 <!ATTLIST annotation value CDATA #REQUIRED>
79 <!ATTLIST annotation keep CDATA "true">
Chirayu Desaid5a5b192013-11-21 19:15:30 +053080
Mike Frysinger3891b752018-10-05 19:26:15 -040081 <!ELEMENT copyfile EMPTY>
82 <!ATTLIST copyfile src CDATA #REQUIRED>
83 <!ATTLIST copyfile dest CDATA #REQUIRED>
Ruslan Bilovol54527e72015-09-08 13:11:23 +030084
Mike Frysinger3891b752018-10-05 19:26:15 -040085 <!ELEMENT linkfile EMPTY>
86 <!ATTLIST linkfile src CDATA #REQUIRED>
87 <!ATTLIST linkfile dest CDATA #REQUIRED>
Ruslan Bilovol54527e72015-09-08 13:11:23 +030088
Mike Frysinger3891b752018-10-05 19:26:15 -040089 <!ELEMENT extend-project EMPTY>
90 <!ATTLIST extend-project name CDATA #REQUIRED>
91 <!ATTLIST extend-project path CDATA #IMPLIED>
92 <!ATTLIST extend-project groups CDATA #IMPLIED>
93 <!ATTLIST extend-project revision CDATA #IMPLIED>
Josh Triplett884a3872014-06-12 14:57:29 -070094
Mike Frysinger3891b752018-10-05 19:26:15 -040095 <!ELEMENT remove-project EMPTY>
96 <!ATTLIST remove-project name CDATA #REQUIRED>
Doug Anderson37282b42011-03-04 11:54:18 -080097
Mike Frysinger3891b752018-10-05 19:26:15 -040098 <!ELEMENT repo-hooks EMPTY>
99 <!ATTLIST repo-hooks in-project CDATA #REQUIRED>
100 <!ATTLIST repo-hooks enabled-list CDATA #REQUIRED>
Brian Harring26448742011-04-28 05:04:41 -0700101
Mike Frysinger3891b752018-10-05 19:26:15 -0400102 <!ELEMENT include EMPTY>
103 <!ATTLIST include name CDATA #REQUIRED>
104]>
105```
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800106
107A description of the elements and their attributes follows.
108
109
110Element manifest
111----------------
112
113The root element of the file.
114
115
116Element remote
117--------------
118
119One or more remote elements may be specified. Each remote element
120specifies a Git URL shared by one or more projects and (optionally)
121the Gerrit review server those projects upload changes through.
122
123Attribute `name`: A short name unique to this manifest file. The
124name specified here is used as the remote name in each project's
125.git/config, and is therefore automatically available to commands
126like `git fetch`, `git remote`, `git pull` and `git push`.
127
Yestin Sunb292b982012-07-02 07:32:50 -0700128Attribute `alias`: The alias, if specified, is used to override
129`name` to be set as the remote name in each project's .git/config.
130Its value can be duplicated while attribute `name` has to be unique
131in the manifest file. This helps each project to be able to have
132same remote name which actually points to different remote url.
133
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800134Attribute `fetch`: The Git URL prefix for all projects which use
135this remote. Each project's name is appended to this prefix to
136form the actual URL used to clone the project.
137
Steve Raed6480452016-08-10 15:00:00 -0700138Attribute `pushurl`: The Git "push" URL prefix for all projects
139which use this remote. Each project's name is appended to this
140prefix to form the actual URL used to "git push" the project.
141This attribute is optional; if not specified then "git push"
142will use the same URL as the `fetch` attribute.
143
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800144Attribute `review`: Hostname of the Gerrit server where reviews
145are uploaded to by `repo upload`. This attribute is optional;
146if not specified then `repo upload` will not function.
147
Anthony King36ea2fb2014-05-06 11:54:01 +0100148Attribute `revision`: Name of a Git branch (e.g. `master` or
149`refs/heads/master`). Remotes with their own revision will override
150the default revision.
151
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800152Element default
153---------------
154
155At most one default element may be specified. Its remote and
156revision attributes are used when a project element does not
157specify its own remote or revision attribute.
158
159Attribute `remote`: Name of a previously defined remote element.
160Project elements lacking a remote attribute of their own will use
161this remote.
162
163Attribute `revision`: Name of a Git branch (e.g. `master` or
164`refs/heads/master`). Project elements lacking their own
165revision attribute will use this revision.
166
Bryan Jacobsf609f912013-05-06 13:36:24 -0400167Attribute `dest-branch`: Name of a Git branch (e.g. `master`).
168Project elements not setting their own `dest-branch` will inherit
169this value. If this value is not set, projects will use `revision`
170by default instead.
171
Nasser Grainawida403412018-05-04 12:53:29 -0600172Attribute `upstream`: Name of the Git ref in which a sha1
173can be found. Used when syncing a revision locked manifest in
174-c mode to avoid having to sync the entire ref space. Project elements
175not setting their own `upstream` will inherit this value.
176
Mani Chandel7a91d512014-07-24 16:27:08 +0530177Attribute `sync-j`: Number of parallel jobs to use when synching.
David Pursehouse4e465202012-11-27 22:20:10 +0900178
Mani Chandel7a91d512014-07-24 16:27:08 +0530179Attribute `sync-c`: Set to true to only sync the given Git
David Pursehouse4e465202012-11-27 22:20:10 +0900180branch (specified in the `revision` attribute) rather than the
Mani Chandel7a91d512014-07-24 16:27:08 +0530181whole ref space. Project elements lacking a sync-c element of
David Pursehouse4e465202012-11-27 22:20:10 +0900182their own will use this value.
183
Mani Chandel7a91d512014-07-24 16:27:08 +0530184Attribute `sync-s`: Set to true to also sync sub-projects.
David Pursehouse4e465202012-11-27 22:20:10 +0900185
YOUNG HO CHAa32c92c2018-02-14 16:57:31 +0900186Attribute `sync-tags`: Set to false to only sync the given Git
187branch (specified in the `revision` attribute) rather than
188the other ref tags.
189
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800190
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -0700191Element manifest-server
192-----------------------
193
194At most one manifest-server may be specified. The url attribute
195is used to specify the URL of a manifest server, which is an
David Pursehouse9a27d012012-08-21 14:23:49 +0900196XML RPC service.
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -0700197
David Pursehouse9a27d012012-08-21 14:23:49 +0900198The manifest server should implement the following RPC methods:
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -0700199
Mike Frysinger3891b752018-10-05 19:26:15 -0400200 GetApprovedManifest(branch, target)
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -0700201
David Pursehouse9a27d012012-08-21 14:23:49 +0900202Return a manifest in which each project is pegged to a known good revision
David Pursehousee8688412016-04-13 17:55:34 +0900203for the current branch and target. This is used by repo sync when the
204--smart-sync option is given.
David Pursehouse9a27d012012-08-21 14:23:49 +0900205
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -0700206The target to use is defined by environment variables TARGET_PRODUCT
207and TARGET_BUILD_VARIANT. These variables are used to create a string
208of the form $TARGET_PRODUCT-$TARGET_BUILD_VARIANT, e.g. passion-userdebug.
209If one of those variables or both are not present, the program will call
David Pursehousedaa851f2012-08-21 13:52:18 +0900210GetApprovedManifest without the target parameter and the manifest server
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -0700211should choose a reasonable default target.
212
Mike Frysinger3891b752018-10-05 19:26:15 -0400213 GetManifest(tag)
David Pursehouse9a27d012012-08-21 14:23:49 +0900214
215Return a manifest in which each project is pegged to the revision at
David Pursehousee8688412016-04-13 17:55:34 +0900216the specified tag. This is used by repo sync when the --smart-tag option
217is given.
David Pursehouse9a27d012012-08-21 14:23:49 +0900218
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -0700219
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800220Element project
221---------------
222
223One or more project elements may be specified. Each element
224describes a single Git repository to be cloned into the repo
Che-Liang Chioub2bd91c2012-01-11 11:28:42 +0800225client workspace. You may specify Git-submodules by creating a
226nested project. Git-submodules will be automatically
227recognized and inherit their parent's attributes, but those
228may be overridden by an explicitly specified project element.
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800229
230Attribute `name`: A unique name for this project. The project's
231name is appended onto its remote's fetch URL to generate the actual
232URL to configure the Git remote with. The URL gets formed as:
233
Mike Frysinger3891b752018-10-05 19:26:15 -0400234 ${remote_fetch}/${project_name}.git
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800235
236where ${remote_fetch} is the remote's fetch attribute and
237${project_name} is the project's name attribute. The suffix ".git"
David Pursehousedaa851f2012-08-21 13:52:18 +0900238is always appended as repo assumes the upstream is a forest of
Che-Liang Chioub2bd91c2012-01-11 11:28:42 +0800239bare Git repositories. If the project has a parent element, its
240name will be prefixed by the parent's.
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800241
242The project name must match the name Gerrit knows, if Gerrit is
243being used for code reviews.
244
245Attribute `path`: An optional path relative to the top directory
246of the repo client where the Git working directory for this project
247should be placed. If not supplied the project name is used.
Che-Liang Chioub2bd91c2012-01-11 11:28:42 +0800248If the project has a parent element, its path will be prefixed
249by the parent's.
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800250
251Attribute `remote`: Name of a previously defined remote element.
252If not supplied the remote given by the default element is used.
253
254Attribute `revision`: Name of the Git branch the manifest wants
255to track for this project. Names can be relative to refs/heads
256(e.g. just "master") or absolute (e.g. "refs/heads/master").
257Tags and/or explicit SHA-1s should work in theory, but have not
258been extensively tested. If not supplied the revision given by
Anthony King36ea2fb2014-05-06 11:54:01 +0100259the remote element is used if applicable, else the default
260element is used.
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800261
Bryan Jacobsf609f912013-05-06 13:36:24 -0400262Attribute `dest-branch`: Name of a Git branch (e.g. `master`).
263When using `repo upload`, changes will be submitted for code
264review on this branch. If unspecified both here and in the
265default element, `revision` is used instead.
266
Colin Cross5acde752012-03-28 20:15:45 -0700267Attribute `groups`: List of groups to which this project belongs,
Conley Owens971de8e2012-04-16 10:36:08 -0700268whitespace or comma separated. All projects belong to the group
Conley Owensbb1b5f52012-08-13 13:11:18 -0700269"all", and each project automatically belongs to a group of
270its name:`name` and path:`path`. E.g. for
Brian Harring7da13142012-06-15 02:24:20 -0700271<project name="monkeys" path="barrel-of"/>, that project
272definition is implicitly in the following manifest groups:
Conley Owensbb1b5f52012-08-13 13:11:18 -0700273default, name:monkeys, and path:barrel-of. If you place a project in the
274group "notdefault", it will not be automatically downloaded by repo.
Che-Liang Chioub2bd91c2012-01-11 11:28:42 +0800275If the project has a parent element, the `name` and `path` here
276are the prefixed ones.
Colin Cross5acde752012-03-28 20:15:45 -0700277
Mani Chandel7a91d512014-07-24 16:27:08 +0530278Attribute `sync-c`: Set to true to only sync the given Git
David Pursehouse4e465202012-11-27 22:20:10 +0900279branch (specified in the `revision` attribute) rather than the
280whole ref space.
281
Mani Chandel7a91d512014-07-24 16:27:08 +0530282Attribute `sync-s`: Set to true to also sync sub-projects.
David Pursehouse4e465202012-11-27 22:20:10 +0900283
Nasser Grainawi909d58b2014-09-19 12:13:04 -0600284Attribute `upstream`: Name of the Git ref in which a sha1
David Pursehouse4e465202012-11-27 22:20:10 +0900285can be found. Used when syncing a revision locked manifest in
286-c mode to avoid having to sync the entire ref space.
287
David Pursehouseede7f122012-11-27 22:25:30 +0900288Attribute `clone-depth`: Set the depth to use when fetching this
289project. If specified, this value will override any value given
290to repo init with the --depth option on the command line.
291
Scott Fandb83b1b2013-02-28 09:34:14 +0800292Attribute `force-path`: Set to true to force this project to create the
293local mirror repository according to its `path` attribute (if supplied)
294rather than the `name` attribute. This attribute only applies to the
295local mirrors syncing, it will be ignored when syncing the projects in a
296client working directory.
297
Josh Triplett884a3872014-06-12 14:57:29 -0700298Element extend-project
299----------------------
300
301Modify the attributes of the named project.
302
303This element is mostly useful in a local manifest file, to modify the
304attributes of an existing project without completely replacing the
305existing project definition. This makes the local manifest more robust
306against changes to the original manifest.
307
308Attribute `path`: If specified, limit the change to projects checked out
309at the specified path, rather than all projects with the given name.
310
311Attribute `groups`: List of additional groups to which this project
312belongs. Same syntax as the corresponding element of `project`.
313
Luis Hector Chavez7d525852018-03-15 09:54:08 -0700314Attribute `revision`: If specified, overrides the revision of the original
315project. Same syntax as the corresponding element of `project`.
316
James W. Mills24c13082012-04-12 15:04:13 -0500317Element annotation
318------------------
319
320Zero or more annotation elements may be specified as children of a
321project element. Each element describes a name-value pair that will be
322exported into each project's environment during a 'forall' command,
323prefixed with REPO__. In addition, there is an optional attribute
324"keep" which accepts the case insensitive values "true" (default) or
325"false". This attribute determines whether or not the annotation will
326be kept when exported with the manifest subcommand.
327
Ruslan Bilovol54527e72015-09-08 13:11:23 +0300328Element copyfile
329----------------
330
331Zero or more copyfile elements may be specified as children of a
332project element. Each element describes a src-dest pair of files;
Mike Frysinger3891b752018-10-05 19:26:15 -0400333the "src" file will be copied to the "dest" place during `repo sync`
Ruslan Bilovol54527e72015-09-08 13:11:23 +0300334command.
335"src" is project relative, "dest" is relative to the top of the tree.
336
337Element linkfile
338----------------
339
340It's just like copyfile and runs at the same time as copyfile but
341instead of copying it creates a symlink.
342
Shawn O. Pearce03eaf072008-11-20 11:42:22 -0800343Element remove-project
344----------------------
345
346Deletes the named project from the internal manifest table, possibly
347allowing a subsequent project element in the same manifest file to
348replace the project with a different source.
349
David Pursehouseb1525bf2012-11-14 08:51:38 +0900350This element is mostly useful in a local manifest file, where
Shawn O. Pearce03eaf072008-11-20 11:42:22 -0800351the user can remove a project, and possibly replace it with their
352own definition.
353
Brian Harring26448742011-04-28 05:04:41 -0700354Element include
355---------------
356
357This element provides the capability of including another manifest
358file into the originating manifest. Normal rules apply for the
David Pursehouse9f3406e2012-11-14 08:52:25 +0900359target manifest to include - it must be a usable manifest on its own.
Brian Harring26448742011-04-28 05:04:41 -0700360
David Pursehouse9f3406e2012-11-14 08:52:25 +0900361Attribute `name`: the manifest to include, specified relative to
362the manifest repository's root.
Brian Harring26448742011-04-28 05:04:41 -0700363
Shawn O. Pearce03eaf072008-11-20 11:42:22 -0800364
David Pursehouse2d5a0df2012-11-13 02:50:36 +0900365Local Manifests
366===============
Shawn O. Pearce70cd4ab2008-11-06 08:48:44 -0800367
David Pursehouse2d5a0df2012-11-13 02:50:36 +0900368Additional remotes and projects may be added through local manifest
369files stored in `$TOP_DIR/.repo/local_manifests/*.xml`.
Shawn O. Pearce70cd4ab2008-11-06 08:48:44 -0800370
371For example:
372
Mike Frysinger3891b752018-10-05 19:26:15 -0400373 $ ls .repo/local_manifests
374 local_manifest.xml
375 another_local_manifest.xml
David Pursehouse2d5a0df2012-11-13 02:50:36 +0900376
Mike Frysinger3891b752018-10-05 19:26:15 -0400377 $ cat .repo/local_manifests/local_manifest.xml
378 <?xml version="1.0" encoding="UTF-8"?>
379 <manifest>
380 <project path="manifest"
381 name="tools/manifest" />
382 <project path="platform-manifest"
383 name="platform/manifest" />
384 </manifest>
Shawn O. Pearce70cd4ab2008-11-06 08:48:44 -0800385
David Pursehouse2d5a0df2012-11-13 02:50:36 +0900386Users may add projects to the local manifest(s) prior to a `repo sync`
Shawn O. Pearce70cd4ab2008-11-06 08:48:44 -0800387invocation, instructing repo to automatically download and manage
388these extra projects.
David Pursehouse2d5a0df2012-11-13 02:50:36 +0900389
David Pursehouse52f1e5d2012-11-14 04:53:24 +0900390Manifest files stored in `$TOP_DIR/.repo/local_manifests/*.xml` will
391be loaded in alphabetical order.
392
David Pursehouse2d5a0df2012-11-13 02:50:36 +0900393Additional remotes and projects may also be added through a local
David Pursehouse5566ae52012-11-13 03:04:18 +0900394manifest, stored in `$TOP_DIR/.repo/local_manifest.xml`. This method
395is deprecated in favor of using multiple manifest files as mentioned
396above.
David Pursehouse52f1e5d2012-11-14 04:53:24 +0900397
398If `$TOP_DIR/.repo/local_manifest.xml` exists, it will be loaded before
399any manifest files stored in `$TOP_DIR/.repo/local_manifests/*.xml`.