Patchwork D7477: util: add an optional `prefix` argument to debugstacktrace

login
register
mail settings
Submitter phabricator
Date Nov. 23, 2019, 4:07 a.m.
Message ID <da472cf1ce2e6166e29bb6f2556c2f28@localhost.localdomain>
Download mbox | patch
Permalink /patch/43459/
State Not Applicable
Headers show

Comments

phabricator - Nov. 23, 2019, 4:07 a.m.
Closed by commit rHG6301ea7a26b6: util: add an optional `prefix` argument to debugstacktrace (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7477?vs=18284&id=18329

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7477/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7477

AFFECTED FILES
  mercurial/util.py

CHANGE DETAILS




To: marmoute, #hg-reviewers, indygreg
Cc: mercurial-devel

Patch

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -3466,6 +3466,7 @@ 
     f=procutil.stderr,
     otherf=procutil.stdout,
     depth=0,
+    prefix=b'',
 ):
     '''Writes a message to f (stderr) with a nicely formatted stacktrace.
     Skips the 'skip' entries closest to the call, then show 'depth' entries.
@@ -3475,9 +3476,9 @@ 
     '''
     if otherf:
         otherf.flush()
-    f.write(b'%s at:\n' % msg.rstrip())
+    f.write(b'%s%s at:\n' % (prefix, msg.rstrip()))
     for line in getstackframes(skip + 1, depth=depth):
-        f.write(line)
+        f.write(prefix + line)
     f.flush()