[PATCH 1 of 2] statprof: cleanup string construction

Yuya Nishihara yuya at tcha.org
Mon Jul 16 05:44:09 EDT 2018


On Mon, 16 Jul 2018 10:59:57 +0200, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld at octobus.net>
> # Date 1527845766 -7200
> #      Fri Jun 01 11:36:06 2018 +0200
> # Node ID eabea66333aa934d8a8f0fc68633a72623a0864b
> # Parent  3700564c63fee7b26ca948e75dee2ea631b1dd4e
> # EXP-Topic cleanupstat
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r eabea66333aa
> statprof: cleanup string construction
> 
> Use string substitutions instead of string additions.
> 
> diff --git a/mercurial/statprof.py b/mercurial/statprof.py
> --- a/mercurial/statprof.py
> +++ b/mercurial/statprof.py
> @@ -356,7 +356,7 @@ def save_data(path):
>              stack = sample.stack
>              sites = ['\1'.join([s.path, str(s.lineno), s.function])
>                       for s in stack]
> -            file.write(time + '\0' + '\0'.join(sites) + '\n')
> +            file.write("%s\05%s\n" % (time, '\0'.join(sites)))

\05 ?


More information about the Mercurial-devel mailing list