[PATCH RFC] formatter: convert identify command

Matt Mackall mpm at selenic.com
Sat Sep 15 11:41:22 CDT 2012


On Tue, 2012-09-11 at 21:26 -0400, David Carr wrote:
> # HG changeset patch
> # User David M. Carr  <david at carrclan.us>
> # Date 1347413070 14400
> # Node ID f16835267ff0075424d56db9aa210ef60fd578f8
> # Parent  ba61e84ff4ce474366294df7cd3a1d6b8b5132d5
> formatter: convert identify command
> 
> This is an attempt at converting the identify command to use the formatter,
> towards "generic templating".  It was based on mpm's example in 68007f0557de.
> After this change, identify should produce identical output unless a non-default
> formatter is used.

Thanks for looking into this!

There's one philosophical point I don't think I've spelled out
elsewhere: much like revsets obsolete most of the option switches in log
(and many other places), display switches are obsoleted by generic
templating. In other words, a template should have potential access to
all the relevant data, regardless of the display switches.

That means when something isn't shown in the plain view (because it's
either off by default or the verbosity is too low or a switch turned it
off), you should pass that field to formatter anyway (with data()).

>          elif default and not ui.quiet:
>              # multiple bookmarks for a single parent separated by '/'
>              bm = '/'.join(getbms())
>              if bm:
> -                output.append(bm)
> +                fields.append('bookmarks')
> +                fieldvalues.append(bm)

Hmmm. I think we want to present this sort of thing as a list.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list