D652: blackbox: simplify ui states
quark (Jun Wu)
phabricator at mercurial-scm.org
Wed Sep 20 13:02:23 UTC 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGa37e18b5f055: blackbox: simplify ui states (authored by quark, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D652?vs=1878&id=1920
REVISION DETAIL
https://phab.mercurial-scm.org/D652
AFFECTED FILES
hgext/blackbox.py
CHANGE DETAILS
diff --git a/hgext/blackbox.py b/hgext/blackbox.py
--- a/hgext/blackbox.py
+++ b/hgext/blackbox.py
@@ -75,24 +75,6 @@
def wrapui(ui):
class blackboxui(ui.__class__):
- def __init__(self, src=None):
- super(blackboxui, self).__init__(src)
- if src is None:
- self._partialinit()
- else:
- self._bbinlog = False
- self._bbrepo = getattr(src, '_bbrepo', None)
-
- def _partialinit(self):
- if self._bbvfs:
- return
- self._bbinlog = False
- self._bbrepo = None
-
- def copy(self):
- self._partialinit()
- return self.__class__(self)
-
@property
def _bbvfs(self):
repo = getattr(self, '_bbrepo', None)
@@ -140,7 +122,6 @@
def log(self, event, *msg, **opts):
global lastui
super(blackboxui, self).log(event, *msg, **opts)
- self._partialinit()
if not '*' in self.track and not event in self.track:
return
@@ -155,9 +136,10 @@
if not ui:
return
- if not lastui or ui._bbrepo:
+ repo = getattr(ui, '_bbrepo', None)
+ if not lastui or repo:
lastui = ui
- if ui._bbinlog:
+ if getattr(ui, '_bbinlog', False):
# recursion and failure guard
return
try:
@@ -169,8 +151,8 @@
formattedmsg = msg[0] % msg[1:]
rev = '(unknown)'
changed = ''
- if ui._bbrepo:
- ctx = ui._bbrepo[None]
+ if repo:
+ ctx = repo[None]
parents = ctx.parents()
rev = ('+'.join([hex(p.node()) for p in parents]))
if (ui.configbool('blackbox', 'dirty') and
@@ -196,7 +178,6 @@
pass
def setrepo(self, repo):
- self._bbinlog = False
self._bbrepo = repo
ui.__class__ = blackboxui
To: quark, #hg-reviewers, durham, yuja
Cc: yuja, mercurial-devel
More information about the Mercurial-devel
mailing list