[PATCH 1 of 3] template: modify showextras to return a hybrid
Matthew Turk
matthewturk at gmail.com
Thu Nov 21 15:04:23 CST 2013
# HG changeset patch
# User Matthew Turk <matthewturk at gmail.com>
# Date 1385066809 18000
# Thu Nov 21 15:46:49 2013 -0500
# Node ID e4c89fff1cc57f532d43d0015445ab44a739f6d7
# Parent f8737bce736a6e8171ec955734aa6a19b8def074
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 -r f8737bce736a -r e4c89fff1cc5 mercurial/templatekw.py
--- a/mercurial/templatekw.py Mon Nov 11 16:35:12 2013 -0800
+++ b/mercurial/templatekw.py Thu Nov 21 15:46:49 2013 -0500
@@ -221,8 +221,10 @@
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."""
More information about the Mercurial-devel
mailing list