1. mirror
  2. mercurial-crew


David Carr  committed ff5ed1e

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.

  • Participants
  • Parent commits 331d611
  • Branches default

Comments (0)

Files changed (1)

File mercurial/formatter.py

View file
  • Ignore whitespace
         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):