##// 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 def wrapui(ui):
76 def wrapui(ui):
77 class blackboxui(ui.__class__):
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 @property
78 @property
97 def _bbvfs(self):
79 def _bbvfs(self):
98 repo = getattr(self, '_bbrepo', None)
80 repo = getattr(self, '_bbrepo', None)
@@ -140,7 +122,6 b' def wrapui(ui):'
140 def log(self, event, *msg, **opts):
122 def log(self, event, *msg, **opts):
141 global lastui
123 global lastui
142 super(blackboxui, self).log(event, *msg, **opts)
124 super(blackboxui, self).log(event, *msg, **opts)
143 self._partialinit()
144
125
145 if not '*' in self.track and not event in self.track:
126 if not '*' in self.track and not event in self.track:
146 return
127 return
@@ -155,9 +136,10 b' def wrapui(ui):'
155
136
156 if not ui:
137 if not ui:
157 return
138 return
158 if not lastui or ui._bbrepo:
139 repo = getattr(ui, '_bbrepo', None)
140 if not lastui or repo:
159 lastui = ui
141 lastui = ui
160 if ui._bbinlog:
142 if getattr(ui, '_bbinlog', False):
161 # recursion and failure guard
143 # recursion and failure guard
162 return
144 return
163 try:
145 try:
@@ -169,8 +151,8 b' def wrapui(ui):'
169 formattedmsg = msg[0] % msg[1:]
151 formattedmsg = msg[0] % msg[1:]
170 rev = '(unknown)'
152 rev = '(unknown)'
171 changed = ''
153 changed = ''
172 if ui._bbrepo:
154 if repo:
173 ctx = ui._bbrepo[None]
155 ctx = repo[None]
174 parents = ctx.parents()
156 parents = ctx.parents()
175 rev = ('+'.join([hex(p.node()) for p in parents]))
157 rev = ('+'.join([hex(p.node()) for p in parents]))
176 if (ui.configbool('blackbox', 'dirty') and
158 if (ui.configbool('blackbox', 'dirty') and
@@ -196,7 +178,6 b' def wrapui(ui):'
196 pass
178 pass
197
179
198 def setrepo(self, repo):
180 def setrepo(self, repo):
199 self._bbinlog = False
200 self._bbrepo = repo
181 self._bbrepo = repo
201
182
202 ui.__class__ = blackboxui
183 ui.__class__ = blackboxui
General Comments 0
You need to be logged in to leave comments. Login now