Patchwork [4,of,5] blackbox: inline temporary variables which are referenced only once

login
register
mail settings
Submitter Yuya Nishihara
Date Nov. 14, 2018, 1:32 p.m.
Message ID <3fd774814e7e80fbaaac.1542202361@mimosa>
Download mbox | patch
Permalink /patch/36576/
State Accepted
Headers show

Comments

Yuya Nishihara - Nov. 14, 2018, 1:32 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1541922270 -32400
#      Sun Nov 11 16:44:30 2018 +0900
# Node ID 3fd774814e7e80fbaaac3f6a610d49393d0444b5
# Parent  ac34d1daab7fddeafc6a9f171965f82c24c40759
blackbox: inline temporary variables which are referenced only once

Patch

diff --git a/hgext/blackbox.py b/hgext/blackbox.py
--- a/hgext/blackbox.py
+++ b/hgext/blackbox.py
@@ -165,9 +165,6 @@  def wrapui(ui):
             else:
                 return
 
-            vfs = ui._bbvfs
-            repo = ui._bbrepo
-
             if getattr(ui, '_bbinlog', False):
                 # recursion and failure guard
                 return
@@ -180,7 +177,7 @@  def wrapui(ui):
             formattedmsg = msg[0] % msg[1:]
             rev = '(unknown)'
             changed = ''
-            ctx = repo[None]
+            ctx = ui._bbrepo[None]
             parents = ctx.parents()
             rev = ('+'.join([hex(p.node()) for p in parents]))
             if (ui.configbool('blackbox', 'dirty') and
@@ -193,7 +190,7 @@  def wrapui(ui):
             try:
                 fmt = '%s %s @%s%s (%s)%s> %s'
                 args = (date, user, rev, changed, pid, src, formattedmsg)
-                with _openlogfile(ui, vfs) as fp:
+                with _openlogfile(ui, ui._bbvfs) as fp:
                     fp.write(fmt % args)
             except (IOError, OSError) as err:
                 self.debug('warning: cannot write to blackbox.log: %s\n' %