[PATCH 4 of 8] blackbox: initialize repo attribute properly

Yuya Nishihara yuya at tcha.org
Thu Nov 15 08:02:45 EST 2018


# HG changeset patch
# User Yuya Nishihara <yuya at 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.

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__):


More information about the Mercurial-devel mailing list