Mercurial > hg
changeset 17630:ff5ed1ecd43a
formatter: improve implementation of data method
This alternate syntax was proposed by Bryan O'Sullivan in a review of
772b3764d3e8. I haven't been able to measure any particular performance
difference, but the new syntax is more concise and easier to read.
author | David M. Carr <david@carrclan.us> |
---|---|
date | Thu, 20 Sep 2012 23:30:59 -0400 |
parents | 331d611813ec |
children | 0b241d7a8c62 |
files | mercurial/formatter.py |
diffstat | 1 files changed, 1 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/formatter.py Wed Sep 19 09:38:51 2012 -0700 +++ b/mercurial/formatter.py Thu Sep 20 23:30:59 2012 -0400 @@ -26,8 +26,7 @@ self._item = {} def data(self, **data): '''insert data into item that's not shown in default output''' - for k, v in data.iteritems(): - self._item[k] = v + self._item.update(data) def write(self, fields, deftext, *fielddata, **opts): '''do default text output while assigning data to item''' for k, v in zip(fields.split(), fielddata):