Commit 3e571614 authored by Tom Powell's avatar Tom Powell Committed by Romain Hunault
Browse files

roomservice: support new manifest formats.

.repo/manifest.xml is no longer a symlink becuase apparently windows
developers need to use repo and windows needs admin for symlinks.

https: //
Change-Id: I88ea0295133959136d7214f13a76b66d89dc88d4

(cherry picked from commit f8adf067)
parent d73af327
...@@ -110,8 +110,21 @@ def indent(elem, level=0): ...@@ -110,8 +110,21 @@ def indent(elem, level=0):
if level and (not elem.tail or not elem.tail.strip()): if level and (not elem.tail or not elem.tail.strip()):
elem.tail = i elem.tail = i
def get_default_revision(): def get_manifest_path():
'''Find the current manifest path
In old versions of repo this is at .repo/manifest.xml
In new versions, .repo/manifest.xml includes an include
to some arbitrary file in .repo/manifests'''
m = ElementTree.parse(".repo/manifest.xml") m = ElementTree.parse(".repo/manifest.xml")
return '.repo/manifest.xml'
except IndexError:
return ".repo/manifests/{}".format(m.find("include").get("name"))
def get_default_revision():
m = ElementTree.parse(get_manifest_path())
d = m.findall('default')[0] d = m.findall('default')[0]
r = d.get('revision') r = d.get('revision')
return r.replace('refs/heads/', '').replace('refs/tags/', '') return r.replace('refs/heads/', '').replace('refs/tags/', '')
...@@ -142,7 +155,7 @@ def is_in_manifest(projectpath): ...@@ -142,7 +155,7 @@ def is_in_manifest(projectpath):
# Search in main manifest, too # Search in main manifest, too
try: try:
lm = ElementTree.parse(".repo/manifest.xml") lm = ElementTree.parse(get_manifest_path())
lm = lm.getroot() lm = lm.getroot()
except: except:
lm = ElementTree.Element("manifest") lm = ElementTree.Element("manifest")
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment