repoview: display stack trace along side the debug message
When a filter computation is triggered, If --traceback is provided, we will
display a traceback in addition to the debug message.
Differential Revision: https://phab.mercurial-scm.org/D7478
--- a/mercurial/repoview.py Sun Nov 17 06:26:41 2019 +0100
+++ b/mercurial/repoview.py Sun Nov 17 06:27:00 2019 +0100
@@ -218,8 +218,18 @@
cache it's result"""
if filtername not in repo.filteredrevcache:
if repo.ui.configbool(b'devel', b'debug.repo-filters'):
- msg = b'debug.filters: computing revision filter for "%s"\n'
- repo.ui.debug(msg % filtername)
+ msg = b'computing revision filter for "%s"'
+ msg %= filtername
+ if repo.ui.tracebackflag and repo.ui.debugflag:
+ # XXX use ui.write_err
+ util.debugstacktrace(
+ msg,
+ f=repo.ui._fout,
+ otherf=repo.ui._ferr,
+ prefix=b'debug.filters: ',
+ )
+ else:
+ repo.ui.debug(b'debug.filters: %s\n' % msg)
func = filtertable[filtername]
if visibilityexceptions:
return func(repo.unfiltered, visibilityexceptions)