Mercurial > hg
comparison mercurial/ui.py @ 40759:fdc6eb1d650d
blackbox: send debug message to logger by core ui
Since the core ui.log() may recurse into ui.log() through ui.debug(), it
must guard against recursion.
The ui extension class can finally be removed.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 11 Nov 2018 17:34:46 +0900 |
parents | 55b053af7196 |
children | ffd574c144d2 |
comparison
equal
deleted
inserted
replaced
40758:eb5948f29c60 | 40759:fdc6eb1d650d |
---|---|
1519 | 1519 |
1520 This adds an output label of "ui.debug". | 1520 This adds an output label of "ui.debug". |
1521 ''' | 1521 ''' |
1522 if self.debugflag: | 1522 if self.debugflag: |
1523 self._writemsg(self._fmsgout, type='debug', *msg, **opts) | 1523 self._writemsg(self._fmsgout, type='debug', *msg, **opts) |
1524 self.log(b'debug', b'%s', b''.join(msg)) | |
1524 | 1525 |
1525 def edit(self, text, user, extra=None, editform=None, pending=None, | 1526 def edit(self, text, user, extra=None, editform=None, pending=None, |
1526 repopath=None, action=None): | 1527 repopath=None, action=None): |
1527 if action is None: | 1528 if action is None: |
1528 self.develwarn('action is None but will soon be a required ' | 1529 self.develwarn('action is None but will soon be a required ' |
1738 return | 1739 return |
1739 activeloggers = [l for l in self._loggers.itervalues() | 1740 activeloggers = [l for l in self._loggers.itervalues() |
1740 if l.tracked(event)] | 1741 if l.tracked(event)] |
1741 if not activeloggers: | 1742 if not activeloggers: |
1742 return | 1743 return |
1743 for logger in activeloggers: | 1744 # guard against recursion from e.g. ui.debug() |
1744 logger.log(self, event, msg, opts) | 1745 registeredloggers = self._loggers |
1746 self._loggers = {} | |
1747 try: | |
1748 for logger in activeloggers: | |
1749 logger.log(self, event, msg, opts) | |
1750 finally: | |
1751 self._loggers = registeredloggers | |
1745 | 1752 |
1746 def label(self, msg, label): | 1753 def label(self, msg, label): |
1747 '''style msg based on supplied label | 1754 '''style msg based on supplied label |
1748 | 1755 |
1749 If some color mode is enabled, this will add the necessary control | 1756 If some color mode is enabled, this will add the necessary control |