Patchwork [4,of,8] blackbox: initialize repo attribute properly

login
register
mail settings
Submitter Yuya Nishihara
Date Nov. 15, 2018, 1:02 p.m.
Message ID <2d05663583476bed5a90.1542286965@mimosa>
Download mbox | patch
Permalink /patch/36607/
State Accepted
Headers show

Comments

Yuya Nishihara - Nov. 15, 2018, 1:02 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1541924668 -32400
#      Sun Nov 11 17:24:28 2018 +0900
# Node ID 2d05663583476bed5a907d5c39f2850730c6e5b0
# Parent  acb592903d0e8062e0a2e8a5409bf9fe3262845f
blackbox: initialize repo attribute properly

And ditch the "bb" prefix as it's no longer a ui extension class.

Patch

diff --git a/hgext/blackbox.py b/hgext/blackbox.py
--- a/hgext/blackbox.py
+++ b/hgext/blackbox.py
@@ -129,14 +129,14 @@  def _openlogfile(ui, vfs):
 
 class blackboxlogger(object):
     def __init__(self, ui):
+        self._repo = None
         self.track = ui.configlist('blackbox', 'track')
 
     @property
     def _bbvfs(self):
         vfs = None
-        repo = getattr(self, '_bbrepo', None)
-        if repo:
-            vfs = repo.vfs
+        if self._repo:
+            vfs = self._repo.vfs
             if not vfs.isdir('.'):
                 vfs = None
         return vfs
@@ -169,7 +169,7 @@  class blackboxlogger(object):
         formattedmsg = msg[0] % msg[1:]
         rev = '(unknown)'
         changed = ''
-        ctx = self._bbrepo[None]
+        ctx = self._repo[None]
         parents = ctx.parents()
         rev = ('+'.join([hex(p.node()) for p in parents]))
         if (ui.configbool('blackbox', 'dirty') and
@@ -193,7 +193,7 @@  class blackboxlogger(object):
             self._bbinlog = False
 
     def setrepo(self, repo):
-        self._bbrepo = repo
+        self._repo = repo
 
 def wrapui(ui):
     class blackboxui(ui.__class__):