summaryrefslogtreecommitdiffstats
path: root/docs/manifest-format.md
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2018-10-05 19:26:15 -0400
committerMike Frysinger <vapier@google.com>2018-10-05 19:32:51 -0400
commit3891b7519d35b6bac3e81744c846ca2ed0bd1be2 (patch)
treeb968b6c5611ea21703dfc1144f7fe175c9409dfb /docs/manifest-format.md
parent2b42d288c08bdfd0fc3402fa118d91a1aebdb655 (diff)
downloadgit-repo-3891b7519d35b6bac3e81744c846ca2ed0bd1be2.tar.gz
manifest-format: convert to markdown
The gitiles system doesn't render .txt files, so convert this to .md for better display online. Change-Id: Ie12e46daf008dd8c97ae2ffd21fb68bd948fe625
Diffstat (limited to 'docs/manifest-format.md')
-rw-r--r--docs/manifest-format.md399
1 files changed, 399 insertions, 0 deletions
diff --git a/docs/manifest-format.md b/docs/manifest-format.md
new file mode 100644
index 00000000..cf48698d
--- /dev/null
+++ b/docs/manifest-format.md
@@ -0,0 +1,399 @@
1repo 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[TOC]
16
17
18XML File Format
19---------------
20
21A manifest XML file (e.g. `default.xml`) roughly conforms to the
22following DTD:
23
24```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*)>
35
36 <!ELEMENT notice (#PCDATA)>
37
38 <!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>
45
46 <!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>
55
56 <!ELEMENT manifest-server EMPTY>
57 <!ATTLIST manifest-server url CDATA #REQUIRED>
58
59 <!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>
75
76 <!ELEMENT annotation EMPTY>
77 <!ATTLIST annotation name CDATA #REQUIRED>
78 <!ATTLIST annotation value CDATA #REQUIRED>
79 <!ATTLIST annotation keep CDATA "true">
80
81 <!ELEMENT copyfile EMPTY>
82 <!ATTLIST copyfile src CDATA #REQUIRED>
83 <!ATTLIST copyfile dest CDATA #REQUIRED>
84
85 <!ELEMENT linkfile EMPTY>
86 <!ATTLIST linkfile src CDATA #REQUIRED>
87 <!ATTLIST linkfile dest CDATA #REQUIRED>
88
89 <!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>
94
95 <!ELEMENT remove-project EMPTY>
96 <!ATTLIST remove-project name CDATA #REQUIRED>
97
98 <!ELEMENT repo-hooks EMPTY>
99 <!ATTLIST repo-hooks in-project CDATA #REQUIRED>
100 <!ATTLIST repo-hooks enabled-list CDATA #REQUIRED>
101
102 <!ELEMENT include EMPTY>
103 <!ATTLIST include name CDATA #REQUIRED>
104]>
105```
106
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
128Attribute `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
134Attribute `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
138Attribute `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
144Attribute `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
148Attribute `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
152Element 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
167Attribute `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
172Attribute `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
177Attribute `sync-j`: Number of parallel jobs to use when synching.
178
179Attribute `sync-c`: Set to true to only sync the given Git
180branch (specified in the `revision` attribute) rather than the
181whole ref space. Project elements lacking a sync-c element of
182their own will use this value.
183
184Attribute `sync-s`: Set to true to also sync sub-projects.
185
186Attribute `sync-tags`: Set to false to only sync the given Git
187branch (specified in the `revision` attribute) rather than
188the other ref tags.
189
190
191Element 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
196XML RPC service.
197
198The manifest server should implement the following RPC methods:
199
200 GetApprovedManifest(branch, target)
201
202Return a manifest in which each project is pegged to a known good revision
203for the current branch and target. This is used by repo sync when the
204--smart-sync option is given.
205
206The 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
210GetApprovedManifest without the target parameter and the manifest server
211should choose a reasonable default target.
212
213 GetManifest(tag)
214
215Return a manifest in which each project is pegged to the revision at
216the specified tag. This is used by repo sync when the --smart-tag option
217is given.
218
219
220Element project
221---------------
222
223One or more project elements may be specified. Each element
224describes a single Git repository to be cloned into the repo
225client 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.
229
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
234 ${remote_fetch}/${project_name}.git
235
236where ${remote_fetch} is the remote's fetch attribute and
237${project_name} is the project's name attribute. The suffix ".git"
238is always appended as repo assumes the upstream is a forest of
239bare Git repositories. If the project has a parent element, its
240name will be prefixed by the parent's.
241
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.
248If the project has a parent element, its path will be prefixed
249by the parent's.
250
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
259the remote element is used if applicable, else the default
260element is used.
261
262Attribute `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
267Attribute `groups`: List of groups to which this project belongs,
268whitespace or comma separated. All projects belong to the group
269"all", and each project automatically belongs to a group of
270its name:`name` and path:`path`. E.g. for
271<project name="monkeys" path="barrel-of"/>, that project
272definition is implicitly in the following manifest groups:
273default, name:monkeys, and path:barrel-of. If you place a project in the
274group "notdefault", it will not be automatically downloaded by repo.
275If the project has a parent element, the `name` and `path` here
276are the prefixed ones.
277
278Attribute `sync-c`: Set to true to only sync the given Git
279branch (specified in the `revision` attribute) rather than the
280whole ref space.
281
282Attribute `sync-s`: Set to true to also sync sub-projects.
283
284Attribute `upstream`: Name of the Git ref in which a sha1
285can be found. Used when syncing a revision locked manifest in
286-c mode to avoid having to sync the entire ref space.
287
288Attribute `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
292Attribute `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
298Element 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
314Attribute `revision`: If specified, overrides the revision of the original
315project. Same syntax as the corresponding element of `project`.
316
317Element 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
328Element 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;
333the "src" file will be copied to the "dest" place during `repo sync`
334command.
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
343Element 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
350This element is mostly useful in a local manifest file, where
351the user can remove a project, and possibly replace it with their
352own definition.
353
354Element include
355---------------
356
357This element provides the capability of including another manifest
358file into the originating manifest. Normal rules apply for the
359target manifest to include - it must be a usable manifest on its own.
360
361Attribute `name`: the manifest to include, specified relative to
362the manifest repository's root.
363
364
365Local Manifests
366===============
367
368Additional remotes and projects may be added through local manifest
369files stored in `$TOP_DIR/.repo/local_manifests/*.xml`.
370
371For example:
372
373 $ ls .repo/local_manifests
374 local_manifest.xml
375 another_local_manifest.xml
376
377 $ 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>
385
386Users may add projects to the local manifest(s) prior to a `repo sync`
387invocation, instructing repo to automatically download and manage
388these extra projects.
389
390Manifest files stored in `$TOP_DIR/.repo/local_manifests/*.xml` will
391be loaded in alphabetical order.
392
393Additional remotes and projects may also be added through a local
394manifest, stored in `$TOP_DIR/.repo/local_manifest.xml`. This method
395is deprecated in favor of using multiple manifest files as mentioned
396above.
397
398If `$TOP_DIR/.repo/local_manifest.xml` exists, it will be loaded before
399any manifest files stored in `$TOP_DIR/.repo/local_manifests/*.xml`.