[PATCH V4] mercurial: add debugextensions command (issue4676)

Yuya Nishihara yuya at tcha.org
Thu Sep 24 08:05:12 CDT 2015


On Wed, 23 Sep 2015 23:32:25 +0200, liscju wrote:
> # HG changeset patch
> # User liscju <piotr.listkiewicz at gmail.com>
> # Date 1441896787 -7200
> #      Thu Sep 10 16:53:07 2015 +0200
> # Node ID 682511eeaa61ac914e2455bc1dddf1c41211bfd1
> # Parent  ea489d94e1dc1fc3dc1dcbef1c86c18c49605ed1
> mercurial: add debugextensions command (issue4676)

> + at command('debugextensions', formatteropts, [], norepo=True)
> +def debugextensions(ui, **opts):
> +    '''show information about active extensions'''
> +    exts = extensions.extensions(ui)
> +    fm = ui.formatter('debugextensions', opts)
> +    for extname, extmod in sorted(exts, key=operator.itemgetter(0)):
> +        extsource = extmod.__file__
> +        exttestedwith = getattr(extmod, 'testedwith', None)
> +        if exttestedwith is not None:
> +            exttestedwith = exttestedwith.split()
> +        extbuglink = getattr(extmod, 'buglink', None)
> +
> +        fm.startitem()
> +
> +        if ui.quiet or ui.verbose:
> +            fm.write('name', '%s\n', extname)
> +        else:
> +            fm.write('name', '%s', extname)
> +            if not exttestedwith:
> +                fm.plain(_(' (untested!)\n'))
> +            else:
> +                if exttestedwith == ['internal'] or \
> +                                util.version() in exttestedwith:
> +                    fm.plain('\n')
> +                else:
> +                    lasttestedversion = exttestedwith[-1]
> +                    fm.plain(' (%s!)\n' % lasttestedversion)
> +
> +        fm.condwrite(ui.verbose and extsource, 'source',
> +                 _('  location: %s\n'), extsource)
> +
> +        fm.condwrite(ui.verbose and exttestedwith, 'testedwith',
> +                 _('  tested with: %s\n'), ' '.join(exttestedwith or []))

I might be too nitpicky, but why not use the original testedwith variable?

This patch does print '"buglink": null' if buglink isn't defined, but
'"testedwith": ""' if testedwith is undefined. It seems inconsistent.

> How many test case should i add: with mocked extensions with/without
> testedwith,with/without buglink etc or just for mocked extension without
> testedwith?

If I were you, I would add an extension that has no buglink nor testedwith,
and load it by extensions.foo=foo.py.
There's no branching for "buglink <op> testedwith".

Regards,


More information about the Mercurial-devel mailing list