Patchwork [2,of,2] statprof: small if cleanup

login
register
mail settings
Submitter Boris Feld
Date July 16, 2018, 8:59 a.m.
Message ID <e97a69d13f38cbb4389f.1531731598@FB-lair>
Download mbox | patch
Permalink /patch/32856/
State Accepted
Headers show

Comments

Boris Feld - July 16, 2018, 8:59 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1527847834 -7200
#      Fri Jun 01 12:10:34 2018 +0200
# Node ID e97a69d13f38cbb4389fdc8a7555eab0753c5af9
# Parent  eabea66333aa934d8a8f0fc68633a72623a0864b
# EXP-Topic cleanupstat
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r e97a69d13f38
statprof: small if cleanup

Explicitly testing for None to avoid comparison bugs.
Yuya Nishihara - July 16, 2018, 9:44 a.m.
On Mon, 16 Jul 2018 10:59:58 +0200, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1527847834 -7200
> #      Fri Jun 01 12:10:34 2018 +0200
> # Node ID e97a69d13f38cbb4389fdc8a7555eab0753c5af9
> # Parent  eabea66333aa934d8a8f0fc68633a72623a0864b
> # EXP-Topic cleanupstat
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r e97a69d13f38
> statprof: small if cleanup

Queued this, thanks.

Patch

diff --git a/mercurial/statprof.py b/mercurial/statprof.py
--- a/mercurial/statprof.py
+++ b/mercurial/statprof.py
@@ -454,7 +454,8 @@  class DisplayFormats:
 
 def display(fp=None, format=3, data=None, **kwargs):
     '''Print statistics, either to stdout or the given file object.'''
-    data = data or state
+    if data is None:
+        data = state
 
     if fp is None:
         import sys