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