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

Piotr Listkiewicz piotr.listkiewicz at gmail.com
Wed Sep 23 04:00:30 CDT 2015


>
> It seems you missed the point of fm.condwrite(). It does
>  - print if condition met in plain output
>  - assign variable to JSON or templated formatter unconditionally, which
>    allows us to use that variable in template if we want


You were right, i totally missed the point :P I suppressed it in
machine-readable and templated output using fm.plain() as You suggested in
Patch V3.

No whitespace, no uppercase letter, and perhaps no underscore. They should
> look like template keywords.


Changed as requested in Patch V3

I think the simplest way is to print the original space-separated testedwith
> string. If you don't like it, you can use fm.plain() and fm.data().


In V3 it prints space separated testedwith versions as string

2015-09-23 5:40 GMT+02:00 Yuya Nishihara <yuya at tcha.org>:

> On Tue, 22 Sep 2015 21:37:20 +0200, Piotr Listkiewicz wrote:
> > > This 'tested with' field will be overwritten by the subsequent
> condwrite().
> > > We could
> > >  a) suppress it in machine-readable and templated output: use
> fm.plain()
> > >  b) or give different field name
> >
> >  It won't, for verbose it will only be written by fm.condwrite , for
> > normal(not verbose and not quiet) it will only be written in if stm and
> for
> > quiet it will not be written.
>
> It seems you missed the point of fm.condwrite(). It does
>
>  - print if condition met in plain output
>  - assign variable to JSON or templated formatter unconditionally, which
>    allows us to use that variable in template if we want
>
> For details, see formatter.py, e8075329c5fb, the wiki page, etc.
>
> https://mercurial.selenic.com/wiki/GenericTemplatingPlan
>
> > It should be something like this:
> > >   fm.condwrite(ui.verbose and extbuglink, 'buglink',
> > >                _('  bug reporting: %s\n'), extbuglink)
> > > because
> > >  - we probably don't want to see raw representation like "None" in
> plain
> > > output
> > >  - plain output should be translated, so wrap it by _()
> > >  - field names are space-separated list, and they are used as template
> > > keywords,
> > >    e.g. -T '{name} ({testedwith})\n  <{buglink}>\n'
> >
> > So field names should not have space inside?
>
> No whitespace, no uppercase letter, and perhaps no underscore. They should
> look like template keywords.
>
> > > Can we avoid raw list representation "['...']" ?
> >
> > How it should look like instead? I added in formatter._jsonifyobj case
> for
> > showing the list same way at it shows tuple in this patch and from there
> it
> > is not problem for changing how the list is shown. What would you suggest
> > to do?
>
> I think the simplest way is to print the original space-separated
> testedwith
> string. If you don't like it, you can use fm.plain() and fm.data().
>
> FWIW, I didn't add isinstance(v, list) to _jsonifyobj at 17eeda31e52b
> because
> a list is mutable, but that isn't important.
>
> Regards,
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20150923/9599f637/attachment.html>


More information about the Mercurial-devel mailing list