Bug 1205144 - Remove 'REMOVED' commands from output of mach-commands and mach-debug-commands. r=gps DONTBUILD
authorXidorn Quan <quanxunzhen@gmail.com>
Mon, 21 Sep 2015 11:32:03 +1000
changeset 296087 fa5be14d26e5adf896324d91b73cc628bf18b8db
parent 296086 1ff3901d09898110232f23b02d989c7c152aa1ad
child 296088 e92fa2dcd9df9c4f63f50dc18fe0e32e8f0e7200
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1205144
milestone43.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 1205144 - Remove 'REMOVED' commands from output of mach-commands and mach-debug-commands. r=gps DONTBUILD
python/mach/mach/commands/commandinfo.py
testing/mochitest/mach_commands.py
--- a/python/mach/mach/commands/commandinfo.py
+++ b/python/mach/mach/commands/commandinfo.py
@@ -11,30 +11,36 @@ from mach.decorators import (
 )
 
 
 @CommandProvider
 class BuiltinCommands(object):
     def __init__(self, context):
         self.context = context
 
+    @property
+    def command_keys(self):
+        # NOTE 'REMOVED' is a function in testing/mochitest/mach_commands.py
+        return (k for k, v in self.context.commands.command_handlers.items()
+                if not v.conditions or v.conditions[0].__name__ != 'REMOVED')
+
     @Command('mach-commands', category='misc',
         description='List all mach commands.')
     def commands(self):
-        print("\n".join(self.context.commands.command_handlers.keys()))
+        print("\n".join(self.command_keys))
 
     @Command('mach-debug-commands', category='misc',
         description='Show info about available mach commands.')
     @CommandArgument('match', metavar='MATCH', default=None, nargs='?',
         help='Only display commands containing given substring.')
     def debug_commands(self, match=None):
         import inspect
 
         handlers = self.context.commands.command_handlers
-        for command in sorted(handlers.keys()):
+        for command in sorted(self.command_keys):
             if match and match not in command:
                 continue
 
             handler = handlers[command]
             cls = handler.cls
             method = getattr(cls, getattr(handler, 'method'))
 
             print(command)
--- a/testing/mochitest/mach_commands.py
+++ b/testing/mochitest/mach_commands.py
@@ -643,16 +643,19 @@ class RobocopCommands(MachCommandBase):
         resolver = self._spawn(TestResolver)
         tests = list(resolver.resolve_tests(paths=test_paths, cwd=self._mach_context.cwd,
             flavor='instrumentation', subsuite='robocop'))
 
         mochitest = self._spawn(MochitestRunner)
         return mochitest.run_robocop_test(self._mach_context, tests, 'robocop', **kwargs)
 
 
+# NOTE python/mach/mach/commands/commandinfo.py references this function
+#      by name. If this function is renamed or removed, that file should
+#      be updated accordingly as well.
 def REMOVED(cls):
     """Command no longer exists! Use |mach mochitest| instead.
 
     The |mach mochitest| command will automatically detect which flavors and
     subsuites exist in a given directory. If desired, flavors and subsuites
     can be restricted using `--flavor` and `--subsuite` respectively. E.g:
 
         $ ./mach mochitest dom/indexedDB