mercurial/statprof.py
changeset 46018 8b0a3ff5ed12
parent 46017 068307b638f4
child 48481 c1fe758c1530
--- a/mercurial/statprof.py	Wed Dec 02 15:38:05 2020 -0800
+++ b/mercurial/statprof.py	Wed Dec 02 12:33:51 2020 -0800
@@ -768,10 +768,18 @@
                 filename,
                 function,
             )
-            codepattern = b'%' + (b'%d' % (55 - len(liststring))) + b's %d:  %s'
+            # 4 to account for the word 'line'
+            spacing_len = max(4, 55 - len(liststring))
+            prefix = b''
+            if spacing_len == 4:
+                prefix = b', '
+
+            codepattern = b'%s%s %d: %s%s'
             codestring = codepattern % (
-                b'line',
+                prefix,
+                b'line'.rjust(spacing_len),
                 site.lineno,
+                b''.ljust(max(0, 4 - len(str(site.lineno)))),
                 site.getsource(30),
             )