[PATCH] hgweb: display difference for a changeset against any parents (issue2810)
Weiwen Liu
weiwen at fb.com
Wed Nov 28 17:56:26 CST 2012
Matt has taken the generator->list patch into his branch. Thanks!
On the question about 'originalnode':
I'd like to display rev/y:x, where y is the original node, and x is one of its parents. while processing
{parent%changesetbaseline},
changesetbaseline = '<a href="{url}rev/{originalnode|short}:{node|short}{sessionvars%urlparameter}">{node|short} </a> '
the template engine overwrites template variable 'node' with its parent node value, so by the time we try to display rev/y:x, we only know x, but not y.
Is there another way to retrieve y?
________________________________________
From: Matt Mackall [mpm at selenic.com]
Sent: Wednesday, November 28, 2012 2:27 PM
To: Weiwen Liu
Cc: Bryan O'Sullivan; mercurial-devel
Subject: RE: [PATCH] hgweb: display difference for a changeset against any parents (issue2810)
On Tue, 2012-11-27 at 21:29 +0000, Weiwen Liu wrote:
> --- a/mercurial/templater.py
> +++ b/mercurial/templater.py
> @@ -8,6 +8,7 @@
> from i18n import _
> import sys, os, re
> import util, config, templatefilters, parser, error
> +import types
>
> # template parsing
>
> @@ -140,6 +141,10 @@
> v = context._defaults.get(key, '')
> if util.safehasattr(v, '__call__'):
> return v(**mapping)
> + if isinstance(v, types.GeneratorType):
> + v = list(v)
> + mapping[key] = v
> + return v
> return v
>
> def buildfilter(exp, context):
This should be its own preliminary patch. One change per patch.
> @@ -179,6 +184,7 @@
> for i in d:
> if isinstance(i, dict):
> lm.update(i)
> + lm['originalnode'] = mapping.get('node')
??
This looks like debug code. The templater code should not know about
'nodes'.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list