##// END OF EJS Templates
blackbox: simplify ui states...
Jun Wu -
r34275:a37e18b5 default
parent child Browse files
Show More
@@ -75,24 +75,6 b' lastui = None'
75 75
76 76 def wrapui(ui):
77 77 class blackboxui(ui.__class__):
78 def __init__(self, src=None):
79 super(blackboxui, self).__init__(src)
80 if src is None:
81 self._partialinit()
82 else:
83 self._bbinlog = False
84 self._bbrepo = getattr(src, '_bbrepo', None)
85
86 def _partialinit(self):
87 if self._bbvfs:
88 return
89 self._bbinlog = False
90 self._bbrepo = None
91
92 def copy(self):
93 self._partialinit()
94 return self.__class__(self)
95
96 78 @property
97 79 def _bbvfs(self):
98 80 repo = getattr(self, '_bbrepo', None)
@@ -140,7 +122,6 b' def wrapui(ui):'
140 122 def log(self, event, *msg, **opts):
141 123 global lastui
142 124 super(blackboxui, self).log(event, *msg, **opts)
143 self._partialinit()
144 125
145 126 if not '*' in self.track and not event in self.track:
146 127 return
@@ -155,9 +136,10 b' def wrapui(ui):'
155 136
156 137 if not ui:
157 138 return
158 if not lastui or ui._bbrepo:
139 repo = getattr(ui, '_bbrepo', None)
140 if not lastui or repo:
159 141 lastui = ui
160 if ui._bbinlog:
142 if getattr(ui, '_bbinlog', False):
161 143 # recursion and failure guard
162 144 return
163 145 try:
@@ -169,8 +151,8 b' def wrapui(ui):'
169 151 formattedmsg = msg[0] % msg[1:]
170 152 rev = '(unknown)'
171 153 changed = ''
172 if ui._bbrepo:
173 ctx = ui._bbrepo[None]
154 if repo:
155 ctx = repo[None]
174 156 parents = ctx.parents()
175 157 rev = ('+'.join([hex(p.node()) for p in parents]))
176 158 if (ui.configbool('blackbox', 'dirty') and
@@ -196,7 +178,6 b' def wrapui(ui):'
196 178 pass
197 179
198 180 def setrepo(self, repo):
199 self._bbinlog = False
200 181 self._bbrepo = repo
201 182
202 183 ui.__class__ = blackboxui
General Comments 0
You need to be logged in to leave comments. Login now