json output using mercurial templates

Matthew Turk matthewturk at gmail.com
Mon Nov 29 18:35:51 CST 2010


On Mon, Nov 29, 2010 at 4:24 PM, Matt Mackall <mpm at selenic.com> wrote:
> On Mon, 2010-11-29 at 19:24 +0000, Matt Hawley wrote:
>> With the basic conditionals what were you thinking? We'd love to adopt
>> this for doing easy paging via the CodePlex web site vs the manual
>> manipulation we currently do of hg.exe.
>
> Well the big piece is having some if a = b then template x else template
> y.
>
> But paging is probably best done on objects. For instance, rather than
> exploding repo objects out to lists of dicts of changeset attributes, we
> could simply expose a "repo" object to the templater that acted like a
> list of context objects. Python-speak would be something like:
>
> for x in range(pager(position)):
>   showtemplate(repo[x], "{x.author}: {x.description|firstline}")
>
> Translating that into template-speak might look like:
>
> apply(x, repo, pager(position), "{x.author}: {x.description|firstline}")

On a possibly related note, with these modifications would it be
possible to be able to pull config options from a repo object during
the templating stage?  For instance, per-repository supplemental
fields in the .hg/hgrc of a repository, describing license, maybe even
URLs?  As it stands, I know that these can be fed in through (for
instance) modifications to hgweb.py, but would it be viable to have
this exposed somehow during templating?

Best,

Matt

>
> --
> Mathematics is the supreme nostalgia of our time.
>
>
> _______________________________________________
> Mercurial mailing list
> Mercurial at selenic.com
> http://selenic.com/mailman/listinfo/mercurial
>


More information about the Mercurial mailing list