Patchwork [3,of,3,V2] template: change extras to use showlist rather than manual templ call

login
register
mail settings
Submitter Matthew Turk
Date Nov. 15, 2013, 11:14 p.m.
Message ID <9ce53de39ab39b05658d.1384557264@ridcully>
Download mbox | patch
Permalink /patch/2957/
State Superseded
Headers show

Comments

Matthew Turk - Nov. 15, 2013, 11:14 p.m.
# HG changeset patch
# User Matthew Turk <matthewturk@gmail.com>
# Date 1384556930 18000
#      Fri Nov 15 18:08:50 2013 -0500
# Node ID 9ce53de39ab39b05658d618bc584ab3b1610386a
# Parent  b69f7178f1da0a7dda97a6d5c8ccbf138579a73e
template: change extras to use showlist rather than manual templ call.

This enables start_extras and end_extras in template maps.
Augie Fackler - Nov. 16, 2013, 5:45 p.m.
On Fri, Nov 15, 2013 at 06:14:24PM -0500, Matthew Turk wrote:
> # HG changeset patch
> # User Matthew Turk <matthewturk@gmail.com>
> # Date 1384556930 18000
> #      Fri Nov 15 18:08:50 2013 -0500
> # Node ID 9ce53de39ab39b05658d618bc584ab3b1610386a
> # Parent  b69f7178f1da0a7dda97a6d5c8ccbf138579a73e
> template: change extras to use showlist rather than manual templ call.

Queued, thanks

>
> This enables start_extras and end_extras in template maps.
>
> diff -r b69f7178f1da -r 9ce53de39ab3 mercurial/templatekw.py
> --- a/mercurial/templatekw.py	Fri Nov 15 18:09:02 2013 -0500
> +++ b/mercurial/templatekw.py	Fri Nov 15 18:08:50 2013 -0500
> @@ -221,11 +221,8 @@
>  def showextras(**args):
>      """:extras: List of dicts with key, value entries of the 'extras'
>      field of this changeset."""
> -    templ = args['templ']
> -    for key, value in sorted(args['ctx'].extra().items()):
> -        args = args.copy()
> -        args.update(dict(key=key, value=value))
> -        yield templ('extra', **args)
> +    yield showlist('extra', sorted(dict(key=a, value=b)
> +                   for (a, b) in args['ctx'].extra().items()), **args)
>
>  def showfileadds(**args):
>      """:file_adds: List of strings. Files added by this changeset."""
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff -r b69f7178f1da -r 9ce53de39ab3 mercurial/templatekw.py
--- a/mercurial/templatekw.py	Fri Nov 15 18:09:02 2013 -0500
+++ b/mercurial/templatekw.py	Fri Nov 15 18:08:50 2013 -0500
@@ -221,11 +221,8 @@ 
 def showextras(**args):
     """:extras: List of dicts with key, value entries of the 'extras'
     field of this changeset."""
-    templ = args['templ']
-    for key, value in sorted(args['ctx'].extra().items()):
-        args = args.copy()
-        args.update(dict(key=key, value=value))
-        yield templ('extra', **args)
+    yield showlist('extra', sorted(dict(key=a, value=b)
+                   for (a, b) in args['ctx'].extra().items()), **args)
 
 def showfileadds(**args):
     """:file_adds: List of strings. Files added by this changeset."""