repopick: Support project paths detection on different branches
* When some projects are declared in the manifests with specific
changes (revision="refs/changes/../....../."), the path
detection does not work, while most cases have a unique paths
* Allow projects with unique branches to select their paths
upon repopick with a warning about the selection
Change-Id: Ic873d69f57c78f233db3d0de4ebd529f896799ea
diff --git a/build/tools/repopick.py b/build/tools/repopick.py
index dd6bb2c..bf27d1d 100755
--- a/build/tools/repopick.py
+++ b/build/tools/repopick.py
@@ -366,6 +366,10 @@
project_path = project_name_to_data[item['project']][item['branch']]
elif args.path:
project_path = args.path
+ elif item['project'] in project_name_to_data and len(project_name_to_data[item['project']]) == 1:
+ local_branch = list(project_name_to_data[item['project']])[0]
+ project_path = project_name_to_data[item['project']][local_branch]
+ print('WARNING: Project {0} has a different branch ("{1}" != "{2}")'.format(project_path, local_branch, item['branch']))
elif args.ignore_missing:
print('WARNING: Skipping {0} since there is no project directory for: {1}\n'.format(item['id'], item['project']))
continue