# HG changeset patch # User Matthew Turk # Date 2013-11-21 20:46:49 # Node ID de7e6c489412c6a1caec93ec23e37b8bab7e2a2f # Parent 04036798ebed0c6d7062517bb49b308a15e4345e template: modify showextras to return a hybrid This modifies slightly the behavior introduced in 519120a96c63 to allow showextras to return a hybrid, rather than showlist. The example in the template help file now executes and returns meaningful results. diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py --- a/mercurial/templatekw.py +++ b/mercurial/templatekw.py @@ -222,8 +222,10 @@ def showdiffstat(repo, ctx, templ, **arg def showextras(**args): """:extras: List of dicts with key, value entries of the 'extras' field of this changeset.""" - yield showlist('extra', sorted(dict(key=a, value=b) - for (a, b) in args['ctx'].extra().items()), **args) + extras = args['ctx'].extra() + c = [{'key': x[0], 'value': x[1]} for x in sorted(extras.items())] + f = _showlist('extra', c, plural='extras', **args) + return _hybrid(f, c, lambda x: '%s=%s' % (x['key'], x['value'])) def showfileadds(**args): """:file_adds: List of strings. Files added by this changeset."""