# HG changeset patch # User Yuya Nishihara # Date 1541921689 -32400 # Node ID 5bd3d6b264c1912b150d64ed769b38b63b15424d # Parent ab59cc71f80ca0f59cc29fa8b48ff989dfaeeea6 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. diff -r ab59cc71f80c -r 5bd3d6b264c1 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: