diff options
Diffstat (limited to 'manifest_xml.py')
| -rw-r--r-- | manifest_xml.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/manifest_xml.py b/manifest_xml.py index 9603906f..14b03a30 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
| @@ -1233,7 +1233,12 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
| 1233 | ) | 1233 | ) |
| 1234 | 1234 | ||
| 1235 | def _ParseManifestXml( | 1235 | def _ParseManifestXml( |
| 1236 | self, path, include_root, parent_groups="", restrict_includes=True | 1236 | self, |
| 1237 | path, | ||
| 1238 | include_root, | ||
| 1239 | parent_groups="", | ||
| 1240 | restrict_includes=True, | ||
| 1241 | parent_node=None, | ||
| 1237 | ): | 1242 | ): |
| 1238 | """Parse a manifest XML and return the computed nodes. | 1243 | """Parse a manifest XML and return the computed nodes. |
| 1239 | 1244 | ||
| @@ -1243,6 +1248,8 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
| 1243 | parent_groups: The groups to apply to this projects. | 1248 | parent_groups: The groups to apply to this projects. |
| 1244 | restrict_includes: Whether to constrain the "name" attribute of | 1249 | restrict_includes: Whether to constrain the "name" attribute of |
| 1245 | includes. | 1250 | includes. |
| 1251 | parent_node: The parent include node, to apply attribute to this | ||
| 1252 | projects. | ||
| 1246 | 1253 | ||
| 1247 | Returns: | 1254 | Returns: |
| 1248 | List of XML nodes. | 1255 | List of XML nodes. |
| @@ -1288,7 +1295,9 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
| 1288 | ) | 1295 | ) |
| 1289 | try: | 1296 | try: |
| 1290 | nodes.extend( | 1297 | nodes.extend( |
| 1291 | self._ParseManifestXml(fp, include_root, include_groups) | 1298 | self._ParseManifestXml( |
| 1299 | fp, include_root, include_groups, parent_node=node | ||
| 1300 | ) | ||
| 1292 | ) | 1301 | ) |
| 1293 | # should isolate this to the exact exception, but that's | 1302 | # should isolate this to the exact exception, but that's |
| 1294 | # tricky. actual parsing implementation may vary. | 1303 | # tricky. actual parsing implementation may vary. |
| @@ -1311,6 +1320,14 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
| 1311 | node.getAttribute("groups") + "," + nodeGroups | 1320 | node.getAttribute("groups") + "," + nodeGroups |
| 1312 | ) | 1321 | ) |
| 1313 | node.setAttribute("groups", nodeGroups) | 1322 | node.setAttribute("groups", nodeGroups) |
| 1323 | if ( | ||
| 1324 | parent_node | ||
| 1325 | and node.nodeName == "project" | ||
| 1326 | and not node.hasAttribute("revision") | ||
| 1327 | ): | ||
| 1328 | node.setAttribute( | ||
| 1329 | "revision", parent_node.getAttribute("revision") | ||
| 1330 | ) | ||
| 1314 | nodes.append(node) | 1331 | nodes.append(node) |
| 1315 | return nodes | 1332 | return nodes |
| 1316 | 1333 | ||
