D7477: util: add an optional `prefix` argument to debugstacktrace
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Fri Nov 22 09:20:13 UTC 2019
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
This is useful when using it in a specific context.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D7477
AFFECTED FILES
mercurial/util.py
CHANGE DETAILS
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()
To: marmoute, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list