chromacs: manifest_parser bugfix for no 'path' attribute projects.
When parsing the manifest XML file, the parser can halt with a no key
error when a project element does not have a path attribute. If there
is no path attribute, we use the project name in its stead.
BUG=chromium:1114856
TEST=Parsed xml file with project elements that have no path attribute.
Change-Id: I48639088a3be277446dc44ba7f2be668fe759fc5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/2347868
Tested-by: Aaron Massey <aaronmassey@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-by: Sean McAllister <smcallis@google.com>
Commit-Queue: Aaron Massey <aaronmassey@chromium.org>
diff --git a/contrib/emacs/manifest_parser.py b/contrib/emacs/manifest_parser.py
index f5eb452..29147e7 100755
--- a/contrib/emacs/manifest_parser.py
+++ b/contrib/emacs/manifest_parser.py
@@ -36,9 +36,9 @@
attrs: A dictionary of the handled xml element's attributes.
"""
if name == 'project':
- project_path = attrs['path']
project_name = attrs['name']
- dest_branch = attrs['dest-branch'] if 'dest-branch' in attrs else None
+ project_path = attrs.get('path', project_name)
+ dest_branch = attrs.get('dest-branch')
if not dest_branch:
# We skip anything without a dest-branch
return