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

Piotr Listkiewicz piotr.listkiewicz at gmail.com
Thu Sep 24 08:32:18 CDT 2015


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


Right, i changed to show "" instead in PATCH V2. In json it seems more
reasonable, let me now what you think.

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


Original string value was split to be list of versions, thanks to that in
my view method is more readable. If You think otherwise i will change it, i
stay with this behaviour in PATCH V5 because now all values beside extname
are guarded to not show None value by:
value or ""
and it seems consistent

If I were you, I would add an extension that has no buglink nor testedwith,
> and load it by extensions.foo=foo.py.


Done this in PATCH V5

There's no branching for "buglink <op> testedwith".


I dont understand what you meant


2015-09-24 15:05 GMT+02:00 Yuya Nishihara <yuya at tcha.org>:

> 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,
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20150924/54209c7a/attachment.html>


More information about the Mercurial-devel mailing list