Mercurial > public > mercurial-scm > hg
comparison mercurial/statprof.py @ 48481:c1fe758c1530
statprof: convert a few exception byte strings to str
That way these display without the b'' prefix.
Differential Revision: https://phab.mercurial-scm.org/D11920
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Mon, 13 Dec 2021 17:59:36 -0500 |
parents | 8b0a3ff5ed12 |
children | d2fff292c265 |
comparison
equal
deleted
inserted
replaced
48480:cfb4f1dee978 | 48481:c1fe758c1530 |
---|---|
514 elif format == DisplayFormats.Json: | 514 elif format == DisplayFormats.Json: |
515 write_to_json(data, fp) | 515 write_to_json(data, fp) |
516 elif format == DisplayFormats.Chrome: | 516 elif format == DisplayFormats.Chrome: |
517 write_to_chrome(data, fp, **kwargs) | 517 write_to_chrome(data, fp, **kwargs) |
518 else: | 518 else: |
519 raise Exception(b"Invalid display format") | 519 raise Exception("Invalid display format") |
520 | 520 |
521 if format not in (DisplayFormats.Json, DisplayFormats.Chrome): | 521 if format not in (DisplayFormats.Json, DisplayFormats.Chrome): |
522 fp.write(b'---\n') | 522 fp.write(b'---\n') |
523 fp.write(b'Sample count: %d\n' % len(data.samples)) | 523 fp.write(b'Sample count: %d\n' % len(data.samples)) |
524 fp.write(b'Total time: %f seconds (%f wall)\n' % data.accumulated_time) | 524 fp.write(b'Total time: %f seconds (%f wall)\n' % data.accumulated_time) |
623 fp.write(b'%33.0f%% %6.2f line %d: %s\n' % stattuple) | 623 fp.write(b'%33.0f%% %6.2f line %d: %s\n' % stattuple) |
624 | 624 |
625 | 625 |
626 def display_about_method(data, fp, function=None, **kwargs): | 626 def display_about_method(data, fp, function=None, **kwargs): |
627 if function is None: | 627 if function is None: |
628 raise Exception(b"Invalid function") | 628 raise Exception("Invalid function") |
629 | 629 |
630 filename = None | 630 filename = None |
631 if b':' in function: | 631 if b':' in function: |
632 filename, function = function.split(b':') | 632 filename, function = function.split(b':') |
633 | 633 |
1078 displayargs[b'scriptpath'] = value | 1078 displayargs[b'scriptpath'] = value |
1079 elif o in ("-h", "help"): | 1079 elif o in ("-h", "help"): |
1080 printusage() | 1080 printusage() |
1081 return 0 | 1081 return 0 |
1082 else: | 1082 else: |
1083 assert False, b"unhandled option %s" % o | 1083 assert False, "unhandled option %s" % o |
1084 | 1084 |
1085 if not path: | 1085 if not path: |
1086 print('must specify --file to load') | 1086 print('must specify --file to load') |
1087 return 1 | 1087 return 1 |
1088 | 1088 |