blob: 0bf09f6fb1a19bdd74782f3524572bc0e5da176f [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>
David Pursehouse4e465202012-11-27 22:20:10 +090058 <!ATTLIST project upstream CDATA #IMPLIED>
James W. Mills24c13082012-04-12 15:04:13 -050059
60 <!ELEMENT annotation (EMPTY)>
61 <!ATTLIST annotation name CDATA #REQUIRED>
62 <!ATTLIST annotation value CDATA #REQUIRED>
63 <!ATTLIST annotation keep CDATA "true">
Shawn O. Pearce43c3d9e2009-03-04 14:26:50 -080064
Shawn O. Pearce43c3d9e2009-03-04 14:26:50 -080065 <!ELEMENT remove-project (EMPTY)>
66 <!ATTLIST remove-project name CDATA #REQUIRED>
Doug Anderson37282b42011-03-04 11:54:18 -080067
68 <!ELEMENT repo-hooks (EMPTY)>
69 <!ATTLIST repo-hooks in-project CDATA #REQUIRED>
70 <!ATTLIST repo-hooks enabled-list CDATA #REQUIRED>
Brian Harring26448742011-04-28 05:04:41 -070071
72 <!ELEMENT include (EMPTY)>
73 <!ATTLIST include name CDATA #REQUIRED>
Shawn O. Pearce43c3d9e2009-03-04 14:26:50 -080074 ]>
Shawn O. Pearce3e548192008-11-04 11:19:36 -080075
76A description of the elements and their attributes follows.
77
78
79Element manifest
80----------------
81
82The root element of the file.
83
84
85Element remote
86--------------
87
88One or more remote elements may be specified. Each remote element
89specifies a Git URL shared by one or more projects and (optionally)
90the Gerrit review server those projects upload changes through.
91
92Attribute `name`: A short name unique to this manifest file. The
93name specified here is used as the remote name in each project's
94.git/config, and is therefore automatically available to commands
95like `git fetch`, `git remote`, `git pull` and `git push`.
96
Yestin Sunb292b982012-07-02 07:32:50 -070097Attribute `alias`: The alias, if specified, is used to override
98`name` to be set as the remote name in each project's .git/config.
99Its value can be duplicated while attribute `name` has to be unique
100in the manifest file. This helps each project to be able to have
101same remote name which actually points to different remote url.
102
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800103Attribute `fetch`: The Git URL prefix for all projects which use
104this remote. Each project's name is appended to this prefix to
105form the actual URL used to clone the project.
106
107Attribute `review`: Hostname of the Gerrit server where reviews
108are uploaded to by `repo upload`. This attribute is optional;
109if not specified then `repo upload` will not function.
110
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800111Element default
112---------------
113
114At most one default element may be specified. Its remote and
115revision attributes are used when a project element does not
116specify its own remote or revision attribute.
117
118Attribute `remote`: Name of a previously defined remote element.
119Project elements lacking a remote attribute of their own will use
120this remote.
121
122Attribute `revision`: Name of a Git branch (e.g. `master` or
123`refs/heads/master`). Project elements lacking their own
124revision attribute will use this revision.
125
David Pursehouse4e465202012-11-27 22:20:10 +0900126Attribute `sync_j`: Number of parallel jobs to use when synching.
127
128Attribute `sync_c`: Set to true to only sync the given Git
129branch (specified in the `revision` attribute) rather than the
130whole ref space. Project elements lacking a sync_c element of
131their own will use this value.
132
133Attribute `sync_s`: Set to true to also sync sub-projects.
134
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800135
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -0700136Element manifest-server
137-----------------------
138
139At most one manifest-server may be specified. The url attribute
140is used to specify the URL of a manifest server, which is an
David Pursehouse9a27d012012-08-21 14:23:49 +0900141XML RPC service.
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -0700142
David Pursehouse9a27d012012-08-21 14:23:49 +0900143The manifest server should implement the following RPC methods:
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -0700144
145 GetApprovedManifest(branch, target)
146
David Pursehouse9a27d012012-08-21 14:23:49 +0900147Return a manifest in which each project is pegged to a known good revision
148for the current branch and target.
149
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -0700150The target to use is defined by environment variables TARGET_PRODUCT
151and TARGET_BUILD_VARIANT. These variables are used to create a string
152of the form $TARGET_PRODUCT-$TARGET_BUILD_VARIANT, e.g. passion-userdebug.
153If one of those variables or both are not present, the program will call
David Pursehousedaa851f2012-08-21 13:52:18 +0900154GetApprovedManifest without the target parameter and the manifest server
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -0700155should choose a reasonable default target.
156
David Pursehouse9a27d012012-08-21 14:23:49 +0900157 GetManifest(tag)
158
159Return a manifest in which each project is pegged to the revision at
160the specified tag.
161
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -0700162
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800163Element project
164---------------
165
166One or more project elements may be specified. Each element
167describes a single Git repository to be cloned into the repo
Che-Liang Chioub2bd91c2012-01-11 11:28:42 +0800168client workspace. You may specify Git-submodules by creating a
169nested project. Git-submodules will be automatically
170recognized and inherit their parent's attributes, but those
171may be overridden by an explicitly specified project element.
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800172
173Attribute `name`: A unique name for this project. The project's
174name is appended onto its remote's fetch URL to generate the actual
175URL to configure the Git remote with. The URL gets formed as:
176
177 ${remote_fetch}/${project_name}.git
178
179where ${remote_fetch} is the remote's fetch attribute and
180${project_name} is the project's name attribute. The suffix ".git"
David Pursehousedaa851f2012-08-21 13:52:18 +0900181is always appended as repo assumes the upstream is a forest of
Che-Liang Chioub2bd91c2012-01-11 11:28:42 +0800182bare Git repositories. If the project has a parent element, its
183name will be prefixed by the parent's.
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800184
185The project name must match the name Gerrit knows, if Gerrit is
186being used for code reviews.
187
188Attribute `path`: An optional path relative to the top directory
189of the repo client where the Git working directory for this project
190should be placed. If not supplied the project name is used.
Che-Liang Chioub2bd91c2012-01-11 11:28:42 +0800191If the project has a parent element, its path will be prefixed
192by the parent's.
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800193
194Attribute `remote`: Name of a previously defined remote element.
195If not supplied the remote given by the default element is used.
196
197Attribute `revision`: Name of the Git branch the manifest wants
198to track for this project. Names can be relative to refs/heads
199(e.g. just "master") or absolute (e.g. "refs/heads/master").
200Tags and/or explicit SHA-1s should work in theory, but have not
201been extensively tested. If not supplied the revision given by
202the default element is used.
203
Colin Cross5acde752012-03-28 20:15:45 -0700204Attribute `groups`: List of groups to which this project belongs,
Conley Owens971de8e2012-04-16 10:36:08 -0700205whitespace or comma separated. All projects belong to the group
Conley Owensbb1b5f52012-08-13 13:11:18 -0700206"all", and each project automatically belongs to a group of
207its name:`name` and path:`path`. E.g. for
Brian Harring7da13142012-06-15 02:24:20 -0700208<project name="monkeys" path="barrel-of"/>, that project
209definition is implicitly in the following manifest groups:
Conley Owensbb1b5f52012-08-13 13:11:18 -0700210default, name:monkeys, and path:barrel-of. If you place a project in the
211group "notdefault", it will not be automatically downloaded by repo.
Che-Liang Chioub2bd91c2012-01-11 11:28:42 +0800212If the project has a parent element, the `name` and `path` here
213are the prefixed ones.
Colin Cross5acde752012-03-28 20:15:45 -0700214
David Pursehouse4e465202012-11-27 22:20:10 +0900215Attribute `sync_c`: Set to true to only sync the given Git
216branch (specified in the `revision` attribute) rather than the
217whole ref space.
218
219Attribute `sync_s`: Set to true to also sync sub-projects.
220
221Attribute `upstream`: Name of the Git branch in which a sha1
222can be found. Used when syncing a revision locked manifest in
223-c mode to avoid having to sync the entire ref space.
224
James W. Mills24c13082012-04-12 15:04:13 -0500225Element annotation
226------------------
227
228Zero or more annotation elements may be specified as children of a
229project element. Each element describes a name-value pair that will be
230exported into each project's environment during a 'forall' command,
231prefixed with REPO__. In addition, there is an optional attribute
232"keep" which accepts the case insensitive values "true" (default) or
233"false". This attribute determines whether or not the annotation will
234be kept when exported with the manifest subcommand.
235
Shawn O. Pearce03eaf072008-11-20 11:42:22 -0800236Element remove-project
237----------------------
238
239Deletes the named project from the internal manifest table, possibly
240allowing a subsequent project element in the same manifest file to
241replace the project with a different source.
242
David Pursehouseb1525bf2012-11-14 08:51:38 +0900243This element is mostly useful in a local manifest file, where
Shawn O. Pearce03eaf072008-11-20 11:42:22 -0800244the user can remove a project, and possibly replace it with their
245own definition.
246
Brian Harring26448742011-04-28 05:04:41 -0700247Element include
248---------------
249
250This element provides the capability of including another manifest
251file into the originating manifest. Normal rules apply for the
David Pursehouse9f3406e2012-11-14 08:52:25 +0900252target manifest to include - it must be a usable manifest on its own.
Brian Harring26448742011-04-28 05:04:41 -0700253
David Pursehouse9f3406e2012-11-14 08:52:25 +0900254Attribute `name`: the manifest to include, specified relative to
255the manifest repository's root.
Brian Harring26448742011-04-28 05:04:41 -0700256
Shawn O. Pearce03eaf072008-11-20 11:42:22 -0800257
David Pursehouse2d5a0df2012-11-13 02:50:36 +0900258Local Manifests
259===============
Shawn O. Pearce70cd4ab2008-11-06 08:48:44 -0800260
David Pursehouse2d5a0df2012-11-13 02:50:36 +0900261Additional remotes and projects may be added through local manifest
262files stored in `$TOP_DIR/.repo/local_manifests/*.xml`.
Shawn O. Pearce70cd4ab2008-11-06 08:48:44 -0800263
264For example:
265
David Pursehouse2d5a0df2012-11-13 02:50:36 +0900266 $ ls .repo/local_manifests
267 local_manifest.xml
268 another_local_manifest.xml
269
270 $ cat .repo/local_manifests/local_manifest.xml
Shawn O. Pearce43c3d9e2009-03-04 14:26:50 -0800271 <?xml version="1.0" encoding="UTF-8"?>
272 <manifest>
273 <project path="manifest"
274 name="tools/manifest" />
275 <project path="platform-manifest"
276 name="platform/manifest" />
277 </manifest>
Shawn O. Pearce70cd4ab2008-11-06 08:48:44 -0800278
David Pursehouse2d5a0df2012-11-13 02:50:36 +0900279Users may add projects to the local manifest(s) prior to a `repo sync`
Shawn O. Pearce70cd4ab2008-11-06 08:48:44 -0800280invocation, instructing repo to automatically download and manage
281these extra projects.
David Pursehouse2d5a0df2012-11-13 02:50:36 +0900282
David Pursehouse52f1e5d2012-11-14 04:53:24 +0900283Manifest files stored in `$TOP_DIR/.repo/local_manifests/*.xml` will
284be loaded in alphabetical order.
285
David Pursehouse2d5a0df2012-11-13 02:50:36 +0900286Additional remotes and projects may also be added through a local
David Pursehouse5566ae52012-11-13 03:04:18 +0900287manifest, stored in `$TOP_DIR/.repo/local_manifest.xml`. This method
288is deprecated in favor of using multiple manifest files as mentioned
289above.
David Pursehouse52f1e5d2012-11-14 04:53:24 +0900290
291If `$TOP_DIR/.repo/local_manifest.xml` exists, it will be loaded before
292any manifest files stored in `$TOP_DIR/.repo/local_manifests/*.xml`.