repoview: display stack trace along side the debug message
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sun, 17 Nov 2019 06:27:00 +0100
changeset 43755 d2a7f0aab540
parent 43754 02ededbef627
child 43756 3082ef682bc2
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
mercurial/repoview.py
--- 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)