Bug 1543246 - Implement |./mach busted|. r=froydnj
authorBobby Holley <bobbyholley@gmail.com>
Wed, 10 Apr 2019 16:26:44 +0000
changeset 468824 c8dd1ef3daf2537401433b4fec32e6057817c156
parent 468823 7de34f2a331ca4867b2c66f39f23a8f37bc7d64f
child 468825 426c8e0063416e851eb09473580fdd4962436911
push id112755
push userdvarga@mozilla.com
push dateWed, 10 Apr 2019 22:06:41 +0000
treeherdermozilla-inbound@606f85641d0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1543246
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1543246 - Implement |./mach busted|. r=froydnj Depends on D26817 Differential Revision: https://phabricator.services.mozilla.com/D26818
tools/mach_commands.py
--- a/tools/mach_commands.py
+++ b/tools/mach_commands.py
@@ -5,22 +5,54 @@
 from __future__ import absolute_import, unicode_literals
 
 import sys
 
 from mach.decorators import (
     CommandArgument,
     CommandProvider,
     Command,
+    SubCommand,
 )
 
 from mozbuild.base import MachCommandBase, MozbuildObject
 
 
 @CommandProvider
+class BustedProvider(object):
+    @Command('busted', category='misc',
+             description='Query known bugs in our tooling, and file new ones.')
+    def busted_default(self):
+        import requests
+        payload = {'include_fields': 'id,summary,last_change_time',
+                   'blocks': 1543241,
+                   'resolution': '---'}
+        response = requests.get('https://bugzilla.mozilla.org/rest/bug', payload)
+        response.raise_for_status()
+        json_response = response.json()
+        if 'bugs' in json_response and len(json_response['bugs']) > 0:
+            # Display most recently modifed bugs first.
+            bugs = sorted(json_response['bugs'], key=lambda item: item['last_change_time'],
+                          reverse=True)
+            for bug in bugs:
+                print("Bug %s - %s" % (bug['id'], bug['summary']))
+        else:
+            print("No known tooling issues found.")
+
+    @SubCommand('busted',
+                'file',
+                description='File a bug for busted tooling.')
+    def busted_file(self):
+        import webbrowser
+        uri = ('https://bugzilla.mozilla.org/enter_bug.cgi?'
+               'product=Firefox%20Build%20System&component=General&blocked=1543241')
+        webbrowser.open_new_tab(uri)
+
+
+@CommandProvider
 class SearchProvider(object):
     @Command('searchfox', category='misc',
              description='Search for something in Searchfox.')
     @CommandArgument('term', nargs='+', help='Term(s) to search for.')
     def searchfox(self, term):
         import webbrowser
         term = ' '.join(term)
         uri = 'https://searchfox.org/mozilla-central/search?q=%s' % term