Mercurial > hg
changeset 43754:02ededbef627
util: add an optional `prefix` argument to debugstacktrace
This is useful when using it in a specific context.
Differential Revision: https://phab.mercurial-scm.org/D7477
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 17 Nov 2019 06:26:41 +0100 |
parents | 2276a9a1c037 |
children | d2a7f0aab540 |
files | mercurial/util.py |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/util.py Sun Nov 17 05:32:38 2019 +0100 +++ b/mercurial/util.py Sun Nov 17 06:26:41 2019 +0100 @@ -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()