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 | |
| 22 | <!DOCTYPE manifest [ |
Shawn O. Pearce | 70939e2 | 2008-11-06 11:07:14 -0800 | [diff] [blame] | 23 | <!ELEMENT manifest (remote*, |
| 24 | default?, |
| 25 | project*, |
| 26 | add-remote*)> |
Shawn O. Pearce | 3e54819 | 2008-11-04 11:19:36 -0800 | [diff] [blame] | 27 | |
| 28 | <!ELEMENT remote (EMPTY)> |
Shawn O. Pearce | ae6e094 | 2008-11-06 10:25:35 -0800 | [diff] [blame] | 29 | <!ATTLIST remote name ID #REQUIRED> |
| 30 | <!ATTLIST remote fetch CDATA #REQUIRED> |
| 31 | <!ATTLIST remote review CDATA #IMPLIED> |
| 32 | <!ATTLIST remote project-name CDATA #IMPLIED> |
Shawn O. Pearce | 3e54819 | 2008-11-04 11:19:36 -0800 | [diff] [blame] | 33 | |
| 34 | <!ELEMENT default (EMPTY)> |
| 35 | <!ATTLIST default remote IDREF #IMPLIED> |
| 36 | <!ATTLIST default revision CDATA #IMPLIED> |
| 37 | |
| 38 | <!ELEMENT project (remote*)> |
| 39 | <!ATTLIST project name CDATA #REQUIRED> |
| 40 | <!ATTLIST project path CDATA #IMPLIED> |
| 41 | <!ATTLIST project remote IDREF #IMPLIED> |
| 42 | <!ATTLIST project revision CDATA #IMPLIED> |
Shawn O. Pearce | 70939e2 | 2008-11-06 11:07:14 -0800 | [diff] [blame] | 43 | |
| 44 | <!ELEMENT add-remote (EMPTY)> |
| 45 | <!ATTLIST add-remote to-project ID #REQUIRED> |
| 46 | <!ATTLIST add-remote name ID #REQUIRED> |
| 47 | <!ATTLIST add-remote fetch CDATA #REQUIRED> |
| 48 | <!ATTLIST add-remote review CDATA #IMPLIED> |
| 49 | <!ATTLIST add-remote project-name CDATA #IMPLIED> |
Shawn O. Pearce | 3e54819 | 2008-11-04 11:19:36 -0800 | [diff] [blame] | 50 | ]> |
| 51 | |
| 52 | A description of the elements and their attributes follows. |
| 53 | |
| 54 | |
| 55 | Element manifest |
| 56 | ---------------- |
| 57 | |
| 58 | The root element of the file. |
| 59 | |
| 60 | |
| 61 | Element remote |
| 62 | -------------- |
| 63 | |
| 64 | One or more remote elements may be specified. Each remote element |
| 65 | specifies a Git URL shared by one or more projects and (optionally) |
| 66 | the Gerrit review server those projects upload changes through. |
| 67 | |
| 68 | Attribute `name`: A short name unique to this manifest file. The |
| 69 | name specified here is used as the remote name in each project's |
| 70 | .git/config, and is therefore automatically available to commands |
| 71 | like `git fetch`, `git remote`, `git pull` and `git push`. |
| 72 | |
| 73 | Attribute `fetch`: The Git URL prefix for all projects which use |
| 74 | this remote. Each project's name is appended to this prefix to |
| 75 | form the actual URL used to clone the project. |
| 76 | |
| 77 | Attribute `review`: Hostname of the Gerrit server where reviews |
| 78 | are uploaded to by `repo upload`. This attribute is optional; |
| 79 | if not specified then `repo upload` will not function. |
| 80 | |
Shawn O. Pearce | ae6e094 | 2008-11-06 10:25:35 -0800 | [diff] [blame] | 81 | Attribute `project-name`: Specifies the name of this project used |
| 82 | by the review server given in the review attribute of this element. |
| 83 | Only permitted when the remote element is nested inside of a project |
| 84 | element (see below). If not given, defaults to the name supplied |
| 85 | in the project's name attribute. |
| 86 | |
Shawn O. Pearce | 70939e2 | 2008-11-06 11:07:14 -0800 | [diff] [blame] | 87 | Element add-remote |
| 88 | ------------------ |
| 89 | |
| 90 | Adds a remote to an existing project, whose name is given by the |
| 91 | to-project attribute. This is functionally equivalent to nesting |
| 92 | a remote element under the project, but has the advantage that it |
| 93 | can be specified in the uesr's `local_manifest.xml` to add a remote |
| 94 | to a project declared by the normal manifest. |
| 95 | |
| 96 | The element can be used to add a fork of an existing project that |
| 97 | the user needs to work with. |
| 98 | |
Shawn O. Pearce | 3e54819 | 2008-11-04 11:19:36 -0800 | [diff] [blame] | 99 | |
| 100 | Element default |
| 101 | --------------- |
| 102 | |
| 103 | At most one default element may be specified. Its remote and |
| 104 | revision attributes are used when a project element does not |
| 105 | specify its own remote or revision attribute. |
| 106 | |
| 107 | Attribute `remote`: Name of a previously defined remote element. |
| 108 | Project elements lacking a remote attribute of their own will use |
| 109 | this remote. |
| 110 | |
| 111 | Attribute `revision`: Name of a Git branch (e.g. `master` or |
| 112 | `refs/heads/master`). Project elements lacking their own |
| 113 | revision attribute will use this revision. |
| 114 | |
| 115 | |
| 116 | Element project |
| 117 | --------------- |
| 118 | |
| 119 | One or more project elements may be specified. Each element |
| 120 | describes a single Git repository to be cloned into the repo |
| 121 | client workspace. |
| 122 | |
| 123 | Attribute `name`: A unique name for this project. The project's |
| 124 | name is appended onto its remote's fetch URL to generate the actual |
| 125 | URL to configure the Git remote with. The URL gets formed as: |
| 126 | |
| 127 | ${remote_fetch}/${project_name}.git |
| 128 | |
| 129 | where ${remote_fetch} is the remote's fetch attribute and |
| 130 | ${project_name} is the project's name attribute. The suffix ".git" |
| 131 | is always appended as repo assumes the upstream is a forrest of |
| 132 | bare Git repositories. |
| 133 | |
| 134 | The project name must match the name Gerrit knows, if Gerrit is |
| 135 | being used for code reviews. |
| 136 | |
| 137 | Attribute `path`: An optional path relative to the top directory |
| 138 | of the repo client where the Git working directory for this project |
| 139 | should be placed. If not supplied the project name is used. |
| 140 | |
| 141 | Attribute `remote`: Name of a previously defined remote element. |
| 142 | If not supplied the remote given by the default element is used. |
| 143 | |
| 144 | Attribute `revision`: Name of the Git branch the manifest wants |
| 145 | to track for this project. Names can be relative to refs/heads |
| 146 | (e.g. just "master") or absolute (e.g. "refs/heads/master"). |
| 147 | Tags and/or explicit SHA-1s should work in theory, but have not |
| 148 | been extensively tested. If not supplied the revision given by |
| 149 | the default element is used. |
| 150 | |
| 151 | Child element `remote`: Described like the top-level remote element, |
| 152 | but adds an additional remote to only this project. These additional |
| 153 | remotes are fetched from first on the initial `repo sync`, causing |
| 154 | the majority of the project's object database to be obtained through |
| 155 | these additional remotes. |
Shawn O. Pearce | 70cd4ab | 2008-11-06 08:48:44 -0800 | [diff] [blame] | 156 | |
| 157 | |
| 158 | Local Manifest |
| 159 | ============== |
| 160 | |
| 161 | Additional remotes and projects may be added through a local |
| 162 | manifest, stored in `$TOP_DIR/.repo/local_manifest.xml`. |
| 163 | |
| 164 | For example: |
| 165 | |
| 166 | ---- |
| 167 | $ cat .repo/local_manifest.xml |
| 168 | <?xml version="1.0" encoding="UTF-8"?> |
| 169 | <manifest> |
| 170 | <project path="manifest" |
| 171 | name="tools/manifest" /> |
| 172 | <project path="platform-manifest" |
| 173 | name="platform/manifest" /> |
| 174 | </manifest> |
| 175 | ---- |
| 176 | |
| 177 | Users may add projects to the local manifest prior to a `repo sync` |
| 178 | invocation, instructing repo to automatically download and manage |
| 179 | these extra projects. |
| 180 | |
| 181 | Currently the only supported feature of a local manifest is to |
| 182 | add new remotes and/or projects. In the future a local manifest |
| 183 | may support picking different revisions of a project, or deleting |
| 184 | projects specified in the default manifest. |