blackbox: remove redundant check for unassigned repo
authorYuya Nishihara <yuya@tcha.org>
Sun, 11 Nov 2018 16:34:49 +0900
changeset 40674 5bd3d6b264c1
parent 40673 ab59cc71f80c
child 40675 345cdb93851b
blackbox: remove redundant check for unassigned repo Since ui._bbvfs is looked through ui._bbrepo, the repo instance should exist if ui._bbvfs isn't None.
hgext/blackbox.py
--- a/hgext/blackbox.py	Wed Nov 14 10:15:28 2018 -0500
+++ b/hgext/blackbox.py	Sun Nov 11 16:34:49 2018 +0900
@@ -169,9 +169,9 @@
             if not vfs:
                 return
 
-            repo = getattr(ui, '_bbrepo', None)
-            if not lastui or repo:
-                lastui = ui
+            repo = ui._bbrepo
+            lastui = ui
+
             if getattr(ui, '_bbinlog', False):
                 # recursion and failure guard
                 return
@@ -184,13 +184,12 @@
             formattedmsg = msg[0] % msg[1:]
             rev = '(unknown)'
             changed = ''
-            if repo:
-                ctx = repo[None]
-                parents = ctx.parents()
-                rev = ('+'.join([hex(p.node()) for p in parents]))
-                if (ui.configbool('blackbox', 'dirty') and
-                    ctx.dirty(missing=True, merge=False, branch=False)):
-                    changed = '+'
+            ctx = repo[None]
+            parents = ctx.parents()
+            rev = ('+'.join([hex(p.node()) for p in parents]))
+            if (ui.configbool('blackbox', 'dirty') and
+                ctx.dirty(missing=True, merge=False, branch=False)):
+                changed = '+'
             if ui.configbool('blackbox', 'logsource'):
                 src = ' [%s]' % event
             else: