blackbox: initialize repo attribute properly
authorYuya Nishihara <yuya@tcha.org>
Sun, 11 Nov 2018 17:24:28 +0900
changeset 40646 179c02baaa8c
parent 40645 fff3e213ace9
child 40647 6d9a87fb8c89
blackbox: initialize repo attribute properly And ditch the "bb" prefix as it's no longer a ui extension class.
hgext/blackbox.py
--- a/hgext/blackbox.py	Sun Nov 11 17:22:14 2018 +0900
+++ b/hgext/blackbox.py	Sun Nov 11 17:24:28 2018 +0900
@@ -129,14 +129,14 @@
 
 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 @@
         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 @@
             self._bbinlog = False
 
     def setrepo(self, repo):
-        self._bbrepo = repo
+        self._repo = repo
 
 def wrapui(ui):
     class blackboxui(ui.__class__):