Bug 1234912 - Check for |mozext| after |mach artifact install| hg failure. r?gps draft
authorNick Alexander <nalexander@mozilla.com>
Wed, 06 Jan 2016 21:19:49 -0800
changeset 319568 25560e05bec3802192d39365ca59ce999897c9a4
parent 319567 fa077489e763b5cc5f547868d3be33cd7aa3c987
child 512612 96775149e0cf15b1831126455de737dd93be8c62
push id9053
push usernalexander@mozilla.com
push dateThu, 07 Jan 2016 05:21:01 +0000
reviewersgps
bugs1234912
milestone46.0a1
Bug 1234912 - Check for |mozext| after |mach artifact install| hg failure. r?gps
python/mozbuild/mozbuild/artifacts.py
--- a/python/mozbuild/mozbuild/artifacts.py
+++ b/python/mozbuild/mozbuild/artifacts.py
@@ -396,22 +396,30 @@ class PushHeadCache(CacheManager):
     def __init__(self, hg, cache_dir, log=None):
         # It's not unusual to pull hundreds of changesets at once, and perhaps
         # |hg up| back and forth a few times.
         CacheManager.__init__(self, cache_dir, 'pushheads', MAX_CACHED_PARENTS, log=log)
         self._hg = hg
 
     @cachedmethod(operator.attrgetter('_cache'))
     def pushheads(self, tree, parent):
-        pushheads = subprocess.check_output([self._hg, 'log',
-            '--template', '{node}\n',
-            '-r', 'last(pushhead("{tree}") and ::"{parent}", {num})'.format(
-                tree=tree, parent=parent, num=NUM_PUSHHEADS_TO_QUERY_PER_PARENT)])
-        pushheads = pushheads.strip().split('\n')
-        return pushheads
+        try:
+            pushheads = subprocess.check_output([self._hg, 'log',
+                '--template', '{node}\n',
+                '-r', 'last(pushhead("{tree}") and ::"{parent}", {num})'.format(
+                    tree=tree, parent=parent, num=NUM_PUSHHEADS_TO_QUERY_PER_PARENT)])
+            pushheads = pushheads.strip().split('\n')
+            return pushheads
+        except subprocess.CalledProcessError as e:
+            # Probably don't have the mozext extension installed.
+            ret = subprocess.call([self._hg, 'showconfig', 'extensions.mozext'])
+            if ret:
+                raise Exception('Could not find candidate pushheads. Enable the "mozext" hg extension.')
+            # Otherwise, perhaps the pushlog database is not present locally.
+            raise Exception('Could not find candidate pushheads. Try running |hg pushlogsync|.')
 
 
 class TaskCache(CacheManager):
     '''Map candidate pushheads to Task Cluster task IDs and artifact URLs.'''
 
     def __init__(self, cache_dir, log=None):
         CacheManager.__init__(self, cache_dir, 'artifact_url', MAX_CACHED_TASKS, log=log)
         self._index = taskcluster.Index()