author Markus Stange <>
Fri, 18 May 2018 17:36:30 -0400
changeset 421027 1d38a4cf5a4a7e54adbdb5ffa31c944e41e27e18
parent 382296 c6d94140d11b651cae7bdf8b44ddc028ebea94eb
child 440551 84e2040e592add53094c718a6d766d9559ab2498
permissions -rw-r--r--
Bug 1462784 - Remove EVENTS category. r=njn Categories are useful to indicate: This much % of time was spent in this category. The EVENTS category isn't a very good match for this. This category is currently only set on labels of functions that handle the processing of an event. But those functions are usually closer to the base of the stack, and the actual CPU work during the processing of an event is usually in another category closer to the top of the stack, e.g. in JS if we're running an event handler, or in LAYOUT if we're hit testing the position of the event. This changeset removes the EVENTS category and replaces all uses of it with the OTHER category. MozReview-Commit-ID: JPm5hQiBkvp

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this,
# file, You can obtain one at

from __future__ import absolute_import, print_function, unicode_literals

from mach.decorators import (

from mach.base import (

class CompareLocales(object):
    """Run compare-locales."""

    @Command('compare-locales', category='testing',
             description='Run source checks on a localization.')
    @CommandArgument('config_paths', metavar='l10n.toml', nargs='+',
                     help='TOML or INI file for the project')
    @CommandArgument('l10n_base_dir', metavar='l10n-base-dir',
                     help='Parent directory of localizations')
    @CommandArgument('locales', nargs='*', metavar='locale-code',
                     help='Locale code and top-level directory of '
                          'each localization')
    @CommandArgument('-m', '--merge',
                     help='''Use this directory to stage merged files''')
    @CommandArgument('-D', action='append', metavar='var=value',
                     default=[], dest='defines',
                     help='Overwrite variables in TOML files')
    @CommandArgument('--unified', action="store_true",
                     help="Show output for all projects unified")
    @CommandArgument('--full', action="store_true",
                     help="Compare projects that are disabled")
    def compare(self, **kwargs):
        from compare_locales.commands import CompareLocales

        class ErrorHelper(object):
            '''Dummy ArgumentParser to marshall compare-locales
            commandline errors to mach exceptions.
            def error(self, msg):
                raise FailedCommandError(msg)

            def exit(self, message=None, status=0):
                raise FailedCommandError(message, exit_code=status)

        cmd = CompareLocales()
        cmd.parser = ErrorHelper()
        return cmd.handle(**kwargs)