changeset 34123:50df6cf22717

blackbox: inline _bbwrite There is no need to make it a separate method. This makes the next change easier to read. Differential Revision: https://phab.mercurial-scm.org/D649
author Jun Wu <quark@fb.com>
date Wed, 06 Sep 2017 20:54:53 -0700
parents 4f60720cf0df
children cf04db16f583
files hgext/blackbox.py
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/blackbox.py	Wed Sep 06 19:27:30 2017 -0700
+++ b/hgext/blackbox.py	Wed Sep 06 20:54:53 2017 -0700
@@ -135,10 +135,6 @@
                                newpath=maxfiles > 0 and path + '.1')
             return self._bbvfs(name, 'a')
 
-        def _bbwrite(self, fmt, *args):
-            self._bbfp.write(fmt % args)
-            self._bbfp.flush()
-
         def log(self, event, *msg, **opts):
             global lastui
             super(blackboxui, self).log(event, *msg, **opts)
@@ -192,8 +188,11 @@
                 else:
                     src = ''
                 try:
-                    ui._bbwrite('%s %s @%s%s (%s)%s> %s',
-                        date, user, rev, changed, pid, src, formattedmsg)
+                    fp = ui._bbfp
+                    fmt = '%s %s @%s%s (%s)%s> %s'
+                    args = (date, user, rev, changed, pid, src, formattedmsg)
+                    fp.write(fmt % args)
+                    fp.flush()
                 except IOError as err:
                     self.debug('warning: cannot write to blackbox.log: %s\n' %
                                err.strerror)