[PATCH] hgweb: display difference for a changeset against any parents (issue2810)

Matt Mackall mpm at selenic.com
Tue Nov 27 00:41:52 CST 2012


On Tue, 2012-11-27 at 05:51 +0000, Weiwen Liu wrote:
> I try out a small change to convert generator to list, and it works:
> 	return tmpl('changeset',
> 	...
> 	parent=list(webutil.parents(ctx)),
> 
> Since we have at most 2 parents, memory consumption is not a concern.
> This change allows us to not pass a datum to template, but the style is
> different from generator usage in the code base.
>
> Matt, if you think this is the appropriate way, I can go ahead with a new
> diff submission.

No, please change the template engine.

> >>http://www.selenic.com/hg/file/d0d99c8bdf51/mercurial/templater.py#l137

When the templater looks up a symbol, it has the opportunity to expect
the value (named v here), and if its an iterator rather than a list,
convert it to a list.

Then:

a) unused symbols won't ever even be generated by their generators
b) we only have to fix the code in one place

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list