##// END OF EJS Templates
blackbox: defer opening a log file until needed (issue3869)...
Bryan O'Sullivan -
r18831:17f6644a default
parent child Browse files
Show More
@@ -47,6 +47,15 b' def wrapui(ui):'
47
47
48 if util.safehasattr(self, '_blackbox'):
48 if util.safehasattr(self, '_blackbox'):
49 blackbox = self._blackbox
49 blackbox = self._blackbox
50 elif util.safehasattr(self, '_bbopener'):
51 try:
52 self._blackbox = self._bbopener('blackbox.log', 'a')
53 except (IOError, OSError), err:
54 self.debug('warning: cannot write to blackbox.log: %s\n' %
55 err.strerror)
56 del self._bbopener
57 self._blackbox = None
58 blackbox = self._blackbox
50 else:
59 else:
51 # certain ui instances exist outside the context of
60 # certain ui instances exist outside the context of
52 # a repo, so just default to the last blackbox that
61 # a repo, so just default to the last blackbox that
@@ -65,12 +74,7 b' def wrapui(ui):'
65 lastblackbox = blackbox
74 lastblackbox = blackbox
66
75
67 def setrepo(self, repo):
76 def setrepo(self, repo):
68 try:
77 self._bbopener = repo.opener
69 self._blackbox = repo.opener('blackbox.log', 'a')
70 except (IOError, OSError), err:
71 self.debug('warning: cannot write to blackbox.log: %s\n' %
72 err.strerror)
73 self._blackbox = None
74
78
75 ui.__class__ = blackboxui
79 ui.__class__ = blackboxui
76
80
General Comments 0
You need to be logged in to leave comments. Login now