mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Add <add-remote to-project="..."> to inject additional remotes
This way users can add forks they know about to an existing project that was already declared in the primary manifest. This is mostly useful with the Linux kernel project, where multiple forks is quite common for the main upstream tree (e.g. Linus' tree), a platform architecture tree (e.g. ARM) and a device specific tree (e.g. the msm7k tree used by Android). Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
parent
ae6e0949d1
commit
70939e2f73
@ -20,7 +20,10 @@ A manifest XML file (e.g. 'default.xml') roughly conforms to the
|
|||||||
following DTD:
|
following DTD:
|
||||||
|
|
||||||
<!DOCTYPE manifest [
|
<!DOCTYPE manifest [
|
||||||
<!ELEMENT manifest (remote*, default?, project*)>
|
<!ELEMENT manifest (remote*,
|
||||||
|
default?,
|
||||||
|
project*,
|
||||||
|
add-remote*)>
|
||||||
|
|
||||||
<!ELEMENT remote (EMPTY)>
|
<!ELEMENT remote (EMPTY)>
|
||||||
<!ATTLIST remote name ID #REQUIRED>
|
<!ATTLIST remote name ID #REQUIRED>
|
||||||
@ -37,6 +40,13 @@ following DTD:
|
|||||||
<!ATTLIST project path CDATA #IMPLIED>
|
<!ATTLIST project path CDATA #IMPLIED>
|
||||||
<!ATTLIST project remote IDREF #IMPLIED>
|
<!ATTLIST project remote IDREF #IMPLIED>
|
||||||
<!ATTLIST project revision CDATA #IMPLIED>
|
<!ATTLIST project revision CDATA #IMPLIED>
|
||||||
|
|
||||||
|
<!ELEMENT add-remote (EMPTY)>
|
||||||
|
<!ATTLIST add-remote to-project ID #REQUIRED>
|
||||||
|
<!ATTLIST add-remote name ID #REQUIRED>
|
||||||
|
<!ATTLIST add-remote fetch CDATA #REQUIRED>
|
||||||
|
<!ATTLIST add-remote review CDATA #IMPLIED>
|
||||||
|
<!ATTLIST add-remote project-name CDATA #IMPLIED>
|
||||||
]>
|
]>
|
||||||
|
|
||||||
A description of the elements and their attributes follows.
|
A description of the elements and their attributes follows.
|
||||||
@ -74,6 +84,18 @@ Only permitted when the remote element is nested inside of a project
|
|||||||
element (see below). If not given, defaults to the name supplied
|
element (see below). If not given, defaults to the name supplied
|
||||||
in the project's name attribute.
|
in the project's name attribute.
|
||||||
|
|
||||||
|
Element add-remote
|
||||||
|
------------------
|
||||||
|
|
||||||
|
Adds a remote to an existing project, whose name is given by the
|
||||||
|
to-project attribute. This is functionally equivalent to nesting
|
||||||
|
a remote element under the project, but has the advantage that it
|
||||||
|
can be specified in the uesr's `local_manifest.xml` to add a remote
|
||||||
|
to a project declared by the normal manifest.
|
||||||
|
|
||||||
|
The element can be used to add a fork of an existing project that
|
||||||
|
the user needs to work with.
|
||||||
|
|
||||||
|
|
||||||
Element default
|
Element default
|
||||||
---------------
|
---------------
|
||||||
|
21
manifest.py
21
manifest.py
@ -165,6 +165,16 @@ class Manifest(object):
|
|||||||
(project.name, self.manifestFile)
|
(project.name, self.manifestFile)
|
||||||
self._projects[project.name] = project
|
self._projects[project.name] = project
|
||||||
|
|
||||||
|
for node in config.childNodes:
|
||||||
|
if node.nodeName == 'add-remote':
|
||||||
|
pn = self._reqatt(node, 'to-project')
|
||||||
|
project = self._projects.get(pn)
|
||||||
|
if not project:
|
||||||
|
raise ManifestParseError, \
|
||||||
|
'project %s not defined in %s' % \
|
||||||
|
(pn, self.manifestFile)
|
||||||
|
self._ParseProjectExtraRemote(project, node)
|
||||||
|
|
||||||
def _AddMetaProjectMirror(self, m):
|
def _AddMetaProjectMirror(self, m):
|
||||||
name = None
|
name = None
|
||||||
m_url = m.GetRemote(m.remote.name).url
|
m_url = m.GetRemote(m.remote.name).url
|
||||||
@ -281,6 +291,13 @@ class Manifest(object):
|
|||||||
|
|
||||||
for n in node.childNodes:
|
for n in node.childNodes:
|
||||||
if n.nodeName == 'remote':
|
if n.nodeName == 'remote':
|
||||||
|
self._ParseProjectExtraRemote(project, n)
|
||||||
|
elif n.nodeName == 'copyfile':
|
||||||
|
self._ParseCopyFile(project, n)
|
||||||
|
|
||||||
|
return project
|
||||||
|
|
||||||
|
def _ParseProjectExtraRemote(self, project, n):
|
||||||
r = self._ParseRemote(n)
|
r = self._ParseRemote(n)
|
||||||
if project.extraRemotes.get(r.name) \
|
if project.extraRemotes.get(r.name) \
|
||||||
or project.remote.name == r.name:
|
or project.remote.name == r.name:
|
||||||
@ -288,10 +305,6 @@ class Manifest(object):
|
|||||||
'duplicate remote %s in project %s in %s' % \
|
'duplicate remote %s in project %s in %s' % \
|
||||||
(r.name, project.name, self.manifestFile)
|
(r.name, project.name, self.manifestFile)
|
||||||
project.extraRemotes[r.name] = r
|
project.extraRemotes[r.name] = r
|
||||||
elif n.nodeName == 'copyfile':
|
|
||||||
self._ParseCopyFile(project, n)
|
|
||||||
|
|
||||||
return project
|
|
||||||
|
|
||||||
def _ParseCopyFile(self, project, node):
|
def _ParseCopyFile(self, project, node):
|
||||||
src = self._reqatt(node, 'src')
|
src = self._reqatt(node, 'src')
|
||||||
|
Loading…
Reference in New Issue
Block a user