changeset 43755:d2a7f0aab540

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
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 17 Nov 2019 06:27:00 +0100
parents 02ededbef627
children 3082ef682bc2
files mercurial/repoview.py
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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)