changeset 40196:2864f8d3fcd6

py3: use raw strings for stack names These are used for simple compares. We don't need to normalize to bytes. As part of this, I expanded a set literal so entries are 1 per line. Differential Revision: https://phab.mercurial-scm.org/D5013
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 12 Oct 2018 18:37:42 +0200
parents 720355c7b7c9
children 113adb1b3f24
files mercurial/statprof.py
diffstat 1 files changed, 17 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/statprof.py	Fri Oct 12 18:30:40 2018 +0200
+++ b/mercurial/statprof.py	Fri Oct 12 18:37:42 2018 +0200
@@ -125,13 +125,21 @@
 
 __all__ = ['start', 'stop', 'reset', 'display', 'profile']
 
-skips = {"util.py:check", "extensions.py:closure",
-         "color.py:colorcmd", "dispatch.py:checkargs",
-         "dispatch.py:<lambda>", "dispatch.py:_runcatch",
-         "dispatch.py:_dispatch", "dispatch.py:_runcommand",
-         "pager.py:pagecmd", "dispatch.py:run",
-         "dispatch.py:dispatch", "dispatch.py:runcommand",
-         "hg.py:<module>", "evolve.py:warnobserrors",
+skips = {
+    r"util.py:check",
+    r"extensions.py:closure",
+    r"color.py:colorcmd",
+    r"dispatch.py:checkargs",
+    r"dispatch.py:<lambda>",
+    r"dispatch.py:_runcatch",
+    r"dispatch.py:_dispatch",
+    r"dispatch.py:_runcommand",
+    r"pager.py:pagecmd",
+    r"dispatch.py:run",
+    r"dispatch.py:dispatch",
+    r"dispatch.py:runcommand",
+    r"hg.py:<module>",
+    r"evolve.py:warnobserrors",
 }
 
 ###########################################################################
@@ -647,7 +655,8 @@
             if len(stack) > 1:
                 i = 1
                 # Skip boiler plate parts of the stack
-                while i < len(stack) and '%s:%s' % (stack[i].filename(), stack[i].function) in skips:
+                name = r'%s:%s' % (stack[i].filename(), stack[i].function)
+                while i < len(stack) and name in skips:
                     i += 1
                 if i < len(stack):
                     child.add(stack[i:], time)