blob: f6dba6407aad9e3dc722e0650694f9ec4ea8918c [file] [log] [blame]
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
9a single 'default.xml' XML file in the top level directory.
10
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
15
16XML File Format
17---------------
18
19A manifest XML file (e.g. 'default.xml') roughly conforms to the
20following DTD:
21
Shawn O. Pearce43c3d9e2009-03-04 14:26:50 -080022 <!DOCTYPE manifest [
Doug Anderson2b8db3c2010-11-01 15:08:06 -070023 <!ELEMENT manifest (notice?,
24 remote*,
Shawn O. Pearce43c3d9e2009-03-04 14:26:50 -080025 default?,
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -070026 manifest-server?,
Shawn O. Pearce43c3d9e2009-03-04 14:26:50 -080027 remove-project*,
Doug Anderson37282b42011-03-04 11:54:18 -080028 project*,
29 repo-hooks?)>
Shawn O. Pearce43c3d9e2009-03-04 14:26:50 -080030
Doug Anderson2b8db3c2010-11-01 15:08:06 -070031 <!ELEMENT notice (#PCDATA)>
32
Shawn O. Pearce43c3d9e2009-03-04 14:26:50 -080033 <!ELEMENT remote (EMPTY)>
34 <!ATTLIST remote name ID #REQUIRED>
Yestin Sunb292b982012-07-02 07:32:50 -070035 <!ATTLIST remote alias CDATA #IMPLIED>
Shawn O. Pearce43c3d9e2009-03-04 14:26:50 -080036 <!ATTLIST remote fetch CDATA #REQUIRED>
37 <!ATTLIST remote review CDATA #IMPLIED>
Shawn O. Pearce43c3d9e2009-03-04 14:26:50 -080038
39 <!ELEMENT default (EMPTY)>
40 <!ATTLIST default remote IDREF #IMPLIED>
41 <!ATTLIST default revision CDATA #IMPLIED>
Shawn O. Pearce6392c872011-09-22 17:44:31 -070042 <!ATTLIST default sync-j CDATA #IMPLIED>
Anatol Pomazau79770d22012-04-20 14:41:59 -070043 <!ATTLIST default sync-c CDATA #IMPLIED>
Che-Liang Chioub2bd91c2012-01-11 11:28:42 +080044 <!ATTLIST default sync-s CDATA #IMPLIED>
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -070045
46 <!ELEMENT manifest-server (EMPTY)>
47 <!ATTLIST url CDATA #REQUIRED>
Shawn O. Pearce43c3d9e2009-03-04 14:26:50 -080048
Che-Liang Chioub2bd91c2012-01-11 11:28:42 +080049 <!ELEMENT project (annotation?,
50 project*)>
Shawn O. Pearce43c3d9e2009-03-04 14:26:50 -080051 <!ATTLIST project name CDATA #REQUIRED>
52 <!ATTLIST project path CDATA #IMPLIED>
53 <!ATTLIST project remote IDREF #IMPLIED>
54 <!ATTLIST project revision CDATA #IMPLIED>
Colin Cross5acde752012-03-28 20:15:45 -070055 <!ATTLIST project groups CDATA #IMPLIED>
Anatol Pomazau79770d22012-04-20 14:41:59 -070056 <!ATTLIST project sync-c CDATA #IMPLIED>
Che-Liang Chioub2bd91c2012-01-11 11:28:42 +080057 <!ATTLIST project sync-s CDATA #IMPLIED>
James W. Mills24c13082012-04-12 15:04:13 -050058
59 <!ELEMENT annotation (EMPTY)>
60 <!ATTLIST annotation name CDATA #REQUIRED>
61 <!ATTLIST annotation value CDATA #REQUIRED>
62 <!ATTLIST annotation keep CDATA "true">
Shawn O. Pearce43c3d9e2009-03-04 14:26:50 -080063
Shawn O. Pearce43c3d9e2009-03-04 14:26:50 -080064 <!ELEMENT remove-project (EMPTY)>
65 <!ATTLIST remove-project name CDATA #REQUIRED>
Doug Anderson37282b42011-03-04 11:54:18 -080066
67 <!ELEMENT repo-hooks (EMPTY)>
68 <!ATTLIST repo-hooks in-project CDATA #REQUIRED>
69 <!ATTLIST repo-hooks enabled-list CDATA #REQUIRED>
Brian Harring26448742011-04-28 05:04:41 -070070
71 <!ELEMENT include (EMPTY)>
72 <!ATTLIST include name CDATA #REQUIRED>
Shawn O. Pearce43c3d9e2009-03-04 14:26:50 -080073 ]>
Shawn O. Pearce3e548192008-11-04 11:19:36 -080074
75A description of the elements and their attributes follows.
76
77
78Element manifest
79----------------
80
81The root element of the file.
82
83
84Element remote
85--------------
86
87One or more remote elements may be specified. Each remote element
88specifies a Git URL shared by one or more projects and (optionally)
89the Gerrit review server those projects upload changes through.
90
91Attribute `name`: A short name unique to this manifest file. The
92name specified here is used as the remote name in each project's
93.git/config, and is therefore automatically available to commands
94like `git fetch`, `git remote`, `git pull` and `git push`.
95
Yestin Sunb292b982012-07-02 07:32:50 -070096Attribute `alias`: The alias, if specified, is used to override
97`name` to be set as the remote name in each project's .git/config.
98Its value can be duplicated while attribute `name` has to be unique
99in the manifest file. This helps each project to be able to have
100same remote name which actually points to different remote url.
101
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800102Attribute `fetch`: The Git URL prefix for all projects which use
103this remote. Each project's name is appended to this prefix to
104form the actual URL used to clone the project.
105
106Attribute `review`: Hostname of the Gerrit server where reviews
107are uploaded to by `repo upload`. This attribute is optional;
108if not specified then `repo upload` will not function.
109
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800110Element default
111---------------
112
113At most one default element may be specified. Its remote and
114revision attributes are used when a project element does not
115specify its own remote or revision attribute.
116
117Attribute `remote`: Name of a previously defined remote element.
118Project elements lacking a remote attribute of their own will use
119this remote.
120
121Attribute `revision`: Name of a Git branch (e.g. `master` or
122`refs/heads/master`). Project elements lacking their own
123revision attribute will use this revision.
124
125
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -0700126Element manifest-server
127-----------------------
128
129At most one manifest-server may be specified. The url attribute
130is used to specify the URL of a manifest server, which is an
David Pursehouse9a27d012012-08-21 14:23:49 +0900131XML RPC service.
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -0700132
David Pursehouse9a27d012012-08-21 14:23:49 +0900133The manifest server should implement the following RPC methods:
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -0700134
135 GetApprovedManifest(branch, target)
136
David Pursehouse9a27d012012-08-21 14:23:49 +0900137Return a manifest in which each project is pegged to a known good revision
138for the current branch and target.
139
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -0700140The target to use is defined by environment variables TARGET_PRODUCT
141and TARGET_BUILD_VARIANT. These variables are used to create a string
142of the form $TARGET_PRODUCT-$TARGET_BUILD_VARIANT, e.g. passion-userdebug.
143If one of those variables or both are not present, the program will call
David Pursehousedaa851f2012-08-21 13:52:18 +0900144GetApprovedManifest without the target parameter and the manifest server
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -0700145should choose a reasonable default target.
146
David Pursehouse9a27d012012-08-21 14:23:49 +0900147 GetManifest(tag)
148
149Return a manifest in which each project is pegged to the revision at
150the specified tag.
151
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -0700152
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800153Element project
154---------------
155
156One or more project elements may be specified. Each element
157describes a single Git repository to be cloned into the repo
Che-Liang Chioub2bd91c2012-01-11 11:28:42 +0800158client workspace. You may specify Git-submodules by creating a
159nested project. Git-submodules will be automatically
160recognized and inherit their parent's attributes, but those
161may be overridden by an explicitly specified project element.
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800162
163Attribute `name`: A unique name for this project. The project's
164name is appended onto its remote's fetch URL to generate the actual
165URL to configure the Git remote with. The URL gets formed as:
166
167 ${remote_fetch}/${project_name}.git
168
169where ${remote_fetch} is the remote's fetch attribute and
170${project_name} is the project's name attribute. The suffix ".git"
David Pursehousedaa851f2012-08-21 13:52:18 +0900171is always appended as repo assumes the upstream is a forest of
Che-Liang Chioub2bd91c2012-01-11 11:28:42 +0800172bare Git repositories. If the project has a parent element, its
173name will be prefixed by the parent's.
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800174
175The project name must match the name Gerrit knows, if Gerrit is
176being used for code reviews.
177
178Attribute `path`: An optional path relative to the top directory
179of the repo client where the Git working directory for this project
180should be placed. If not supplied the project name is used.
Che-Liang Chioub2bd91c2012-01-11 11:28:42 +0800181If the project has a parent element, its path will be prefixed
182by the parent's.
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800183
184Attribute `remote`: Name of a previously defined remote element.
185If not supplied the remote given by the default element is used.
186
187Attribute `revision`: Name of the Git branch the manifest wants
188to track for this project. Names can be relative to refs/heads
189(e.g. just "master") or absolute (e.g. "refs/heads/master").
190Tags and/or explicit SHA-1s should work in theory, but have not
191been extensively tested. If not supplied the revision given by
192the default element is used.
193
Colin Cross5acde752012-03-28 20:15:45 -0700194Attribute `groups`: List of groups to which this project belongs,
Conley Owens971de8e2012-04-16 10:36:08 -0700195whitespace or comma separated. All projects belong to the group
Conley Owensbb1b5f52012-08-13 13:11:18 -0700196"all", and each project automatically belongs to a group of
197its name:`name` and path:`path`. E.g. for
Brian Harring7da13142012-06-15 02:24:20 -0700198<project name="monkeys" path="barrel-of"/>, that project
199definition is implicitly in the following manifest groups:
Conley Owensbb1b5f52012-08-13 13:11:18 -0700200default, name:monkeys, and path:barrel-of. If you place a project in the
201group "notdefault", it will not be automatically downloaded by repo.
Che-Liang Chioub2bd91c2012-01-11 11:28:42 +0800202If the project has a parent element, the `name` and `path` here
203are the prefixed ones.
Colin Cross5acde752012-03-28 20:15:45 -0700204
James W. Mills24c13082012-04-12 15:04:13 -0500205Element annotation
206------------------
207
208Zero or more annotation elements may be specified as children of a
209project element. Each element describes a name-value pair that will be
210exported into each project's environment during a 'forall' command,
211prefixed with REPO__. In addition, there is an optional attribute
212"keep" which accepts the case insensitive values "true" (default) or
213"false". This attribute determines whether or not the annotation will
214be kept when exported with the manifest subcommand.
215
Shawn O. Pearce03eaf072008-11-20 11:42:22 -0800216Element remove-project
217----------------------
218
219Deletes the named project from the internal manifest table, possibly
220allowing a subsequent project element in the same manifest file to
221replace the project with a different source.
222
David Pursehouseb1525bf2012-11-14 08:51:38 +0900223This element is mostly useful in a local manifest file, where
Shawn O. Pearce03eaf072008-11-20 11:42:22 -0800224the user can remove a project, and possibly replace it with their
225own definition.
226
Brian Harring26448742011-04-28 05:04:41 -0700227Element include
228---------------
229
230This element provides the capability of including another manifest
231file into the originating manifest. Normal rules apply for the
David Pursehouse9f3406e2012-11-14 08:52:25 +0900232target manifest to include - it must be a usable manifest on its own.
Brian Harring26448742011-04-28 05:04:41 -0700233
David Pursehouse9f3406e2012-11-14 08:52:25 +0900234Attribute `name`: the manifest to include, specified relative to
235the manifest repository's root.
Brian Harring26448742011-04-28 05:04:41 -0700236
Shawn O. Pearce03eaf072008-11-20 11:42:22 -0800237
David Pursehouse2d5a0df2012-11-13 02:50:36 +0900238Local Manifests
239===============
Shawn O. Pearce70cd4ab2008-11-06 08:48:44 -0800240
David Pursehouse2d5a0df2012-11-13 02:50:36 +0900241Additional remotes and projects may be added through local manifest
242files stored in `$TOP_DIR/.repo/local_manifests/*.xml`.
Shawn O. Pearce70cd4ab2008-11-06 08:48:44 -0800243
244For example:
245
David Pursehouse2d5a0df2012-11-13 02:50:36 +0900246 $ ls .repo/local_manifests
247 local_manifest.xml
248 another_local_manifest.xml
249
250 $ cat .repo/local_manifests/local_manifest.xml
Shawn O. Pearce43c3d9e2009-03-04 14:26:50 -0800251 <?xml version="1.0" encoding="UTF-8"?>
252 <manifest>
253 <project path="manifest"
254 name="tools/manifest" />
255 <project path="platform-manifest"
256 name="platform/manifest" />
257 </manifest>
Shawn O. Pearce70cd4ab2008-11-06 08:48:44 -0800258
David Pursehouse2d5a0df2012-11-13 02:50:36 +0900259Users may add projects to the local manifest(s) prior to a `repo sync`
Shawn O. Pearce70cd4ab2008-11-06 08:48:44 -0800260invocation, instructing repo to automatically download and manage
261these extra projects.
David Pursehouse2d5a0df2012-11-13 02:50:36 +0900262
David Pursehouse52f1e5d2012-11-14 04:53:24 +0900263Manifest files stored in `$TOP_DIR/.repo/local_manifests/*.xml` will
264be loaded in alphabetical order.
265
David Pursehouse2d5a0df2012-11-13 02:50:36 +0900266Additional remotes and projects may also be added through a local
David Pursehouse5566ae52012-11-13 03:04:18 +0900267manifest, stored in `$TOP_DIR/.repo/local_manifest.xml`. This method
268is deprecated in favor of using multiple manifest files as mentioned
269above.
David Pursehouse52f1e5d2012-11-14 04:53:24 +0900270
271If `$TOP_DIR/.repo/local_manifest.xml` exists, it will be loaded before
272any manifest files stored in `$TOP_DIR/.repo/local_manifests/*.xml`.