diff options
-rw-r--r-- | docs/manifest-format.txt | 39 | ||||
-rw-r--r-- | manifest.py | 38 | ||||
-rw-r--r-- | project.py | 15 | ||||
-rw-r--r-- | remote.py | 4 |
4 files changed, 5 insertions, 91 deletions
diff --git a/docs/manifest-format.txt b/docs/manifest-format.txt index d8db21de..da0e69ff 100644 --- a/docs/manifest-format.txt +++ b/docs/manifest-format.txt | |||
@@ -23,32 +23,23 @@ following DTD: | |||
23 | <!ELEMENT manifest (remote*, | 23 | <!ELEMENT manifest (remote*, |
24 | default?, | 24 | default?, |
25 | remove-project*, | 25 | remove-project*, |
26 | project*, | 26 | project*)> |
27 | add-remote*)> | ||
28 | 27 | ||
29 | <!ELEMENT remote (EMPTY)> | 28 | <!ELEMENT remote (EMPTY)> |
30 | <!ATTLIST remote name ID #REQUIRED> | 29 | <!ATTLIST remote name ID #REQUIRED> |
31 | <!ATTLIST remote fetch CDATA #REQUIRED> | 30 | <!ATTLIST remote fetch CDATA #REQUIRED> |
32 | <!ATTLIST remote review CDATA #IMPLIED> | 31 | <!ATTLIST remote review CDATA #IMPLIED> |
33 | <!ATTLIST remote project-name CDATA #IMPLIED> | ||
34 | 32 | ||
35 | <!ELEMENT default (EMPTY)> | 33 | <!ELEMENT default (EMPTY)> |
36 | <!ATTLIST default remote IDREF #IMPLIED> | 34 | <!ATTLIST default remote IDREF #IMPLIED> |
37 | <!ATTLIST default revision CDATA #IMPLIED> | 35 | <!ATTLIST default revision CDATA #IMPLIED> |
38 | 36 | ||
39 | <!ELEMENT project (remote*)> | 37 | <!ELEMENT project (EMPTY)> |
40 | <!ATTLIST project name CDATA #REQUIRED> | 38 | <!ATTLIST project name CDATA #REQUIRED> |
41 | <!ATTLIST project path CDATA #IMPLIED> | 39 | <!ATTLIST project path CDATA #IMPLIED> |
42 | <!ATTLIST project remote IDREF #IMPLIED> | 40 | <!ATTLIST project remote IDREF #IMPLIED> |
43 | <!ATTLIST project revision CDATA #IMPLIED> | 41 | <!ATTLIST project revision CDATA #IMPLIED> |
44 | 42 | ||
45 | <!ELEMENT add-remote (EMPTY)> | ||
46 | <!ATTLIST add-remote to-project ID #REQUIRED> | ||
47 | <!ATTLIST add-remote name ID #REQUIRED> | ||
48 | <!ATTLIST add-remote fetch CDATA #REQUIRED> | ||
49 | <!ATTLIST add-remote review CDATA #IMPLIED> | ||
50 | <!ATTLIST add-remote project-name CDATA #IMPLIED> | ||
51 | |||
52 | <!ELEMENT remove-project (EMPTY)> | 43 | <!ELEMENT remove-project (EMPTY)> |
53 | <!ATTLIST remove-project name CDATA #REQUIRED> | 44 | <!ATTLIST remove-project name CDATA #REQUIRED> |
54 | ]> | 45 | ]> |
@@ -82,25 +73,6 @@ Attribute `review`: Hostname of the Gerrit server where reviews | |||
82 | are uploaded to by `repo upload`. This attribute is optional; | 73 | are uploaded to by `repo upload`. This attribute is optional; |
83 | if not specified then `repo upload` will not function. | 74 | if not specified then `repo upload` will not function. |
84 | 75 | ||
85 | Attribute `project-name`: Specifies the name of this project used | ||
86 | by the review server given in the review attribute of this element. | ||
87 | Only permitted when the remote element is nested inside of a project | ||
88 | element (see below). If not given, defaults to the name supplied | ||
89 | in the project's name attribute. | ||
90 | |||
91 | Element add-remote | ||
92 | ------------------ | ||
93 | |||
94 | Adds a remote to an existing project, whose name is given by the | ||
95 | to-project attribute. This is functionally equivalent to nesting | ||
96 | a remote element under the project, but has the advantage that it | ||
97 | can be specified in the uesr's `local_manifest.xml` to add a remote | ||
98 | to a project declared by the normal manifest. | ||
99 | |||
100 | The element can be used to add a fork of an existing project that | ||
101 | the user needs to work with. | ||
102 | |||
103 | |||
104 | Element default | 76 | Element default |
105 | --------------- | 77 | --------------- |
106 | 78 | ||
@@ -152,13 +124,6 @@ Tags and/or explicit SHA-1s should work in theory, but have not | |||
152 | been extensively tested. If not supplied the revision given by | 124 | been extensively tested. If not supplied the revision given by |
153 | the default element is used. | 125 | the default element is used. |
154 | 126 | ||
155 | Child element `remote`: Described like the top-level remote element, | ||
156 | but adds an additional remote to only this project. These additional | ||
157 | remotes are fetched from first on the initial `repo sync`, causing | ||
158 | the majority of the project's object database to be obtained through | ||
159 | these additional remotes. | ||
160 | |||
161 | |||
162 | Element remove-project | 127 | Element remove-project |
163 | ---------------------- | 128 | ---------------------- |
164 | 129 | ||
diff --git a/manifest.py b/manifest.py index 4b740e5a..e7a5afba 100644 --- a/manifest.py +++ b/manifest.py | |||
@@ -80,8 +80,6 @@ class Manifest(object): | |||
80 | e.setAttribute('fetch', r.fetchUrl) | 80 | e.setAttribute('fetch', r.fetchUrl) |
81 | if r.reviewUrl is not None: | 81 | if r.reviewUrl is not None: |
82 | e.setAttribute('review', r.reviewUrl) | 82 | e.setAttribute('review', r.reviewUrl) |
83 | if r.projectName is not None: | ||
84 | e.setAttribute('project-name', r.projectName) | ||
85 | 83 | ||
86 | def Save(self, fd, peg_rev=False): | 84 | def Save(self, fd, peg_rev=False): |
87 | """Write the current manifest out to the given file descriptor. | 85 | """Write the current manifest out to the given file descriptor. |
@@ -133,8 +131,6 @@ class Manifest(object): | |||
133 | elif not d.revision or p.revision != d.revision: | 131 | elif not d.revision or p.revision != d.revision: |
134 | e.setAttribute('revision', p.revision) | 132 | e.setAttribute('revision', p.revision) |
135 | 133 | ||
136 | for r in p.extraRemotes: | ||
137 | self._RemoteToXml(p.extraRemotes[r], doc, e) | ||
138 | for c in p.copyfiles: | 134 | for c in p.copyfiles: |
139 | ce = doc.createElement('copyfile') | 135 | ce = doc.createElement('copyfile') |
140 | ce.setAttribute('src', c.src) | 136 | ce.setAttribute('src', c.src) |
@@ -245,16 +241,6 @@ class Manifest(object): | |||
245 | (project.name, self.manifestFile) | 241 | (project.name, self.manifestFile) |
246 | self._projects[project.name] = project | 242 | self._projects[project.name] = project |
247 | 243 | ||
248 | for node in config.childNodes: | ||
249 | if node.nodeName == 'add-remote': | ||
250 | pn = self._reqatt(node, 'to-project') | ||
251 | project = self._projects.get(pn) | ||
252 | if not project: | ||
253 | raise ManifestParseError, \ | ||
254 | 'project %s not defined in %s' % \ | ||
255 | (pn, self.manifestFile) | ||
256 | self._ParseProjectExtraRemote(project, node) | ||
257 | |||
258 | def _AddMetaProjectMirror(self, m): | 244 | def _AddMetaProjectMirror(self, m): |
259 | name = None | 245 | name = None |
260 | m_url = m.GetRemote(m.remote.name).url | 246 | m_url = m.GetRemote(m.remote.name).url |
@@ -298,16 +284,7 @@ class Manifest(object): | |||
298 | review = node.getAttribute('review') | 284 | review = node.getAttribute('review') |
299 | if review == '': | 285 | if review == '': |
300 | review = None | 286 | review = None |
301 | 287 | return Remote(name=name, fetch=fetch, review=review) | |
302 | projectName = node.getAttribute('project-name') | ||
303 | if projectName == '': | ||
304 | projectName = None | ||
305 | |||
306 | r = Remote(name=name, | ||
307 | fetch=fetch, | ||
308 | review=review, | ||
309 | projectName=projectName) | ||
310 | return r | ||
311 | 288 | ||
312 | def _ParseDefault(self, node): | 289 | def _ParseDefault(self, node): |
313 | """ | 290 | """ |
@@ -367,22 +344,11 @@ class Manifest(object): | |||
367 | revision = revision) | 344 | revision = revision) |
368 | 345 | ||
369 | for n in node.childNodes: | 346 | for n in node.childNodes: |
370 | if n.nodeName == 'remote': | 347 | if n.nodeName == 'copyfile': |
371 | self._ParseProjectExtraRemote(project, n) | ||
372 | elif n.nodeName == 'copyfile': | ||
373 | self._ParseCopyFile(project, n) | 348 | self._ParseCopyFile(project, n) |
374 | 349 | ||
375 | return project | 350 | return project |
376 | 351 | ||
377 | def _ParseProjectExtraRemote(self, project, n): | ||
378 | r = self._ParseRemote(n) | ||
379 | if project.extraRemotes.get(r.name) \ | ||
380 | or project.remote.name == r.name: | ||
381 | raise ManifestParseError, \ | ||
382 | 'duplicate remote %s in project %s in %s' % \ | ||
383 | (r.name, project.name, self.manifestFile) | ||
384 | project.extraRemotes[r.name] = r | ||
385 | |||
386 | def _ParseCopyFile(self, project, node): | 352 | def _ParseCopyFile(self, project, node): |
387 | src = self._reqatt(node, 'src') | 353 | src = self._reqatt(node, 'src') |
388 | dest = self._reqatt(node, 'dest') | 354 | dest = self._reqatt(node, 'dest') |
@@ -230,7 +230,6 @@ class Project(object): | |||
230 | self.relpath = relpath | 230 | self.relpath = relpath |
231 | self.revision = revision | 231 | self.revision = revision |
232 | self.snapshots = {} | 232 | self.snapshots = {} |
233 | self.extraRemotes = {} | ||
234 | self.copyfiles = [] | 233 | self.copyfiles = [] |
235 | self.config = GitConfig.ForRepository( | 234 | self.config = GitConfig.ForRepository( |
236 | gitdir = self.gitdir, | 235 | gitdir = self.gitdir, |
@@ -579,9 +578,6 @@ class Project(object): | |||
579 | self._InitGitDir() | 578 | self._InitGitDir() |
580 | 579 | ||
581 | self._InitRemote() | 580 | self._InitRemote() |
582 | for r in self.extraRemotes.values(): | ||
583 | if not self._RemoteFetch(r.name): | ||
584 | return False | ||
585 | if not self._RemoteFetch(): | 581 | if not self._RemoteFetch(): |
586 | return False | 582 | return False |
587 | 583 | ||
@@ -1083,17 +1079,6 @@ class Project(object): | |||
1083 | remote.ResetFetch(mirror=True) | 1079 | remote.ResetFetch(mirror=True) |
1084 | remote.Save() | 1080 | remote.Save() |
1085 | 1081 | ||
1086 | for r in self.extraRemotes.values(): | ||
1087 | remote = self.GetRemote(r.name) | ||
1088 | remote.url = r.fetchUrl | ||
1089 | remote.review = r.reviewUrl | ||
1090 | if r.projectName: | ||
1091 | remote.projectname = r.projectName | ||
1092 | elif remote.projectname is None: | ||
1093 | remote.projectname = self.name | ||
1094 | remote.ResetFetch() | ||
1095 | remote.Save() | ||
1096 | |||
1097 | def _InitMRef(self): | 1082 | def _InitMRef(self): |
1098 | if self.manifest.branch: | 1083 | if self.manifest.branch: |
1099 | msg = 'manifest set to %s' % self.revision | 1084 | msg = 'manifest set to %s' % self.revision |
@@ -16,9 +16,7 @@ | |||
16 | class Remote(object): | 16 | class Remote(object): |
17 | def __init__(self, name, | 17 | def __init__(self, name, |
18 | fetch=None, | 18 | fetch=None, |
19 | review=None, | 19 | review=None): |
20 | projectName=None): | ||
21 | self.name = name | 20 | self.name = name |
22 | self.fetchUrl = fetch | 21 | self.fetchUrl = fetch |
23 | self.reviewUrl = review | 22 | self.reviewUrl = review |
24 | self.projectName = projectName | ||