Add a way to override the revision of an <extend-project>

This change adds support for the 'revision' attribute in
<extend-project>. This avoids the need to perform a <remove-project>
followed by a <project> in local manifests.

Change-Id: Id2834fcfc1ae0d74b3347bed3618f250bf696b1f
This commit is contained in:
Luis Hector Chavez 2018-03-15 09:54:08 -07:00
parent 1f365701b3
commit 7d52585ec4
2 changed files with 7 additions and 0 deletions

View File

@ -86,6 +86,7 @@ following DTD:
<!ATTLIST extend-project name CDATA #REQUIRED> <!ATTLIST extend-project name CDATA #REQUIRED>
<!ATTLIST extend-project path CDATA #IMPLIED> <!ATTLIST extend-project path CDATA #IMPLIED>
<!ATTLIST extend-project groups CDATA #IMPLIED> <!ATTLIST extend-project groups CDATA #IMPLIED>
<!ATTLIST extend-project revision CDATA #IMPLIED>
<!ELEMENT remove-project EMPTY> <!ELEMENT remove-project EMPTY>
<!ATTLIST remove-project name CDATA #REQUIRED> <!ATTLIST remove-project name CDATA #REQUIRED>
@ -300,6 +301,9 @@ at the specified path, rather than all projects with the given name.
Attribute `groups`: List of additional groups to which this project Attribute `groups`: List of additional groups to which this project
belongs. Same syntax as the corresponding element of `project`. belongs. Same syntax as the corresponding element of `project`.
Attribute `revision`: If specified, overrides the revision of the original
project. Same syntax as the corresponding element of `project`.
Element annotation Element annotation
------------------ ------------------

View File

@ -571,12 +571,15 @@ class XmlManifest(object):
groups = node.getAttribute('groups') groups = node.getAttribute('groups')
if groups: if groups:
groups = self._ParseGroups(groups) groups = self._ParseGroups(groups)
revision = node.getAttribute('revision')
for p in self._projects[name]: for p in self._projects[name]:
if path and p.relpath != path: if path and p.relpath != path:
continue continue
if groups: if groups:
p.groups.extend(groups) p.groups.extend(groups)
if revision:
p.revisionExpr = revision
if node.nodeName == 'repo-hooks': if node.nodeName == 'repo-hooks':
# Get the name of the project and the (space-separated) list of enabled. # Get the name of the project and the (space-separated) list of enabled.
repo_hooks_project = self._reqatt(node, 'in-project') repo_hooks_project = self._reqatt(node, 'in-project')