OSDN Git Service

repopick: try to use remote's default revision
authorDan Pasanen <invisiblek@cyanogenmod.org>
Thu, 25 Aug 2016 14:39:27 +0000 (09:39 -0500)
committerSteve Kondik <steve@cyngn.com>
Sun, 4 Sep 2016 04:47:36 +0000 (21:47 -0700)
* If the project doesn't have a revision specified, try
  to see if it's remote has one specified before falling back
  to the global default.

Change-Id: I05129413b154e5d08d0fa9ef0ce853631b7e1562

tools/repopick.py

index a53c043..2b0aab4 100755 (executable)
@@ -209,6 +209,7 @@ if __name__ == '__main__':
     manifest = subprocess.check_output(['repo', 'manifest'])
     xml_root = ElementTree.fromstring(manifest)
     projects = xml_root.findall('project')
+    remotes = xml_root.findall('remote')
     default_revision = xml_root.findall('default')[0].get('revision').split('/')[-1]
 
     #dump project data into the a list of dicts with the following data:
@@ -219,7 +220,11 @@ if __name__ == '__main__':
         path = project.get('path')
         revision = project.get('revision')
         if revision is None:
-            revision = default_revision
+            for remote in remotes:
+                if remote.get('name') == project.get('remote'):
+                    revision = remote.get('revision')
+            if revision is None:
+                revision = default_revision
 
         if not name in project_name_to_data:
             project_name_to_data[name] = {}